Skip to content

Commit

Permalink
error message maximum length correction
Browse files Browse the repository at this point in the history
test correction for server < 10.2
  • Loading branch information
rusher committed Jun 19, 2018
1 parent 268c74a commit 5261f9a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
12 changes: 6 additions & 6 deletions lib/cmd/resultset.js
Expand Up @@ -310,8 +310,8 @@ class ResultSet extends Command {
*/
displaySql() {
if (this.opts && this.initialValues) {
if (this.sql.length > 1024) {
return "sql: " + this.sql.substring(0, 1024) + "...";
if (this.sql.length > this.opts.debugLen) {
return "sql: " + this.sql.substring(0, this.opts.debugLen) + "...";
}

let sqlMsg = "sql: " + this.sql + " - parameters:";
Expand All @@ -328,8 +328,8 @@ class ResultSet extends Command {
sqlMsg += "'" + key + "':";
let param = this.initialValues[key];
sqlMsg = logParam(sqlMsg, param);
if (sqlMsg.length > 1024) {
sqlMsg += "...";
if (sqlMsg.length > this.opts.debugLen) {
sqlMsg = sqlMsg.substr(0, this.opts.debugLen) + "...";
break;
}
}
Expand All @@ -343,8 +343,8 @@ class ResultSet extends Command {
if (i !== 0) sqlMsg += ",";
let param = values[i];
sqlMsg = logParam(sqlMsg, param);
if (sqlMsg.length > 1024) {
sqlMsg += "...";
if (sqlMsg.length > this.opts.debugLen) {
sqlMsg = sqlMsg.substr(0, this.opts.debugLen) + "...";
break;
}
}
Expand Down
12 changes: 6 additions & 6 deletions test/integration/test-big-query.js
Expand Up @@ -59,17 +59,17 @@ describe("Big query", function() {
});

it("buffer growing", function(done) {
if (maxAllowedSize <= testSize) this.skip();
this.timeout(10000); //can take some time
base.createConnection().then(conn => {
const st = Buffer.alloc(131072, "0").toString();
const st = Buffer.alloc(65536, "0").toString();
const st2 = Buffer.alloc(1048576, "0").toString();
const params = [st];
let sql = "CREATE TEMPORARY TABLE bigParameter (a0 MEDIUMTEXT ";
let sqlInsert = "insert into bigParameter values (?";
for (let i = 1; i < 150; i++) {
for (let i = 1; i < 10; i++) {
sql += ",a" + i + " MEDIUMTEXT ";
sqlInsert += ",?";
params.push(st);
params.push(i < 4 ? st : st2);
}
sql += ")";
sqlInsert += ")";
Expand All @@ -80,8 +80,8 @@ describe("Big query", function() {
return conn.query("SELECT * from bigParameter");
})
.then(rows => {
for (let i = 0; i < 150; i++) {
assert.deepEqual(rows[0]["a" + i], st);
for (let i = 0; i < 10; i++) {
assert.deepEqual(rows[0]["a" + i], params[i]);
}
conn.end();
done();
Expand Down
4 changes: 2 additions & 2 deletions test/integration/test-debug.js
Expand Up @@ -136,8 +136,8 @@ describe("debug", () => {
process.stderr.write = initialStdErr;
const serverVersion = conn.serverVersion();
conn.end();
const rangeWithEOF = Conf.baseConfig.compress ? [4450, 4470] : [4390, 4430];
const rangeWithoutEOF = Conf.baseConfig.compress ? [4450, 4470] : [4280, 4330];
const rangeWithEOF = Conf.baseConfig.compress ? [4450, 4470] : [4300 , 4430];
const rangeWithoutEOF = Conf.baseConfig.compress ? [4450, 4470] : [4280, 4350];
if (
(conn.isMariaDB() && conn.hasMinVersion(10, 2, 2)) ||
(!conn.isMariaDB() && conn.hasMinVersion(5, 7, 5))
Expand Down
1 change: 1 addition & 0 deletions test/integration/test-streaming.js
Expand Up @@ -37,6 +37,7 @@ describe("streaming", () => {
});

it("Streaming url content", function(done) {
this.timeout(10000);
const https = require("https");
https.get(
"https://node.green/#ES2018-features-Promise-prototype-finally-basic-support",
Expand Down

0 comments on commit 5261f9a

Please sign in to comment.