Browse Source

Add []byte(nil) insert check

Julien Schmidt 12 năm trước cách đây
mục cha
commit
830d66e037
1 tập tin đã thay đổi với 9 bổ sung0 xóa
  1. 9 0
      driver_test.go

+ 9 - 0
driver_test.go

@@ -517,6 +517,15 @@ func TestNULL(t *testing.T) {
 		if b == nil {
 			dbt.Error("Nil []byte wich should be non-nil")
 		}
+		// Insert nil
+		b = nil
+		success := false
+		if err = dbt.db.QueryRow("SELECT ? IS NULL", b).Scan(&success); err != nil {
+			dbt.Fatal(err)
+		}
+		if !success {
+			dbt.Error("Inserting []byte(nil) as NULL failed")
+		}
 		// Check input==output (==nil)
 		b = nil
 		if err = dbt.db.QueryRow("SELECT ?", nil).Scan(&b); err != nil {