Browse Source

* add mode objfpc

peter 24 years ago
parent
commit
a400014d54
1 changed files with 85 additions and 84 deletions
  1. 85 84
      fcl/db/interbase/interbase.pp

+ 85 - 84
fcl/db/interbase/interbase.pp

@@ -1,10 +1,10 @@
-{   $Id$     
-    
+{   $Id$
+
     Copyright (c) 2000 by Pavel Stingl
     Copyright (c) 2000 by Pavel Stingl
 
 
 
 
     Interbase database & dataset
     Interbase database & dataset
-    
+
     See the file COPYING.FPC, included in this distribution,
     See the file COPYING.FPC, included in this distribution,
     for details about the copyright.
     for details about the copyright.
 
 
@@ -16,6 +16,7 @@
 
 
 unit Interbase;
 unit Interbase;
 
 
+{$mode objfpc}
 {$H+}
 {$H+}
 
 
 interface
 interface
@@ -26,14 +27,14 @@ type
 
 
   PInteger = ^integer;
   PInteger = ^integer;
   PSmallInt= ^smallint;
   PSmallInt= ^smallint;
-  
+
   TIBDatabase = class;
   TIBDatabase = class;
   TIBTransaction = class;
   TIBTransaction = class;
   TIBQuery = class;
   TIBQuery = class;
   TIBStoredProc = class;
   TIBStoredProc = class;
-    
+
 { TIBDatabase }
 { TIBDatabase }
-  
+
   TIBDatabase = class (TDatabase)
   TIBDatabase = class (TDatabase)
   private
   private
     FIBDatabaseHandle    : pointer;
     FIBDatabaseHandle    : pointer;
@@ -42,20 +43,20 @@ type
     FTransaction         : TIBTransaction;
     FTransaction         : TIBTransaction;
     FUserName            : string;
     FUserName            : string;
     FDialect             : integer;
     FDialect             : integer;
-    
+
     procedure SetDBDialect;
     procedure SetDBDialect;
     procedure SetTransaction(Value : TIBTransaction);
     procedure SetTransaction(Value : TIBTransaction);
   protected
   protected
     function GetHandle : pointer; virtual;
     function GetHandle : pointer; virtual;
       { This procedure makes connection to Interbase server internally.
       { This procedure makes connection to Interbase server internally.
         Is visible only by descendants, in application programming
         Is visible only by descendants, in application programming
-        will be invisible. Connection you must establish by setting 
+        will be invisible. Connection you must establish by setting
         @link(Connected) property to true, or by call of Open method.
         @link(Connected) property to true, or by call of Open method.
       }
       }
     procedure DoInternalConnect; override;
     procedure DoInternalConnect; override;
       { This procedure disconnects object from IB server internally.
       { This procedure disconnects object from IB server internally.
         Is visible only by descendants, in application programming
         Is visible only by descendants, in application programming
-        will be invisible. Disconnection you must make by setting 
+        will be invisible. Disconnection you must make by setting
         @link(Connected) property to false, or by call of Close method.
         @link(Connected) property to false, or by call of Close method.
       }
       }
     procedure DoInternalDisconnect; override;
     procedure DoInternalDisconnect; override;
@@ -105,32 +106,32 @@ type
     If you, on other side, need only commit or rollback data
     If you, on other side, need only commit or rollback data
     without transaction closing, execute with CommitRetaining or
     without transaction closing, execute with CommitRetaining or
     RollbackRetaining. Transaction handle, environment etc. will be
     RollbackRetaining. Transaction handle, environment etc. will be
-    as same as before action. Possible values are : caNone, caCommit, caCommitRetaining, caRollback, 
+    as same as before action. Possible values are : caNone, caCommit, caCommitRetaining, caRollback,
     caRollbackRetaining
     caRollbackRetaining
   }
   }
-  
-  TCommitRollbackAction = (caNone, caCommit, caCommitRetaining, caRollback, 
+
+  TCommitRollbackAction = (caNone, caCommit, caCommitRetaining, caRollback,
     caRollbackRetaining);
     caRollbackRetaining);
   TAccessMode = (amReadWrite, amReadOnly);
   TAccessMode = (amReadWrite, amReadOnly);
   TIsolationLevel = (ilConcurrent, ilConsistent, ilReadCommittedRecV,
   TIsolationLevel = (ilConcurrent, ilConsistent, ilReadCommittedRecV,
     ilReadCommitted);
     ilReadCommitted);
   TLockResolution = (lrWait, lrNoWait);
   TLockResolution = (lrWait, lrNoWait);
-  TTableReservation = (trNone, trSharedLockRead, trSharedLockWrite, 
+  TTableReservation = (trNone, trSharedLockRead, trSharedLockWrite,
     trProtectedLockRead, trProtectedLockWrite);
     trProtectedLockRead, trProtectedLockWrite);
-  
+
   TIBTransaction = class (TComponent)
   TIBTransaction = class (TComponent)
   private
   private
     FTransactionHandle   : pointer;               // Transaction handle
     FTransactionHandle   : pointer;               // Transaction handle
-    FAction              : TCommitRollbackAction; 
+    FAction              : TCommitRollbackAction;
     FActive              : boolean;
     FActive              : boolean;
     FTPB                 : string;                // Transaction parameter buffer
     FTPB                 : string;                // Transaction parameter buffer
     FDatabase            : TIBDatabase;
     FDatabase            : TIBDatabase;
     FAccessMode          : TAccessMode;
     FAccessMode          : TAccessMode;
     FIsolationLevel      : TIsolationLevel;
     FIsolationLevel      : TIsolationLevel;
     FLockResolution      : TLockResolution;
     FLockResolution      : TLockResolution;
-    FTableReservation    : TTableReservation; 
+    FTableReservation    : TTableReservation;
     FStatus              : array [0..19] of ISC_STATUS;
     FStatus              : array [0..19] of ISC_STATUS;
-    
+
     procedure SetActive(Value : boolean);
     procedure SetActive(Value : boolean);
     procedure SetTPB;
     procedure SetTPB;
   protected
   protected
@@ -150,11 +151,11 @@ type
     constructor Create(AOwner : TComponent); override;
     constructor Create(AOwner : TComponent); override;
     destructor Destroy; override;
     destructor Destroy; override;
   published
   published
-    { Default action while closing transaction by setting 
+    { Default action while closing transaction by setting
      @link(Active) property. For details see @link(TCommitRollbackAction)}
      @link(Active) property. For details see @link(TCommitRollbackAction)}
     property Action : TCommitRollbackAction read FAction write FAction;
     property Action : TCommitRollbackAction read FAction write FAction;
     { Is set to true while transaction is active, false if not.
     { Is set to true while transaction is active, false if not.
-      If you set it manually to true, object executes 
+      If you set it manually to true, object executes
       @link(StartTransaction) method, if transaction is
       @link(StartTransaction) method, if transaction is
       active, and you set Active to false, object executes
       active, and you set Active to false, object executes
       one of @link(Commit), @link(CommitRetaining), @link(Rollback),
       one of @link(Commit), @link(CommitRetaining), @link(Rollback),
@@ -166,7 +167,7 @@ type
       you must use this property}
       you must use this property}
     property Database : TIBDatabase read FDatabase write FDatabase;
     property Database : TIBDatabase read FDatabase write FDatabase;
   end;
   end;
-  
+
 { TIBQuery }
 { TIBQuery }
 
 
   PIBBookmark = ^TIBBookmark;
   PIBBookmark = ^TIBBookmark;
@@ -174,11 +175,11 @@ type
     BookmarkData : integer;
     BookmarkData : integer;
     BookmarkFlag : TBookmarkFlag;
     BookmarkFlag : TBookmarkFlag;
   end;
   end;
-  
+
   TStatementType = (stNone, stSelect, stInsert, stUpdate, stDelete,
   TStatementType = (stNone, stSelect, stInsert, stUpdate, stDelete,
     stDDL, stGetSegment, stPutSegment, stExecProcedure,
     stDDL, stGetSegment, stPutSegment, stExecProcedure,
     stStartTrans, stCommit, stRollback, stSelectForUpd);
     stStartTrans, stCommit, stRollback, stSelectForUpd);
-  
+
   TIBQuery = class (TDBDataset)
   TIBQuery = class (TDBDataset)
   private
   private
     FTransaction         : TIBTransaction;
     FTransaction         : TIBTransaction;
@@ -197,7 +198,7 @@ type
     FIsEOF               : boolean;
     FIsEOF               : boolean;
     FStatementType       : TStatementType;
     FStatementType       : TStatementType;
     FLoadingFieldDefs    : boolean;
     FLoadingFieldDefs    : boolean;
-        
+
     procedure SetDatabase(Value : TIBDatabase);
     procedure SetDatabase(Value : TIBDatabase);
     procedure SetTransaction(Value : TIBTransaction);
     procedure SetTransaction(Value : TIBTransaction);
     procedure AllocSQLDA(Count : integer);
     procedure AllocSQLDA(Count : integer);
@@ -218,13 +219,13 @@ type
     procedure ExecuteImmediate;
     procedure ExecuteImmediate;
     procedure ExecuteParams;
     procedure ExecuteParams;
     procedure Execute;
     procedure Execute;
-    
+
     // conversion methods
     // conversion methods
     procedure GetDateTime(CurrBuff, Buffer : pointer; AType : integer);
     procedure GetDateTime(CurrBuff, Buffer : pointer; AType : integer);
     procedure GetFloat(CurrBuff, Buffer : pointer; Field : TField);
     procedure GetFloat(CurrBuff, Buffer : pointer; Field : TField);
 
 
   protected
   protected
-  
+
     // abstract & virual methods of TDataset
     // abstract & virual methods of TDataset
     function AllocRecordBuffer: PChar; override;
     function AllocRecordBuffer: PChar; override;
     procedure FreeRecordBuffer(var Buffer: PChar); override;
     procedure FreeRecordBuffer(var Buffer: PChar); override;
@@ -265,9 +266,9 @@ type
     { This property holds SQL command, which you want to execute }
     { This property holds SQL command, which you want to execute }
     property SQL         : TStrings read FSQL write FSQL;
     property SQL         : TStrings read FSQL write FSQL;
   end;
   end;
-  
+
 { TIBStoredProc - not implemented - yet :-/}
 { TIBStoredProc - not implemented - yet :-/}
-  
+
   TIBStoredProc = class (TDataset)
   TIBStoredProc = class (TDataset)
   private
   private
   protected
   protected
@@ -324,16 +325,16 @@ begin
   x := 0;
   x := 0;
   while x < 40 do
   while x < 40 do
     case ResBuf[x] of
     case ResBuf[x] of
-      isc_info_db_sql_dialect : 
+      isc_info_db_sql_dialect :
         begin
         begin
           Inc(x);
           Inc(x);
           Len := isc_vax_integer(@ResBuf[x], 2);
           Len := isc_vax_integer(@ResBuf[x], 2);
           Inc(x, 2);
           Inc(x, 2);
           FDialect := isc_vax_integer(@ResBuf[x], Len);
           FDialect := isc_vax_integer(@ResBuf[x], Len);
-          Inc(x, Len);  
+          Inc(x, Len);
         end;
         end;
       isc_info_end : Break;
       isc_info_end : Break;
-    end;  
+    end;
 end;
 end;
 
 
 procedure TIBDatabase.SetTransaction(Value : TIBTransaction);
 procedure TIBDatabase.SetTransaction(Value : TIBTransaction);
@@ -344,14 +345,14 @@ begin
     FTransaction.Database := Self;
     FTransaction.Database := Self;
     Exit;
     Exit;
   end;
   end;
-  
+
   if (Value <> FTransaction) and (Value <> nil) then
   if (Value <> FTransaction) and (Value <> nil) then
     if (not FTransaction.Active) then
     if (not FTransaction.Active) then
     begin
     begin
       FTransaction := Value;
       FTransaction := Value;
       FTransaction.Database := Self;
       FTransaction.Database := Self;
     end
     end
-    else Exception.Create('Cannot assign transaction while old transaction active!'); 
+    else Exception.Create('Cannot assign transaction while old transaction active!');
 end;
 end;
 
 
 function TIBDatabase.GetHandle: pointer;
 function TIBDatabase.GetHandle: pointer;
@@ -364,7 +365,7 @@ var
   DPB : string;
   DPB : string;
 begin
 begin
   if Connected then
   if Connected then
-    Close;    
+    Close;
   DPB := chr(isc_dpb_version1);
   DPB := chr(isc_dpb_version1);
   if (FUserName <> '') then
   if (FUserName <> '') then
   begin
   begin
@@ -375,7 +376,7 @@ begin
   if (DatabaseName = '') then
   if (DatabaseName = '') then
     raise Exception.Create('TIBDatabase.Open: Database connect string not filled in!');
     raise Exception.Create('TIBDatabase.Open: Database connect string not filled in!');
   FIBDatabaseHandle := nil;
   FIBDatabaseHandle := nil;
-  if isc_attach_database(@FStatus, Length(DatabaseName), @DatabaseName[1], @FIBDatabaseHandle, 
+  if isc_attach_database(@FStatus, Length(DatabaseName), @DatabaseName[1], @FIBDatabaseHandle,
          Length(DPB), @DPB[1]) <> 0 then
          Length(DPB), @DPB[1]) <> 0 then
     CheckError('TIBDatabase.Open', FStatus);
     CheckError('TIBDatabase.Open', FStatus);
   SetDBDialect;
   SetDBDialect;
@@ -396,14 +397,14 @@ procedure TIBDatabase.StartTransaction;
 begin
 begin
   if FTransaction = nil then
   if FTransaction = nil then
     raise EDatabaseError.Create('TIBDatabase.StartTransaction: Transaction not set');
     raise EDatabaseError.Create('TIBDatabase.StartTransaction: Transaction not set');
-  FTransaction.Active := True;    
+  FTransaction.Active := True;
 end;
 end;
 
 
 procedure TIBDatabase.EndTransaction;
 procedure TIBDatabase.EndTransaction;
 begin
 begin
   if FTransaction = nil then
   if FTransaction = nil then
     raise EDatabaseError.Create('TIBDatabase.EndTransaction: Transaction not set');
     raise EDatabaseError.Create('TIBDatabase.EndTransaction: Transaction not set');
-  FTransaction.Active := False;    
+  FTransaction.Active := False;
 end;
 end;
 
 
 constructor TIBDatabase.Create(AOwner : TComponent);
 constructor TIBDatabase.Create(AOwner : TComponent);
@@ -452,7 +453,7 @@ begin
     amReadWrite : FTPB := FTPB + chr(isc_tpb_write);
     amReadWrite : FTPB := FTPB + chr(isc_tpb_write);
     amReadOnly  : FTPB := FTPB + chr(isc_tpb_read);
     amReadOnly  : FTPB := FTPB + chr(isc_tpb_read);
   end;
   end;
-  
+
   case FIsolationLevel of
   case FIsolationLevel of
     ilConsistent        : FTPB := FTPB + chr(isc_tpb_consistency);
     ilConsistent        : FTPB := FTPB + chr(isc_tpb_consistency);
     ilConcurrent        : FTPB := FTPB + chr(isc_tpb_concurrency);
     ilConcurrent        : FTPB := FTPB + chr(isc_tpb_concurrency);
@@ -461,16 +462,16 @@ begin
     ilReadCommitted     : FTPB := FTPB + chr(isc_tpb_read_committed) +
     ilReadCommitted     : FTPB := FTPB + chr(isc_tpb_read_committed) +
       chr(isc_tpb_no_rec_version);
       chr(isc_tpb_no_rec_version);
   end;
   end;
-  
+
   case FLockResolution of
   case FLockResolution of
     lrWait   : FTPB := FTPB + chr(isc_tpb_wait);
     lrWait   : FTPB := FTPB + chr(isc_tpb_wait);
     lrNoWait : FTPB := FTPB + chr(isc_tpb_nowait);
     lrNoWait : FTPB := FTPB + chr(isc_tpb_nowait);
   end;
   end;
-  
+
   case FTableReservation of
   case FTableReservation of
-    trSharedLockRead     : FTPB := FTPB + chr(isc_tpb_shared) + 
+    trSharedLockRead     : FTPB := FTPB + chr(isc_tpb_shared) +
       chr(isc_tpb_lock_read);
       chr(isc_tpb_lock_read);
-    trSharedLockWrite    : FTPB := FTPB + chr(isc_tpb_shared) + 
+    trSharedLockWrite    : FTPB := FTPB + chr(isc_tpb_shared) +
       chr(isc_tpb_lock_write);
       chr(isc_tpb_lock_write);
     trProtectedLockRead  : FTPB := FTPB + chr(isc_tpb_protected) +
     trProtectedLockRead  : FTPB := FTPB + chr(isc_tpb_protected) +
       chr(isc_tpb_lock_read);
       chr(isc_tpb_lock_read);
@@ -519,17 +520,17 @@ var
   DBHandle : pointer;
   DBHandle : pointer;
 begin
 begin
   if Active then Active := False;
   if Active then Active := False;
-  
+
   if FDatabase = nil then
   if FDatabase = nil then
     Exception.Create('TIBTransaction.StartTransaction: Database not assigned!');
     Exception.Create('TIBTransaction.StartTransaction: Database not assigned!');
-  
+
   if not Database.Connected then
   if not Database.Connected then
     Database.Open;
     Database.Open;
-  
+
   DBHandle := Database.GetHandle;
   DBHandle := Database.GetHandle;
   SetTPB;
   SetTPB;
   FTransactionHandle := nil;
   FTransactionHandle := nil;
-  
+
   if isc_start_transaction(@FStatus, @FTransactionHandle, 1,
   if isc_start_transaction(@FStatus, @FTransactionHandle, 1,
      [@DBHandle, Length(FTPB), @FTPB[1]]) <> 0 then
      [@DBHandle, Length(FTPB), @FTPB[1]]) <> 0 then
     CheckError('TIBTransaction.StartTransaction',FStatus)
     CheckError('TIBTransaction.StartTransaction',FStatus)
@@ -548,7 +549,7 @@ begin
   FTableReservation := trNone;
   FTableReservation := trNone;
   FTransactionHandle := nil;
   FTransactionHandle := nil;
   FDatabase := nil;
   FDatabase := nil;
-  
+
   FillChar(FStatus, SizeOf(FStatus), #0);
   FillChar(FStatus, SizeOf(FStatus), #0);
 end;
 end;
 
 
@@ -560,14 +561,14 @@ begin
 {  // i really can't allow commit of transaction
 {  // i really can't allow commit of transaction
   // on destroy...
   // on destroy...
 }
 }
-{  
+{
   try
   try
-    if Active then 
+    if Active then
       Active := False;
       Active := False;
   except
   except
   end;
   end;
 }
 }
-  
+
   inherited Destroy;
   inherited Destroy;
 end;
 end;
 
 
@@ -598,7 +599,7 @@ begin
   GetMem(FSQLDA, XSQLDA_Length * Count);
   GetMem(FSQLDA, XSQLDA_Length * Count);
   FSQLDAAllocated := Count;
   FSQLDAAllocated := Count;
   FSQLDA^.Version := sqlda_version1;
   FSQLDA^.Version := sqlda_version1;
-  FSQLDA^.SQLN := Count; 
+  FSQLDA^.SQLN := Count;
 end;
 end;
 
 
 procedure TIBQuery.AllocStatement;
 procedure TIBQuery.AllocStatement;
@@ -608,7 +609,7 @@ begin
   if not FDatabase.Connected then
   if not FDatabase.Connected then
     FDatabase.Open;
     FDatabase.Open;
   dh := FDatabase.GetHandle;
   dh := FDatabase.GetHandle;
-  
+
   if isc_dsql_allocate_statement(@FStatus, @dh, @FStatement) <> 0 then
   if isc_dsql_allocate_statement(@FStatus, @dh, @FStatement) <> 0 then
     CheckError('TIBQuery.AllocStatement', FStatus);
     CheckError('TIBQuery.AllocStatement', FStatus);
 end;
 end;
@@ -627,10 +628,10 @@ var
   tr  : pointer;
   tr  : pointer;
 begin
 begin
   tr := FTransaction.GetHandle;
   tr := FTransaction.GetHandle;
-  
+
   for x := 0 to FSQL.Count - 1 do
   for x := 0 to FSQL.Count - 1 do
     Buf := Buf + FSQL[x] + ' ';
     Buf := Buf + FSQL[x] + ' ';
-    
+
   if isc_dsql_prepare(@FStatus, @tr, @FStatement, 0, @Buf[1], 1, nil) <> 0 then
   if isc_dsql_prepare(@FStatus, @tr, @FStatement, 0, @Buf[1], 1, nil) <> 0 then
     CheckError('TIBQuery.PrepareStatement', FStatus);
     CheckError('TIBQuery.PrepareStatement', FStatus);
 end;
 end;
@@ -654,23 +655,23 @@ begin
   for x := 0 to FSQLDA^.SQLN - 1 do
   for x := 0 to FSQLDA^.SQLN - 1 do
   begin
   begin
     case FSQLDA^.SQLVar[x].SQLType of
     case FSQLDA^.SQLVar[x].SQLType of
-      sql_varying + 1: 
+      sql_varying + 1:
         FSQLDA^.SQLVar[x].SQLType := sql_varying;
         FSQLDA^.SQLVar[x].SQLType := sql_varying;
-      sql_text + 1   : 
+      sql_text + 1   :
         FSQLDA^.SQLVar[x].SQLType := sql_text;
         FSQLDA^.SQLVar[x].SQLType := sql_text;
       sql_short, sql_short + 1, sql_long + 1:
       sql_short, sql_short + 1, sql_long + 1:
         FSQLDA^.SQLVar[x].SQLType := sql_long;
         FSQLDA^.SQLVar[x].SQLType := sql_long;
       sql_float + 1  :
       sql_float + 1  :
         FSQLDA^.SQLVar[x].SQLType := sql_float;
         FSQLDA^.SQLVar[x].SQLType := sql_float;
-      sql_double + 1 : 
+      sql_double + 1 :
         FSQLDA^.SQLVar[x].SQLType := sql_double;
         FSQLDA^.SQLVar[x].SQLType := sql_double;
-      sql_blob + 1   : 
+      sql_blob + 1   :
         FSQLDA^.SQLVar[x].SQLType := sql_blob;
         FSQLDA^.SQLVar[x].SQLType := sql_blob;
       sql_type_time + 1   :
       sql_type_time + 1   :
         FSQLDA^.SQLVar[x].SQLType := sql_type_time;
         FSQLDA^.SQLVar[x].SQLType := sql_type_time;
       sql_timestamp + 1:
       sql_timestamp + 1:
         FSQLDA^.SQLVar[x].SQLType := sql_timestamp;
         FSQLDA^.SQLVar[x].SQLType := sql_timestamp;
-    end; 
+    end;
   end;
   end;
 end;
 end;
 
 
@@ -699,7 +700,7 @@ begin
     if FSQLDA^.SQLVar[x].SQLData <> nil then
     if FSQLDA^.SQLVar[x].SQLData <> nil then
     begin
     begin
       FreeMem(FSQLDA^.SQLVar[x].SQLData);
       FreeMem(FSQLDA^.SQLVar[x].SQLData);
-      FSQLDA^.SQLVar[x].SQLData := nil; 
+      FSQLDA^.SQLVar[x].SQLData := nil;
     end;
     end;
   end;
   end;
   {$R+}
   {$R+}
@@ -709,14 +710,14 @@ procedure TIBQuery.Fetch;
 var
 var
   retcode : integer;
   retcode : integer;
 begin
 begin
-  if not (FStatementType in [stSelect]) then 
+  if not (FStatementType in [stSelect]) then
     Exit;
     Exit;
 
 
   retcode := isc_dsql_fetch(@FStatus, @FStatement, 1, FSQLDA);
   retcode := isc_dsql_fetch(@FStatus, @FStatement, 1, FSQLDA);
   if (retcode <> 0) and (retcode <> 100) then
   if (retcode <> 0) and (retcode <> 100) then
     CheckError('TIBQuery.Fetch', FStatus);
     CheckError('TIBQuery.Fetch', FStatus);
 
 
-  FIsEOF := (retcode = 100); 
+  FIsEOF := (retcode = 100);
 end;
 end;
 
 
 function TIBQuery.LoadBufferFromSQLDA(Buffer : PChar): TGetResult;
 function TIBQuery.LoadBufferFromSQLDA(Buffer : PChar): TGetResult;
@@ -724,14 +725,14 @@ var
   x          : integer;
   x          : integer;
   VarcharLen : word;
   VarcharLen : word;
 begin
 begin
-  
+
   Fetch;
   Fetch;
   if FIsEOF then
   if FIsEOF then
   begin
   begin
     Result := grEOF;
     Result := grEOF;
     Exit;
     Exit;
   end;
   end;
-  
+
   {$R-}
   {$R-}
   for x := 0 to FSQLDA^.SQLD - 1 do
   for x := 0 to FSQLDA^.SQLD - 1 do
   begin
   begin
@@ -747,7 +748,7 @@ begin
       Inc(Buffer, SQLLen);
       Inc(Buffer, SQLLen);
     end;
     end;
   end;
   end;
-  {$R+} 
+  {$R+}
   Result := grOK;
   Result := grOK;
 
 
 end;
 end;
@@ -759,7 +760,7 @@ var
 begin
 begin
   FStatementType := stNone;
   FStatementType := stNone;
   x := isc_info_sql_stmt_type;
   x := isc_info_sql_stmt_type;
-  if isc_dsql_sql_info(@FStatus, @FStatement, SizeOf(X), 
+  if isc_dsql_sql_info(@FStatus, @FStatement, SizeOf(X),
     @x, SizeOf(ResBuf), @ResBuf) <> 0 then
     @x, SizeOf(ResBuf), @ResBuf) <> 0 then
     CheckError('TIBQuery.GetStatementType', FStatus);
     CheckError('TIBQuery.GetStatementType', FStatus);
   if Ord(ResBuf[0]) = isc_info_sql_stmt_type then
   if Ord(ResBuf[0]) = isc_info_sql_stmt_type then
@@ -788,13 +789,13 @@ begin
   LensSet := False;
   LensSet := False;
 
 
   case (SQLType and not 1) of
   case (SQLType and not 1) of
-    SQL_VARYING : 
+    SQL_VARYING :
       begin
       begin
         LensSet := True;
         LensSet := True;
         TrType := ftString;
         TrType := ftString;
         TrLen := SQLLen;
         TrLen := SQLLen;
       end;
       end;
-    SQL_TEXT :      
+    SQL_TEXT :
       begin
       begin
         LensSet := True;
         LensSet := True;
         TrType := ftString;
         TrType := ftString;
@@ -809,7 +810,7 @@ begin
     SQL_ARRAY :
     SQL_ARRAY :
       begin
       begin
       end;
       end;
-    SQL_BLOB : 
+    SQL_BLOB :
       begin
       begin
       end;
       end;
     SQL_SHORT :
     SQL_SHORT :
@@ -865,8 +866,8 @@ var
   STime : TSystemTime;  // System time
   STime : TSystemTime;  // System time
   PTime : TDateTime;    // Pascal time
   PTime : TDateTime;    // Pascal time
 begin
 begin
-  case (AType and not 1) of 
-    SQL_TYPE_DATE : 
+  case (AType and not 1) of
+    SQL_TYPE_DATE :
       isc_decode_sql_date(PISC_DATE(CurrBuff), @CTime);
       isc_decode_sql_date(PISC_DATE(CurrBuff), @CTime);
     SQL_TYPE_TIME :
     SQL_TYPE_TIME :
       isc_decode_sql_time(PISC_TIME(CurrBuff), @CTime);
       isc_decode_sql_time(PISC_TIME(CurrBuff), @CTime);
@@ -880,7 +881,7 @@ begin
   STime.Minute      := CTime.tm_min;
   STime.Minute      := CTime.tm_min;
   STime.Second      := CTime.tm_sec;
   STime.Second      := CTime.tm_sec;
   STime.Millisecond := 0;
   STime.Millisecond := 0;
-  
+
   PTime := SystemTimeToDateTime(STime);
   PTime := SystemTimeToDateTime(STime);
   Move(PTime, Buffer^, SizeOf(PTime));
   Move(PTime, Buffer^, SizeOf(PTime));
 end;
 end;
@@ -919,7 +920,7 @@ end;
 
 
 procedure TIBQuery.GetBookmarkData(Buffer: PChar; Data: Pointer);
 procedure TIBQuery.GetBookmarkData(Buffer: PChar; Data: Pointer);
 begin
 begin
-  PInteger(Data)^ := PIBBookmark(Buffer + FRecordSize)^.BookmarkData; 
+  PInteger(Data)^ := PIBBookmark(Buffer + FRecordSize)^.BookmarkData;
 end;
 end;
 
 
 function TIBQuery.GetBookmarkFlag(Buffer: PChar): TBookmarkFlag;
 function TIBQuery.GetBookmarkFlag(Buffer: PChar): TBookmarkFlag;
@@ -935,14 +936,14 @@ var
 begin
 begin
   Result := False;
   Result := False;
   CurrBuff := ActiveBuffer;
   CurrBuff := ActiveBuffer;
-  
+
   for x := 0 to FSQLDA^.SQLD - 1 do
   for x := 0 to FSQLDA^.SQLD - 1 do
   begin
   begin
     {$R-}
     {$R-}
     if (Field.FieldName = FSQLDA^.SQLVar[x].SQLName) then
     if (Field.FieldName = FSQLDA^.SQLVar[x].SQLName) then
     begin
     begin
       case Field.DataType of
       case Field.DataType of
-        ftInteger : 
+        ftInteger :
           begin
           begin
             b := 0;
             b := 0;
             Move(b, Buffer^, 4);
             Move(b, Buffer^, 4);
@@ -955,12 +956,12 @@ begin
             Move(CurrBuff^, Buffer^, Field.Size);
             Move(CurrBuff^, Buffer^, Field.Size);
             PChar(Buffer + Field.Size)^ := #0;
             PChar(Buffer + Field.Size)^ := #0;
           end;
           end;
-        ftFloat   : 
+        ftFloat   :
           GetFloat(CurrBuff, Buffer, Field);
           GetFloat(CurrBuff, Buffer, Field);
       end;
       end;
-      
+
       Result := True;
       Result := True;
-      
+
       Break;
       Break;
     end
     end
     else Inc(CurrBuff, FSQLDA^.SQLVar[x].SQLLen);
     else Inc(CurrBuff, FSQLDA^.SQLVar[x].SQLLen);
@@ -970,7 +971,7 @@ end;
 
 
 function TIBQuery.GetRecord(Buffer: PChar; GetMode: TGetMode; DoCheck: Boolean): TGetResult;
 function TIBQuery.GetRecord(Buffer: PChar; GetMode: TGetMode; DoCheck: Boolean): TGetResult;
 begin
 begin
-  if FStatementType <> stSelect then 
+  if FStatementType <> stSelect then
   begin
   begin
     Result := grEOF;
     Result := grEOF;
     Exit;
     Exit;
@@ -987,10 +988,10 @@ begin
           FCurrentRecord := -1;
           FCurrentRecord := -1;
         end
         end
         else Dec(FCurrentRecord);
         else Dec(FCurrentRecord);
-      gmCurrent : 
+      gmCurrent :
         if (FCurrentRecord < 0) or (FCurrentRecord >= RecordCount) then
         if (FCurrentRecord < 0) or (FCurrentRecord >= RecordCount) then
           Result := grError;
           Result := grError;
-      gmNext : 
+      gmNext :
         if FCurrentRecord >= (RecordCount - 1) then
         if FCurrentRecord >= (RecordCount - 1) then
         begin
         begin
           Result := LoadBufferFromSQLDA(Buffer);
           Result := LoadBufferFromSQLDA(Buffer);
@@ -1003,7 +1004,7 @@ begin
         else Inc(FCurrentRecord);
         else Inc(FCurrentRecord);
     end;
     end;
   end;
   end;
-  
+
   if Result = grOK then
   if Result = grOK then
   begin
   begin
     with PIBBookmark(Buffer + FRecordSize)^ do
     with PIBBookmark(Buffer + FRecordSize)^ do
@@ -1074,15 +1075,15 @@ begin
     Exit;
     Exit;
 
 
   FLoadingFieldDefs := True;
   FLoadingFieldDefs := True;
-  
+
   try
   try
     FieldDefs.Clear;
     FieldDefs.Clear;
     {$R-}
     {$R-}
     for x := 0 to FSQLDA^.SQLD - 1 do
     for x := 0 to FSQLDA^.SQLD - 1 do
     begin
     begin
-      TranslateFldType(FSQLDA^.SQLVar[x].SQLType, FSQLDA^.SQLVar[x].SQLLen, lenset, 
+      TranslateFldType(FSQLDA^.SQLVar[x].SQLType, FSQLDA^.SQLVar[x].SQLLen, lenset,
         TransType, TransLen);
         TransType, TransLen);
-      TFieldDef.Create(FieldDefs, FSQLDA^.SQLVar[x].SQLName, TransType, 
+      TFieldDef.Create(FieldDefs, FSQLDA^.SQLVar[x].SQLName, TransType,
         TransLen, False, (x + 1));
         TransLen, False, (x + 1));
     end;
     end;
     {$R+}
     {$R+}