knex/lib/dialects/mysql2/index.js

31 lines
707 B
JavaScript
Raw Normal View History

2015-05-09 13:58:18 -04:00
// MySQL2 Client
// -------
const Client_MySQL = require('../mysql');
const Transaction = require('./transaction');
2015-05-09 13:58:18 -04:00
// Always initialize with the "QueryBuilder" and "QueryCompiler"
// objects, which extend the base 'lib/query/builder' and
// 'lib/query/compiler', respectively.
2021-01-31 13:40:13 +03:00
class Client_MySQL2 extends Client_MySQL {
2016-09-12 18:45:35 -04:00
transaction() {
return new Transaction(this, ...arguments);
2021-01-31 13:40:13 +03:00
}
2015-05-09 13:58:18 -04:00
_driver() {
return require('mysql2');
2021-01-31 13:40:13 +03:00
}
validateConnection(connection) {
if (connection._fatalError) {
return false;
}
return true;
2021-01-31 13:40:13 +03:00
}
}
Object.assign(Client_MySQL2.prototype, {
// The "dialect", for reference elsewhere.
driverName: 'mysql2',
});
2015-05-09 13:58:18 -04:00
module.exports = Client_MySQL2;