[freetds] [unixODBC][Driver Manager]Function sequence error (SQL-HY010)

Bower, Wayne (Wayne) Wayne.Bower at lsi.com
Fri Mar 2 16:43:39 EST 2012

Found what looks like a bug and I did my best to reduce the code that reproduces to a small test case.
The code I reduced it to has no practical use other than to reveal what appears to be the bug and how I am able to work around it.

uname -a
Linux palltc04 2.6.9-89.0.20.EL.bz501565.11largesmp #1 SMP Tue Mar 23 04:20:50 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux

perl v5.14.1
DBI 1.616
DBD::ODBC 1.33
freeTDS 0.91 and unixODBC

The 1st attachment (debugio14.pl) is the script that demonstrates the problem and how I'm attempting to work around it.

The 2nd attachment (debugio14.log) is from DBI_TRACE=15=debugio14_dbi.log ./debugio14 >debugio14.log 2>&1

I also have debugio14_dbi.log (the DBI_TRACE output) if that helps, but it will exceed the mail message size limit.

Essentially the issue appears to be related to using 'SET NOCOUNT ON' in a stored procedure. The script creates a procedure and executes it.  The cases that fail issue the message '[unixODBC][Driver Manager]Function sequence error (SQL-HY010)'.  To avoid the failure I have to either remove 'SET NOCOUNT ON' or move later in the procedure.  Keep in mind that this is just a test case to reveal the issue.  In our actual code we always start each procedure with 'SET NOCOUNT ON' and do much more than shown in this test case.

We don't see this problem using our old install of perl 5.8.7, DBI 1.616, DBD::ODBC 1.16, freeTDS 0.64 with iodbc.

The DBD::ODBC developer already reviewed this and believes the issue to be with freeTDS 0.91 since he doesn't see the problem using both of the following:
Easysoft SQL Server ODBC Driver and unixODBC driver manager
MS ODBC Driver manager and MS SQL Server ODBC Driver

-------------- next part --------------
A non-text attachment was scrubbed...
Name: debugio14.log
Type: application/octet-stream
Size: 3884 bytes
Desc: debugio14.log
Url : http://lists.ibiblio.org/pipermail/freetds/attachments/20120302/c97564fa/attachment.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: debugio14.pl
Type: application/octet-stream
Size: 7136 bytes
Desc: debugio14.pl
Url : http://lists.ibiblio.org/pipermail/freetds/attachments/20120302/c97564fa/attachment-0001.obj 

More information about the FreeTDS mailing list