From 3659488d8736da0e7e5a5178811d50155e1a8155 Mon Sep 17 00:00:00 2001 From: Dirkjan Bussink Date: Wed, 24 Jul 2024 06:33:02 +0200 Subject: [PATCH] Add basic vector type (#2866) This adds the new MySQL 9.0 vector type. It can still be handled like a binary blob for now I think. Maybe it's worth in the future to directly decode / parse it into an array of floats here? Signed-off-by: Dirkjan Bussink --- lib/constants/types.js | 1 + typings/mysql/lib/constants/Types.d.ts | 2 ++ typings/mysql/lib/parsers/typeCast.d.ts | 1 + 3 files changed, 4 insertions(+) diff --git a/lib/constants/types.js b/lib/constants/types.js index aa975e29d2..2a1c226133 100644 --- a/lib/constants/types.js +++ b/lib/constants/types.js @@ -51,6 +51,7 @@ module.exports.YEAR = 0x0d; // aka YEAR, 1 byte (don't ask) module.exports.NEWDATE = 0x0e; // aka ? module.exports.VARCHAR = 0x0f; // aka VARCHAR (?) module.exports.BIT = 0x10; // aka BIT, 1-8 byte +module.exports.VECTOR = 0xf2; module.exports.JSON = 0xf5; module.exports.NEWDECIMAL = 0xf6; // aka DECIMAL module.exports.ENUM = 0xf7; // aka ENUM diff --git a/typings/mysql/lib/constants/Types.d.ts b/typings/mysql/lib/constants/Types.d.ts index 73f34f0f85..2719509e7a 100644 --- a/typings/mysql/lib/constants/Types.d.ts +++ b/typings/mysql/lib/constants/Types.d.ts @@ -16,6 +16,7 @@ interface Types { 0x0e: string; 0x0f: string; 0x10: string; + 0xf2: string; 0xf5: string; 0xf6: string; 0xf7: string; @@ -45,6 +46,7 @@ interface Types { NEWDATE: number; VARCHAR: number; BIT: number; + VECTOR: number; JSON: number; NEWDECIMAL: number; ENUM: number; diff --git a/typings/mysql/lib/parsers/typeCast.d.ts b/typings/mysql/lib/parsers/typeCast.d.ts index 65bfaa8949..b8e975148b 100644 --- a/typings/mysql/lib/parsers/typeCast.d.ts +++ b/typings/mysql/lib/parsers/typeCast.d.ts @@ -25,6 +25,7 @@ export type Type = { | 'NEWDATE' | 'VARCHAR' | 'BIT' + | 'VECTOR' | 'JSON' | 'NEWDECIMAL' | 'ENUM'