Hello Devart,
We are making an infrastructure change in an old application. We decided to replace an old database with PostgreSQL and use UniDAC as a data access component. Our processes such as updating the components and transferring the database are finished. Therefore, we want to detect differences in sql clauses and if there is any, and update the infrastructure of the application without any problem.
Let me talk about the problem; When we add a record with a Unidac object (Unitable or Uniquery), the ID value of this record is not returned to us. We tried your recommendations in several places on this issue, but some of these recommendations did not work, others were very difficult to implement in accordance with the codes of our project. In the case of an append / insert, as our request was done in the old database, auto inc. return the value of the field. In this way, we will get rid of this problem that occurs in most parts of our project. We request your help in this regard. I've prepared a test for you. Please read the codes found in that test and the ReadMe section.
My Version Information:
IDE: Delphi 10.4
Unidac: 8.3.2
Database: PostgreSQL 12
Removed test case!
P.S: Test application was created with native components.
Thank you,
Best Regards.
UniDAC - ID Capture on PostgreSQL Record Insertion
-
- Posts: 10
- Joined: Fri 12 Feb 2021 10:25
UniDAC - ID Capture on PostgreSQL Record Insertion
Last edited by HalilHanBADEM on Mon 01 Mar 2021 06:54, edited 1 time in total.
Re: UniDAC - ID Capture on PostgreSQL Record Insertion
Hello,
Please accept our sincere apologies caused by the delay in response.
You can use this code to get the value of the new primary key:
wbr, Oleg
Devart Team
Please accept our sincere apologies caused by the delay in response.
You can use this code to get the value of the new primary key:
Code: Select all
UniTable1.DMLRefresh:=True;
UniTable1.Options.RequiredFields := False;
UniTable1.Open;
UniTable1.Append;
UniTable1.Post;
ShowMessage(UniTable1.FieldByName('id').AsString); // New ID
Devart Team