Browse Source

* Patch from Ludo to preinitialize certain (var)parameters that are only
partially inited in some versions. (Endianess?) Mantis #21596

git-svn-id: trunk@20654 -

marco 13 years ago
parent
commit
493064a241
1 changed files with 8 additions and 2 deletions
  1. 8 2
      packages/fcl-db/src/sqldb/oracle/oracleconnection.pp

+ 8 - 2
packages/fcl-db/src/sqldb/oracle/oracleconnection.pp

@@ -713,11 +713,11 @@ var Param      : POCIParam;
 
     FieldType  : TFieldType;
     FieldName  : string;
-    FieldSize  : integer;
+    FieldSize  : cardinal;
 
     OFieldType   : ub2;
     OFieldName   : Pchar;
-    OFieldSize   : sb4;
+    OFieldSize   : ub4;
     OFNameLength : ub4;
     NumCols      : ub4;
     FOciDefine   : POCIDefine;
@@ -736,6 +736,12 @@ begin
 
     for tel := 1 to numcols do
       begin
+      // Clear OFieldSize. Oracle 9i, 10g doc says *ub4 but some clients use *ub2 leaving
+      // high 16 bit untouched resulting in huge values and ORA-01062
+      // WARNING: this is not working in big endian systems !!!!
+      // To be tested if BE systems have this *ub2<->*ub4 problem
+      OFieldSize:=0;
+
       if OCIParamGet(FOciStmt,OCI_HTYPE_STMT,FOciError,Param,tel) = OCI_ERROR then
         HandleError;