ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/trunk/runtime/nongui/IBTable.pas
(Generate patch)

Comparing ibx/trunk/runtime/nongui/IBTable.pas (file contents):
Revision 380 by tony, Mon Jan 10 10:13:17 2022 UTC vs.
Revision 410 by tony, Thu Jun 22 13:52:39 2023 UTC

# Line 39 | Line 39 | unit IBTable;
39  
40   interface
41  
42 < uses SysUtils, Classes, DB, IB,  IBCustomDataSet, IBDatabase, IBSQL, IBUtils;
42 > uses SysUtils, Classes, DB, IB,  IBCustomDataSet, IBDatabase, IBSQL, IBUtils,
43 >  IBBufferedCursors;
44      
45   type
46  
# Line 126 | Line 127 | type
127      procedure SetFiltered(Value: Boolean); override;
128      procedure SetFilterText(const Value: string); override;
129      procedure SetFilterOptions(Value: TFilterOptions); override;
130 <    procedure InternalRefreshRow; override;
130 >    procedure InternalRefreshRow(Buff: TRecordBuffer); override;
131      function GetMasterDetailDelay: integer; override;
132      procedure SetMasterDetailDelay(AValue: integer); override;
133  
# Line 153 | Line 154 | type
154      property AutoCommit;
155      property Active;
156      property BufferChunks;
157 +    property BufferChunksInFirstBlock;
158      property CachedUpdates;
159      property DataSetCloseAction;
160   //    property Constraints stored ConstraintsStored;
# Line 356 | Line 358 | begin
358      IBError(ibxeNotSupported, [nil]);
359   end;
360  
361 < procedure TIBTable.InternalRefreshRow;
361 > procedure TIBTable.InternalRefreshRow(Buff: TRecordBuffer);
362   begin
363    if CurrentDBKey.DBKey[0] <> 0 then
364      QRefresh.SQL.Assign(WhereDBKeyRefreshSQL)
# Line 364 | Line 366 | begin
366      QRefresh.SQL.Assign(WherePrimaryRefreshSQL)
367    else
368      QRefresh.SQL.Assign(WhereAllRefreshSQL);
369 <  inherited InternalRefreshRow;
369 >  inherited InternalRefreshRow(Buff);
370   end;
371  
372   function TIBTable.GetMasterDetailDelay: integer;
# Line 965 | Line 967 | begin
967      if Active then
968      begin
969        ClearBuffers;
970 <      ResetBufferCache;
970 >      ReQuery;
971        DataEvent(deDataSetChange, 0);
972      end;
973    finally
# Line 1046 | Line 1048 | end;
1048   procedure TIBTable.MasterDisabled(Sender: TObject);
1049   begin
1050    DataEvent(dePropertyChange, 0);
1049  ReQuery;
1051   end;
1052  
1053   function TIBTable.GetDataSource: TDataSource;
# Line 1338 | Line 1339 | begin
1339    SQL := TStringList.Create;
1340    SQL.Text := 'select ' + {do not localize}
1341      QuoteIdentifier(DataBase.SQLDialect, FTableName) + '.*, ' {do not localize}
1342 <    + 'RDB$DB_KEY as IBX_INTERNAL_DBKEY from ' {do not localize}
1342 >    + 'RDB$DB_KEY as ' + sDBkeyAlias + ' from ' {do not localize}
1343      + QuoteIdentifier(DataBase.SQLDialect, FTableName);
1344    if Filtered and (Filter <> '') then
1345    begin
# Line 1372 | Line 1373 | begin
1373    SelectSQL.Assign(SQL);
1374    RefreshSQL.Text := 'select ' + {do not localize}
1375      QuoteIdentifier(DataBase.SQLDialect, FTableName) + '.*, ' {do not localize}
1376 <    + 'RDB$DB_KEY as IBX_INTERNAL_DBKEY from ' {do not localize}
1376 >    + 'RDB$DB_KEY as ' + sDBkeyAlias + ' from ' {do not localize}
1377      + QuoteIdentifier(DataBase.SQLDialect, FTableName) +
1378 <    ' where RDB$DB_KEY = :IBX_INTERNAL_DBKEY'; {do not localize}
1378 >    ' where RDB$DB_KEY = :' + sDBkeyAlias; {do not localize}
1379    WhereDBKeyRefreshSQL.Assign(RefreshSQL);
1380    InternalPrepare;
1381    SQL.Free;
# Line 1479 | Line 1480 | begin
1480    begin
1481      DeleteSQL.Text := 'delete from ' + {do not localize}
1482        QuoteIdentifier(DataBase.SQLDialect, FTableName) +
1483 <      ' where RDB$DB_KEY = ' + ':IBX_INTERNAL_DBKEY'; {do not localize}
1483 >      ' where RDB$DB_KEY = ' + ':' + sDBkeyAlias; {do not localize}
1484      GenerateFieldLists;
1485      InsertSQL.Text := 'insert into ' + {do not localize}
1486        QuoteIdentifier(DataBase.SQLDialect, FTableName) +
# Line 1488 | Line 1489 | begin
1489      ModifySQL.Text := 'update ' +
1490        QuoteIdentifier(DataBase.SQLDialect, FTableName) +
1491        ' set ' + UpdateFieldList + {do not localize}
1492 <      ' where RDB$DB_KEY = :IBX_INTERNAL_DBKEY' + UpdateReturningFieldList; {do not localize}
1492 >      ' where RDB$DB_KEY = :' + sDBkeyAlias + UpdateReturningFieldList; {do not localize}
1493      WhereAllRefreshSQL.Text := 'select ' +  {do not localize}
1494        QuoteIdentifier(DataBase.SQLDialect, FTableName) + '.*, '
1495 <      + 'RDB$DB_KEY as IBX_INTERNAL_DBKEY from ' {do not localize}
1495 >      + 'RDB$DB_KEY as ' + sDBkeyAlias + ' from ' {do not localize}
1496        + QuoteIdentifier(DataBase.SQLDialect, FTableName) +
1497        ' where ' + WhereAllFieldList ; {do not localize}
1498      if FPrimaryIndexFields <> '' then
# Line 1499 | Line 1500 | begin
1500        GenerateWherePrimaryFieldList;
1501        WherePrimaryRefreshSQL.Text := 'select ' + {do not localize}
1502          QuoteIdentifier(DataBase.SQLDialect, FTableName) + '.*, ' {do not localize}
1503 <        + 'RDB$DB_KEY as IBX_INTERNAL_DBKEY from ' {do not localize}
1503 >        + 'RDB$DB_KEY as ' + sDBkeyAlias + ' from ' {do not localize}
1504          + QuoteIdentifier(DataBase.SQLDialect, FTableName) +
1505          ' where ' + WherePrimaryFieldList; {do not localize}
1506      end;
# Line 1546 | Line 1547 | begin
1547      result := False;
1548      First;
1549      while ((not result) and (not EOF)) do begin
1550 <      if (DBKeyCompare (DBKey, PRecordData(GetActiveBuf)^.rdDBKey)) then
1550 >      if (DBKeyCompare (DBKey, GetCurrentDBKey)) then
1551          result := True
1552        else
1553          Next;
# Line 1561 | Line 1562 | begin
1562   end;
1563  
1564   function TIBTable.GetCurrentDBKey: TIBDBKey;
1564 var
1565  Buf: pChar;
1565   begin
1566    CheckActive;
1567 <  buf := GetActiveBuf;
1569 <  if Buf <> nil then
1570 <    Result := PRecordData(Buf)^.rdDBKey
1571 <  else
1572 <    Result.DBKey[0] := 0;
1567 >  Result := Cursor.GetRecDBkey(GetActiveBuf);
1568   end;
1569  
1570   procedure TIBTable.Reopen;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines