TPgTable.RefreshOptions (roAfterInsert)

Discussion of open issues, suggestions and bugs regarding PgDAC (PostgreSQL Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
yapt
Posts: 69
Joined: Mon 16 Mar 2009 12:06

TPgTable.RefreshOptions (roAfterInsert)

Post by yapt » Thu 16 Apr 2009 18:04

Why if I set PgTable.RefreshOptions to true I got an:

Exception
Invalid parameters specified

After a PgTable.Post ???

What I should configure/set to let this option runs fine ?

Greetings.

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Fri 17 Apr 2009 13:23

Are you assigning a value to the primary key before posting or you are using SERIAL column? If you don't set the primary key value, new record cannot be refreshed.

yapt
Posts: 69
Joined: Mon 16 Mar 2009 12:06

Post by yapt » Fri 17 Apr 2009 15:33

Sorry Plash, I forgot to clarify this.

My structrure was:
TableClients
MasterDetail
TableInvoices
MasterDetail
TableInvoiceLines

I was appending (on a transaction):
TableInvoices and (one or more lines) TableInvoiceLines.

But TableClients, in spite of was changing to the right client on application (TableInvoices.Append), was being pointed to old selected TableClients (clientId).

All was fine until post TableInvoices was executed. Then, TableInvoices selected record was returning to the set of TableClients (selected client).

Summary:
There was a bug.

But the error message showed by the refresh was not very clear. Perhaps an extended error message would be better. Ie: "record cannot be found (or refreshed) with this keys: .....,....,....,.....".

Thanks.

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Tue 21 Apr 2009 07:36

As I understand you add records to the detail table that do not match the key of the master table. So after you call Post these records disappear. You cannot refresh such record because it does not exist in the dataset.

yapt
Posts: 69
Joined: Mon 16 Mar 2009 12:06

Post by yapt » Tue 21 Apr 2009 09:15

yapt wrote: Summary:
There was a bug.
Yes, I was meaning "There was a bug ON MY OWN source code".

Thanks...

Post Reply