X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 20C2CD1B47D for ; Sat, 10 Jan 2004 14:13:14 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 05000-05 for ; Sat, 10 Jan 2004 10:12:46 -0400 (AST) Received: from relay.netbox.cz (relay.netbox.cz [212.96.166.9]) by svr1.postgresql.org (Postfix) with ESMTP id BEA5FD1B46D for ; Sat, 10 Jan 2004 10:12:41 -0400 (AST) Received: from localhost (localhost [127.0.0.1]) by localhost.netbox.cz (Postfix) with ESMTP id 3FD2D37B83; Sat, 10 Jan 2004 15:12:39 +0100 (CET) Received: from relay.netbox.cz ([127.0.0.1]) by localhost (relay [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 02618-01-61; Sat, 10 Jan 2004 15:12:38 +0100 (CET) Received: from smtp.pzkagis.cz (gis.netbox.cz [212.96.173.85]) by relay.netbox.cz (Postfix) with ESMTP id 2E89F37B77; Sat, 10 Jan 2004 15:12:37 +0100 (CET) Received: (from luf@localhost) by smtp.pzkagis.cz (8.11.6/8.11.6) id i0AECan19260; Sat, 10 Jan 2004 15:12:36 +0100 Date: Sat, 10 Jan 2004 15:12:36 +0100 From: "'Ludek Finstrle'" To: Hiroshi Inoue Cc: "'Ludek Finstrle'" , pgsql-odbc@postgresql.org Subject: Re: Bug in clear_error in SQLExecute? Message-ID: <20040110141236.GA19067@soptik.pzkagis.cz> References: <20040109212710.GA16057@soptik.pzkagis.cz> <007d01c3d77c$dbce6900$3d283ddb@PbgX> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="17pEHd4RhPHOinZp" Content-Disposition: inline In-Reply-To: <007d01c3d77c$dbce6900$3d283ddb@PbgX> User-Agent: Mutt/1.4i X-Virus-Scanned: by amavisd-new-20030616-p5 (Debian) at relay.netbox.cz X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200401/17 X-Sequence-Number: 3646 --17pEHd4RhPHOinZp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline > Hiroshi Inoue > > > Ludek Finstrle > > > > I think I found a bug in SQLExecute. IMHO SC_clean_error should be > > called there only sometimes as you can see from my patch created > > againist fresh CVS snapshot. > > > > Without this patch application fail becouse error is produced in Fetch > > instead of in Execute. > > Could you explain the examples ? I can. I attach part of mylog output where the problem is described. I try explain it in english and I hope you can understand. Application call select on non-exists table. It's allocate stmt then it prepare stmt. Then it call NumResultCols. Error raise in this function but it return SQL_SUCCESS (I think this is right) and set stmt status to STMT_PREMATURE. Then it call Execute. There is clean_error so it return SQL_SUCCES and I think this is wrong>. After it app call Fetch and it fail. Application doesn't expect failure in Fetch after success execute. I don't have source for app because it's commercial one. So I can't change it's behaviour. I tried create table but app fails later. When I patch psqlodbc it's doing what I expect. But I'm not sure if it's good for all situations. I don't see so far. The opposite one situation which I think about is execute twice or more times with different binding parameters. So I add test status to STMT_FINISHED. As I said I'm not sure if it's correct. Best regards Luf --17pEHd4RhPHOinZp Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="mylog_clean_error.log" [1080][[SQLAllocHandle]][1080]PGAPI_AllocStmt: entering... [1080]**** PGAPI_AllocStmt: hdbc = 22773424, stmt = 22850256 [1080]CC_add_statement: self=22773424, stmt=22850256 [1080][[SQLGetStmtAttr]] Handle=22850256 10010 [1080]PGAPI_GetStmtAttr Handle=22850256 10010 [1080][[SQLGetStmtAttr]] Handle=22850256 10011 [1080]PGAPI_GetStmtAttr Handle=22850256 10011 [1080][[SQLGetStmtAttr]] Handle=22850256 10012 [1080]PGAPI_GetStmtAttr Handle=22850256 10012 [1080][[SQLGetStmtAttr]] Handle=22850256 10013 [1080]PGAPI_GetStmtAttr Handle=22850256 10013 [1080][SQLPrepare][1080]PGAPI_Prepare: entering... [1080]**** PGAPI_Prepare: STMT_ALLOCATED, copy [1080][SQLNumResultCols][1080]PGAPI_NumResultCols: entering... [1080]SC_pre_execute: status = 1 [1080] preprocess: status = READY [1080]PGAPI_Execute: entering... [1080]PGAPI_Execute: clear errors... [1080]recycle statement: self= 22850256 [1080]APD_free_params: ENTER, self=22850508 [1080]IPD_free_params: ENTER, self=22850572 [1080]IPD_free_params: EXIT [1080]PDATA_free_params: ENTER, self=22850680 [1080]Exec_with_parameters_resolved: copying statement params: trans_status=1, len=105, stmt='select table_name,column_name,join_table,code_column,text_column,index_column,index_value from mscodelist' [1080] stmt_with_params = 'declare SQL_CUR015CAAD0 cursor for select table_name,column_name,join_table,code_column,text_column,index_column,index_value from mscodelist' [1080] about to begin a transaction on statement = 22850256 [1080] Sending SELECT statement on stmt=22850256, cursor_name='SQL_CUR015CAAD0' [1080]send_query(): conn=22773424, query='declare SQL_CUR015CAAD0 cursor for select table_name,column_name,join_table,code_column,text_column,index_column,index_value from mscodelist' [1080]send_query: done sending query [1080]in QR_Constructor [1080]exit QR_Constructor [1080]read 54, global_socket_buffersize=4096 [1080]send_query: got id = 'C' [1080]send_query: ok - 'C' - BEGIN [1080]send_query: setting cmdbuffer = 'BEGIN' [1080]send_query: got id = 'E' [1080]send_query: 'E' - ERROR: Relation 'mscodelist' does not exist [1080]read 1, global_socket_buffersize=4096 [1080]send_query: got id = 'Z' [1080] done sending the query: [1080]send_query(): conn=22773424, query='ROLLBACK' [1080]send_query: done sending query [1080]in QR_Constructor [1080]exit QR_Constructor [1080]read 11, global_socket_buffersize=4096 [1080]send_query: got id = 'C' [1080]send_query: ok - 'C' - ROLLBACK [1080]send_query: setting cmdbuffer = 'ROLLBACK' [1080]send_query: returning res = 22849808 [1080]send_query: got id = 'Z' [1080]CC_abort: sending ABORT! [1080]QResult: in DESTRUCTOR [1080]QResult: free memory in, fcount=0 [1080]QResult: free memory out [1080]QResult: exit DESTRUCTOR [1080]STATEMENT ERROR: func=SC_execute, desc='', errnum=7, errmsg='Error while executing the query' [1080]CONN ERROR: func=SC_execute, desc='', errnum=110, errmsg='ERROR: Relation 'mscodelist' does not exist' [1080] preprocess: after status = FINISHED, so set PREMATURE [1080]PGAPI_NumResultCols: result = 22850000, status = 2, numcols = 0 [1080][SQLExecute][1080]PGAPI_Execute: entering... [1080]PGAPI_Execute: premature statement but return SQL_SUCCESS [1080][[SQLFetch]][1080]PGAPI_ExtendedFetch: stmt=22850256 [1080]STATEMENT ERROR: func=PGAPI_ExtendedFetch, desc='', errnum=15, errmsg='Bindings were not allocated properly.' [1080]CONN ERROR: func=PGAPI_ExtendedFetch, desc='', errnum=110, errmsg='ERROR: Relation 'mscodelist' does not exist' [1080][SQLDisconnect][1080]PGAPI_Disconnect: entering... [1080]PGAPI_Disconnect: about to CC_cleanup [1080]in CC_Cleanup, self=22773424 [1080]after CC_abort [1080]SOCK_Destructor [1080]after SOCK destructor [1080]SC_Destructor: self=22818240, self->result=0, self->hdbc=0 --17pEHd4RhPHOinZp--