TimelordUK / node-sqlserver-v8

branched from node-sqlserver, SQL server driver compatible with all versions of Node
Other
135 stars 43 forks source link

Question: Using prepared query with Pool #295

Open WillCauldron opened 1 year ago

WillCauldron commented 1 year ago

tl;dr is it possible to create a prepared statement and submit to the pool, rather than manually opening a connection and submitting the query there?

First, having previously worked on a project with a much older version of this library, I'm in adoration of the new features available in v4+. Particularly the Pool and Prepared Statements. So many thanks for these excellent additions.

I'd like to make use of the prepared statements feature, to better optimise some repeated calls to the database. However, I'm struggling to work out how you would combine this with the Pool logic. I can't see a route by which you could create a prepared statement without first needing a connection, nor a way of requesting a connection from the pool directly.

Is there an existing route for combining these two features?