[freetds] 0.65 (or whatever) TODO

James K. Lowden jklowden at freetds.org
Thu Apr 12 20:49:45 EDT 2007


ZIGLIO, Frediano, VF-IT wrote:
> Message handling has been a 
> > problem in ODBC
> > from the beginning.  
> 
> 8-| I never though this was a "problem"... currently is not "broken" but
> perhaps "ugly".
> ODBC read as much as it can like proprietary implementations. The
> problem is that code is in ODBC and not in libTDS so dblib is not that
> perfect as ODBC

Sorry, Freddy.  I did not mean to offend.  

I'm talking about server message handling.  Sometimes we lose them and
sometimes they print out in the wrong order.  I include two examples
below. 

I consider this to be part of result set handling.  In a production
environment, server messages can be very important to understanding a log
file.  That's why I've spent so much time trying to fix it, even to the
point of writing my own application (bsqlodbc).  

Do these queries work correctly for you?  

Regards, 

--jkl


Example 1: losing messages
--------------------------

$ cat hsg.sql 
print 'hello' select 1 as one print 'goodbye'
select 2 as two

$ cat hsg.sql | isql -vb $S $U $P # loses 'goodbye' message
...
SQL> [01000][unixODBC][FreeTDS][SQL Server]hello
[ISQL]INFO: SQLExecute returned SQL_SUCCESS_WITH_INFO
+------------+
| one        |
+------------+
| 1          |
+------------+
SQLRowCount returns 1
1 rows fetched
SQL> +------------+
| two        |
+------------+
| 2          |
+------------+
SQLRowCount returns 1
1 rows fetched

$ cat hsg.sql | ./bsqlodbc -S $S -U $P -P $P # loses 'goodbye' message
"[FreeTDS][SQL Server]hello"
       one
----------
         1
       two
----------
         2

$ cat hsg.sql | ./bsqldb -S $S -U $P -P $P # works 
hello
@@rowcount not available
        one
-----------
          1
1 rows affected
goodbye
        two
-----------
          2
1 rows affected


Example 2: Reverses messages! 
-----------------------------

$ cat hg.sql 
print 'hello' print 'goodbye'

$ cat hg.sql | ./bsqldb -S $S -U $P -P $P  # OK
hello
@@rowcount not available
goodbye

$ cat hg.sql | ./bsqlodbc -S $S -U $P -P $P # OK 
"[FreeTDS][SQL Server]hello"
"[FreeTDS][SQL Server]goodbye"

$ cat hg.sql | isql -vb $S $U $PP $P # print 2nd message first.  Why not? 

...
SQL> [01000][unixODBC][FreeTDS][SQL Server]goodbye
[01000][unixODBC][FreeTDS][SQL Server]hello
[ISQL]INFO: SQLExecute returned SQL_SUCCESS_WITH_INFO
SQLRowCount returns -1
SQL> 


More information about the FreeTDS mailing list