开发者

Does the Microsoft SQL Server native client support IDBAsynchNotify?

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:开发者_如何学Python: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?


See Performing Asynchronous Operations for SQL Native Client OLE Db specifics, including examples. The link says the only acceptable RIIDs are IID_IDBAsynchStatus and IID_ISSAsynchStatus, so my understanding that is that the programming model is pool based, not notification based.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜