Skip to Content.
Sympa Menu

freetds - RE: [freetds] Row processed count returns 0

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] Row processed count returns 0
  • Date: Thu, 25 Mar 2004 14:58:13 +0100

> Hi All,
>
> Attached I have the odbclog file and tdsdump file.
> Something strange is happening now, I am using freetds 0.62.2 with
> OTLV4.
> Attached is also the code.
>
> What happens is the select statement does not return the correct id,
> instead it seems like it returns some weird long number. (
> line 42 - 46
> in sample ).
>
> The correct result is returned fine when I use the openlink
> ODBC driver.
> When I rewrite the C app to Perl it works fine ( using DBI::ODBC ) &
> FreeTDS.
>
> I would like to offer assistance if any coding/testing is required,
> however I am not familiar with the ODBC-internals..
> ( That's why I stick to OTL :-)
>
> One more thing: make check failed, I am not sure why but for your
> interest I have attached the stderr & stdout logs in makecheckres.tgz
>
> Many thanks
> Piet
>

I recompiled your test under my Linux machine and test with a mssql2k
server. To fetch columns types it calls SQLPrepare and then get columns
informations. However this is not still supported under FreeTDS...

Just from your dump

unix 00004000 EXIT SQLAllocHandle with return code 0
(SQL_SUCCESS)
SQLSMALLINT 3 (SQL_HANDLE_STMT)
SQLHANDLE 0x8059180
SQLHANDLE * 0x805a194 (0x8059d08)

unix 00004000 ENTER SQLPrepare
SQLHSTMT 0x8059d08
SQLCHAR * 0x8091708
| select id from testtable where
enddate i |
| s null
|
SQLINTEGER -3 (SQL_NTS)

unix 00004000 EXIT SQLPrepare with return code 0
(SQL_SUCCESS)
SQLHSTMT 0x8059d08
SQLCHAR * 0x8091708
SQLINTEGER -3 (SQL_NTS)

unix 00004000 ENTER SQLNumResultCols
SQLHSTMT 0x8059d08
SQLSMALLINT * 0xbfffcfdc

unix 00004000 EXIT SQLNumResultCols with return code 0
(SQL_SUCCESS)
SQLHSTMT 0x8059d08
SQLSMALLINT * 0xbfffcfdc (0)

unix 00004000 ENTER SQLSetStmtAttr
SQLHSTMT 0x8059d08
SQLINTEGER 27 (SQL_ATTR_ROW_ARRAY_SIZE)
SQLPOINTER 0x32
SQLINTEGER * -3 (SQL_NTS)

unix 00004000 EXIT SQLSetStmtAttr with return code 1
(SQL_SUCCESS_WITH_INFO)
SQLHSTMT 0x8059d08
SQLINTEGER 27 (SQL_ATTR_ROW_ARRAY_SIZE)
SQLPOINTER 0x32
SQLINTEGER * -3 (SQL_NTS)

unix 00004000 ENTER SQLSetStmtAttr
SQLHSTMT 0x8059d08
SQLINTEGER 26 (SQL_ATTR_ROWS_FETCHED_PTR)
SQLPOINTER 0x805a1f4
SQLINTEGER * -3 (SQL_NTS)

unix 00004000 EXIT SQLSetStmtAttr with return code 0
(SQL_SUCCESS)
SQLHSTMT 0x8059d08
SQLINTEGER 26 (SQL_ATTR_ROWS_FETCHED_PTR)
SQLPOINTER 0x805a1f4
SQLINTEGER * -3 (SQL_NTS)

unix 00004000 ENTER SQLExecute
SQLHSTMT 0x8059d08

unix 00004000 EXIT SQLExecute with return code 0
(SQL_SUCCESS)
SQLHSTMT 0x8059d08

unix 00004000 ENTER SQLFetchScroll
SQLHSTMT 0x8059d08
SQLUSMALLINT 1 (SQL_FETCH_NEXT)
SQLINTEGER 1

unix 00004000 EXIT SQLFetchScroll with return code 0
(SQL_SUCCESS)
SQLHSTMT 0x8059d08
SQLUSMALLINT 1 (SQL_FETCH_NEXT)
SQLINTEGER 1

(iODBC I imagine)
You see
- SQLAllocHandle to allocate statement
- SQLPrepare to prepare your select
- SQLNumResultCols to get columns... however it return 0 column!!!
- SQLExecute issue the prepared select
- SQLFetchScroll to fetch data (with no binding :( )

So it's not a 0.62.2 problem but a FreeTDS missing implementation :(

> Ps:
> Freddy,
> I could not find these lines in 0.62.2 release which you instructed me
> to remove in your previous email:
>
> #if !UNIXODBC
> if (stmt->dbc->current_statement != stmt) {
> odbc_errs_add(&stmt->errs, "24000", NULL, NULL);
> ODBC_RETURN(stmt, SQL_ERROR);
> }
>
> IRD_CHECK;
> #endif
>
> from odbc.c (SQLNumResultCols
>

Already removed in 0.62.2.

freddy77




Archive powered by MHonArc 2.6.24.

Top of Page