mirror of
https://github.com/darksaid98/oxmysql.git
synced 2026-12-03 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,
|
connectTimeout: 60000,
|
||||||
trace: false,
|
trace: false,
|
||||||
supportBigNumbers: true,
|
supportBigNumbers: true,
|
||||||
|
jsonStrings: true,
|
||||||
...options,
|
...options,
|
||||||
typeCast,
|
typeCast,
|
||||||
namedPlaceholders: false, // we use our own named-placeholders patch, disable mysql2s
|
namedPlaceholders: false, // we use our own named-placeholders patch, disable mysql2s
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ export class MySql {
|
|||||||
const [result] = await this.connection.execute({
|
const [result] = await this.connection.execute({
|
||||||
sql: query,
|
sql: query,
|
||||||
values: values,
|
values: values,
|
||||||
typeCast: typeCastExecute as TypeCast,
|
typeCast: typeCastExecute,
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,21 +2,17 @@ import type { TypeCastField, TypeCastNext } from 'mysql2/promise';
|
|||||||
|
|
||||||
const BINARY_CHARSET = 63;
|
const BINARY_CHARSET = 63;
|
||||||
|
|
||||||
interface Field extends TypeCastField {
|
|
||||||
charset: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* node-mysql2 v3.9.0 introduced (breaking) typecasting for execute methods.
|
* 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();
|
return next();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* mysql-async compatible typecasting.
|
* mysql-async compatible typecasting.
|
||||||
*/
|
*/
|
||||||
export function typeCast(field: Field, next: TypeCastNext) {
|
export function typeCast(field: TypeCastField, next: TypeCastNext) {
|
||||||
switch (field.type) {
|
switch (field.type) {
|
||||||
case 'DATETIME':
|
case 'DATETIME':
|
||||||
case 'DATETIME2':
|
case 'DATETIME2':
|
||||||
|
|||||||
Reference in new issue
Block a user