Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 1999-12

TDataset ready and tested !!

5 messages · 4 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Unknown author

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.

Reply by email

Michael Van Canneyt
to Shane Miller: I am assuming that a TDatabase component is already there? What units are these coded in?…
Shane Miller wrote
I am assuming that a TDatabase component is already there?

Yes, but not really functional. It just closes all datasets connected to it. The rest of the code must still be implemented, but this is all closely connected with the TQuery and TTable implementations.

What units are these coded in? I'd like to look at the implementation when I test them.......

The db unit. see fcl/db the implementation is split into several include files, because otherwise it becomes unreadable.

Michael.

Show quoted text 57 lines
Shane >>> Michael Van Canneyt 12/02/99 02:05AM >>> On Wed, 1 Dec 1999, Michael A. Hess wrote: > wrote: > > > > With Data do > > begin > > Append; > > FieldByName('Name').AsString:='Michael A. Hess'; > > FieldByName('Age').AsInteger:=3; > > FieldByName('Height').AsFloat:=5.8; > > Post; > > end; > > Well the height is almost correct but the age is WAY off. ;-) I was wondering if you would notice. As an eye catcher it seems to have worked :-) > > > 0) Please test and give lots of feedback !! > > Nothing much constructive from me yet other than....impressive. :-) > > > 4) If KCL or Lazarus or MOS is ready: produce a set of Data-aware > > controls. > > This would be a major thing to have in Lazarus. Given the fact that alot > of Delphi programs use databases and the TDataset this would make FPC > and Lazarus VERY popular on Linux. I really hope so. I read somewhere that a survey by Inprise (not the one on linux) showed that 95% of programming is connected with Databases in some way, and so support for it is very important IMHO. I also think that CGI programming will be very easy with this; till now it was cumbersome to use the C interface to mysql, but with this, programming complex forms in CGI which do data access should be a breeze. Michael. _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.miraclec.com/list_archives/lazarus _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.miraclec.com/list_archives/lazarus

Reply by email

Michael Van Canneyt
to Michael A. Hess: Well the height is almost correct but the age is WAY off. ;-) Nothing much constructive…
Michael A. Hess wrote 12 lines
wrote: > > With Data do > begin > Append; > FieldByName('Name').AsString:='Michael A. Hess'; > FieldByName('Age').AsInteger:=3; > FieldByName('Height').AsFloat:=5.8; > Post; > end; Well the height is almost correct but the age is WAY off. ;-)

I was wondering if you would notice.
As an eye catcher it seems to have worked :-)

Show quoted text 11 lines
> 0) Please test and give lots of feedback !! Nothing much constructive from me yet other than....impressive. :-) > 4) If KCL or Lazarus or MOS is ready: produce a set of Data-aware > controls. This would be a major thing to have in Lazarus. Given the fact that alot of Delphi programs use databases and the TDataset this would make FPC and Lazarus VERY popular on Linux.

I really hope so. I read somewhere that a survey by Inprise (not the one on linux) showed that 95% of programming is connected with Databases in some way, and so support for it is very important IMHO.

I also think that CGI programming will be very easy with this; till now it was cumbersome to use the C interface to mysql, but with this, programming complex forms in CGI which do data access should be a breeze.

Michael.

Reply by email

Michael A. Hess
to Unknown author: With the latest bugs in the compiler gone (well almost), I was able to test the…
Show quoted text 9 lines
With Data do begin Append; FieldByName('Name').AsString:='Michael A. Hess'; FieldByName('Age').AsInteger:=3; FieldByName('Height').AsFloat:=5.8; Post; end;

Well the height is almost correct but the age is WAY off. ;-)

0) Please test and give lots of feedback !!

Nothing much constructive from me yet other than....impressive. :-)

4) If KCL or Lazarus or MOS is ready: produce a set of Data-aware controls.

This would be a major thing to have in Lazarus. Given the fact that alot of Delphi programs use databases and the TDataset this would make FPC and Lazarus VERY popular on Linux.

5b) Make some money with them and become terribly rich...

Oh.... now this I LIKE!!!! ;-)

5c) Give half your earnings to support the FPC team... :-)

I might have to think about this one. Hmmmmmm. :-)

==== Programming my first best destiny! ==== Michael A. Hess Miracle Concepts, Inc. http://www.miraclec.com

Reply by email

Shane Miller

I am assuming that a TDatabase component is already there? What units are these coded in? I'd like to look at the implementation when I test them.......

Shane

>> Michael Van Canneyt 12/02/99 02:05AM >>>
Michael A. Hess wrote 12 lines
wrote: > > With Data do > begin > Append; > FieldByName('Name').AsString:='Michael A. Hess'; > FieldByName('Age').AsInteger:=3; > FieldByName('Height').AsFloat:=5.8; > Post; > end; Well the height is almost correct but the age is WAY off. ;-)

I was wondering if you would notice.
As an eye catcher it seems to have worked :-)

Show quoted text 11 lines
> 0) Please test and give lots of feedback !! Nothing much constructive from me yet other than....impressive. :-) > 4) If KCL or Lazarus or MOS is ready: produce a set of Data-aware > controls. This would be a major thing to have in Lazarus. Given the fact that alot of Delphi programs use databases and the TDataset this would make FPC and Lazarus VERY popular on Linux.

I really hope so. I read somewhere that a survey by Inprise (not the one on linux) showed that 95% of programming is connected with Databases in some way, and so support for it is very important IMHO.

I also think that CGI programming will be very easy with this; till now it was cumbersome to use the C interface to mysql, but with this, programming complex forms in CGI which do data access should be a breeze.

Michael.

_________________________________________________________________ To unsubscribe: mail with
"unsubscribe" as the Subject
archives at http://www.miraclec.com/list_archives/lazarus

Reply by email