Hello,
With the latest bugs in the compiler gone (well almost), I was able to test the insert/Append/edit methods of TDataset. This more or less concludes the initial implementation of TDataset.
For those of you not familiar with Delphi or Database programming in it: ------------------------------------------------------------------------ What is TDataset ?
TDataset is an abstract class that implements a universal interface to records in databases (it can even be flat files). It offers methods to easily navigate and edit the records and the fields in the records of any database.
As an example, the following code:
With Data do
While NOT EOF do
begin
For I:=0 to FieldCount-1 do
Writeln (FieldByNAme('Name'));
Next;
end;will dump the field 'Name' from all records in a table. Other methods exist to navigate : First, prior,next,last - and bookmarks are supported as well, to allow fast jumping to some record.
From today on, editing is also implemented, meaning that you can do a
With Data do
begin
Append;
FieldByName('Name').AsString:='Michael A. Hess';
FieldByName('Age').AsInteger:=3;
FieldByName('Height').AsFloat:=5.8;
Post;
end;similarly, you can edit a field with Edit; and insert one with 'Insert'. ------------------------------------------------------------------------ End of 'What is TDataset ?'
Some more info:
The most important field types are supported:
string, integer, word, byte, boolean, date, time, datetime, float not yet supported are BLOB fields and related (memo fields, graphic fields)
All this is (hopefully) 100% interface compatible with Delphi's TDataset.
There are currently 2 descendents of TDataset implemented:
1) TDDG_DS which writes records to a 'file' of record, and which keeps an index file for fast lookup. This descendent is read/write.
2) TMySQLDataset Reads records from a MySQL database server.
Both are fully operational and tested; a test program is provided that dumps the contents of any MySQL table containing the above fields.
Now, what is next ?
0) Please test and give lots of feedback !!
Also, any help is appreciated !!
1) Port winzeos to FPC so we have read/write access to MySQL.
2) Implement TTable and TQuery descendents more or less as in Delphi. (ideas are already laid out and documented, just the implementation is needed)
3) Implement TDatasource support.
4) If KCL or Lazarus or MOS is ready: produce a set of Data-aware controls.
And of course:
5) make nice Database applications using FPC.
5b) Make some money with them and become terribly rich... 5c) Give half your earnings to support the FPC team... :-)
That said, any help is welcome, and I mean that !!
Michael.
