MCPcopy
hub / github.com/go-sql-driver/mysql / TestRawBytes

Function TestRawBytes

driver_test.go:666–693  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

664}
665
666func TestRawBytes(t *testing.T) {
667 runTestsParallel(t, dsn, func(dbt *DBTest, _ string) {
668 v1 := []byte("aaa")
669 v2 := []byte("bbb")
670 rows := dbt.mustQuery("SELECT ?, ?", v1, v2)
671 defer rows.Close()
672 if rows.Next() {
673 var o1, o2 sql.RawBytes
674 if err := rows.Scan(&o1, &o2); err != nil {
675 dbt.Errorf("Got error: %v", err)
676 }
677 if !bytes.Equal(v1, o1) {
678 dbt.Errorf("expected %v, got %v", v1, o1)
679 }
680 if !bytes.Equal(v2, o2) {
681 dbt.Errorf("expected %v, got %v", v2, o2)
682 }
683 // https://github.com/go-sql-driver/mysql/issues/765
684 // Appending to RawBytes shouldn't overwrite next RawBytes.
685 o1 = append(o1, "xyzzy"...)
686 if !bytes.Equal(v2, o2) {
687 dbt.Errorf("expected %v, got %v", v2, o2)
688 }
689 } else {
690 dbt.Errorf("no data")
691 }
692 })
693}
694
695func TestRawMessage(t *testing.T) {
696 runTestsParallel(t, dsn, func(dbt *DBTest, _ string) {

Callers

nothing calls this directly

Calls 5

runTestsParallelFunction · 0.85
mustQueryMethod · 0.80
ScanMethod · 0.80
CloseMethod · 0.45
NextMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…