[Libpqxx-general] Calling 'stored procedures' and capturing results
Christian von Kietzell
christian at vonkietzell.de
Tue Jan 19 04:15:37 UTC 2010
Hi,
Am Montag, den 18.01.2010, 20:34 -0500 schrieb Alex Milstead:
> I've created some PL/pgSQL functions on my db back-end, and I'd like to
> call them from the C++ app I'm writing to interface with it. Some of
> these functions return values, while others don't. I can call the
> functions just fine, but capturing the results is where I'm having the
> issue.
>
> How am I supposed to properly call the stored functions and subsequently
> capture their return values?
Isn't that like retrieving the value of any other SQL query? For
example:
pqxx::result res = t.exec("SELECT my_proc(some_argument)");
or
res = t.exec("SELECT * FROM my_proc(some_argument)");
// for procedures that return setof something
Where t is a transaction object. You can then access the values in the
result set using the "res[row][column]" syntax.
Unless I missed something (certainly a possibility) there's no special
way to call stored procedures.
Kind regards,
Chris
More information about the Libpqxx-general
mailing list