I'm working on some OLE DB code that runs queries on MS SQL Server via ICommand::Execute. I'm converting this code to operate asynchronously by setting the DBPROPVAL_ASYNCH_INITIALIZE property on the command before executing.
I'd prefer to register a IDBAsynchNotify sink so that my code can be notified of events, as opposed to polling or blocking via ISSAsynchStatus.
The documentation for ICommand::Execute does not show IConnectionPointContainer as an acceptable riid parameter, but the same document, when discussing the DB_S_ASYNCHRONOUS return code, suggests that it is possible to request an IConnectionPointContainer interface that I could use to register my event sink.
When I call ICommand::Execute, passing IID_IConnectionPointContainer as the riid parameter, I receive the E_NOINTERFACE error. I also tried setting the DBPROP_IConnectionPointContainer property before Execute but I received the same results.
If I have to, I'll use ISSAsynchStatus, but I'd much rather use IDBAsynchNotify. Is it possible?
According to the response on this SQL Server Native Client blog post, "asynchronous notification programming model" was the fifth most important feature that was requested for the native client. I guess that answers the question. Hopefully the sqlncli team will address this sooner rather than later. I am easily annoyed by polling.