[freetds] MS query notifications patch

Richard Hughes cyreve at gmail.com
Wed Apr 16 14:12:44 EDT 2014


Hi all,

I needed support for SQL Server 2005's Query Notifications feature, so
here's a patch against tip.

I've only given the patch a light sprinkling of testing so far, but
could I ask somebody to review it and confirm that I'm on the right
track so that I can create a v2 patch that is (hopefully) mergeable?
Both the Microsoft API and the TDS implementation feel extremely
kludgy to me and hence some of that kludginess needed to be reflected
in the patch; sorry about that, but don't shoot the messenger.

About Query Notifications:

Query Notifications are designed to support client-side caching of
datasets by providing a mechanism to allow the application to be
notified whenever its cache may have become out of date (i.e. because
somebody updated the underlying table(s)). Fundamentally the feature
works by delivering a query to the server and, rather than executing
it, the server does internal magic to register that query and a
user-specified cookie. When the result set that the query would have
returned (had it actually been executed) changes, the cookie is
delivered back to the caller through a WAITFOR/RECEIVE statement.

User-level doc: http://technet.microsoft.com/en-us/library/ms130764.aspx
Protocol doc: http://msdn.microsoft.com/en-us/library/dd304949.aspx

Only the registering of the query and cookie with the server needs
FreeTDS changes. The WAITFOR statement is just executed as a normal
statement with a normal result set.

Richard.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: freetds-mssql-query-notifications-v1.diff
Type: application/octet-stream
Size: 16047 bytes
Desc: not available
URL: <http://lists.ibiblio.org/pipermail/freetds/attachments/20140416/71510d25/attachment-0001.obj>


More information about the FreeTDS mailing list