Page 1 of 1

Documentation with examples, reference manual

Posted: Wed 28 Oct 2009 11:40
by liebehenz
Hello!

Has somebody an idea, where i can get an excellent documentation with examples about pg_query, pg_table, tfields and database-programming?

The documentation in delphi2009 is... uggly. No examples and else.

Currently i try -something "easy"- like "to copy one record from Database A, table B to Database B table b with same definition.
This costs much time and is very inefficient. try and error. And drives me crazy. That must be easier to go.

And I am not an beginner!

---
self.PgTable_mts.Append;

// for i := 0 to self.PgTable_mts.Fields.Count - 1 do begin
// if self.PgTable_mts.Fields.FieldName = 'be_seq' then begin
// // self.PgQuery2.SQL.Append('be_seq='+inttostr(sequence));
// end else
// self.PgTable_mts.Fields.Value := self.PgTable_tmp_mts.Fields.Value;
// end; //for
self.PgTable_mts.FieldByName('be_diag').Value := '1';

self.PgTable_mts.Post;


thank you for answering me.

Posted: Thu 29 Oct 2009 08:11
by Plash
There is no simple method to copy a record from one dataset to another. You should copy all fields values in a loop as you are doing.

If you need to copy the entire dataset to another database, you can use TPgLoader or TCRBatchMove components.

Posted: Tue 03 Nov 2009 17:42
by liebehenz
Yes.

But the greater problem was to FIND out that

Code: Select all

PgTable.ApplyUpdates;
was right and

Code: Select all

PgTable.Post 
was wrong.

Do you understood my problem? :oops:
I need some hint thought the 100 possible methods and properties.

thanks for answering me.

Posted: Wed 04 Nov 2009 09:45
by Plash
We don't have any tutorial about using data access components. You can find information about using standard components like BDE, ADO or dbExpress in the Internet. PgDAC has the same interface as standard components. So you can use this information when working with PgDAC.

You need to call the Post method anyway. If you have enabled CachedUpdates mode, you need to call ApplyUpdates after you post some records.

Posted: Thu 05 Nov 2009 23:46
by dschuch
the delphi help is very good to lern the basics.

look for tdataset.

daniel

Posted: Mon 09 Nov 2009 19:52
by snorkel
They key to working with postgresql and inserting a bunch of records from one db to another is to do it like you are doing, but to get speed you need to start a transaction on the database you are inserting into and do a commit like every 1000 records, this will speed it up by a large margin.
By default Postgresql will do a autocommit on each insert you do and this can cause a big performance hit.

You may not be doing the inserts yourself, but the library is doing them for a append. Doing a post or apply updates does not commit the transaction.