From 786321304854b5f001a66527016308c9a9828583 Mon Sep 17 00:00:00 2001 From: reiniero Date: Fri, 13 Jun 2014 12:31:04 +0000 Subject: [PATCH] * fcl-db: oracle connection fixes: - unregister on finalization instead of register - check cursor is assigned in rowsaffected Patch by Laco. git-svn-id: trunk@27944 - --- packages/fcl-db/src/sqldb/oracle/oracleconnection.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/fcl-db/src/sqldb/oracle/oracleconnection.pp b/packages/fcl-db/src/sqldb/oracle/oracleconnection.pp index faf41e07ef..ab4641dabd 100644 --- a/packages/fcl-db/src/sqldb/oracle/oracleconnection.pp +++ b/packages/fcl-db/src/sqldb/oracle/oracleconnection.pp @@ -732,7 +732,7 @@ end; function TOracleConnection.RowsAffected(cursor: TSQLCursor): TRowsCount; var rowcount: ub4; begin - if OCIAttrGet((cursor as TOracleCursor).FOciStmt, OCI_HTYPE_STMT, @rowcount, nil, OCI_ATTR_ROW_COUNT, FOciError) = OCI_SUCCESS then + if Assigned(cursor) and (OCIAttrGet((cursor as TOracleCursor).FOciStmt, OCI_HTYPE_STMT, @rowcount, nil, OCI_ATTR_ROW_COUNT, FOciError) = OCI_SUCCESS) then Result:=rowcount else Result:=inherited RowsAffected(cursor); @@ -1112,6 +1112,6 @@ end; initialization RegisterConnection(TOracleConnectionDef); finalization - RegisterConnection(TOracleConnectionDef); + UnRegisterConnection(TOracleConnectionDef); end.