Perform INSERT ... RETURNING statement using IZStatement?

The official tester's forum for ZeosLib 7.1. Ask for help, post proposals or solutions.
Post Reply
angusj
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: 05.01.2017, 01:01

Perform INSERT ... RETURNING statement using IZStatement?

Post by angusj »

I'm a newbie to ZeosLib so apologies if this is the wrong forum for this post.

I'm able to perform an "INSERT INTO table (...) VALUES (...) RETURNING oid" statement using a TZquery component, but is this possible using an IZStatement or IZPreparedStatement instead?
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1956
Joined: 17.01.2011, 14:17

Re: Perform INSERT ... RETURNING statement using IZStatement?

Post by marsupilami »

Hello angusj,

TZQuery usually should already be doing this - if your Zeos already supports this with your database. In principle this should also be possible with an IZPrepared statement. But you will not have the simple data bindiung suport of TDataset then.

With best regards,

Jan
angusj
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: 05.01.2017, 01:01

Re: Perform INSERT ... RETURNING statement using IZStatement?

Post by angusj »

Hi Jan. Thanks for replying.
marsupilami wrote:TZQuery usually should already be doing this
Yes, it is but I just need to know the OID that's returned by an INSERT statement (using a Postgresql database) but without the overhead of a TDataset component, and I can't find a way to do that.
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1956
Joined: 17.01.2011, 14:17

Re: Perform INSERT ... RETURNING statement using IZStatement?

Post by marsupilami »

Hello angusj,

in that case you usually create an IZStatement or IZPreparedStatement, call ExecuteQuery or ExecuteQueryPrepared and see if you get an IZResultSet. Your best bet in that case is to check the JDBC specification for help then because the ZDBC layer still is a port of the JDBC API to Object Pascal. Also see this link: http://archive.li/KOWz5

It might be a good idea to resurrect that archived article and move it into the SourceForge Knowledge Base...

With best regards,

Jan
angusj
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: 05.01.2017, 01:01

Re: Perform INSERT ... RETURNING statement using IZStatement?

Post by angusj »

OK, thanks again.
Post Reply