* 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:
joost 2009-01-05 20:46:14 +00:00
parent f722533e9a
commit d844200495
3 changed files with 32 additions and 1 deletions

1
.gitattributes vendored
View File

@ -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

View File

@ -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;

View 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.