diff --git a/sq/database.go b/sq/database.go index 4eb40ae..c40ac80 100644 --- a/sq/database.go +++ b/sq/database.go @@ -36,7 +36,7 @@ func (db *database) SetListener(listener Listener) { func (db *database) Exec(ctx context.Context, sql string, prep PP) (sql.Result, error) { if db.lstr != nil { - db.lstr.OnExec(nil, sql, &prep) + db.lstr.OnExec(nil, &sql, &prep) } res, err := db.db.NamedExecContext(ctx, sql, prep) @@ -48,7 +48,7 @@ func (db *database) Exec(ctx context.Context, sql string, prep PP) (sql.Result, func (db *database) Query(ctx context.Context, sql string, prep PP) (*sqlx.Rows, error) { if db.lstr != nil { - db.lstr.OnQuery(nil, sql, &prep) + db.lstr.OnQuery(nil, &sql, &prep) } rows, err := db.db.NamedQueryContext(ctx, sql, prep) diff --git a/sq/listener.go b/sq/listener.go index 9d27bc3..d41f1c7 100644 --- a/sq/listener.go +++ b/sq/listener.go @@ -1,8 +1,8 @@ package sq type Listener interface { - OnQuery(txID *uint16, sql string, params *PP) - OnExec(txID *uint16, sql string, params *PP) + OnQuery(txID *uint16, sql *string, params *PP) + OnExec(txID *uint16, sql *string, params *PP) OnPing() OnTxBegin(txid uint16) OnTxCommit(txid uint16) diff --git a/sq/transaction.go b/sq/transaction.go index be2e539..50d111e 100644 --- a/sq/transaction.go +++ b/sq/transaction.go @@ -46,7 +46,7 @@ func (tx *transaction) Commit() error { func (tx *transaction) Exec(ctx context.Context, sql string, prep PP) (sql.Result, error) { if tx.lstr != nil { - tx.lstr.OnExec(langext.Ptr(tx.id), sql, &prep) + tx.lstr.OnExec(langext.Ptr(tx.id), &sql, &prep) } res, err := tx.tx.NamedExecContext(ctx, sql, prep) @@ -58,7 +58,7 @@ func (tx *transaction) Exec(ctx context.Context, sql string, prep PP) (sql.Resul func (tx *transaction) Query(ctx context.Context, sql string, prep PP) (*sqlx.Rows, error) { if tx.lstr != nil { - tx.lstr.OnQuery(langext.Ptr(tx.id), sql, &prep) + tx.lstr.OnQuery(langext.Ptr(tx.id), &sql, &prep) } rows, err := sqlx.NamedQueryContext(ctx, tx.tx, sql, prep)