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

Function TestFoundRows2

driver_test.go:1457–1479  ·  driver_test.go::TestFoundRows2
(t *testing.T)

Source from the content-addressed store, hash-verified

1455}
1456
1457func TestFoundRows2(t *testing.T) {
1458 runTestsParallel(t, dsn+"&clientFoundRows=true", func(dbt *DBTest, tbl string) {
1459 dbt.mustExec("CREATE TABLE " + tbl + " (id INT NOT NULL ,data INT NOT NULL)")
1460 dbt.mustExec("INSERT INTO " + tbl + " (id, data) VALUES (0, 0),(0, 0),(1, 0),(1, 0),(1, 1)")
1461
1462 res := dbt.mustExec("UPDATE " + tbl + " SET data = 1 WHERE id = 0")
1463 count, err := res.RowsAffected()
1464 if err != nil {
1465 dbt.Fatalf("res.RowsAffected() returned error: %s", err.Error())
1466 }
1467 if count != 2 {
1468 dbt.Fatalf("Expected 2 matched rows, got %d", count)
1469 }
1470 res = dbt.mustExec("UPDATE " + tbl + " SET data = 1 WHERE id = 1")
1471 count, err = res.RowsAffected()
1472 if err != nil {
1473 dbt.Fatalf("res.RowsAffected() returned error: %s", err.Error())
1474 }
1475 if count != 3 {
1476 dbt.Fatalf("Expected 3 matched rows, got %d", count)
1477 }
1478 })
1479}
1480
1481func TestTLS(t *testing.T) {
1482 tlsTestReq := func(dbt *DBTest) {

Callers

nothing calls this directly

Calls 4

runTestsParallelFunction · 0.85
mustExecMethod · 0.80
RowsAffectedMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected