Skip to content
Merged
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
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
"bugs": {
"url": "https://github.com/singlestore-labs/singlestore-nodejs/issues"
},

"dependencies": {
"aws-ssl-profiles": "^1.1.1",
"denque": "^2.1.0",
Expand Down
8 changes: 4 additions & 4 deletions test/esm/integration/connection/test-column-inspect.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ const common = require('../../../common.test.cjs');

// Normalize types to match inspectResults
const typeMap = {
'LONGTEXT': 'LONG_BLOB(4294967295)',
'MEDIUMTEXT': 'MEDIUM_BLOB(16777215)',
'TEXT': 'BLOB(65535)',
'TINYTEXT': 'TINY_BLOB(255)',
LONGTEXT: 'LONG_BLOB(4294967295)',
MEDIUMTEXT: 'MEDIUM_BLOB(16777215)',
TEXT: 'BLOB(65535)',
TINYTEXT: 'TINY_BLOB(255)',
};
if (typeMap[type]) type = typeMap[type];
// Rebuild the line with normalized type
Expand Down
4 changes: 3 additions & 1 deletion test/esm/integration/connection/test-execute-1.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ const common = require('../../../common.test.cjs');
'проводить собрания, митинги и демонстрации, шествия и пикетирование',
]);

const [_rows] = await connection.execute('SELECT * FROM announcements order by id');
const [_rows] = await connection.execute(
'SELECT * FROM announcements order by id'
);

assert.equal(_rows.length, 2, 'rows length needs to be 2');
assert.equal(
Expand Down
2 changes: 1 addition & 1 deletion test/esm/regressions/2052.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ test(async () => {
await connection
.promise()
.query(
"CREATE TABLE IF NOT EXISTS user (User VARCHAR(255), Host VARCHAR(255))"
'CREATE TABLE IF NOT EXISTS user (User VARCHAR(255), Host VARCHAR(255))'
);

const mySqlVersion = await common.getMysqlVersion(connection);
Expand Down
20 changes: 4 additions & 16 deletions test/integration/connection/encoding/test-charset-results.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,8 @@ function tryEncoding(encoding, cb) {
assert.ifError(err);
connection.query('SELECT ?', [payload], (err, rows, fields) => {
assert.ifError(err);
let iconvEncoding = encoding;
if (encoding === 'utf8mb4') {
iconvEncoding = 'utf8';
}
assert.equal(
mysql.CharsetToEncoding[fields[0].characterSet],
'utf8'
);

assert.equal(mysql.CharsetToEncoding[fields[0].characterSet], 'utf8');
assert.equal(fields[0].name, payload);
assert.equal(rows[0][fields[0].name], payload);
cb();
Expand All @@ -38,14 +32,8 @@ function tryEncodingExecute(encoding, cb) {
assert.ifError(err);
connection.execute('SELECT ? as n', [payload], (err, rows, fields) => {
assert.ifError(err);
let iconvEncoding = encoding;
if (encoding === 'utf8mb4') {
iconvEncoding = 'utf8';
}
assert.equal(
mysql.CharsetToEncoding[fields[0].characterSet],
'utf8'
);

assert.equal(mysql.CharsetToEncoding[fields[0].characterSet], 'utf8');
// TODO: figure out correct metadata encodings setup for binary protocol
// assert.equal(fields[0].name, payload);
assert.equal(rows[0][fields[0].name], payload);
Expand Down
15 changes: 12 additions & 3 deletions test/integration/connection/test-binary-multiple-results.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ const fields2 = clone(fields1);
fields2[0].name = '2';

const tests = [
['ECHO select * from some_rows order by test', [[select3, rs3], [sr_fields, undefined], 2]], // select 3 rows
[
'ECHO select * from some_rows order by test',
[[select3, rs3], [sr_fields, undefined], 2],
], // select 3 rows
[
'SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT; SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS',
[rs2, undefined, 1],
Expand All @@ -97,8 +100,14 @@ const tests = [
['set @a = 1; ECHO select 1', [[select1, rs2], [fields1, undefined], 2]],
['ECHO select 1; set @a = 1', [[select1, rs2], [fields1, undefined], 2]],
['ECHO select * from no_rows', [[[], rs3], [nr_fields, undefined], 2]], // select 0 rows"
['set @a = 1; ECHO select * from no_rows', [[[], rs3], [nr_fields, undefined], 2]], // insert + select 0 rows
['ECHO select * from no_rows; set @a = 1', [[[], rs3], [nr_fields, undefined], 2]], // select 0 rows + insert
[
'set @a = 1; ECHO select * from no_rows',
[[[], rs3], [nr_fields, undefined], 2],
], // insert + select 0 rows
[
'ECHO select * from no_rows; set @a = 1',
[[[], rs3], [nr_fields, undefined], 2],
], // select 0 rows + insert
[
'set @a = 1; ECHO select * from some_rows order by test',
[[select3, rs3], [sr_fields, undefined], 2],
Expand Down
11 changes: 7 additions & 4 deletions test/integration/connection/test-charset-encoding.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,13 @@ const testEncoding = function (err) {
);
});

connection.query('SELECT * from `test-charset-encoding` ORDER BY id', (err, results) => {
assert.ifError(err);
resultData = results;
});
connection.query(
'SELECT * from `test-charset-encoding` ORDER BY id',
(err, results) => {
assert.ifError(err);
resultData = results;
}
);
connection.end();
};

Expand Down
10 changes: 8 additions & 2 deletions test/integration/connection/test-execute-type-casting.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,14 @@ test(async () => {
if (test.type.startsWith('bit')) {
const expectedBuffer = expected;
const gotBuffer = got;
const slicedGot = gotBuffer.slice(gotBuffer.length - expectedBuffer.length);
assert.deepEqual(slicedGot, expectedBuffer, `Buffer for ${test.type} does not match`);
const slicedGot = gotBuffer.slice(
gotBuffer.length - expectedBuffer.length
);
assert.deepEqual(
slicedGot,
expectedBuffer,
`Buffer for ${test.type} does not match`
);
return; // Skip the generic buffer string comparison
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,48 +21,81 @@ connection.query(
// Insert test data with explicit IDs to match the expected assertions
connection.query("INSERT INTO bigs SET title='test1', id=123", (err) => {
if (err) throw err;

connection.query("INSERT INTO bigs SET title='test2', id=124", (err) => {
if (err) throw err;

connection.query("INSERT INTO bigs SET title='test3', id=123456789", (err) => {
if (err) throw err;

connection.query("INSERT INTO bigs SET title='test4', id=123456790", (err) => {

connection.query(
"INSERT INTO bigs SET title='test3', id=123456789",
(err) => {
if (err) throw err;

connection.query("INSERT INTO bigs SET title='test5', id=9007199254740992", (err) => {
if (err) throw err;

connection.query("INSERT INTO bigs SET title='test6', id=9007199254740993", (err) => {

connection.query(
"INSERT INTO bigs SET title='test4', id=123456790",
(err) => {
if (err) throw err;

connection.query("INSERT INTO bigs SET title='test7', id=90071992547409924", (err) => {
if (err) throw err;

connection.query("INSERT INTO bigs SET title='test8', id=90071992547409925", (err) => {

connection.query(
"INSERT INTO bigs SET title='test5', id=9007199254740992",
(err) => {
if (err) throw err;

connection.query('SELECT * FROM bigs ORDER BY id', (err, result) => {
if (err) throw err;

// Use the exact assertions you specified
assert.strictEqual(result[0].id, '123');
assert.strictEqual(result[1].id, '124');
assert.strictEqual(result[2].id, '123456789');
assert.strictEqual(result[3].id, '123456790');
assert.strictEqual(result[4].id, '9007199254740992');
assert.strictEqual(result[5].id, '9007199254740993');
assert.strictEqual(result[6].id, '90071992547409924');
assert.strictEqual(result[7].id, '90071992547409925');

connection.end();
});
});
});
});
});
});
});

connection.query(
"INSERT INTO bigs SET title='test6', id=9007199254740993",
(err) => {
if (err) throw err;

connection.query(
"INSERT INTO bigs SET title='test7', id=90071992547409924",
(err) => {
if (err) throw err;

connection.query(
"INSERT INTO bigs SET title='test8', id=90071992547409925",
(err) => {
if (err) throw err;

connection.query(
'SELECT * FROM bigs ORDER BY id',
(err, result) => {
if (err) throw err;

// Use the exact assertions you specified
assert.strictEqual(result[0].id, '123');
assert.strictEqual(result[1].id, '124');
assert.strictEqual(result[2].id, '123456789');
assert.strictEqual(result[3].id, '123456790');
assert.strictEqual(
result[4].id,
'9007199254740992'
);
assert.strictEqual(
result[5].id,
'9007199254740993'
);
assert.strictEqual(
result[6].id,
'90071992547409924'
);
assert.strictEqual(
result[7].id,
'90071992547409925'
);

connection.end();
}
);
}
);
}
);
}
);
}
);
}
);
}
);
});
});
Loading
Loading