Giter VIP home page Giter VIP logo

Comments (2)

boromisp avatar boromisp commented on August 15, 2024

You can use any number of parameters with the library, as this library does not parse the query string, it just passes it to the server to handle.

You seem to be doing the parsing yourself, by monkey patching Query.submit.

What are you trying to achieve? Are you trying to avoid the extended protocol for some reason?

from node-postgres.

emafriedrich avatar emafriedrich commented on August 15, 2024

sorry @boromisp , my bad. It was a mistake in the snippet that you refer. I found it in the web to log the queries. Not sure if the library has support for logging queries, for that I looked into the web for some logging approach.

import { Pool } from "pg";

const connection = new Pool({
  host: process.env.DB_HOST,
  user: process.env.DB_USER,
  password: process.env.DB_PASSWORD,
  database: process.env.DB_NAME,
  port: +process.env.DB_PORT! || 5432,
});

const test = async () => {
  const result = await connection.query(
    `SELECT
      $1 a,
      $2 b,
      $3 c,
      $4 d,
      $5 e,
      $6 f,
      $7 g,
      $8 h,
      $9 i,
      $10 j,
      $11 k,
      $12 l
   `,
    [
      "foo",
      "foo",
      "foo",
      "foo",
      "foo",
      "foo",
      "foo",
      "foo",
      "foo",
      "foo",
      "foo",
      "foo",
    ]
  );

  console.log(result.rows[0]);
};

(async () => await test())();

And all was resolved fine.

from node-postgres.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.