Skip to content

Support reuse of templates across connections #1611

@tsegismont

Description

@tsegismont

Describe the feature

Currently, templates require a SqlClient param at creation time. This param is used to compute the SQL query (the underlying driver is used to generated parameter parts, e.g. $1 for Postgres), and then stored for the future execution of the template.

Therefore, a template is always bound to the client that created it. But creating a template is not a cheap operation. Reuse is possible if the template was created with a pool instance and execution happening outside a transaction started by the user. Otherwise, the template has to be created again every time a new transaction is started.

To support of reuse of templates across connections / transactions, the user must be able to provide a client when invoking the execute method.

Metadata

Metadata

Assignees

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions