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

Function TestErrorInMultiResult

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

Source from the content-addressed store, hash-verified

3567}
3568
3569func TestErrorInMultiResult(t *testing.T) {
3570 if !available {
3571 t.Skipf("MySQL server not running on %s", netAddr)
3572 }
3573 // https://github.com/go-sql-driver/mysql/issues/1361
3574 var db *sql.DB
3575 if _, err := ParseDSN(dsn); err != errInvalidDSNUnsafeCollation {
3576 db, err = sql.Open("mysql", dsn)
3577 if err != nil {
3578 t.Fatalf("error connecting: %s", err.Error())
3579 }
3580 defer db.Close()
3581 }
3582
3583 dbt := &DBTest{t, db}
3584 query := `
3585CREATE PROCEDURE test_proc1()
3586BEGIN
3587 SELECT 1,2;
3588 SELECT 3,4;
3589 SIGNAL SQLSTATE '10000' SET MESSAGE_TEXT = "some error", MYSQL_ERRNO = 10000;
3590END;
3591`
3592 runCallCommand(dbt, query, "test_proc1")
3593}
3594
3595func runCallCommand(dbt *DBTest, query, name string) {
3596 dbt.mustExec(fmt.Sprintf("DROP PROCEDURE IF EXISTS %s", name))

Callers

nothing calls this directly

Calls 5

ParseDSNFunction · 0.85
runCallCommandFunction · 0.85
OpenMethod · 0.80
ErrorMethod · 0.45
CloseMethod · 0.45

Tested by

no test coverage detected