[unixODBC-support] Problem in using cursor to fetch millionsofrows

Jerry Lam jlam at sandvine.com
Thu Apr 7 03:55:10 BST 2005


Hi,

After I turned on the trace mode as Eric told me, I found out that the execution hung at SQLexecute for about 20 secs, then it starts to fetch the rows. By that time, it consumes already 132meg.... Any idea??

Thank you,

Jerry

[ODBC][61976][__handles.c][421]
        Exit:[SQL_SUCCESS]
            Environment = 0x80ca800
[ODBC][61976][SQLAllocHandle.c][345]
        Entry:
            Handle Type = 2
            Input Handle = 0x80ca800
[ODBC][61976][SQLAllocHandle.c][463]
        Exit:[SQL_SUCCESS]
            Output Handle = 0x80cf000
[ODBC][61976][SQLDriverConnect.c][662]
        Entry:
            Connection = 0x80cf000
            Window Hdl = 0x0
            Str Out = 0xbfbff240
            Str Out Max = 255
            Str Out Ptr = 0xbfbff23e
            Completion = 0
[ODBC][61976][SQLDriverConnect.c][1402]
        Exit:[SQL_SUCCESS]
            Connection Out [DRIVER=PostgreSQL;DATABASE=bar;SERVER=loalhost;PORT=5432;U...]
[ODBC][61976][SQLGetInfo.c][211]
        Entry:
            Connection = 0x80cf000
            Info Type = SQL_GETDATA_EXTENSIONS (81)
            Info Value = 0x8097fd8
            Buffer Length = 4
            StrLen = 0xbfbff23c
[ODBC][61976][SQLGetInfo.c][522]
        Exit:[SQL_SUCCESS]
[ODBC][61976][SQLAllocHandle.c][510]
        Entry:
            Handle Type = 3
            Input Handle = 0x80cf000
[ODBC][61976][SQLAllocHandle.c][872]
        Exit:[SQL_SUCCESS]
            Output Handle = 0x80d9000
[ODBC][61976][SQLPrepare.c][180]
        Entry:
            Statement = 0x80d9000
            SQL = [select id from foo][length = 32]
[ODBC][61976][SQLPrepare.c][355]
        Exit:[SQL_SUCCESS]
[ODBC][61976][SQLNumParams.c][140]
        Entry:
            Statement = 0x80d9000
            Param Count = 0x80d23a8
[ODBC][61976][SQLNumParams.c][224]
        Exit:[SQL_SUCCESS]
            Count = 0x80d23a8 -> 0
[ODBC][61976][SQLFreeStmt.c][140]
        Entry:
            Statement = 0x80d9000
            Option = 0
[ODBC][61976][SQLFreeStmt.c][246]
        Exit:[SQL_SUCCESS]
[ODBC][61976][SQLExecute.c][193]

-----Original Message-----
From: unixodbc-support-bounces at easysoft.com
[mailto:unixodbc-support-bounces at easysoft.com]On Behalf Of Jerry Lam
Sent: Wednesday, April 06, 2005 9:46 PM
To: Eric Sharkey; Support for the unixODBC project
Subject: RE: [unixODBC-support] Problem in using cursor to fetch
millionsofrows 


Hi,

In order to facilitate debugging process, is there a way I can turn something on in odbc driver to trace all the communications from tclodbc to unixodbc? I found out that the execute command was used internally in other methods as well but they behave the way they should all behave. The problem only occurs when I create the statement object by myself than it is called for execution it actually does the wrong thing. Any help will be appreciated.

Thank you,

Jerry

-----Original Message-----
From: unixodbc-support-bounces at easysoft.com
[mailto:unixodbc-support-bounces at easysoft.com]On Behalf Of Eric Sharkey
Sent: Wednesday, April 06, 2005 3:58 PM
To: Support for the unixODBC project
Subject: Re: [unixODBC-support] Problem in using cursor to fetch
millions ofrows 


> Hi,
> 
> I'm very appreciated the help here. I read the source code in the execute met
> hod, the line that is suspicious to me in the void TclSqlStatement::Execute(T
> cl_Interp *interp, int objc, TCL_CMDARGS) is this:
> 
> while ((rc = SQLExecute(stmt)) == SQL_STILL_EXECUTING) SqlWait(1);

This looks ok.  If the statement is being executed asynchronously,
then SQLExecute will return SQL_STILL_EXECUTING until the execution
is done, at which point it will return SQL_SUCCESS, SQL_ERROR or something
in between.

If the statement is not being executed asyncrhonously, then SQLExecute
will never return SQL_STILL_EXECUTING, so that loop just executes
the statement once and moves on.

Basically, this loop makes it effectively synchronous, regardless of
whether or not the driver is running in a synchronous or asychronous mode.

Whatever your problem is, it isn't there.

Eric
_______________________________________________
unixODBC-support mailing list
unixODBC-support at easysoft.com
http://mail.easysoft.com/mailman/listinfo/unixodbc-support

_______________________________________________
unixODBC-support mailing list
unixODBC-support at easysoft.com
http://mail.easysoft.com/mailman/listinfo/unixodbc-support




More information about the unixODBC-support mailing list