[patch_done] Overwrite Records in Tables
Moderators: gto, EgonHugeist, olehs
[patch_done] Overwrite Records in Tables
Good afternoon,
I'm using Zeos Delphi 7 + 7 + UserControl + PostgreSQL 8.x on Windows XP.
Now that a larger volume of data in the database records when altered, are being replaced by others who can not identify where le handle.
That is, my database is being overwritten with informations about random.
I am being forced to using and enjoying the alpha version of Zeos UserControl because that component with the stable version does not work correctly.
I wonder if there is any complaint about that? And if there is a solution to it?
I'm using Zeos Delphi 7 + 7 + UserControl + PostgreSQL 8.x on Windows XP.
Now that a larger volume of data in the database records when altered, are being replaced by others who can not identify where le handle.
That is, my database is being overwritten with informations about random.
I am being forced to using and enjoying the alpha version of Zeos UserControl because that component with the stable version does not work correctly.
I wonder if there is any complaint about that? And if there is a solution to it?
Last edited by rvgugisch on 26.10.2011, 21:57, edited 1 time in total.
Sorry for bad English.
I am now with enough records to test the beta version of ZEOS.
What is happening is it override existing records when I edit a particular record.
When I call a POST ZEOS overrides the record I'm editing with data from another record.
I have overlap occurs because the code inside the component ZEOS and not in my program.
In debugging the error occurs on ZDBCStatment.pas.
Can not find exactly where the overwrite occurs.
I am now with enough records to test the beta version of ZEOS.
What is happening is it override existing records when I edit a particular record.
When I call a POST ZEOS overrides the record I'm editing with data from another record.
I have overlap occurs because the code inside the component ZEOS and not in my program.
In debugging the error occurs on ZDBCStatment.pas.
Can not find exactly where the overwrite occurs.
Ok.
In my system, table Orders have a filter and SortedFields.
My filter:
The information is different in the dialogues of BEFORE and AFTER, mainly RecN.
When I insert a record inder it normally, but the position of the table remains the record that I was before the insert.
When I change a record, the table leaves the current record and other changes.
In my system, table Orders have a filter and SortedFields.
Code: Select all
MessageDlg('BEFORE POST ' + #13 + #13 +
'ID ' + frmPrincipal.MySQLOrdensid.AsString + #13 +
'RecNo ' + IntToStr( frmPrincipal.MySQLOrdens.RecNo) + #13 +
'CNPJ ' + frmPrincipal.MySQLOrdenscnpj.Text + #13 +
'Cod Vend ' + frmPrincipal.MySQLOrdenscod_vend.Text + #13 +
'Cod Produto ' + frmPrincipal.MySQLOrdensproduto.Text + #13 +
'Cod Status ' + frmPrincipal.MySQLOrdensstatus.Text + #13 +
'Dt Status ' + frmPrincipal.MySQLOrdensdt_mudanca.AsString + #13 +
'Dt Entrada ' + frmPrincipal.MySQLOrdensdt_entrada.AsString
, mtWarning, [mbOK], 0);
dsVisao.DataSet.Post;
MessageDlg('AFTER POST ' + #13 + #13 +
'ID ' + frmPrincipal.MySQLOrdensid.AsString + #13 +
'RecNo ' + IntToStr( frmPrincipal.MySQLOrdens.RecNo) + #13 +
'CNPJ ' + frmPrincipal.MySQLOrdenscnpj.Text + #13 +
'Cod Vend ' + frmPrincipal.MySQLOrdenscod_vend.Text + #13 +
'Cod Produto ' + frmPrincipal.MySQLOrdensproduto.Text + #13 +
'Cod Status ' + frmPrincipal.MySQLOrdensstatus.Text + #13 +
'Dt Status ' + frmPrincipal.MySQLOrdensdt_mudanca.AsString + #13 +
'Dt Entrada ' + frmPrincipal.MySQLOrdensdt_entrada.AsString
, mtWarning, [mbOK], 0);
Code: Select all
dsVisao.DataSet.Filter := 'Upper( Tipo ) = ' + QuotedStr('FIXA')
+ ' OR Upper( Tipo ) = ' + QuotedStr('FIXA');
dsVisao.DataSet.Filtered := True;
The information is different in the dialogues of BEFORE and AFTER, mainly RecN.
When I insert a record inder it normally, but the position of the table remains the record that I was before the insert.
When I change a record, the table leaves the current record and other changes.
Try this patch
Code: Select all
Index: src/component/ZAbstractDataset.pas
===================================================================
--- src/component/ZAbstractDataset.pas (revision 891)
+++ src/component/ZAbstractDataset.pas (working copy)
@@ -475,6 +475,7 @@
FreeFieldBuffers;
SetState(dsBrowse);
Resync([]);
+ BM := Bookmark;
if BookmarkValid(@BM) Then
begin
InternalGotoBookmark(@BM);
Hi Mark,
in original code InternalGotoBookmark(@BM) never happens because BM var is never used. In that sense, my patch solves row jumping problem but I didnt do any serious testing (and I'm not using filters in my apps so I can't be 100% sure, but, in other hand, can't be worse than without patch :-) )
in original code InternalGotoBookmark(@BM) never happens because BM var is never used. In that sense, my patch solves row jumping problem but I didnt do any serious testing (and I'm not using filters in my apps so I can't be 100% sure, but, in other hand, can't be worse than without patch :-) )
Do you test code anytime?
In Delphi XE2 - Not work
Fix:
BM - initialize
@BM - {$IFDEF DELPHI12_UP}BM{$ELSE}@BM{$ENDIF}
In Delphi XE2 - Not work
Fix:
BM - initialize
@BM - {$IFDEF DELPHI12_UP}BM{$ELSE}@BM{$ENDIF}
Code: Select all
if (SortedFields <> '') and not (doDontSortOnPost in Options) then begin
FreeFieldBuffers;
SetState(dsBrowse);
Resync([]);
BM := Bookmark;
if BookmarkValid(BM) Then begin
InternalGotoBookmark(BM);
Resync([rmExact, rmCenter]);
end;
DisableControls;
InternalSort;
BookMark:=BM;
UpdateCursorPos;
EnableControls;
end;
- EgonHugeist
- Zeos Project Manager
- Posts: 1936
- Joined: 31.03.2011, 22:38
Can you make a TortoisSVN-Patch eventually?
Best regards, Michael
You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/
You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/
This patch not adapted for other delphi version. Tested only for Delphi XE
Code: Select all
Index: ZAbstractDataset.pas
===================================================================
--- ZAbstractDataset.pas (revision 1089)
+++ ZAbstractDataset.pas (working copy)
@@ -468,16 +468,16 @@
InternalUpdate;
{BUG-FIX: bangfauzan addition}
- if (SortedFields <> '') and not (doDontSortOnPost in Options) then
- begin
+ if (SortedFields <> '') and not (doDontSortOnPost in Options) then begin
+
FreeFieldBuffers;
SetState(dsBrowse);
Resync([]);
- if BookmarkValid(@BM) Then
- begin
- InternalGotoBookmark(@BM);
- Resync([rmExact, rmCenter]);
- end;
+ BM := Bookmark;
+ if BookmarkValid({$IFDEF DELPHI12_UP}BM{$ELSE}@BM{$ENDIF}) Then begin
+ InternalGotoBookmark({$IFDEF DELPHI12_UP}BM{$ELSE}@BM{$ENDIF});
+ Resync([rmExact, rmCenter]);
+ end;
DisableControls;
InternalSort;
BookMark:=BM;