[freetds] MS query notifications patch

Richard Hughes cyreve at gmail.com
Wed May 14 14:24:10 EDT 2014

On 2014-05-10 at 09:55, Frediano Ziglio wrote:
> 2014-04-23 18:50 GMT+01:00 Richard Hughes <cyreve at gmail.com>:
>> On 2014-04-18 at 09:39, Frediano Ziglio wrote:
>>> 2014-04-16 19:12 GMT+01:00 Richard Hughes <cyreve at gmail.com>:
>>>> I needed support for SQL Server 2005's Query Notifications feature, so
>>>> here's a patch against tip.

> Sorry for late reply. I was on holiday and actually I'm without my own computer.

This entire thread seems to be plagued with late replies - work got
busy for me :-)

> I like the idea of splitting in query.c the code that handle tds7 from
> other protocol however I would not expose all these definitions
> outside it and instead all function calls should add the head
> parameter.

I had ruled out that option because I didn't think I was allowed to
change the TDS API. If that breakage is allowed then absolutely adding
a new parameter is cleaner.

This version of the patch does, however, undo the splitting-out of
tds7. I find it difficult to manage and review patches (even my own)
which combine cosmetic changes with functional changes. Once we're
happy with the functional stuff then either you or I can do the split
as a separate task.

> It make sense but perhaps here would
> be more sensible to add a tds_start_query_head (or similar) function.


>>>> @@ -228,6 +229,11 @@ prepare_call(struct _hstmt * stmt)
>>>>      else
>>>>          return SQL_ERROR;
>>>> +    if (tds_dstr_isempty(&stmt->attr.qn_msgtext) != tds_dstr_isempty(&stmt->attr.qn_options))
>>>> +        return SQL_SUCCESS_WITH_INFO;
>>>> +    if (!tds_dstr_isempty(&stmt->attr.qn_msgtext) && !IS_TDS72_PLUS(stmt->dbc->tds_socket->conn))
>>>> +        return SQL_SUCCESS_WITH_INFO;
>>>> +
>>> I'm not sure this is the right place. Also I think MS add some error
>>> to the statement. I didn't find from documentation which error should
>>> be reported.
>> Yes - the _WITH_INFO part should have been a clue that I needed to
>> return some info. MS Native Client returns HY000 for the first case
>> and still executes the query, but I don't have a pre-2005 server to
>> find out what should happen in the second case so I just left it as a
>> generic error.
> I'll try with a former server.

If it's inconvenient for you, I can get all the installation media for
2000 - I just need to find the time to spin up a virtual machine and
get it running and tested.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: freetds-mssql-query-notifications-v3.diff
Type: application/octet-stream
Size: 24547 bytes
Desc: not available
URL: <http://lists.ibiblio.org/pipermail/freetds/attachments/20140514/1ac8a1d6/attachment-0001.obj>

More information about the FreeTDS mailing list