mirror of
https://github.com/knex/knex.git
synced 2025-07-12 19:40:33 +00:00
31 lines
707 B
JavaScript
31 lines
707 B
JavaScript
// MySQL2 Client
|
|
// -------
|
|
const Client_MySQL = require('../mysql');
|
|
const Transaction = require('./transaction');
|
|
|
|
// Always initialize with the "QueryBuilder" and "QueryCompiler"
|
|
// objects, which extend the base 'lib/query/builder' and
|
|
// 'lib/query/compiler', respectively.
|
|
class Client_MySQL2 extends Client_MySQL {
|
|
transaction() {
|
|
return new Transaction(this, ...arguments);
|
|
}
|
|
|
|
_driver() {
|
|
return require('mysql2');
|
|
}
|
|
validateConnection(connection) {
|
|
if (connection._fatalError) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
|
|
Object.assign(Client_MySQL2.prototype, {
|
|
// The "dialect", for reference elsewhere.
|
|
driverName: 'mysql2',
|
|
});
|
|
|
|
module.exports = Client_MySQL2;
|