Skip to Content.
Sympa Menu

freetds - Re: [freetds] 0.65 (or whatever) TODO

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "ZIGLIO, Frediano, VF-IT" <Frediano.Ziglio AT vodafone.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] 0.65 (or whatever) TODO
  • Date: Fri, 13 Apr 2007 10:26:54 +0200

>
> 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 not offended, only surprised.

> 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.
>

There was some bugs in bsqlodbc (committed), now I have (I compiled with
no dm)

$ cat hg.sql | ./bsqlodbc -S xxx -U test -P test
"[FreeTDS][SQL Server]hello"
"[FreeTDS][SQL Server]goodbye"
$ cat hsg.sql | ./bsqlodbc -S xxx -U test -P test
"[FreeTDS][SQL Server]hello"
one
----------
1
"[FreeTDS][SQL Server]goodbye"
two
----------
2

So... it seems fine. Personally I would use ODBC 3 in bsqlodbc with an
option for ODBC 2.

There are some problems:
- SQLFetch/SQLMoreResults return errors even on SQL_NO_DATA. You have to
read them (fixed in bsqlodbc)
- unixODBC till 2.2.11 (I don't know 2.2.12) DO NOT read errors on
SQL_NO_DATA
- ODBC 2 collapse recordset and errors

> 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
>

This is due to bug in bsqlodbc (fixed) and possibly unixODBC (see above)

> $ 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>

I think is a isql problem, from trace

[ODBC][32028][SQLPrepare.c][189]
Entry:
Statement = 0x8a8b978
SQL = [print 'hello' print 'goodbye'][length =
29 (SQL_NTS)]
[ODBC][32028][SQLPrepare.c][364]
Exit:[SQL_SUCCESS]
[ODBC][32028][SQLExecute.c][183]
Entry:
Statement = 0x8a8b978
[ODBC][32028][SQLExecute.c][344]
Exit:[SQL_SUCCESS_WITH_INFO]
DIAG [01000] [FreeTDS][SQL Server]hello

DIAG [01000] [FreeTDS][SQL Server]goodbye

[ODBC][32028][SQLError.c][342]
Entry:
Statement = 0x8a8b978
SQLState = 0xbf8c08fe
Native = 0xbf8c0700
Message Text = 0xbf8c0709
Buffer Length = 500
Text Len Ptr = 0xbf8c0706
[ODBC][32028][SQLError.c][379]
Exit:[SQL_SUCCESS]
SQLState = 01000
Native = 0xbf8c0700 -> 0
Message Text = [[unixODBC][FreeTDS][SQL
Server]goodbye]
[ODBC][32028][SQLError.c][342]
Entry:
Statement = 0x8a8b978
SQLState = 0xbf8c08fe
Native = 0xbf8c0700
Message Text = 0xbf8c0709
Buffer Length = 500
Text Len Ptr = 0xbf8c0706
[ODBC][32028][SQLError.c][379]
Exit:[SQL_SUCCESS]
SQLState = 01000
Native = 0xbf8c0700 -> 0
Message Text = [[unixODBC][FreeTDS][SQL
Server]hello]
[ODBC][32028][SQLError.c][342]
Entry:
Statement = 0x8a8b978
SQLState = 0xbf8c08fe
Native = 0xbf8c0700
Message Text = 0xbf8c0709
Buffer Length = 500
Text Len Ptr = 0xbf8c0706
[ODBC][32028][SQLError.c][379]
Exit:[SQL_NO_DATA]
[ODBC][32028][SQLError.c][424]
Entry:
Connection = 0x8a30130
SQLState = 0xbf8c08fe
Native = 0xbf8c0700
Message Text = 0xbf8c0709
Buffer Length = 500
Text Len Ptr = 0xbf8c0706
[ODBC][32028][SQLError.c][461]
Exit:[SQL_NO_DATA]
[ODBC][32028][SQLError.c][504]
Entry:
Environment = 0x8a2fb58
SQLState = 0xbf8c08fe
Native = 0xbf8c0700
Message Text = 0xbf8c0709
Buffer Length = 500
Text Len Ptr = 0xbf8c0706
[ODBC][32028][SQLError.c][541]
Exit:[SQL_NO_DATA]

freddy77





Archive powered by MHonArc 2.6.24.

Top of Page