Recent

Author Topic: TFixedDataset help  (Read 4667 times)

WalterK

  • New Member
  • *
  • Posts: 48
TFixedDataset help
« on: October 25, 2011, 03:31:52 pm »
I'm trying to figure out TFixedDataset.  The example at
http://wiki.freepascal.org/Lazarus_Database_Tutorial#Using_TSdfDataset_and_TFixedDataset
doesn't show what units I need nor things like how FDataset was declared.
I haven't found any other examples on the internet; not even documentation for TComponentsDatabase.  So I'm really in the dark.

I need this (or another simple) database to put into a daemon-type process - no visual stuff or Lazarus in this program. (Using Laz on another part.)

I basically clueless (and feeling more and more so as the months pass), so I was hoping someone could post a small but complete example.

TIA.

Walter

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3541
Re: TFixedDataset help
« Reply #1 on: October 25, 2011, 03:39:57 pm »
I don't know anything about TFixedDataset, but I improved the example. It was really easy. It has this line of code:

  FDataset := TSdfDataset.Create(nil);

Then it is obvious that the declaration can only be:

var
  FDataset: TSdfDataset;

The unit for that can be obtained in the Lazarus IDE. Go to the tab "Data Acess", right click the component for Sdf, and you get the unit:

uses sdfdata;

WalterK

  • New Member
  • *
  • Posts: 48
Re: TFixedDataset help
« Reply #2 on: October 25, 2011, 04:12:53 pm »
Thanks.

And I found that ftString is in the 'db' unit.

That got me started with a small test program to build from.

Thanks again.

Walter

WalterK

  • New Member
  • *
  • Posts: 48
Re: TFixedDataset help
« Reply #3 on: October 25, 2011, 06:03:17 pm »
Cluelessness is back...

I trying to find how one adds a record to a TsdfDataset (or a TFixedFormatDataset) and I ended up looking at  sfddata.pp through Laz: I don't see any functions to allow adding records.  Or search.

Someone please straighten me out.

TIA

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3541
Re: TFixedDataset help
« Reply #4 on: October 25, 2011, 06:57:00 pm »
It is not supposed to contain any routines for doing stuff, it's base class, TDataset has them all. The idea is that you can change your dataset to another one, from a diferent database format and you don't have to change your code much, because the API is uniform. If you google for "freepascal TDataset" the first link is the documentation for TDataset

http://www.freepascal.org/docs-html/fcl/db/tdataset.html

I think that Insert is the method that you are looking for.

WalterK

  • New Member
  • *
  • Posts: 48
Any simple database working with records
« Reply #5 on: October 26, 2011, 01:39:38 am »
Thanks, but it doesn't even describe the interface (calling sequence).  I had to "google" to find what parameters InsertRecord took.

Didn't Delphi have a component which took the record size and a compare function to implement some sort of database?  Hopefully that's disk-backed, but at this point it's not a requirement... 

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3541
Re: Any simple database working with records
« Reply #6 on: October 26, 2011, 04:28:13 am »
Thanks, but it doesn't even describe the interface (calling sequence). I had to "google" to find what parameters InsertRecord took.

!? Did you try to just click on it? If you click in InsertRecord in the page that I showed you, it will go to:

http://www.freepascal.org/docs-html/fcl/db/tdataset.insertrecord.html

But it seams that InsertRecord is legacy stuff, like I said, you should use Insert

I added an explenation and an example of how to use this here:

http://wiki.lazarus.freepascal.org/Databases#Inserting_a_new_record

WalterK

  • New Member
  • *
  • Posts: 48
Re: TFixedDataset help
« Reply #7 on: October 26, 2011, 09:52:27 am »
Yes, I see that now.  I obviously need to take a break from this because my brain is, plain to anyone, "fried."

Thanks for the example.  I DO think more examples are good for those new to an area of freepascal (like databases).  There are enough examples in the RTL, for instance, but not much (that I've seen) elsewhere.

Thanks for your help and patience and I'm sorry if I've been a bother.

Easing off for a while...
« Last Edit: October 26, 2011, 10:00:36 am by WalterK »

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3541
Re: TFixedDataset help
« Reply #8 on: October 26, 2011, 10:12:33 am »
Thanks for your help and patience and I'm sorry if I've been a bother.

Not at all. The forum is for asking/answering stuff =)

 

TinyPortal © 2005-2018