|
@@ -323,9 +323,8 @@ begin
|
|
InternalOpen;
|
|
InternalOpen;
|
|
FBOF:=True;
|
|
FBOF:=True;
|
|
{$ifdef dsdebug}
|
|
{$ifdef dsdebug}
|
|
- Writeln ('Setting state to browse');
|
|
|
|
|
|
+ Writeln ('Setting buffer size');
|
|
{$endif}
|
|
{$endif}
|
|
- SetState(dsBrowse);
|
|
|
|
{$ifdef dsdebug}
|
|
{$ifdef dsdebug}
|
|
Writeln ('Setting buffer size');
|
|
Writeln ('Setting buffer size');
|
|
{$endif}
|
|
{$endif}
|
|
@@ -338,6 +337,10 @@ begin
|
|
*)
|
|
*)
|
|
RecalcBufListSize;
|
|
RecalcBufListSize;
|
|
//SetBufferCount(DefaultBufferCount);
|
|
//SetBufferCount(DefaultBufferCount);
|
|
|
|
+{$ifdef dsdebug}
|
|
|
|
+ Writeln ('Setting state to browse');
|
|
|
|
+{$endif}
|
|
|
|
+ SetState(dsBrowse);
|
|
DoAfterOpen;
|
|
DoAfterOpen;
|
|
DoAfterScroll;
|
|
DoAfterScroll;
|
|
except
|
|
except
|
|
@@ -573,7 +576,7 @@ Var Shifted : boolean;
|
|
|
|
|
|
begin
|
|
begin
|
|
{$ifdef dsdebug}
|
|
{$ifdef dsdebug}
|
|
- Writeln ('Getting previous record');
|
|
|
|
|
|
+ Writeln ('GetPriorRecord: Getting previous record');
|
|
{$endif}
|
|
{$endif}
|
|
Shifted:=FRecordCount>0;
|
|
Shifted:=FRecordCount>0;
|
|
If Shifted Then
|
|
If Shifted Then
|
|
@@ -1076,7 +1079,7 @@ begin
|
|
SetBookMarkFlag(Buffer,bfEOF);
|
|
SetBookMarkFlag(Buffer,bfEOF);
|
|
FRecordCount:=1;
|
|
FRecordCount:=1;
|
|
{$ifdef dsdebug}
|
|
{$ifdef dsdebug}
|
|
- Writeln ('getting prior records');
|
|
|
|
|
|
+ Writeln ('DoInsertAppend: getting prior records');
|
|
{$endif}
|
|
{$endif}
|
|
GetPriorRecords;
|
|
GetPriorRecords;
|
|
// update active record.
|
|
// update active record.
|
|
@@ -1535,25 +1538,37 @@ Var Count,ShiftCount : Longint;
|
|
|
|
|
|
begin
|
|
begin
|
|
// See if we can find the requested record.
|
|
// See if we can find the requested record.
|
|
|
|
+{$ifdef dsdebug}
|
|
|
|
+ Writeln ('Resync called');
|
|
|
|
+{$endif}
|
|
If rmExact in Mode then
|
|
If rmExact in Mode then
|
|
begin
|
|
begin
|
|
|
|
+{$ifdef dsdebug}
|
|
|
|
+ Writeln ('Exact resync');
|
|
|
|
+{$endif}
|
|
{ throw an exception if not found.
|
|
{ throw an exception if not found.
|
|
Normally the descendant should do this if DoCheck is true. }
|
|
Normally the descendant should do this if DoCheck is true. }
|
|
- If GetRecord(Fbuffers[FRecordCount],gmcurrent,True)<>grOk Then
|
|
|
|
|
|
+ If GetRecord(Fbuffers[FRecordCount-1],gmcurrent,True)<>grOk Then
|
|
DatabaseError(SNoSuchRecord,Self);
|
|
DatabaseError(SNoSuchRecord,Self);
|
|
end
|
|
end
|
|
else
|
|
else
|
|
{ Can we find a record in the neighbourhood ?
|
|
{ Can we find a record in the neighbourhood ?
|
|
Use Shortcut evaluation for this, or we'll have some funny results. }
|
|
Use Shortcut evaluation for this, or we'll have some funny results. }
|
|
- If (GetRecord(Fbuffers[FRecordCount],gmcurrent,True)<>grOk) and
|
|
|
|
- (GetRecord(Fbuffers[FRecordCount],gmprior,True)<>grOk) and
|
|
|
|
- (GetRecord(Fbuffers[FRecordCount],gmprior,True)<>grOk) then
|
|
|
|
|
|
+ If (GetRecord(Fbuffers[FRecordCount-1],gmcurrent,True)<>grOk) and
|
|
|
|
+ (GetRecord(Fbuffers[FRecordCount-1],gmprior,True)<>grOk) and
|
|
|
|
+ (GetRecord(Fbuffers[FRecordCount-1],gmprior,True)<>grOk) then
|
|
begin
|
|
begin
|
|
|
|
+{$ifdef dsdebug}
|
|
|
|
+ Writeln ('Resync: fuzzy resync');
|
|
|
|
+{$endif}
|
|
// nothing found, invalidate buffer and bail out.
|
|
// nothing found, invalidate buffer and bail out.
|
|
ClearBuffers;
|
|
ClearBuffers;
|
|
DataEvent(deDatasetChange,0);
|
|
DataEvent(deDatasetChange,0);
|
|
Exit;
|
|
Exit;
|
|
end;
|
|
end;
|
|
|
|
+{$ifdef dsdebug}
|
|
|
|
+ Writeln ('Resync: Center in resync: ',(rmCenter in Mode));
|
|
|
|
+{$endif}
|
|
If (rmCenter in Mode) then
|
|
If (rmCenter in Mode) then
|
|
ShiftCount:=FbufferCount div 2
|
|
ShiftCount:=FbufferCount div 2
|
|
else
|
|
else
|
|
@@ -1561,17 +1576,23 @@ begin
|
|
ShiftCount:=FActiveRecord;
|
|
ShiftCount:=FActiveRecord;
|
|
// Reposition on 0
|
|
// Reposition on 0
|
|
ShiftBuffers(0,FRecordCount-1);
|
|
ShiftBuffers(0,FRecordCount-1);
|
|
|
|
+{$ifdef dsdebug}
|
|
|
|
+ Writeln ('Resync: activating buffers');
|
|
|
|
+{$endif}
|
|
ActivateBuffers;
|
|
ActivateBuffers;
|
|
try
|
|
try
|
|
Count:=0;
|
|
Count:=0;
|
|
{$ifdef dsdebug}
|
|
{$ifdef dsdebug}
|
|
- Writeln ('Getting previous',ShiftCount,' records');
|
|
|
|
|
|
+ Writeln ('Resync: Getting previous ',ShiftCount,' records');
|
|
{$endif}
|
|
{$endif}
|
|
While (Count<ShiftCount) and GetPriorRecord do
|
|
While (Count<ShiftCount) and GetPriorRecord do
|
|
Inc(Count);
|
|
Inc(Count);
|
|
FActiveRecord:=Count;
|
|
FActiveRecord:=Count;
|
|
// fill rest of buffers, adjust ActiveBuffer.
|
|
// fill rest of buffers, adjust ActiveBuffer.
|
|
- SetCurrentRecord(FRecordCount);
|
|
|
|
|
|
+{$ifdef dsdebug}
|
|
|
|
+ Writeln ('Resync: Set current record to ',FRecordCount,' records');
|
|
|
|
+{$endif}
|
|
|
|
+ SetCurrentRecord(FRecordCount-1);
|
|
GetNextRecords;
|
|
GetNextRecords;
|
|
Inc(FActiveRecord,GetPriorRecords);
|
|
Inc(FActiveRecord,GetPriorRecords);
|
|
finally
|
|
finally
|
|
@@ -1719,8 +1740,23 @@ end;
|
|
|
|
|
|
{
|
|
{
|
|
$Log$
|
|
$Log$
|
|
- Revision 1.14 2004-07-16 19:37:40 michael
|
|
|
|
- + Fix in resync for empty table
|
|
|
|
|
|
+ Revision 1.15 2004-07-25 11:32:40 michael
|
|
|
|
+ * Patches from Joost van der Sluis
|
|
|
|
+ interbase.pp:
|
|
|
|
+ * Removed unused Fprepared
|
|
|
|
+ * Changed the error message 'database connect string not filled
|
|
|
|
+ in' to 'database connect string (databasename) not filled in'
|
|
|
|
+ * Preparestatement and execute now checks if transaction is
|
|
|
|
+ assigned (in stead of crashing if it isn't) and if the
|
|
|
|
+ transaction isn't started, it calls starttransaction.
|
|
|
|
+
|
|
|
|
+ dataset.inc:
|
|
|
|
+ * In DoInternalOpen the buffers are now initialised before the
|
|
|
|
+ dataset is set into browse-state
|
|
|
|
+
|
|
|
|
+ database.inc and db.pp:
|
|
|
|
+ * If the dataset is created from a stream, the database is opened
|
|
|
|
+ after the dataset is read completely
|
|
|
|
|
|
Revision 1.13 2004/05/02 21:23:18 peter
|
|
Revision 1.13 2004/05/02 21:23:18 peter
|
|
* use ptrint
|
|
* use ptrint
|