Skip to Content.
Sympa Menu

freetds - Re: [freetds] Another OTL question / problem

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Frediano Ziglio <freddyz77 AT tin.it>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Another OTL question / problem
  • Date: Tue, 11 May 2004 21:52:35 +0200

Il lun, 2004-05-10 alle 19:54, Piet De Jong ha scritto:
> Hi All,
> Attached I have a very simple select statement which is supposed to
> return a single column.
> However when I run the program I do not get any data returned.
>
> I use the latest version of OTL ( 4.0.84 )
>
> I am not sure if I had asked this question before, I could not find it
> on the list.
>
> The platform with the problem:
> Slackware 9.1.0
> using iodbc 3.51.1
> gcc version: 3.2.3
>
> When I compile and run the attached example on Windows I dont have any
> problems, the correct values ( 1 and RPC = 1 ) are returned.
>
> Many thanks
> PIet
>

>From log (unixODBC)

[ODBC][21603][SQLPrepare.c][173]
Entry:
Statement = 0x91ce160
SQL = [select revision from revisiontable where
version = 1][length = 52 (SQL_NTS)]
[ODBC][21603][SQLPrepare.c][374]
Exit:[SQL_SUCCESS]
[ODBC][21603][SQLNumResultCols.c][142]
Entry:
Statement = 0x91ce160
Column Count = 0xbfeea3ac
[ODBC][21603][SQLNumResultCols.c][233]
Exit:[SQL_SUCCESS]
Count = 0xbfeea3ac -> 0
[ODBC][21603][SQLSetStmtAttr.c][217]
Entry:
Statement = 0x91ce160
Attribute = SQL_ATTR_ROW_ARRAY_SIZE
Value = 0x1
StrLen = -3
[ODBC][21603][SQLSetStmtAttr.c][666]
Exit:[SQL_SUCCESS]
[ODBC][21603][SQLSetStmtAttr.c][217]
Entry:
Statement = 0x91ce160
Attribute = SQL_ATTR_ROWS_FETCHED_PTR
Value = 0x91ce01c
StrLen = -3
[ODBC][21603][SQLSetStmtAttr.c][666]
Exit:[SQL_SUCCESS]
[ODBC][21603][SQLExecute.c][186]
Entry:
Statement = 0x91ce160
[ODBC][21603][SQLExecute.c][341]
Exit:[SQL_SUCCESS]
[ODBC][21603][SQLFetchScroll.c][145]
Entry:
Statement = 0x91ce160
Fetch Orentation = 1
Fetch Offset = 1
[ODBC][21603][SQLFetchScroll.c][346]
Exit:[SQL_SUCCESS]
[ODBC][21603][SQLFetchScroll.c][145]
Entry:
Statement = 0x91ce160
Fetch Orentation = 1
Fetch Offset = 1
[ODBC][21603][SQLFetchScroll.c][346]
Exit:[SQL_NO_DATA]
[ODBC][21603][SQLFreeStmt.c][133]
Entry:
Statement = 0x91ce160
Option = 0
[ODBC][21603][SQLFreeStmt.c][246]
Exit:[SQL_SUCCESS]
[ODBC][21603][SQLFreeStmt.c][133]
Entry:
Statement = 0x91ce160
Option = 1
[ODBC][21603][SQLFreeHandle.c][353]
Entry:
Handle Type = 3
Input Handle = 0x91ce160
[ODBC][21603][SQLFreeHandle.c][454]
Exit:[SQL_SUCCESS]
[ODBC][21603][SQLEndTran.c][315]
Entry:
Connection = 0x91a7dd0
Completion Type = 0

The key it's always (like Oracle connector) SQLNumResultCols after
SQLPrepare... trying with --enable-developing you will get what you
expect:

$ rm /tmp/sql.log && g++ test_select.cpp -lodbc && ./a.out
test_select.cpp:78 - Rev [1]
test_select.cpp:79 - RPC: 1

Current implementation it's no so instable however performance are not
that fine...

More deeply from code comments:

/* try to prepare query */
/* TODO try to prepare only getting informations (faster and
optimizable) for mssql2k */

This can wait however mssql2k can prepare and execute using a single
round-trip (a single store procedure call). Not stopping (for 0.63)

/* TODO support getting info for RPC */

I don't even know if this is possible...

/*
* TODO this should be done if all parameters are bounded or using TDS5
* binary_test for example do not work for this problem (post bind on
image)
*/

binary_test now works using Sybase, not a stop-over, however this
optimization IMO should be implemented in 0.63!

/* TODO use current parameter informations */
stmt->need_reprepare = 1;

quite bad... for every prepare it prepare statement 2 times... just
cause it need to pass types...


This just to explain that this way of getting result it's not that
good!!! IMHO library should change their code to a more optimized way!!!

freddy77






Archive powered by MHonArc 2.6.24.

Top of Page