mirror of
https://github.com/darksaid98/oxmysql.git
synced 2026-12-01 14:38:50 +00:00
chore(utils/typeCast): use patched type
This commit is contained in:
1 parent
75b5e45725
commit
9ee0f62d63
3 files changed
+4
-7
No files matched your search
@@ -106,6 +106,7 @@ export function getConnectionOptions(): ConnectionOptions {
|
||||
connectTimeout: 60000,
|
||||
trace: false,
|
||||
supportBigNumbers: true,
|
||||
jsonStrings: true,
|
||||
...options,
|
||||
typeCast,
|
||||
namedPlaceholders: false, // we use our own named-placeholders patch, disable mysql2s
|
||||
|
||||
@@ -38,7 +38,7 @@ export class MySql {
|
||||
const [result] = await this.connection.execute({
|
||||
sql: query,
|
||||
values: values,
|
||||
typeCast: typeCastExecute as TypeCast,
|
||||
typeCast: typeCastExecute,
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -2,21 +2,17 @@ import type { TypeCastField, TypeCastNext } from 'mysql2/promise';
|
||||
|
||||
const BINARY_CHARSET = 63;
|
||||
|
||||
interface Field extends TypeCastField {
|
||||
charset: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* node-mysql2 v3.9.0 introduced (breaking) typecasting for execute methods.
|
||||
*/
|
||||
export function typeCastExecute(field: Field, next: TypeCastNext) {
|
||||
export function typeCastExecute(field: TypeCastField, next: TypeCastNext) {
|
||||
return next();
|
||||
}
|
||||
|
||||
/**
|
||||
* mysql-async compatible typecasting.
|
||||
*/
|
||||
export function typeCast(field: Field, next: TypeCastNext) {
|
||||
export function typeCast(field: TypeCastField, next: TypeCastNext) {
|
||||
switch (field.type) {
|
||||
case 'DATETIME':
|
||||
case 'DATETIME2':
|
||||
|
||||
Reference in new issue
Block a user