Page 1 of 1

Perform INSERT ... RETURNING statement using IZStatement?

Posted: 14.01.2017, 00:17
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?

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

Posted: 15.01.2017, 23:51
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

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

Posted: 16.01.2017, 12:27
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.

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

Posted: 17.01.2017, 08:45
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

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

Posted: 17.01.2017, 14:24
by angusj
OK, thanks again.