MCPcopy
hub / github.com/jackc/pgx / TestStmtExecContextSuccess

Function TestStmtExecContextSuccess

stdlib/sql_test.go:867–882  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

865}
866
867func TestStmtExecContextSuccess(t *testing.T) {
868 db := openDB(t)
869 defer closeDB(t, db)
870
871 _, err := db.Exec("create temporary table t(id int primary key)")
872 require.NoError(t, err)
873
874 stmt, err := db.Prepare("insert into t(id) values ($1::int4)")
875 require.NoError(t, err)
876 defer stmt.Close()
877
878 _, err = stmt.ExecContext(context.Background(), 42)
879 require.NoError(t, err)
880
881 ensureDBValid(t, db)
882}
883
884func TestStmtExecContextCancel(t *testing.T) {
885 db := openDB(t)

Callers

nothing calls this directly

Calls 7

openDBFunction · 0.85
closeDBFunction · 0.85
ensureDBValidFunction · 0.85
ExecMethod · 0.65
PrepareMethod · 0.65
CloseMethod · 0.65
ExecContextMethod · 0.45

Tested by

no test coverage detected