rittenhop-dev/versions/5.94.2/node_modules/knex/lib/dialects/mysql2/index.js
2024-09-23 19:40:12 -04:00

34 lines
804 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) {
return (
connection &&
!connection._fatalError &&
!connection._protocolError &&
!connection._closing &&
!connection.stream.destroyed
);
}
}
Object.assign(Client_MySQL2.prototype, {
// The "dialect", for reference elsewhere.
driverName: 'mysql2',
});
module.exports = Client_MySQL2;