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 |
|
|
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 |
|
|
154 |
|
property AutoCommit; |
155 |
|
property Active; |
156 |
|
property BufferChunks; |
157 |
+ |
property BufferChunksInFirstBlock; |
158 |
|
property CachedUpdates; |
159 |
|
property DataSetCloseAction; |
160 |
|
// property Constraints stored ConstraintsStored; |
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) |
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; |
967 |
|
if Active then |
968 |
|
begin |
969 |
|
ClearBuffers; |
970 |
< |
ResetBufferCache; |
970 |
> |
ReQuery; |
971 |
|
DataEvent(deDataSetChange, 0); |
972 |
|
end; |
973 |
|
finally |
1048 |
|
procedure TIBTable.MasterDisabled(Sender: TObject); |
1049 |
|
begin |
1050 |
|
DataEvent(dePropertyChange, 0); |
1049 |
– |
ReQuery; |
1051 |
|
end; |
1052 |
|
|
1053 |
|
function TIBTable.GetDataSource: TDataSource; |
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 |
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; |
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) + |
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 |
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; |
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; |
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; |