I've added database support in PESDK. It can use DBase3 compatible files/indexes.
Code:
program dbftest;
{$APPTYPE CONSOLE}
uses
SysUtils,
peApi,
peDatabase;
var
db: TPEDbFile;
begin
try
db := TPEDBFile.Create;
try
// define fields in table
db.ClearFieldDefs;
db.AddFieldDef('Name', ftString, 20);
db.AddFieldDef('Score', ftInteger);
db.AddFieldDef('Skill', ftString, 10);
// define index for table
db.ClearIndexDefs;
db.AddIndexDef('NameIndex', 'Name', ixDescending);
db.AddIndexDef('ScoreIndex', 'Score', ixDescending);
db.Open('HighScores');
db.Empty;
db.ActiveIndex := 'NameIndex';
db.Append;
db.FieldValues['Name'] := 'Mike Jones';
db.FieldValues['Score'] := 527455;
db.FieldValues['Skill'] := 'Normal';
db.Post;
db.Append;
db.FieldValues['Name'] := 'Jimmy Smits';
db.FieldValues['Score'] := 7776453;
db.FieldValues['Skill'] := 'Easy';
db.Post;
db.Append;
db.FieldValues['Name'] := 'Tommy Two Toes';
db.FieldValues['Score'] := 999993;
db.FieldValues['Skill'] := 'Hard';
db.Post;
if db.Locate('Name', 'Mike Jones') then
begin
db.Insert;
//db.Edit;
db.FieldValues['Name'] := 'Pyrogine';
db.FieldValues['Score'] := 45863;
db.FieldValues['Skill'] := 'Hard';
db.Post;
end;
db.Close;
finally
db.Free;
end;
except
on E:Exception do
Writeln(E.Classname, ': ', E.Message);
end;
end.
This should (hopefully) be in the next build.
Bookmarks