denisenkom / go-mssqldb

Microsoft SQL server driver written in go language
BSD 3-Clause "New" or "Revised" License
1.82k stars 495 forks source link

Proposal: accepting a message handler #678

Closed tc-hib closed 3 years ago

tc-hib commented 3 years ago

Hello,

Sometimes it would be useful to receive messages from the server.

If we want to show this information in some UI, we need a way to handle it, we can't have it in logs only.

I propose that we add a new specific type of query argument, like ReturnStatus. That type would be a callback function that would take a mssql.Error.

Here is an example of how it could be implemented: https://github.com/denisenkom/go-mssqldb/compare/master...tc-hib:pr-message-handler?expand=1

tc-hib commented 3 years ago

I forgot there was #221 already.

@kardianos is there any reason why you didn't add support for sqlexp.ReturnMessage in go-mssqldb?