Browse Source

* Store/cache the fieldnumber in FieldBinding

git-svn-id: trunk@5813 -
joost 18 years ago
parent
commit
a65d49d19e
1 changed files with 6 additions and 4 deletions
  1. 6 4
      fcl/db/sqldb/interbase/ibconnection.pp

+ 6 - 4
fcl/db/sqldb/interbase/ibconnection.pp

@@ -21,6 +21,8 @@ type
       GDSErrorCode : Longint;
       GDSErrorCode : Longint;
   end;
   end;
 
 
+  { TIBCursor }
+
   TIBCursor = Class(TSQLCursor)
   TIBCursor = Class(TSQLCursor)
     protected
     protected
     Status               : array [0..19] of ISC_STATUS;
     Status               : array [0..19] of ISC_STATUS;
@@ -28,6 +30,7 @@ type
     SQLDA                : PXSQLDA;
     SQLDA                : PXSQLDA;
     in_SQLDA             : PXSQLDA;
     in_SQLDA             : PXSQLDA;
     ParamBinding         : array of integer;
     ParamBinding         : array of integer;
+    FieldBinding         : array of integer;
   end;
   end;
 
 
   TIBTrans = Class(TSQLHandle)
   TIBTrans = Class(TSQLHandle)
@@ -620,6 +623,7 @@ begin
   {$R-}
   {$R-}
   with cursor as TIBCursor do
   with cursor as TIBCursor do
     begin
     begin
+    setlength(FieldBinding,SQLDA^.SQLD);
     for x := 0 to SQLDA^.SQLD - 1 do
     for x := 0 to SQLDA^.SQLD - 1 do
       begin
       begin
       TranslateFldType(SQLDA^.SQLVar[x].SQLType, SQLDA^.SQLVar[x].SQLLen, SQLDA^.SQLVar[x].SQLScale,
       TranslateFldType(SQLDA^.SQLVar[x].SQLType, SQLDA^.SQLVar[x].SQLLen, SQLDA^.SQLVar[x].SQLScale,
@@ -628,6 +632,7 @@ begin
          TransLen, False, (x + 1));
          TransLen, False, (x + 1));
       if TransType = ftBCD then FD.precision := SQLDA^.SQLVar[x].SQLLen;
       if TransType = ftBCD then FD.precision := SQLDA^.SQLVar[x].SQLLen;
       FD.DisplayName := SQLDA^.SQLVar[x].AliasName;
       FD.DisplayName := SQLDA^.SQLVar[x].AliasName;
+      FieldBinding[FD.FieldNo-1] := x;
       end;
       end;
     end;
     end;
   {$R+}
   {$R+}
@@ -759,8 +764,7 @@ begin
   with cursor as TIBCursor do
   with cursor as TIBCursor do
     begin
     begin
 {$R-}
 {$R-}
-    for x := 0 to SQLDA^.SQLD - 1 do
-      if SQLDA^.SQLVar[x].AliasName = FieldDef.Name then break;
+    x := FieldBinding[FieldDef.FieldNo-1];
 
 
     if SQLDA^.SQLVar[x].AliasName <> FieldDef.Name then
     if SQLDA^.SQLVar[x].AliasName <> FieldDef.Name then
       DatabaseErrorFmt(SFieldNotFound,[FieldDef.Name],self);
       DatabaseErrorFmt(SFieldNotFound,[FieldDef.Name],self);
@@ -1103,6 +1107,4 @@ begin
     CheckError('TIBConnection.CreateBlobStream isc_get_segment', FStatus);
     CheckError('TIBConnection.CreateBlobStream isc_get_segment', FStatus);
 end;
 end;
 
 
-
-
 end.
 end.