mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-03 03:58:01 +00:00
Bump deps
This commit is contained in:
43
vendor/github.com/go-sql-driver/mysql/packets.go
generated
vendored
43
vendor/github.com/go-sql-driver/mysql/packets.go
generated
vendored
@@ -571,7 +571,8 @@ func (mc *mysqlConn) handleErrorPacket(data []byte) error {
|
||||
errno := binary.LittleEndian.Uint16(data[1:3])
|
||||
|
||||
// 1792: ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
|
||||
if errno == 1792 && mc.cfg.RejectReadOnly {
|
||||
// 1290: ER_OPTION_PREVENTS_STATEMENT (returned by Aurora during failover)
|
||||
if (errno == 1792 || errno == 1290) && mc.cfg.RejectReadOnly {
|
||||
// Oops; we are connected to a read-only connection, and won't be able
|
||||
// to issue any write statements. Since RejectReadOnly is configured,
|
||||
// we throw away this connection hoping this one would have write
|
||||
@@ -624,14 +625,7 @@ func (mc *mysqlConn) handleOkPacket(data []byte) error {
|
||||
}
|
||||
|
||||
// warning count [2 bytes]
|
||||
if !mc.strict {
|
||||
return nil
|
||||
}
|
||||
|
||||
pos := 1 + n + m + 2
|
||||
if binary.LittleEndian.Uint16(data[pos:pos+2]) > 0 {
|
||||
return mc.getWarnings()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -706,11 +700,14 @@ func (mc *mysqlConn) readColumns(count int) ([]mysqlField, error) {
|
||||
|
||||
// Filler [uint8]
|
||||
// Charset [charset, collation uint8]
|
||||
pos += n + 1 + 2
|
||||
|
||||
// Length [uint32]
|
||||
pos += n + 1 + 2 + 4
|
||||
columns[i].length = binary.LittleEndian.Uint32(data[pos : pos+4])
|
||||
pos += 4
|
||||
|
||||
// Field type [uint8]
|
||||
columns[i].fieldType = data[pos]
|
||||
columns[i].fieldType = fieldType(data[pos])
|
||||
pos++
|
||||
|
||||
// Flags [uint16]
|
||||
@@ -843,14 +840,7 @@ func (stmt *mysqlStmt) readPrepareResultPacket() (uint16, error) {
|
||||
// Reserved [8 bit]
|
||||
|
||||
// Warning count [16 bit uint]
|
||||
if !stmt.mc.strict {
|
||||
return columnCount, nil
|
||||
}
|
||||
|
||||
// Check for warnings count > 0, only available in MySQL > 4.1
|
||||
if len(data) >= 12 && binary.LittleEndian.Uint16(data[10:12]) > 0 {
|
||||
return columnCount, stmt.mc.getWarnings()
|
||||
}
|
||||
return columnCount, nil
|
||||
}
|
||||
return 0, err
|
||||
@@ -994,7 +984,7 @@ func (stmt *mysqlStmt) writeExecutePacket(args []driver.Value) error {
|
||||
// build NULL-bitmap
|
||||
if arg == nil {
|
||||
nullMask[i/8] |= 1 << (uint(i) & 7)
|
||||
paramTypes[i+i] = fieldTypeNULL
|
||||
paramTypes[i+i] = byte(fieldTypeNULL)
|
||||
paramTypes[i+i+1] = 0x00
|
||||
continue
|
||||
}
|
||||
@@ -1002,7 +992,7 @@ func (stmt *mysqlStmt) writeExecutePacket(args []driver.Value) error {
|
||||
// cache types and values
|
||||
switch v := arg.(type) {
|
||||
case int64:
|
||||
paramTypes[i+i] = fieldTypeLongLong
|
||||
paramTypes[i+i] = byte(fieldTypeLongLong)
|
||||
paramTypes[i+i+1] = 0x00
|
||||
|
||||
if cap(paramValues)-len(paramValues)-8 >= 0 {
|
||||
@@ -1018,7 +1008,7 @@ func (stmt *mysqlStmt) writeExecutePacket(args []driver.Value) error {
|
||||
}
|
||||
|
||||
case float64:
|
||||
paramTypes[i+i] = fieldTypeDouble
|
||||
paramTypes[i+i] = byte(fieldTypeDouble)
|
||||
paramTypes[i+i+1] = 0x00
|
||||
|
||||
if cap(paramValues)-len(paramValues)-8 >= 0 {
|
||||
@@ -1034,7 +1024,7 @@ func (stmt *mysqlStmt) writeExecutePacket(args []driver.Value) error {
|
||||
}
|
||||
|
||||
case bool:
|
||||
paramTypes[i+i] = fieldTypeTiny
|
||||
paramTypes[i+i] = byte(fieldTypeTiny)
|
||||
paramTypes[i+i+1] = 0x00
|
||||
|
||||
if v {
|
||||
@@ -1046,7 +1036,7 @@ func (stmt *mysqlStmt) writeExecutePacket(args []driver.Value) error {
|
||||
case []byte:
|
||||
// Common case (non-nil value) first
|
||||
if v != nil {
|
||||
paramTypes[i+i] = fieldTypeString
|
||||
paramTypes[i+i] = byte(fieldTypeString)
|
||||
paramTypes[i+i+1] = 0x00
|
||||
|
||||
if len(v) < mc.maxAllowedPacket-pos-len(paramValues)-(len(args)-(i+1))*64 {
|
||||
@@ -1064,11 +1054,11 @@ func (stmt *mysqlStmt) writeExecutePacket(args []driver.Value) error {
|
||||
|
||||
// Handle []byte(nil) as a NULL value
|
||||
nullMask[i/8] |= 1 << (uint(i) & 7)
|
||||
paramTypes[i+i] = fieldTypeNULL
|
||||
paramTypes[i+i] = byte(fieldTypeNULL)
|
||||
paramTypes[i+i+1] = 0x00
|
||||
|
||||
case string:
|
||||
paramTypes[i+i] = fieldTypeString
|
||||
paramTypes[i+i] = byte(fieldTypeString)
|
||||
paramTypes[i+i+1] = 0x00
|
||||
|
||||
if len(v) < mc.maxAllowedPacket-pos-len(paramValues)-(len(args)-(i+1))*64 {
|
||||
@@ -1083,7 +1073,7 @@ func (stmt *mysqlStmt) writeExecutePacket(args []driver.Value) error {
|
||||
}
|
||||
|
||||
case time.Time:
|
||||
paramTypes[i+i] = fieldTypeString
|
||||
paramTypes[i+i] = byte(fieldTypeString)
|
||||
paramTypes[i+i+1] = 0x00
|
||||
|
||||
var a [64]byte
|
||||
@@ -1157,10 +1147,11 @@ func (rows *binaryRows) readRow(dest []driver.Value) error {
|
||||
}
|
||||
return io.EOF
|
||||
}
|
||||
mc := rows.mc
|
||||
rows.mc = nil
|
||||
|
||||
// Error otherwise
|
||||
return rows.mc.handleErrorPacket(data)
|
||||
return mc.handleErrorPacket(data)
|
||||
}
|
||||
|
||||
// NULL-bitmap, [(column-count + 7 + 2) / 8 bytes]
|
||||
|
||||
Reference in New Issue
Block a user