Skip to content

feat(connections/query): allow prepared statements #44

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/pool.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,15 +199,15 @@ class PoolManagerCore extends PoolManagerFunctions {
}

// FUNCTION: Execute query
execute(cb, scope) {
execute(cb, payload, scope) {
// Check connection is initialized...
if (!scope.connection) {
return typeof scope.returnCallback === 'function'
? scope.returnCallback([], scope.errorMessage)
: void 0;
}
// Start query execution..
return scope.connection.query(scope.sqlCommand, (err, rows) => {
return scope.connection.query(scope.sqlCommand, payload, (err, rows) => {
// Register query
this.poolActivity[this.currentSessionId()]++;
// Check for any errors
Expand Down Expand Up @@ -238,7 +238,7 @@ class PoolManagerCore extends PoolManagerFunctions {
}

// FUNCTION: Execute query in services database
query(command, callback) {
query(command, payload=[], callback) {
// Scope...
const scope = {
connection: '',
Expand All @@ -254,7 +254,7 @@ class PoolManagerCore extends PoolManagerFunctions {
[
callback => this.checkPoolStatus(callback, scope),
callback => this.getConnection(callback, scope),
callback => this.execute(callback, scope),
callback => this.execute(callback, payload, scope),
],
error => {
if (error) {
Expand Down
Loading