chore(upgradeSQLCipher): Scanning NULL BLOB value should return nil

Fixing failing tests: TestSyncDeviceSuite/TestPairingSyncDeviceClientAsReceiver; TestSyncDeviceSuite/TestPairingSyncDeviceClientAsSender

Considering the following configuration:
1. Table with BLOB column has 1 NULL value
2. Query the value
3. Rows.Scan(&dest sql.NullString)

Expected: dest.Valid == false; dest.String == nil
Actual: dest.Valid == true; dest.String == ""
This commit is contained in:
Alex Jbanca 2023-06-06 15:26:21 +03:00
parent 17828ba1d9
commit 2d907f4ca4
No known key found for this signature in database
GPG Key ID: 6004079575C21C5D
1 changed files with 2 additions and 1 deletions

View File

@ -4,6 +4,7 @@
// Use of this source code is governed by an MIT-style
// license that can be found in the LICENSE file.
//go:build cgo
// +build cgo
package sqlite3
@ -2092,7 +2093,7 @@ func (rc *SQLiteRows) nextSyncLocked(dest []driver.Value) error {
case C.SQLITE_BLOB:
p := C.sqlite3_column_blob(rc.s.s, C.int(i))
if p == nil {
dest[i] = []byte{}
dest[i] = nil
continue
}
n := C.sqlite3_column_bytes(rc.s.s, C.int(i))