@@ -45,8 +45,8 @@ type StatementResult struct {
4545 Query string
4646}
4747
48- func newStatementResult (columnNames []string , rowCh chan rowResult ) * StatementResult {
49- return & StatementResult {ColumnNames : columnNames , RowCh : rowCh }
48+ func newStatementResult (columnNames []string , rowCh chan rowResult , query string ) * StatementResult {
49+ return & StatementResult {ColumnNames : columnNames , RowCh : rowCh , Query : query }
5050}
5151
5252func newStatementResultWithError (err error ) * StatementResult {
@@ -173,7 +173,7 @@ func (db *Db) executeQuery(query string, statementResultCh chan StatementResult)
173173
174174 defer rows .Close ()
175175
176- return readQueryResults (rows , statementResultCh )
176+ return readQueryResults (rows , statementResultCh , query )
177177}
178178
179179func (db * Db ) prepareStatementsIntoQueries (statementsString string ) []string {
@@ -221,10 +221,10 @@ func getColumnTypes(rows *sql.Rows) ([]reflect.Type, error) {
221221 return types , nil
222222}
223223
224- func readQueryResults (queryRows * sql.Rows , statementResultCh chan StatementResult ) (shouldContinue bool ) {
224+ func readQueryResults (queryRows * sql.Rows , statementResultCh chan StatementResult , query string ) (shouldContinue bool ) {
225225 hasResultSetToRead := true
226226 for hasResultSetToRead {
227- if shouldContinue := readQueryResultSet (queryRows , statementResultCh ); ! shouldContinue {
227+ if shouldContinue := readQueryResultSet (queryRows , statementResultCh , query ); ! shouldContinue {
228228 return false
229229 }
230230
@@ -239,7 +239,7 @@ func readQueryResults(queryRows *sql.Rows, statementResultCh chan StatementResul
239239 return true
240240}
241241
242- func readQueryResultSet (queryRows * sql.Rows , statementResultCh chan StatementResult ) (shouldContinue bool ) {
242+ func readQueryResultSet (queryRows * sql.Rows , statementResultCh chan StatementResult , query string ) (shouldContinue bool ) {
243243 columnNames , err := getColumnNames (queryRows )
244244 if err != nil {
245245 statementResultCh <- * newStatementResultWithError (err )
@@ -265,7 +265,7 @@ func readQueryResultSet(queryRows *sql.Rows, statementResultCh chan StatementRes
265265 rowCh := make (chan rowResult )
266266 defer close (rowCh )
267267
268- statementResultCh <- * newStatementResult (columnNames , rowCh )
268+ statementResultCh <- * newStatementResult (columnNames , rowCh , query )
269269
270270 for queryRows .Next () {
271271 err = queryRows .Scan (columnPointers ... )
0 commit comments