Perform INSERT ... RETURNING statement using IZStatement?

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

Perform INSERT ... RETURNING statement using IZStatement?

Postby angusj » 14.01.2017, 00:17

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
Gold Boarder
Gold Boarder
Posts: 571
Joined: 17.01.2011, 14:17

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

Postby marsupilami » 15.01.2017, 23:51

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?

Postby angusj » 16.01.2017, 12:27

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
Gold Boarder
Gold Boarder
Posts: 571
Joined: 17.01.2011, 14:17

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

Postby marsupilami » 17.01.2017, 08:45

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?

Postby angusj » 17.01.2017, 14:24

OK, thanks again.


Return to “ZeosLib 7.1 stable Forum”

Who is online

Users browsing this forum: Baidu [Spider] and 1 guest