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

Lowden, James K james.k.lowden at alliancebernstein.com
Tue Jul 11 18:44:42 EDT 2006


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.  

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.  

Regards, 

--jkl

-----------------------------------------
The information contained in this transmission may be privileged and
confidential and is intended only for the use of the person(s) named
above. If you are not the intended recipient, or an employee or agent responsible
for delivering this message to the intended recipient, any review, dissemination,
distribution or duplication of this communication is strictly prohibited. If you are
not the intended recipient, please contact the sender immediately by reply e-mail
and destroy all copies of the original message. Please note that we do not accept
account orders and/or instructions by e-mail, and therefore will not be responsible
for carrying out such orders and/or instructions.  If you, as the intended recipient
of this message, the purpose of which is to inform and update our clients, prospects
and consultants of developments relating to our services and products, would not
like to receive further e-mail correspondence from the sender, please "reply" to the
sender indicating your wishes.  In the U.S.: 1345 Avenue of the Americas, New York,
NY 10105.



More information about the FreeTDS mailing list