[freetds] SQLMoreResults and odbc/unittests/rpc.c

Frediano Ziglio freddyz77 at tin.it
Wed Jul 12 01:07:42 EDT 2006


Il giorno mar, 11/07/2006 alle 18.44 -0400, Lowden, James K ha scritto:
> Freddy, 
> 
> SQLMoreResults is still broken, but we're getting closer.  You & I found
> the same mistake in rpc.c; I also had changed my local version to a
> do-while loop.  
> 

Well, currently test should work, I tested it with ms odbc and it
returns 3 resultset (and IMO it has to do so...). So the only problem is
that SQLMoreResults returns one more SQL_SUCCESS...

> I also added some logging.  This is the end of the rpc.c log:
> 
> odbc.c:3112:SQLFetch: NO_DATA_FOUND	<== last fetch of last result
> set
> token.c:519:tds_process_tokens(0x8052100, 0xbfbfef54, 0xbfbfef58,
> 0x5914)
> token.c:522:tds_process_tokens() state is COMPLETED
> odbc.c:2884:odbc_process_tokens: tds_process_tokens returned 2,
> result_type 4052
> odbc.c:556:SQLMoreResults: result_type=4046, lastrc=0
> 	[SQLMoreResults sees TDS_CMD_DONE, no error]
> mem.c:559:tds_free_all_results()
> odbc.c:572:SQLMoreResults: row_count=1, lastrc=0
> 	[row_count=1, no error, returns SQL_SUCCESS (wrong)]
> odbc.c:2983:_SQLFetch(0x8052400, 1, 0)
> mem.c:559:tds_free_all_results()
> util.c:119:Changing query state from IDLE to DEAD
> 	[Boom.]
> 
> The problem is row_count=1; it should be TDS_NO_COUNT.
> 
> n odbc.c            SQLMoreResults       538 stmt->row_count =
> TDS_NO_COUNT;
> o odbc.c            SQLMoreResults       565 if (stmt->row_count ==
> TDS_NO_COUNT && !in_row) {
> p odbc.c            SQLMoreResults       568 stmt->row_count =
> stmt->next_row_count;
> q odbc.c            SQLMoreResults       572 tdsdump_log(TDS_DBG_INFO1,
> "SQLMoreResults: row_count=%d, lastrc=%d\n", stmt->row_count,
> stmt->errs.lastrc);
> r odbc.c            SQLMoreResults       574 if (stmt->row_count ==
> TDS_NO_COUNT) {
> s odbc.c            SQLMoreResults       681 stmt->row_count =
> TDS_NO_COUNT;
> t odbc.c            _SQLAllocStmt       1315 stmt->row_count =
> TDS_NO_COUNT;
> u odbc.c            _SQLExecute         2721 stmt->row_count =
> TDS_NO_COUNT;
> v odbc.c            _SQLExecute         2778 stmt->row_count =
> TDS_NO_COUNT;
> w odbc.c            _SQLExecute         2806 && stmt->row_count ==
> TDS_NO_COUNT && !stmt->cursor)
> x odbc.c            odbc_process_tokens 2907 if (stmt->row_count ==
> TDS_NO_COUNT)
> y odbc.c            odbc_process_tokens 2908 stmt->row_count =
> tds->rows_affected;
> z odbc.c            odbc_process_tokens 2936 if (stmt->row_count ==
> TDS_NO_COUNT)
> A odbc.c            odbc_process_tokens 2937 stmt->row_count =
> tds->rows_affected;
> B odbc.c            _SQLFetch           3101 stmt->row_count =
> tds->rows_affected;
> C odbc.c            SQLPrepare          3780 stmt->row_count =
> tds->rows_affected;
> D odbc.c            SQLPrepare          3792 stmt->row_count =
> TDS_NO_COUNT;
> E odbc.c            _SQLRowCount        3835 if (stmt->row_count !=
> TDS_NO_COUNT)
> F odbc.c            _SQLRowCount        3836 *pcrow = stmt->row_count;
> G token.c           tds_process_row     2073 info->row_count++;
> 
> This output is from cscope (http://cscope.sourceforge.net/).
> 
> I hope that by fixing this, we'll make DBD::ODBC happy.  
> 

?? according to http://freetds.sourceforge.net/out/test/test.1.html
DBD::ODBC is already happy..

freddy77





More information about the FreeTDS mailing list