I have inherited an node.js app for RESTFUL api, which uses knex pooling to connect to mysql. I have a nned to perform multiple queries in single function (statement), and as I understand, for that I need multipleStatemnt to be set to truu in knex pooling settings. I have done that:
const connection = (user, password) =>
knex({
client: "mysql",
connection: {
multipleStatements: true,
host: process.env.MYSQL_IP,
port: process.env.MYSQL_PORT,
user,
password,
database: "",
dateStrings: true,
}
});
However, this does not seem to get applied and I cannot execute multiple statements in single query (as per documentation in mysql pooling):
var qString = 'SELECT ?;SELECT ?'
self._client.query(qString, [1,5], function (err, result) {
And if I check my client, I see that multipleStatements are still being set to false:
Pool {
_events: {},
_eventsCount: 0,
_maxListeners: undefined,
config:
PoolConfig {
acquireTimeout: 10000,
connectionConfig:
ConnectionConfig {
host: 'xxx.xxx.xxx.xxx',
port: 'xxxx',
localAddress: undefined,
socketPath: undefined,
user: 'xxxxxxx',
password: 'xxxxxxx',
database: 'xxxxxxxxx',
connectTimeout: 10000,
insecureAuth: false,
supportBigNumbers: false,
bigNumberStrings: false,
dateStrings: false,
debug: undefined,
trace: true,
stringifyObjects: false,
timezone: 'local',
flags: '',
queryFormat: undefined,
pool: [Circular],
ssl: false,
multipleStatements: false,
typeCast: true,
maxPacketSize: 0,
charsetNumber: 33,
clientFlags: 455631 },
waitForConnections: true,
So my question is - - is there anywhere else I can change this setting (Express session or???) or if perhaps someone has some ideas?