dbexec_test.go 578 B

1234567891011121314151617181920212223242526272829303132333435
  1. package test
  2. import (
  3. "fmt"
  4. "testing"
  5. )
  6. var unit_test = "ddl"
  7. var INS = []string{
  8. "INSERT INTO gotab1 VALUES(1, 0.27, 0.99);",
  9. "INSERT INTO gotab1 VALUES(1, NULL, NULL);",
  10. "INSERT INTO gotab2 VALUES(1, 'XuguSQL', '2020-01-01 00:00:00');",
  11. "INSERT INTO gotab2 VALUES(1, '', NULL);"}
  12. func TestDbexec(t *testing.T) {
  13. for _, sql := range INS {
  14. _, err := db.Exec(sql)
  15. if err != nil {
  16. fmt.Printf("[ERROR] %s\n", err.Error())
  17. continue
  18. }
  19. fmt.Printf("%s ... ok\n", sql)
  20. }
  21. err := db.Close()
  22. if err != nil {
  23. fmt.Printf("[ERROR] %s\n", err.Error())
  24. }
  25. }