From 61801ff20dd8b6608b6315ab19a38c5ef3b33ae7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Schw=C3=B6rer?= Date: Sat, 5 Oct 2024 01:12:00 +0200 Subject: [PATCH] v0.0.522 --- goextVersion.go | 4 ++-- sq/database.go | 4 ++-- sq/listener.go | 30 +++++++++++++++--------------- sq/transaction.go | 4 ++-- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/goextVersion.go b/goextVersion.go index 7b03e4d..2194e31 100644 --- a/goextVersion.go +++ b/goextVersion.go @@ -1,5 +1,5 @@ package goext -const GoextVersion = "0.0.521" +const GoextVersion = "0.0.522" -const GoextVersionTimestamp = "2024-10-05T01:06:36+0200" +const GoextVersionTimestamp = "2024-10-05T01:12:00+0200" diff --git a/sq/database.go b/sq/database.go index 677b89e..2059a2c 100644 --- a/sq/database.go +++ b/sq/database.go @@ -75,7 +75,7 @@ func (db *database) Exec(ctx context.Context, sqlstr string, prep PP) (sql.Resul postMeta := PostExecMeta{Context: ctx, TransactionConstructorContext: nil, Init: t0, Start: t1, End: time.Now()} for _, v := range db.lstr { - v.PostExec(nil, origsql, sqlstr, prep, postMeta) + v.PostExec(nil, origsql, sqlstr, prep, err, postMeta) } if err != nil { @@ -104,7 +104,7 @@ func (db *database) Query(ctx context.Context, sqlstr string, prep PP) (*sqlx.Ro postMeta := PostQueryMeta{Context: ctx, TransactionConstructorContext: nil, Init: t0, Start: t1, End: time.Now()} for _, v := range db.lstr { - v.PostQuery(nil, origsql, sqlstr, prep, postMeta) + v.PostQuery(nil, origsql, sqlstr, prep, err, postMeta) } if err != nil { diff --git a/sq/listener.go b/sq/listener.go index f1d7f54..3497939 100644 --- a/sq/listener.go +++ b/sq/listener.go @@ -92,8 +92,8 @@ type Listener interface { PostTxBegin(txid uint16, result error, meta PostTxBeginMeta) PostTxCommit(txid uint16, result error, meta PostTxCommitMeta) PostTxRollback(txid uint16, result error, meta PostTxRollbackMeta) - PostQuery(txID *uint16, sqlOriginal string, sqlReal string, params PP, meta PostQueryMeta) - PostExec(txID *uint16, sqlOriginal string, sqlReal string, params PP, meta PostExecMeta) + PostQuery(txID *uint16, sqlOriginal string, sqlReal string, params PP, result error, meta PostQueryMeta) + PostExec(txID *uint16, sqlOriginal string, sqlReal string, params PP, result error, meta PostExecMeta) } type genListener struct { @@ -107,8 +107,8 @@ type genListener struct { postTxBegin func(txid uint16, result error, meta PostTxBeginMeta) postTxCommit func(txid uint16, result error, meta PostTxCommitMeta) postTxRollback func(txid uint16, result error, meta PostTxRollbackMeta) - postQuery func(txID *uint16, sqlOriginal string, sqlReal string, params PP, meta PostQueryMeta) - postExec func(txID *uint16, sqlOriginal string, sqlReal string, params PP, meta PostExecMeta) + postQuery func(txID *uint16, sqlOriginal string, sqlReal string, params PP, result error, meta PostQueryMeta) + postExec func(txID *uint16, sqlOriginal string, sqlReal string, params PP, result error, meta PostExecMeta) } func (g genListener) PrePing(ctx context.Context, meta PrePingMeta) error { @@ -183,15 +183,15 @@ func (g genListener) PostTxRollback(txid uint16, result error, meta PostTxRollba } } -func (g genListener) PostQuery(txID *uint16, sqlOriginal string, sqlReal string, params PP, meta PostQueryMeta) { +func (g genListener) PostQuery(txID *uint16, sqlOriginal string, sqlReal string, params PP, result error, meta PostQueryMeta) { if g.postQuery != nil { - g.postQuery(txID, sqlOriginal, sqlReal, params, meta) + g.postQuery(txID, sqlOriginal, sqlReal, params, result, meta) } } -func (g genListener) PostExec(txID *uint16, sqlOriginal string, sqlReal string, params PP, meta PostExecMeta) { +func (g genListener) PostExec(txID *uint16, sqlOriginal string, sqlReal string, params PP, result error, meta PostExecMeta) { if g.postExec != nil { - g.postExec(txID, sqlOriginal, sqlReal, params, meta) + g.postExec(txID, sqlOriginal, sqlReal, params, result, meta) } } @@ -246,21 +246,21 @@ func NewPostTxRollbackListener(f func(txid uint16, result error, meta PostTxRoll return genListener{postTxRollback: f} } -func NewPostQueryListener(f func(txID *uint16, sqlOriginal string, sqlReal string, params PP, meta PostQueryMeta)) Listener { +func NewPostQueryListener(f func(txID *uint16, sqlOriginal string, sqlReal string, params PP, result error, meta PostQueryMeta)) Listener { return genListener{postQuery: f} } -func NewPostExecListener(f func(txID *uint16, sqlOriginal string, sqlReal string, params PP, meta PostExecMeta)) Listener { +func NewPostExecListener(f func(txID *uint16, sqlOriginal string, sqlReal string, params PP, result error, meta PostExecMeta)) Listener { return genListener{postExec: f} } -func NewPostListener(f func(cmdtype string, txID *uint16, sqlOriginal string, sqlReal string, params PP)) Listener { +func NewPostListener(f func(cmdtype string, txID *uint16, sqlOriginal string, sqlReal string, result error, params PP)) Listener { return genListener{ - postExec: func(txID *uint16, sqlOriginal string, sqlReal string, params PP, meta PostExecMeta) { - f("EXEC", txID, sqlOriginal, sqlReal, params) + postExec: func(txID *uint16, sqlOriginal string, sqlReal string, params PP, result error, meta PostExecMeta) { + f("EXEC", txID, sqlOriginal, sqlReal, result, params) }, - postQuery: func(txID *uint16, sqlOriginal string, sqlReal string, params PP, meta PostQueryMeta) { - f("QUERY", txID, sqlOriginal, sqlReal, params) + postQuery: func(txID *uint16, sqlOriginal string, sqlReal string, params PP, result error, meta PostQueryMeta) { + f("QUERY", txID, sqlOriginal, sqlReal, result, params) }, } } diff --git a/sq/transaction.go b/sq/transaction.go index 5c1954a..44bee4d 100644 --- a/sq/transaction.go +++ b/sq/transaction.go @@ -128,7 +128,7 @@ func (tx *transaction) Exec(ctx context.Context, sqlstr string, prep PP) (sql.Re postMeta := PostExecMeta{Context: ctx, TransactionConstructorContext: tx.constructorContext, Init: t0, Start: t1, End: time.Now()} for _, v := range tx.db.lstr { - v.PostExec(langext.Ptr(tx.id), origsql, sqlstr, prep, postMeta) + v.PostExec(langext.Ptr(tx.id), origsql, sqlstr, prep, err, postMeta) } if err != nil { @@ -161,7 +161,7 @@ func (tx *transaction) Query(ctx context.Context, sqlstr string, prep PP) (*sqlx postMeta := PostQueryMeta{Context: ctx, TransactionConstructorContext: tx.constructorContext, Init: t0, Start: t1, End: time.Now()} for _, v := range tx.db.lstr { - v.PostQuery(langext.Ptr(tx.id), origsql, sqlstr, prep, postMeta) + v.PostQuery(langext.Ptr(tx.id), origsql, sqlstr, prep, err, postMeta) } if err != nil {