Closed taniabogatsch closed 6 months ago
Reproduction.
func TestAppenderBlob(t *testing.T) { connector, con, appender := prepareAppender(t, `CREATE TABLE test (data BLOB)`) defer con.Close() defer connector.Close() data := []byte{0x01, 0x02, 0x00, 0x03, 0x04} err := appender.AppendRow(data) require.NoError(t, err) // Treat []uint8 the same as []byte. uint8Slice := []uint8{0x01, 0x02, 0x00, 0x03, 0x04} err = appender.AppendRow(uint8Slice) require.NoError(t, err) err = appender.Close() require.NoError(t, err) // Verify results. db := sql.OpenDB(connector) res, err := db.QueryContext( context.Background(), `SELECT data FROM test`, ) require.NoError(t, err) defer res.Close() i := 0 for res.Next() { var b []byte err = res.Scan( &b, ) require.NoError(t, err) require.Equal(t, data, b) i++ } require.Equal(t, 2, i) }
Yields
Expected :[]byte{0x1, 0x2, 0x3, 0x4} Actual :[]byte{0x1, 0x2}
Fixed in #167.
Reproduction.
Yields
Fixed in #167.