denodrivers / postgres

PostgreSQL driver for Deno

Home Page:https://denodrivers.github.io/postgres

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

queryArray/queryObject to execute cached prepared statements

Soremwar opened this issue · comments

With the following API:

await queryArray({
  text: "INSERT INTO TABLE X (Y, Z) VALUES ($1, $2)",
  args: [
    [10, 15],
    [20, 25],
    [30, 35],
  ],
  many: true
});

Would run the above insert three times, through an option in the queryX method to determine if the arguments should be an array of arguments

After working with Python's mysql-connector it was very apparent how much of a necessity this is for big queries

Unfortunately, Postgres message protocol doesn't offer any way to solve this problem. This is probably a better fit for a library that builds on top of Deno postgres and transforms the SQL to adecuate for this purpose