freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: Richard Hughes <cyreve AT gmail.com>
- To: Frediano Ziglio <freddy77 AT gmail.com>
- Cc: FreeTDS Development Group <freetds AT lists.ibiblio.org>
- Subject: Re: [freetds] MS query notifications patch
- Date: Wed, 23 Apr 2014 18:50:57 +0100
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.
>
> The big concern is that I think that this feature works also for every
> queries not for just sql ones. I'll add some comments on your code. I
> think we should test what happens for prepared statements or RPCs.
You're right. I was too stuck in my particular use-case to consider
that RPC might be possible. I actually can't think of realistic design
for an client application that would set up parameterized query
notifications, however the server does support it so I've gone ahead
and implemented it. Unfortunately this makes the patch a whole lot
bigger, and a large part of my delay in getting back to you was spent
changing my mind several times about the neatest way to squeeze it in.
You may wish to read the diff with ignore-whitespace, because I ended
up pulling a load of if statements out into their own functions.
>> @@ -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.
All your other comments have been swept up in to the big restructuring
I needed to do to get RPC working.
Richard.
Attachment:
freetds-mssql-query-notifications-v2.diff
Description: Binary data
-
[freetds] MS query notifications patch,
Richard Hughes, 04/16/2014
-
Re: [freetds] MS query notifications patch,
Frediano Ziglio, 04/18/2014
- Re: [freetds] MS query notifications patch, Richard Hughes, 04/23/2014
-
Re: [freetds] MS query notifications patch,
Frediano Ziglio, 04/18/2014
Archive powered by MHonArc 2.6.24.