(t *testing.T)
| 1431 | } |
| 1432 | |
| 1433 | func TestFoundRows1(t *testing.T) { |
| 1434 | runTestsParallel(t, dsn, func(dbt *DBTest, tbl string) { |
| 1435 | dbt.mustExec("CREATE TABLE " + tbl + " (id INT NOT NULL ,data INT NOT NULL)") |
| 1436 | dbt.mustExec("INSERT INTO " + tbl + " (id, data) VALUES (0, 0),(0, 0),(1, 0),(1, 0),(1, 1)") |
| 1437 | |
| 1438 | res := dbt.mustExec("UPDATE " + tbl + " SET data = 1 WHERE id = 0") |
| 1439 | count, err := res.RowsAffected() |
| 1440 | if err != nil { |
| 1441 | dbt.Fatalf("res.RowsAffected() returned error: %s", err.Error()) |
| 1442 | } |
| 1443 | if count != 2 { |
| 1444 | dbt.Fatalf("Expected 2 affected rows, got %d", count) |
| 1445 | } |
| 1446 | res = dbt.mustExec("UPDATE " + tbl + " SET data = 1 WHERE id = 1") |
| 1447 | count, err = res.RowsAffected() |
| 1448 | if err != nil { |
| 1449 | dbt.Fatalf("res.RowsAffected() returned error: %s", err.Error()) |
| 1450 | } |
| 1451 | if count != 2 { |
| 1452 | dbt.Fatalf("Expected 2 affected rows, got %d", count) |
| 1453 | } |
| 1454 | }) |
| 1455 | } |
| 1456 | |
| 1457 | func TestFoundRows2(t *testing.T) { |
| 1458 | runTestsParallel(t, dsn+"&clientFoundRows=true", func(dbt *DBTest, tbl string) { |
nothing calls this directly
no test coverage detected