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

Function TestFloat64Placeholder

driver_test.go:593–615  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

591}
592
593func TestFloat64Placeholder(t *testing.T) {
594 runTestsParallel(t, dsn, func(dbt *DBTest, tbl string) {
595 types := [2]string{"FLOAT", "DOUBLE"}
596 var expected float64 = 42.23
597 var out float64
598 var rows *sql.Rows
599 for _, v := range types {
600 dbt.mustExec("CREATE TABLE " + tbl + " (id int, value " + v + ")")
601 dbt.mustExec("INSERT INTO " + tbl + " VALUES (1, 42.23)")
602 rows = dbt.mustQuery("SELECT value FROM "+tbl+" WHERE id = ?", 1)
603 if rows.Next() {
604 rows.Scan(&out)
605 if expected != out {
606 dbt.Errorf("%s: %g != %g", v, expected, out)
607 }
608 } else {
609 dbt.Errorf("%s: no data", v)
610 }
611 rows.Close()
612 dbt.mustExec("DROP TABLE IF EXISTS " + tbl)
613 }
614 })
615}
616
617func TestString(t *testing.T) {
618 runTestsParallel(t, dsn, func(dbt *DBTest, tbl string) {

Callers

nothing calls this directly

Calls 6

runTestsParallelFunction · 0.85
mustExecMethod · 0.80
mustQueryMethod · 0.80
ScanMethod · 0.80
NextMethod · 0.45
CloseMethod · 0.45

Tested by

no test coverage detected