TestNumbers test that selecting numeric columns. Both of textRows and binaryRows should return same type and value.
(t *testing.T)
| 406 | // TestNumbers test that selecting numeric columns. |
| 407 | // Both of textRows and binaryRows should return same type and value. |
| 408 | func TestNumbersToAny(t *testing.T) { |
| 409 | runTestsParallel(t, dsn, func(dbt *DBTest, tbl string) { |
| 410 | dbt.mustExec("CREATE TABLE " + tbl + " (id INT PRIMARY KEY, b BOOL, i8 TINYINT, " + |
| 411 | "i16 SMALLINT, i32 INT, i64 BIGINT, f32 FLOAT, f64 DOUBLE, iu32 INT UNSIGNED)") |
| 412 | dbt.mustExec("INSERT INTO " + tbl + " VALUES (1, true, 127, 32767, 2147483647, 9223372036854775807, 1.25, 2.5, 4294967295)") |
| 413 | |
| 414 | // Use binaryRows for interpolateParams=false and textRows for interpolateParams=true. |
| 415 | rows := dbt.mustQuery("SELECT b, i8, i16, i32, i64, f32, f64, iu32 FROM "+tbl+" WHERE id=?", 1) |
| 416 | if !rows.Next() { |
| 417 | dbt.Fatal("no data") |
| 418 | } |
| 419 | var b, i8, i16, i32, i64, f32, f64, iu32 any |
| 420 | err := rows.Scan(&b, &i8, &i16, &i32, &i64, &f32, &f64, &iu32) |
| 421 | if err != nil { |
| 422 | dbt.Fatal(err) |
| 423 | } |
| 424 | if b.(int64) != 1 { |
| 425 | dbt.Errorf("b != 1") |
| 426 | } |
| 427 | if i8.(int64) != 127 { |
| 428 | dbt.Errorf("i8 != 127") |
| 429 | } |
| 430 | if i16.(int64) != 32767 { |
| 431 | dbt.Errorf("i16 != 32767") |
| 432 | } |
| 433 | if i32.(int64) != 2147483647 { |
| 434 | dbt.Errorf("i32 != 2147483647") |
| 435 | } |
| 436 | if i64.(int64) != 9223372036854775807 { |
| 437 | dbt.Errorf("i64 != 9223372036854775807") |
| 438 | } |
| 439 | if f32.(float32) != 1.25 { |
| 440 | dbt.Errorf("f32 != 1.25") |
| 441 | } |
| 442 | if f64.(float64) != 2.5 { |
| 443 | dbt.Errorf("f64 != 2.5") |
| 444 | } |
| 445 | if iu32.(int64) != 4294967295 { |
| 446 | dbt.Errorf("iu32 != 4294967295") |
| 447 | } |
| 448 | }) |
| 449 | } |
| 450 | |
| 451 | func TestMultiQuery(t *testing.T) { |
| 452 | runTestsWithMultiStatement(t, dsn, func(dbt *DBTest) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…