Skip to content

Commit fcb28a6

Browse files
committed
Add support for new VECTOR type
MySQL 9.0.0 added support for the VECTOR type. This adds basic support so it can be handled at the protocol level. Signed-off-by: Dirkjan Bussink <[email protected]>
1 parent 3484db1 commit fcb28a6

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

AUTHORS

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ Daniel Montoya <dsmontoyam at gmail.com>
3333
Daniel Nichter <nil at codenode.com>
3434
Daniël van Eeden <git at myname.nl>
3535
Dave Protasowski <dprotaso at gmail.com>
36+
Dirkjan Bussink <d.bussink at gmail.com>
3637
DisposaBoy <disposaboy at dby.me>
3738
Egor Smolyakov <egorsmkv at gmail.com>
3839
Erwan Martin <hello at erwan.io>

const.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,10 @@ const (
125125
fieldTypeBit
126126
)
127127
const (
128-
fieldTypeJSON fieldType = iota + 0xf5
128+
fieldTypeVector fieldType = iota + 0xf2
129+
fieldTypeInvalid
130+
fieldTypeBool
131+
fieldTypeJSON
129132
fieldTypeNewDecimal
130133
fieldTypeEnum
131134
fieldTypeSet

fields.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ func (mf *mysqlField) typeDatabaseName() string {
112112
return "VARCHAR"
113113
case fieldTypeYear:
114114
return "YEAR"
115+
case fieldTypeVector:
116+
return "VECTOR"
115117
default:
116118
return ""
117119
}
@@ -198,7 +200,7 @@ func (mf *mysqlField) scanType() reflect.Type {
198200
return scanTypeNullFloat
199201

200202
case fieldTypeBit, fieldTypeTinyBLOB, fieldTypeMediumBLOB, fieldTypeLongBLOB,
201-
fieldTypeBLOB, fieldTypeVarString, fieldTypeString, fieldTypeGeometry:
203+
fieldTypeBLOB, fieldTypeVarString, fieldTypeString, fieldTypeGeometry, fieldTypeVector:
202204
if mf.charSet == binaryCollationID {
203205
return scanTypeBytes
204206
}

packets.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -1329,7 +1329,8 @@ func (rows *binaryRows) readRow(dest []driver.Value) error {
13291329
case fieldTypeDecimal, fieldTypeNewDecimal, fieldTypeVarChar,
13301330
fieldTypeBit, fieldTypeEnum, fieldTypeSet, fieldTypeTinyBLOB,
13311331
fieldTypeMediumBLOB, fieldTypeLongBLOB, fieldTypeBLOB,
1332-
fieldTypeVarString, fieldTypeString, fieldTypeGeometry, fieldTypeJSON:
1332+
fieldTypeVarString, fieldTypeString, fieldTypeGeometry, fieldTypeJSON,
1333+
fieldTypeVector:
13331334
var isNull bool
13341335
var n int
13351336
dest[i], isNull, n, err = readLengthEncodedString(data[pos:])

0 commit comments

Comments
 (0)