mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-19 23:19:24 +02:00
* On TDataset.Edit exit the method when the state is dsEdit or dsInsert before CheckBrowseMode is called, because CheckBrowseMode will always set the state to dsBrowse. (+test)
git-svn-id: trunk@12515 -
This commit is contained in:
parent
f722533e9a
commit
d844200495
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -7669,6 +7669,7 @@ tests/test/packages/fcl-db/dbftoolsunit.pas svneol=native#text/plain
|
||||
tests/test/packages/fcl-db/tdb1.pp svneol=native#text/plain
|
||||
tests/test/packages/fcl-db/tdb2.pp svneol=native#text/plain
|
||||
tests/test/packages/fcl-db/tdb3.pp svneol=native#text/plain
|
||||
tests/test/packages/fcl-db/tdb4.pp svneol=native#text/plain
|
||||
tests/test/packages/fcl-db/toolsunit.pas svneol=native#text/plain
|
||||
tests/test/packages/fcl-registry/tregistry1.pp svneol=native#text/plain
|
||||
tests/test/packages/hash/tmdtest.pp svneol=native#text/plain
|
||||
|
@ -1669,10 +1669,10 @@ end;
|
||||
Procedure TDataset.Edit;
|
||||
|
||||
begin
|
||||
If State in [dsedit,dsinsert] then exit;
|
||||
CheckBrowseMode;
|
||||
If Not CanModify then
|
||||
DatabaseError(SDatasetReadOnly,Self);
|
||||
If State in [dsedit,dsinsert] then exit;
|
||||
If FRecordCount = 0 then
|
||||
begin
|
||||
Append;
|
||||
|
30
tests/test/packages/fcl-db/tdb4.pp
Executable file
30
tests/test/packages/fcl-db/tdb4.pp
Executable file
@ -0,0 +1,30 @@
|
||||
program TestMemDs;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
memds,db;
|
||||
|
||||
var
|
||||
DSet:TMemDataset;
|
||||
|
||||
begin
|
||||
DSet:=TMemDataset.Create(nil);
|
||||
DSet.FieldDefs.Add('NAME',ftString,20);
|
||||
DSet.CreateTable;
|
||||
DSet.Open;
|
||||
|
||||
DSet.Append;
|
||||
DSet.Edit;
|
||||
DSet.FieldByName('NAME').Value:='aaa';
|
||||
DSet.Post;
|
||||
|
||||
DSet.Append;
|
||||
DSet.Edit;
|
||||
DSet.FieldByName('NAME').Value:='bbb';
|
||||
DSet.Post;
|
||||
|
||||
if Dset.RecordCount<>2 then
|
||||
halt(1);
|
||||
DSet.Free;
|
||||
end.
|
Loading…
Reference in New Issue
Block a user