Skip to content

Commit f5df724

Browse files
committed
[CONJS-86] Support extension type format
1 parent 1a0c370 commit f5df724

38 files changed

+362
-140
lines changed

.travis.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ matrix:
4444
include:
4545
- node_js: "12"
4646
env: DB=build SKIP_LEAK=1
47-
- node_js: "8"
48-
env: DB=mariadb:10.4
4947
- node_js: "10"
5048
env: DB=mariadb:10.4
5149
- node_js: "12"

appveyor.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ environment:
1212
TEST_LOG_PACKETS: true
1313
matrix:
1414

15-
- DB: '10.4.6'
16-
MEM: "21"
17-
nodejs_version: "8"
18-
1915
- DB: '10.4.12'
2016
MEM: "21"
2117
nodejs_version: "10"
@@ -95,6 +91,6 @@ build: off
9591
test_script:
9692
- node --version
9793
- if "%SKIP_LEAK%" == "" npm install node-memwatch
98-
- if "%BENCH%" == "1" ( npm install microtime ) else ( npm test )
94+
- if "%BENCH%" == "1" ( npm install microtime ) else ( npm run test )
9995
- if "%BENCH%" == "1" ( npm install promise-mysql mysql2 )
10096
- if "%BENCH%" == "1" ( node c:\projects\mariadb-connector-nodejs\benchmarks\benchmarks.js )

benchmarks/benchmarkOne.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ let bench;
77
const launchBenchs = function (path) {
88
bench = new Bench();
99

10-
const test = 'bench_promise_select_one_user.js';
10+
const test = 'bench_promise_select_param.js';
1111
const m = require(path + '/' + test);
1212
bench.initFcts.push([m.initFct, m.promise]);
1313
bench.add(m.title, m.displaySql, m.benchFct, m.onComplete, m.promise, m.pool); //, bench.CONN.MYSQL);

benchmarks/benchs/bench_do.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const assert = require('assert');
33
module.exports.title = 'do ? using callback';
44
module.exports.displaySql = 'do ?';
55
module.exports.promise = false;
6-
module.exports.benchFct = function(conn, deferred) {
6+
module.exports.benchFct = function (conn, deferred) {
77
conn.query('do ?', ['' + Math.floor(Math.random() * 50000000)], (err, res) => {
88
if (err) throw err;
99
// let val = Array.isArray(rows) ? rows[0] : rows;

benchmarks/benchs/bench_promise_do.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ const assert = require('assert');
33
module.exports.title = 'do ? using promise';
44
module.exports.displaySql = 'do ?';
55
module.exports.promise = true;
6-
module.exports.benchFct = function(conn, deferred) {
6+
module.exports.benchFct = function (conn, deferred) {
77
conn
88
.query('do ?', ['' + Math.floor(Math.random() * 50000000)])
9-
.then(rows => {
9+
.then((rows) => {
1010
// let val = Array.isArray(rows) ? rows[0] : rows;
1111
// assert.equal(1, val.info ? val.info.affectedRows : val.affectedRows);
1212
deferred.resolve();
1313
})
14-
.catch(err => {
14+
.catch((err) => {
1515
throw err;
1616
});
1717
};

benchmarks/benchs/bench_promise_insert.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,44 +28,44 @@ module.exports.title = 'insert 10 parameters of 100 characters using promise';
2828
module.exports.displaySql =
2929
'INSERT INTO testn.perfTestText VALUES (<100 ?>) (into BLACKHOLE ENGINE)';
3030
module.exports.promise = true;
31-
module.exports.benchFct = function(conn, deferred) {
31+
module.exports.benchFct = function (conn, deferred) {
3232
const params = [];
3333
for (let i = 0; i < 10; i++) {
3434
params.push(randomString(100));
3535
}
3636

3737
conn
3838
.query(sqlInsert, params)
39-
.then(rows => {
39+
.then((rows) => {
4040
// let val = Array.isArray(rows) ? rows[0] : rows;
4141
// assert.equal(1, val.info ? val.info.affectedRows : val.affectedRows);
4242
deferred.resolve();
4343
})
44-
.catch(err => {
44+
.catch((err) => {
4545
throw err;
4646
});
4747
};
4848

49-
module.exports.initFct = function(conn) {
49+
module.exports.initFct = function (conn) {
5050
return Promise.all([
5151
conn.query('DROP TABLE IF EXISTS testn.perfTestText'),
5252
conn.query("INSTALL SONAME 'ha_blackhole'"),
5353
conn.query(sqlTable + " ENGINE = BLACKHOLE COLLATE='utf8mb4_unicode_ci'")
5454
])
55-
.catch(err => {
55+
.catch((err) => {
5656
return Promise.all([
5757
conn.query('DROP TABLE IF EXISTS testn.perfTestText'),
5858
conn.query(sqlTable + " COLLATE='utf8mb4_unicode_ci'")
5959
]);
6060
})
61-
.catch(e => {
61+
.catch((e) => {
6262
console.log(e);
6363
throw e;
6464
});
6565
};
6666

67-
module.exports.onComplete = function(conn) {
68-
conn.query('TRUNCATE TABLE testn.perfTestText').catch(e => {
67+
module.exports.onComplete = function (conn) {
68+
conn.query('TRUNCATE TABLE testn.perfTestText').catch((e) => {
6969
console.log(e);
7070
throw e;
7171
});

benchmarks/benchs/bench_promise_insert_batch.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ module.exports.title =
2323
module.exports.displaySql = 'INSERT INTO testn.perfTestTextPipe VALUES (?) (into BLACKHOLE ENGINE)';
2424
const iterations = 100;
2525
module.exports.promise = true;
26-
module.exports.benchFct = function(conn, deferred, connType) {
26+
module.exports.benchFct = function (conn, deferred, connType) {
2727
const params = [randomString(100)];
2828
// console.log(connType.desc);
2929
if (!connType.desc.includes('mariadb')) {
@@ -32,14 +32,14 @@ module.exports.benchFct = function(conn, deferred, connType) {
3232
for (let i = 0; i < iterations; i++) {
3333
conn
3434
.query(sqlInsert, params)
35-
.then(rows => {
35+
.then((rows) => {
3636
// let val = Array.isArray(rows) ? rows[0] : rows;
3737
// assert.equal(1, val.info ? val.info.affectedRows : val.affectedRows);
3838
if (++ended === iterations) {
3939
deferred.resolve();
4040
}
4141
})
42-
.catch(err => {
42+
.catch((err) => {
4343
throw err;
4444
});
4545
}
@@ -51,35 +51,35 @@ module.exports.benchFct = function(conn, deferred, connType) {
5151
}
5252
conn
5353
.batch(sqlInsert, totalParams)
54-
.then(rows => {
54+
.then((rows) => {
5555
deferred.resolve();
5656
})
57-
.catch(err => {
57+
.catch((err) => {
5858
throw err;
5959
});
6060
}
6161
};
6262

63-
module.exports.initFct = function(conn) {
63+
module.exports.initFct = function (conn) {
6464
return Promise.all([
6565
conn.query('DROP TABLE IF EXISTS testn.perfTestTextPipe'),
6666
conn.query("INSTALL SONAME 'ha_blackhole'"),
6767
conn.query(sqlTable + " ENGINE = BLACKHOLE COLLATE='utf8mb4_unicode_ci'")
6868
])
69-
.catch(err => {
69+
.catch((err) => {
7070
return Promise.all([
7171
conn.query('DROP TABLE IF EXISTS testn.perfTestTextPipe'),
7272
conn.query(sqlTable + " COLLATE='utf8mb4_unicode_ci'")
7373
]);
7474
})
75-
.catch(e => {
75+
.catch((e) => {
7676
console.log(e);
7777
throw e;
7878
});
7979
};
8080

81-
module.exports.onComplete = function(conn) {
82-
conn.query('TRUNCATE TABLE testn.perfTestTextPipe').catch(e => {
81+
module.exports.onComplete = function (conn) {
82+
conn.query('TRUNCATE TABLE testn.perfTestTextPipe').catch((e) => {
8383
console.log(e);
8484
throw e;
8585
});

benchmarks/benchs/bench_promise_insert_pipelining.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,45 +22,45 @@ module.exports.title = '100 * insert 100 characters using promise';
2222
module.exports.displaySql = 'INSERT INTO testn.perfTestTextPipe VALUES (?) (into BLACKHOLE ENGINE)';
2323
const iterations = 100;
2424
module.exports.promise = true;
25-
module.exports.benchFct = function(conn, deferred) {
25+
module.exports.benchFct = function (conn, deferred) {
2626
const params = [randomString(100)];
2727
let ended = 0;
2828
for (let i = 0; i < iterations; i++) {
2929
conn
3030
.query(sqlInsert, params)
31-
.then(rows => {
31+
.then((rows) => {
3232
// let val = Array.isArray(rows) ? rows[0] : rows;
3333
// assert.equal(1, val.info ? val.info.affectedRows : val.affectedRows);
3434
if (++ended === iterations) {
3535
deferred.resolve();
3636
}
3737
})
38-
.catch(err => {
38+
.catch((err) => {
3939
throw err;
4040
});
4141
}
4242
};
4343

44-
module.exports.initFct = function(conn) {
44+
module.exports.initFct = function (conn) {
4545
return Promise.all([
4646
conn.query('DROP TABLE IF EXISTS testn.perfTestTextPipe'),
4747
conn.query("INSTALL SONAME 'ha_blackhole'"),
4848
conn.query(sqlTable + " ENGINE = BLACKHOLE COLLATE='utf8mb4_unicode_ci'")
4949
])
50-
.catch(err => {
50+
.catch((err) => {
5151
return Promise.all([
5252
conn.query('DROP TABLE IF EXISTS testn.perfTestTextPipe'),
5353
conn.query(sqlTable + " COLLATE='utf8mb4_unicode_ci'")
5454
]);
5555
})
56-
.catch(e => {
56+
.catch((e) => {
5757
console.log(e);
5858
throw e;
5959
});
6060
};
6161

62-
module.exports.onComplete = function(conn) {
63-
conn.query('TRUNCATE TABLE testn.perfTestTextPipe').catch(e => {
62+
module.exports.onComplete = function (conn) {
63+
conn.query('TRUNCATE TABLE testn.perfTestTextPipe').catch((e) => {
6464
console.log(e);
6565
throw e;
6666
});

benchmarks/benchs/bench_promise_select_collation.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@ const assert = require('assert');
33
module.exports.title = 'select multiple collation using promise';
44
module.exports.displaySql = 'select * from information_schema.COLLATIONS';
55
module.exports.promise = true;
6-
module.exports.benchFct = function(conn, deferred) {
6+
module.exports.benchFct = function (conn, deferred) {
77
conn
88
.query('select * from information_schema.COLLATIONS')
9-
.then(rows => {
9+
.then((rows) => {
1010
// assert.ok(rows.length > 230);
1111
// assert.equal("big5_chinese_ci", rows[0].COLLATION_NAME);
1212

1313
deferred.resolve();
1414
})
15-
.catch(err => {
15+
.catch((err) => {
1616
throw err;
1717
});
1818
};

benchmarks/benchs/bench_promise_select_one_user.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ const assert = require('assert');
33
module.exports.title = 'select one mysql.user using promise';
44
module.exports.displaySql = 'select <all mysql.user fields> from mysql.user u LIMIT 1';
55
module.exports.promise = true;
6-
module.exports.benchFct = function(conn, deferred) {
6+
module.exports.benchFct = function (conn, deferred) {
77
conn
88
.query('select * from mysql.user u LIMIT 1')
9-
.then(rows => {
9+
.then((rows) => {
1010
// assert.equal(50000000, rows[0]["t"]);
1111

1212
deferred.resolve();
1313
})
14-
.catch(err => {
14+
.catch((err) => {
1515
throw err;
1616
});
1717
};

0 commit comments

Comments
 (0)