From 1add01944ae0035afc06ab7d6d66006743318b84 Mon Sep 17 00:00:00 2001 From: Aleksey Myasnikov Date: Thu, 9 Nov 2023 11:51:54 +0300 Subject: [PATCH] Added function id into database/sql traces (start info's) Fix of breaking changes --- internal/xsql/conn.go | 16 +++++++----- internal/xsql/connector.go | 5 +++- internal/xsql/stmt.go | 7 +++--- internal/xsql/tx.go | 11 ++++---- internal/xsql/tx_fake.go | 16 ++++++++---- trace/sql.go | 32 ++++++++++++++++++++++-- trace/sql_gtrace.go | 51 ++++++++++++++++++++++++++------------ 7 files changed, 100 insertions(+), 38 deletions(-) diff --git a/internal/xsql/conn.go b/internal/xsql/conn.go index 2811bbf67..85c99a746 100644 --- a/internal/xsql/conn.go +++ b/internal/xsql/conn.go @@ -152,7 +152,7 @@ func (c *conn) PrepareContext(ctx context.Context, query string) (_ driver.Stmt, if c.currentTx != nil { return c.currentTx.PrepareContext(ctx, query) } - onDone := trace.DatabaseSQLOnConnPrepare(c.trace, &ctx, query) + onDone := trace.DatabaseSQLOnConnPrepare(c.trace, &ctx, stack.FunctionID(0), query) defer func() { onDone(finalErr) }() @@ -177,7 +177,9 @@ func (c *conn) execContext(ctx context.Context, query string, args []driver.Name ) { var ( m = queryModeFromContext(ctx, c.defaultQueryMode) - onDone = trace.DatabaseSQLOnConnExec(c.trace, &ctx, query, m.String(), xcontext.IsIdempotent(ctx), c.sinceLastUsage()) + onDone = trace.DatabaseSQLOnConnExec( + c.trace, &ctx, stack.FunctionID(0), query, m.String(), xcontext.IsIdempotent(ctx), c.sinceLastUsage(), + ) ) defer func() { @@ -270,7 +272,7 @@ func (c *conn) queryContext(ctx context.Context, query string, args []driver.Nam ) { m := queryModeFromContext(ctx, c.defaultQueryMode) onDone := trace.DatabaseSQLOnConnQuery( - c.trace, &ctx, query, m.String(), xcontext.IsIdempotent(ctx), c.sinceLastUsage(), + c.trace, &ctx, stack.FunctionID(0), query, m.String(), xcontext.IsIdempotent(ctx), c.sinceLastUsage(), ) defer func() { c.lastUsage.Store(time.Now().Unix()) @@ -351,7 +353,7 @@ func (c *conn) queryContext(ctx context.Context, query string, args []driver.Nam } func (c *conn) Ping(ctx context.Context) (finalErr error) { - onDone := trace.DatabaseSQLOnConnPing(c.trace, &ctx) + onDone := trace.DatabaseSQLOnConnPing(c.trace, &ctx, stack.FunctionID(0)) defer func() { onDone(finalErr) }() @@ -367,7 +369,9 @@ func (c *conn) Ping(ctx context.Context) (finalErr error) { func (c *conn) Close() (finalErr error) { if c.closed.CompareAndSwap(false, true) { c.connector.detach(c) - onDone := trace.DatabaseSQLOnConnClose(c.trace) + onDone := trace.DatabaseSQLOnConnClose( + c.trace, &c.openConnCtx, stack.FunctionID(0), + ) defer func() { onDone(finalErr) }() @@ -406,7 +410,7 @@ func (c *conn) ID() string { func (c *conn) BeginTx(ctx context.Context, txOptions driver.TxOptions) (_ driver.Tx, finalErr error) { var tx currentTx - onDone := trace.DatabaseSQLOnConnBegin(c.trace, &ctx) + onDone := trace.DatabaseSQLOnConnBegin(c.trace, &ctx, stack.FunctionID(0)) defer func() { onDone(tx, finalErr) }() diff --git a/internal/xsql/connector.go b/internal/xsql/connector.go index 10437e011..e95f5926a 100644 --- a/internal/xsql/connector.go +++ b/internal/xsql/connector.go @@ -11,6 +11,7 @@ import ( "github.com/ydb-platform/ydb-go-sdk/v3/internal/bind" metaHeaders "github.com/ydb-platform/ydb-go-sdk/v3/internal/meta" + "github.com/ydb-platform/ydb-go-sdk/v3/internal/stack" "github.com/ydb-platform/ydb-go-sdk/v3/internal/xcontext" "github.com/ydb-platform/ydb-go-sdk/v3/internal/xerrors" "github.com/ydb-platform/ydb-go-sdk/v3/meta" @@ -295,7 +296,9 @@ func (c *Connector) detach(cc *conn) { func (c *Connector) Connect(ctx context.Context) (_ driver.Conn, err error) { var ( - onDone = trace.DatabaseSQLOnConnectorConnect(c.trace, &ctx) + onDone = trace.DatabaseSQLOnConnectorConnect( + c.trace, &ctx, stack.FunctionID(0), + ) session table.ClosableSession ) defer func() { diff --git a/internal/xsql/stmt.go b/internal/xsql/stmt.go index e3c5d10ee..d4d84335f 100644 --- a/internal/xsql/stmt.go +++ b/internal/xsql/stmt.go @@ -5,6 +5,7 @@ import ( "database/sql/driver" "fmt" + "github.com/ydb-platform/ydb-go-sdk/v3/internal/stack" "github.com/ydb-platform/ydb-go-sdk/v3/internal/xerrors" "github.com/ydb-platform/ydb-go-sdk/v3/internal/xsql/badconn" "github.com/ydb-platform/ydb-go-sdk/v3/trace" @@ -29,7 +30,7 @@ var ( ) func (s *stmt) QueryContext(ctx context.Context, args []driver.NamedValue) (_ driver.Rows, finalErr error) { - onDone := trace.DatabaseSQLOnStmtQuery(s.trace, &ctx, &s.prepareCtx, s.query) + onDone := trace.DatabaseSQLOnStmtQuery(s.trace, &ctx, stack.FunctionID(0), &s.prepareCtx, s.query) defer func() { onDone(finalErr) }() @@ -45,7 +46,7 @@ func (s *stmt) QueryContext(ctx context.Context, args []driver.NamedValue) (_ dr } func (s *stmt) ExecContext(ctx context.Context, args []driver.NamedValue) (_ driver.Result, finalErr error) { - onDone := trace.DatabaseSQLOnStmtExec(s.trace, &ctx, &s.prepareCtx, s.query) + onDone := trace.DatabaseSQLOnStmtExec(s.trace, &ctx, stack.FunctionID(0), &s.prepareCtx, s.query) defer func() { onDone(finalErr) }() @@ -65,7 +66,7 @@ func (s *stmt) NumInput() int { } func (s *stmt) Close() (finalErr error) { - onDone := trace.DatabaseSQLOnStmtClose(s.trace, &s.prepareCtx) + onDone := trace.DatabaseSQLOnStmtClose(s.trace, &s.prepareCtx, stack.FunctionID(0)) defer func() { onDone(finalErr) }() diff --git a/internal/xsql/tx.go b/internal/xsql/tx.go index bb4430201..1eb5c10ed 100644 --- a/internal/xsql/tx.go +++ b/internal/xsql/tx.go @@ -5,6 +5,7 @@ import ( "database/sql/driver" "fmt" + "github.com/ydb-platform/ydb-go-sdk/v3/internal/stack" "github.com/ydb-platform/ydb-go-sdk/v3/internal/xerrors" "github.com/ydb-platform/ydb-go-sdk/v3/internal/xsql/badconn" "github.com/ydb-platform/ydb-go-sdk/v3/internal/xsql/isolation" @@ -70,7 +71,7 @@ func (tx *tx) checkTxState() error { } func (tx *tx) Commit() (finalErr error) { - onDone := trace.DatabaseSQLOnTxCommit(tx.conn.trace, &tx.beginCtx, tx) + onDone := trace.DatabaseSQLOnTxCommit(tx.conn.trace, &tx.beginCtx, stack.FunctionID(0), tx) defer func() { onDone(finalErr) }() @@ -88,7 +89,7 @@ func (tx *tx) Commit() (finalErr error) { } func (tx *tx) Rollback() (finalErr error) { - onDone := trace.DatabaseSQLOnTxRollback(tx.conn.trace, &tx.beginCtx, tx) + onDone := trace.DatabaseSQLOnTxRollback(tx.conn.trace, &tx.beginCtx, stack.FunctionID(0), tx) defer func() { onDone(finalErr) }() @@ -108,7 +109,7 @@ func (tx *tx) Rollback() (finalErr error) { func (tx *tx) QueryContext(ctx context.Context, query string, args []driver.NamedValue) ( _ driver.Rows, finalErr error, ) { - onDone := trace.DatabaseSQLOnTxQuery(tx.conn.trace, &ctx, &tx.beginCtx, tx, query) + onDone := trace.DatabaseSQLOnTxQuery(tx.conn.trace, &ctx, stack.FunctionID(0), &tx.beginCtx, tx, query, true) defer func() { onDone(finalErr) }() @@ -146,7 +147,7 @@ func (tx *tx) QueryContext(ctx context.Context, query string, args []driver.Name func (tx *tx) ExecContext(ctx context.Context, query string, args []driver.NamedValue) ( _ driver.Result, finalErr error, ) { - onDone := trace.DatabaseSQLOnTxExec(tx.conn.trace, &ctx, &tx.beginCtx, tx, query) + onDone := trace.DatabaseSQLOnTxExec(tx.conn.trace, &ctx, stack.FunctionID(0), &tx.beginCtx, tx, query, true) defer func() { onDone(finalErr) }() @@ -176,7 +177,7 @@ func (tx *tx) ExecContext(ctx context.Context, query string, args []driver.Named } func (tx *tx) PrepareContext(ctx context.Context, query string) (_ driver.Stmt, finalErr error) { - onDone := trace.DatabaseSQLOnTxPrepare(tx.conn.trace, &ctx, &tx.beginCtx, tx, query) + onDone := trace.DatabaseSQLOnTxPrepare(tx.conn.trace, &ctx, stack.FunctionID(0), &tx.beginCtx, tx, query) defer func() { onDone(finalErr) }() diff --git a/internal/xsql/tx_fake.go b/internal/xsql/tx_fake.go index f84be9d76..9bd55d811 100644 --- a/internal/xsql/tx_fake.go +++ b/internal/xsql/tx_fake.go @@ -4,6 +4,8 @@ import ( "context" "database/sql/driver" + "github.com/ydb-platform/ydb-go-sdk/v3/internal/stack" + "github.com/ydb-platform/ydb-go-sdk/v3/internal/xcontext" "github.com/ydb-platform/ydb-go-sdk/v3/internal/xerrors" "github.com/ydb-platform/ydb-go-sdk/v3/internal/xsql/badconn" "github.com/ydb-platform/ydb-go-sdk/v3/table" @@ -17,7 +19,7 @@ type txFake struct { } func (tx *txFake) PrepareContext(ctx context.Context, query string) (_ driver.Stmt, finalErr error) { - onDone := trace.DatabaseSQLOnTxPrepare(tx.conn.trace, &ctx, &tx.beginCtx, tx, query) + onDone := trace.DatabaseSQLOnTxPrepare(tx.conn.trace, &ctx, stack.FunctionID(0), &tx.beginCtx, tx, query) defer func() { onDone(finalErr) }() @@ -52,7 +54,7 @@ func (tx *txFake) ID() string { } func (tx *txFake) Commit() (err error) { - onDone := trace.DatabaseSQLOnTxCommit(tx.conn.trace, &tx.ctx, tx) + onDone := trace.DatabaseSQLOnTxCommit(tx.conn.trace, &tx.ctx, stack.FunctionID(0), tx) defer func() { onDone(err) }() @@ -66,7 +68,7 @@ func (tx *txFake) Commit() (err error) { } func (tx *txFake) Rollback() (err error) { - onDone := trace.DatabaseSQLOnTxRollback(tx.conn.trace, &tx.ctx, tx) + onDone := trace.DatabaseSQLOnTxRollback(tx.conn.trace, &tx.ctx, stack.FunctionID(0), tx) defer func() { onDone(err) }() @@ -82,7 +84,9 @@ func (tx *txFake) Rollback() (err error) { func (tx *txFake) QueryContext(ctx context.Context, query string, args []driver.NamedValue) ( rows driver.Rows, err error, ) { - onDone := trace.DatabaseSQLOnTxQuery(tx.conn.trace, &ctx, &tx.ctx, tx, query) + onDone := trace.DatabaseSQLOnTxQuery( + tx.conn.trace, &ctx, stack.FunctionID(0), &tx.ctx, tx, query, xcontext.IsIdempotent(ctx), + ) defer func() { onDone(err) }() @@ -96,7 +100,9 @@ func (tx *txFake) QueryContext(ctx context.Context, query string, args []driver. func (tx *txFake) ExecContext(ctx context.Context, query string, args []driver.NamedValue) ( result driver.Result, err error, ) { - onDone := trace.DatabaseSQLOnTxExec(tx.conn.trace, &ctx, &tx.ctx, tx, query) + onDone := trace.DatabaseSQLOnTxExec( + tx.conn.trace, &ctx, stack.FunctionID(0), &tx.ctx, tx, query, xcontext.IsIdempotent(ctx), + ) defer func() { onDone(err) }() diff --git a/trace/sql.go b/trace/sql.go index 2c21fad26..088a2bb05 100644 --- a/trace/sql.go +++ b/trace/sql.go @@ -40,6 +40,7 @@ type ( // Warning: concurrent access to pointer on client side must be excluded. // Safe replacement of context are provided only inside callback function Context *context.Context + Call call } DatabaseSQLConnectorConnectDoneInfo struct { Error error @@ -51,6 +52,7 @@ type ( // Warning: concurrent access to pointer on client side must be excluded. // Safe replacement of context are provided only inside callback function Context *context.Context + Call call } DatabaseSQLConnPingDoneInfo struct { Error error @@ -61,6 +63,7 @@ type ( // Warning: concurrent access to pointer on client side must be excluded. // Safe replacement of context are provided only inside callback function Context *context.Context + Call call Query string } DatabaseSQLConnPrepareDoneInfo struct { @@ -72,6 +75,7 @@ type ( // Warning: concurrent access to pointer on client side must be excluded. // Safe replacement of context are provided only inside callback function Context *context.Context + Call call TxContext *context.Context Tx tableTransactionInfo Query string @@ -79,8 +83,15 @@ type ( DatabaseSQLTxPrepareDoneInfo struct { Error error } - DatabaseSQLConnCloseStartInfo struct{} - DatabaseSQLConnCloseDoneInfo struct { + DatabaseSQLConnCloseStartInfo struct { + // Context make available context in trace callback function. + // Pointer to context provide replacement of context in trace callback function. + // Warning: concurrent access to pointer on client side must be excluded. + // Safe replacement of context are provided only inside callback function + Context *context.Context + Call call + } + DatabaseSQLConnCloseDoneInfo struct { Error error } DatabaseSQLConnBeginStartInfo struct { @@ -89,6 +100,7 @@ type ( // Warning: concurrent access to pointer on client side must be excluded. // Safe replacement of context are provided only inside callback function Context *context.Context + Call call } DatabaseSQLConnBeginDoneInfo struct { Tx tableTransactionInfo @@ -100,6 +112,7 @@ type ( // Warning: concurrent access to pointer on client side must be excluded. // Safe replacement of context are provided only inside callback function Context *context.Context + Call call Query string Mode string Idempotent bool @@ -114,6 +127,7 @@ type ( // Warning: concurrent access to pointer on client side must be excluded. // Safe replacement of context are provided only inside callback function Context *context.Context + Call call Query string Mode string Idempotent bool @@ -141,9 +155,13 @@ type ( // Warning: concurrent access to pointer on client side must be excluded. // Safe replacement of context are provided only inside callback function Context *context.Context + Call call TxContext *context.Context Tx tableTransactionInfo Query string + + // Deprecated: all transactions are idempotent + Idempotent bool } DatabaseSQLTxQueryDoneInfo struct { Error error @@ -154,9 +172,13 @@ type ( // Warning: concurrent access to pointer on client side must be excluded. // Safe replacement of context are provided only inside callback function Context *context.Context + Call call TxContext *context.Context Tx tableTransactionInfo Query string + + // Deprecated: all transactions are idempotent + Idempotent bool } DatabaseSQLTxExecDoneInfo struct { Error error @@ -167,6 +189,7 @@ type ( // Warning: concurrent access to pointer on client side must be excluded. // Safe replacement of context are provided only inside callback function TxContext *context.Context + Call call Tx tableTransactionInfo } DatabaseSQLTxCommitDoneInfo struct { @@ -178,6 +201,7 @@ type ( // Warning: concurrent access to pointer on client side must be excluded. // Safe replacement of context are provided only inside callback function TxContext *context.Context + Call call Tx tableTransactionInfo } DatabaseSQLTxRollbackDoneInfo struct { @@ -185,6 +209,7 @@ type ( } DatabaseSQLStmtCloseStartInfo struct { StmtContext *context.Context + Call call } DatabaseSQLStmtCloseDoneInfo struct { Error error @@ -195,6 +220,7 @@ type ( // Warning: concurrent access to pointer on client side must be excluded. // Safe replacement of context are provided only inside callback function Context *context.Context + Call call StmtContext *context.Context Query string } @@ -207,6 +233,7 @@ type ( // Warning: concurrent access to pointer on client side must be excluded. // Safe replacement of context are provided only inside callback function Context *context.Context + Call call StmtContext *context.Context Query string } @@ -219,6 +246,7 @@ type ( // Warning: concurrent access to pointer on client side must be excluded. // Safe replacement of context are provided only inside callback function Context *context.Context + Call call ID string Idempotent bool } diff --git a/trace/sql_gtrace.go b/trace/sql_gtrace.go index 26b707414..4d2b6f1d2 100644 --- a/trace/sql_gtrace.go +++ b/trace/sql_gtrace.go @@ -911,9 +911,10 @@ func (t *DatabaseSQL) onDoTx(d DatabaseSQLDoTxStartInfo) func(DatabaseSQLDoTxInt return res } } -func DatabaseSQLOnConnectorConnect(t *DatabaseSQL, c *context.Context) func(_ error, session tableSessionInfo) { +func DatabaseSQLOnConnectorConnect(t *DatabaseSQL, c *context.Context, call call) func(_ error, session tableSessionInfo) { var p DatabaseSQLConnectorConnectStartInfo p.Context = c + p.Call = call res := t.onConnectorConnect(p) return func(e error, session tableSessionInfo) { var p DatabaseSQLConnectorConnectDoneInfo @@ -922,9 +923,10 @@ func DatabaseSQLOnConnectorConnect(t *DatabaseSQL, c *context.Context) func(_ er res(p) } } -func DatabaseSQLOnConnPing(t *DatabaseSQL, c *context.Context) func(error) { +func DatabaseSQLOnConnPing(t *DatabaseSQL, c *context.Context, call call) func(error) { var p DatabaseSQLConnPingStartInfo p.Context = c + p.Call = call res := t.onConnPing(p) return func(e error) { var p DatabaseSQLConnPingDoneInfo @@ -932,9 +934,10 @@ func DatabaseSQLOnConnPing(t *DatabaseSQL, c *context.Context) func(error) { res(p) } } -func DatabaseSQLOnConnPrepare(t *DatabaseSQL, c *context.Context, query string) func(error) { +func DatabaseSQLOnConnPrepare(t *DatabaseSQL, c *context.Context, call call, query string) func(error) { var p DatabaseSQLConnPrepareStartInfo p.Context = c + p.Call = call p.Query = query res := t.onConnPrepare(p) return func(e error) { @@ -943,8 +946,10 @@ func DatabaseSQLOnConnPrepare(t *DatabaseSQL, c *context.Context, query string) res(p) } } -func DatabaseSQLOnConnClose(t *DatabaseSQL) func(error) { +func DatabaseSQLOnConnClose(t *DatabaseSQL, c *context.Context, call call) func(error) { var p DatabaseSQLConnCloseStartInfo + p.Context = c + p.Call = call res := t.onConnClose(p) return func(e error) { var p DatabaseSQLConnCloseDoneInfo @@ -952,9 +957,10 @@ func DatabaseSQLOnConnClose(t *DatabaseSQL) func(error) { res(p) } } -func DatabaseSQLOnConnBegin(t *DatabaseSQL, c *context.Context) func(tx tableTransactionInfo, _ error) { +func DatabaseSQLOnConnBegin(t *DatabaseSQL, c *context.Context, call call) func(tx tableTransactionInfo, _ error) { var p DatabaseSQLConnBeginStartInfo p.Context = c + p.Call = call res := t.onConnBegin(p) return func(tx tableTransactionInfo, e error) { var p DatabaseSQLConnBeginDoneInfo @@ -963,9 +969,10 @@ func DatabaseSQLOnConnBegin(t *DatabaseSQL, c *context.Context) func(tx tableTra res(p) } } -func DatabaseSQLOnConnQuery(t *DatabaseSQL, c *context.Context, query string, mode string, idempotent bool, idleTime time.Duration) func(error) { +func DatabaseSQLOnConnQuery(t *DatabaseSQL, c *context.Context, call call, query string, mode string, idempotent bool, idleTime time.Duration) func(error) { var p DatabaseSQLConnQueryStartInfo p.Context = c + p.Call = call p.Query = query p.Mode = mode p.Idempotent = idempotent @@ -977,9 +984,10 @@ func DatabaseSQLOnConnQuery(t *DatabaseSQL, c *context.Context, query string, mo res(p) } } -func DatabaseSQLOnConnExec(t *DatabaseSQL, c *context.Context, query string, mode string, idempotent bool, idleTime time.Duration) func(error) { +func DatabaseSQLOnConnExec(t *DatabaseSQL, c *context.Context, call call, query string, mode string, idempotent bool, idleTime time.Duration) func(error) { var p DatabaseSQLConnExecStartInfo p.Context = c + p.Call = call p.Query = query p.Mode = mode p.Idempotent = idempotent @@ -1004,12 +1012,14 @@ func DatabaseSQLOnConnIsTableExists(t *DatabaseSQL, c *context.Context, call cal res(p) } } -func DatabaseSQLOnTxQuery(t *DatabaseSQL, c *context.Context, txContext *context.Context, tx tableTransactionInfo, query string) func(error) { +func DatabaseSQLOnTxQuery(t *DatabaseSQL, c *context.Context, call call, txContext *context.Context, tx tableTransactionInfo, query string, idempotent bool) func(error) { var p DatabaseSQLTxQueryStartInfo p.Context = c + p.Call = call p.TxContext = txContext p.Tx = tx p.Query = query + p.Idempotent = idempotent res := t.onTxQuery(p) return func(e error) { var p DatabaseSQLTxQueryDoneInfo @@ -1017,12 +1027,14 @@ func DatabaseSQLOnTxQuery(t *DatabaseSQL, c *context.Context, txContext *context res(p) } } -func DatabaseSQLOnTxExec(t *DatabaseSQL, c *context.Context, txContext *context.Context, tx tableTransactionInfo, query string) func(error) { +func DatabaseSQLOnTxExec(t *DatabaseSQL, c *context.Context, call call, txContext *context.Context, tx tableTransactionInfo, query string, idempotent bool) func(error) { var p DatabaseSQLTxExecStartInfo p.Context = c + p.Call = call p.TxContext = txContext p.Tx = tx p.Query = query + p.Idempotent = idempotent res := t.onTxExec(p) return func(e error) { var p DatabaseSQLTxExecDoneInfo @@ -1030,9 +1042,10 @@ func DatabaseSQLOnTxExec(t *DatabaseSQL, c *context.Context, txContext *context. res(p) } } -func DatabaseSQLOnTxPrepare(t *DatabaseSQL, c *context.Context, txContext *context.Context, tx tableTransactionInfo, query string) func(error) { +func DatabaseSQLOnTxPrepare(t *DatabaseSQL, c *context.Context, call call, txContext *context.Context, tx tableTransactionInfo, query string) func(error) { var p DatabaseSQLTxPrepareStartInfo p.Context = c + p.Call = call p.TxContext = txContext p.Tx = tx p.Query = query @@ -1043,9 +1056,10 @@ func DatabaseSQLOnTxPrepare(t *DatabaseSQL, c *context.Context, txContext *conte res(p) } } -func DatabaseSQLOnTxCommit(t *DatabaseSQL, txContext *context.Context, tx tableTransactionInfo) func(error) { +func DatabaseSQLOnTxCommit(t *DatabaseSQL, txContext *context.Context, call call, tx tableTransactionInfo) func(error) { var p DatabaseSQLTxCommitStartInfo p.TxContext = txContext + p.Call = call p.Tx = tx res := t.onTxCommit(p) return func(e error) { @@ -1054,9 +1068,10 @@ func DatabaseSQLOnTxCommit(t *DatabaseSQL, txContext *context.Context, tx tableT res(p) } } -func DatabaseSQLOnTxRollback(t *DatabaseSQL, txContext *context.Context, tx tableTransactionInfo) func(error) { +func DatabaseSQLOnTxRollback(t *DatabaseSQL, txContext *context.Context, call call, tx tableTransactionInfo) func(error) { var p DatabaseSQLTxRollbackStartInfo p.TxContext = txContext + p.Call = call p.Tx = tx res := t.onTxRollback(p) return func(e error) { @@ -1065,9 +1080,10 @@ func DatabaseSQLOnTxRollback(t *DatabaseSQL, txContext *context.Context, tx tabl res(p) } } -func DatabaseSQLOnStmtQuery(t *DatabaseSQL, c *context.Context, stmtContext *context.Context, query string) func(error) { +func DatabaseSQLOnStmtQuery(t *DatabaseSQL, c *context.Context, call call, stmtContext *context.Context, query string) func(error) { var p DatabaseSQLStmtQueryStartInfo p.Context = c + p.Call = call p.StmtContext = stmtContext p.Query = query res := t.onStmtQuery(p) @@ -1077,9 +1093,10 @@ func DatabaseSQLOnStmtQuery(t *DatabaseSQL, c *context.Context, stmtContext *con res(p) } } -func DatabaseSQLOnStmtExec(t *DatabaseSQL, c *context.Context, stmtContext *context.Context, query string) func(error) { +func DatabaseSQLOnStmtExec(t *DatabaseSQL, c *context.Context, call call, stmtContext *context.Context, query string) func(error) { var p DatabaseSQLStmtExecStartInfo p.Context = c + p.Call = call p.StmtContext = stmtContext p.Query = query res := t.onStmtExec(p) @@ -1089,9 +1106,10 @@ func DatabaseSQLOnStmtExec(t *DatabaseSQL, c *context.Context, stmtContext *cont res(p) } } -func DatabaseSQLOnStmtClose(t *DatabaseSQL, stmtContext *context.Context) func(error) { +func DatabaseSQLOnStmtClose(t *DatabaseSQL, stmtContext *context.Context, call call) func(error) { var p DatabaseSQLStmtCloseStartInfo p.StmtContext = stmtContext + p.Call = call res := t.onStmtClose(p) return func(e error) { var p DatabaseSQLStmtCloseDoneInfo @@ -1099,9 +1117,10 @@ func DatabaseSQLOnStmtClose(t *DatabaseSQL, stmtContext *context.Context) func(e res(p) } } -func DatabaseSQLOnDoTx(t *DatabaseSQL, c *context.Context, iD string, idempotent bool) func(error) func(attempts int, _ error) { +func DatabaseSQLOnDoTx(t *DatabaseSQL, c *context.Context, call call, iD string, idempotent bool) func(error) func(attempts int, _ error) { var p DatabaseSQLDoTxStartInfo p.Context = c + p.Call = call p.ID = iD p.Idempotent = idempotent res := t.onDoTx(p)