Comparing version 2.5.5 to 2.5.6
@@ -116,3 +116,3 @@ 'use strict'; | ||
static parseOkPacket(packet, out, opts, info) { | ||
parseOkPacket(packet, out, opts, info) { | ||
packet.skip(1); //skip header | ||
@@ -119,0 +119,0 @@ |
@@ -141,3 +141,3 @@ 'use strict'; | ||
readOKPacket(packet, out, opts, info) { | ||
const okPacket = Command.parseOkPacket(packet, out, opts, info); | ||
const okPacket = this.parseOkPacket(packet, out, opts, info); | ||
this._rows.push(okPacket); | ||
@@ -520,3 +520,3 @@ | ||
info, | ||
'45034', | ||
'HY000', | ||
Errors.ER_LOCAL_INFILE_WRONG_FILENAME | ||
@@ -523,0 +523,0 @@ ); |
@@ -57,3 +57,3 @@ 'use strict'; | ||
this.initSql = opts.initSql; | ||
this.connectTimeout = opts.connectTimeout === undefined ? 10000 : opts.connectTimeout; | ||
this.connectTimeout = opts.connectTimeout === undefined ? 1000 : opts.connectTimeout; | ||
this.connectAttributes = opts.connectAttributes || false; | ||
@@ -60,0 +60,0 @@ this.compress = opts.compress || false; |
@@ -288,2 +288,8 @@ 'use strict'; | ||
readStringLength() { | ||
throw new Error( | ||
'code is normally superseded by Node encoder or Iconv depending on charset used' | ||
); | ||
} | ||
readStringLengthEncoded(encoding) { | ||
@@ -290,0 +296,0 @@ const len = this.readUnsignedLength(); |
@@ -1008,5 +1008,9 @@ const Errors = require('../misc/errors'); | ||
module.exports.validateFileName = function (sql, parameters, fileName) { | ||
// in case of windows, file name in query are escaped | ||
// so for example LOAD DATA LOCAL INFILE 'C:\\Temp\\myFile.txt' ... | ||
// but server return 'C:\Temp\myFile.txt' | ||
// so with regex escaped, must test LOAD DATA LOCAL INFILE 'C:\\\\Temp\\\\myFile.txt' | ||
let queryValidator = new RegExp( | ||
"^(\\s*\\/\\*([^\\*]|\\*[^\\/])*\\*\\/)*\\s*LOAD\\s+DATA\\s+((LOW_PRIORITY|CONCURRENT)\\s+)?LOCAL\\s+INFILE\\s+'" + | ||
fileName + | ||
fileName.replace(/\\/g, '\\\\\\\\').replace('.', '\\.') + | ||
"'", | ||
@@ -1023,3 +1027,6 @@ 'i' | ||
if (queryValidator.test(sql) && parameters.length > 0) { | ||
return parameters[0].toLowerCase() === fileName.toLowerCase(); | ||
if (Array.isArray(parameters)) { | ||
return parameters[0].toLowerCase() === fileName.toLowerCase(); | ||
} | ||
return parameters.toLowerCase() === fileName.toLowerCase(); | ||
} | ||
@@ -1026,0 +1033,0 @@ } |
@@ -213,12 +213,12 @@ 'use strict'; | ||
return Promise.reject( | ||
Errors.createError( | ||
'sql parameter is mandatory', | ||
null, | ||
false, | ||
null, | ||
'HY000', | ||
Errors.ER_POOL_UNDEFINED_SQL, | ||
undefined, | ||
false | ||
) | ||
Errors.createError( | ||
'sql parameter is mandatory', | ||
null, | ||
false, | ||
null, | ||
'HY000', | ||
Errors.ER_POOL_UNDEFINED_SQL, | ||
undefined, | ||
false | ||
) | ||
); | ||
@@ -225,0 +225,0 @@ } |
{ | ||
"name": "mariadb", | ||
"version": "2.5.5", | ||
"version": "2.5.6", | ||
"description": "fast mariadb/mysql connector.", | ||
@@ -48,28 +48,28 @@ "main": "promise.js", | ||
"dependencies": { | ||
"@types/geojson": "^7946.0.7", | ||
"@types/node": "^14.14.28", | ||
"denque": "^1.5.0", | ||
"@types/geojson": "^7946.0.8", | ||
"@types/node": "^17.0.10", | ||
"denque": "^2.0.1", | ||
"iconv-lite": "^0.6.3", | ||
"long": "^4.0.0", | ||
"moment-timezone": "^0.5.33", | ||
"long": "^5.2.0", | ||
"moment-timezone": "^0.5.34", | ||
"please-upgrade-node": "^3.2.0" | ||
}, | ||
"devDependencies": { | ||
"@typescript-eslint/eslint-plugin": "^4.15.1", | ||
"@typescript-eslint/parser": "^4.15.1", | ||
"@typescript-eslint/eslint-plugin": "^5.10.0", | ||
"@typescript-eslint/parser": "^5.10.0", | ||
"benchmark": "^2.1.4", | ||
"chai": "^4.3.4", | ||
"codecov": "^3.8.2", | ||
"colors": "^1.4.0", | ||
"chalk": "^4.1.2", | ||
"dom-parser": "^0.1.6", | ||
"error-stack-parser": "^2.0.6", | ||
"eslint": "^7.28.0", | ||
"eslint": "^8.7.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-markdown": "^2.2.0", | ||
"eslint-plugin-prettier": "^3.4.0", | ||
"mocha": "^8.3.0", | ||
"eslint-plugin-markdown": "^2.2.1", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"mocha": "^9.2.0", | ||
"mocha-lcov-reporter": "^1.3.0", | ||
"nyc": "^15.1.0", | ||
"prettier": "^2.3.1", | ||
"typescript": "^4.1.5" | ||
"prettier": "^2.5.1", | ||
"typescript": "^4.5.5" | ||
}, | ||
@@ -76,0 +76,0 @@ "bugs": { |
@@ -90,33 +90,7 @@ <p align="center"> | ||
``` | ||
Using ECMAScript < 2017: | ||
example: | ||
```js | ||
const mariadb = require('mariadb'); | ||
const pool = mariadb.createPool({host: process.env.DB_HOST, user: process.env.DB_USER, connectionLimit: 5}); | ||
pool.getConnection() | ||
.then(conn => { | ||
conn.query("SELECT 1 as val") | ||
.then(rows => { // rows: [ {val: 1}, meta: ... ] | ||
return conn.query("INSERT INTO myTable value (?, ?)", [1, "mariadb"]); | ||
}) | ||
.then(res => { // res: { affectedRows: 1, insertId: 1, warningStatus: 0 } | ||
conn.release(); // release to pool | ||
}) | ||
.catch(err => { | ||
conn.release(); // release to pool | ||
}) | ||
}).catch(err => { | ||
//not connected | ||
}); | ||
``` | ||
Using ECMAScript 2017: | ||
```js | ||
const mariadb = require('mariadb'); | ||
const pool = mariadb.createPool({host: process.env.DB_HOST, user: process.env.DB_USER, connectionLimit: 5}); | ||
async function asyncFunction() { | ||
@@ -133,4 +107,2 @@ let conn; | ||
} catch (err) { | ||
throw err; | ||
} finally { | ||
@@ -137,0 +109,0 @@ if (conn) conn.release(); //release to pool |
@@ -676,2 +676,4 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ | ||
getConnection(pattern?: string, selector?: string): Promise<PoolConnection>; | ||
on(ev: 'remove', callback: (nodekey: string) => void): PoolCluster; | ||
} | ||
@@ -678,0 +680,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13986
514151
64
126
+ Added@types/node@17.0.45(transitive)
+ Addeddenque@2.1.0(transitive)
+ Addedlong@5.2.3(transitive)
- Removed@types/node@14.18.63(transitive)
- Removeddenque@1.5.1(transitive)
- Removedlong@4.0.0(transitive)
Updated@types/geojson@^7946.0.8
Updated@types/node@^17.0.10
Updateddenque@^2.0.1
Updatedlong@^5.2.0
Updatedmoment-timezone@^0.5.34