pg.ddx.io pgsql-odbc@postgresql.org mailing list archive
help / color / mirror / Atom feedADO, set returning functions, ms acccess
3+ messages / 3 participants
[nested] [flat]
* ADO, set returning functions, ms acccess
@ 2006-10-02 17:42 brian stapel <brians_224@hotmail.com>
2006-10-03 02:26 ` Re: ADO, set returning functions, ms acccess Andreas <maps.on@gmx.net>
0 siblings, 1 reply; 3+ messages in thread
From: brian stapel @ 2006-10-02 17:42 UTC (permalink / raw)
To: pgsql-odbc
Thanks for your time...
I've written a plpgsql function that produces a recordset (i think):
CREATE OR REPLACE FUNCTION "public"."function_name" (int integer) RETURNS SETOF "public"."tbl_nm" AS$body$/* New function body */DECLARE rec public.tbl_nm; BEGIN FOR rec IN select * from tbl_nm where id <> int LOOP RETURN NEXT rec; END LOOP; END;$body$LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;
When I execute the function from the sql editor, it produces the desired results. select * from function_name(1);
When I try to incorporate this function into my ado application, it doesn't seem to return a recordset.
Dim objCnn As ADODB.Connection Dim cmd As ADODB.Command Dim rs As ADODB.Recordset Set objCnn = data_layer.Open_ConnectPostGRESql(objCnn) Set cmd = New ADODB.Command cmd.ActiveConnection = objCnn cmd.CommandText = "Select * from function_name(1);" Set rs = cmd.Execute
rs record count is -1.
Can you help?
_________________________________________________________________
Express yourself - download free Windows Live Messenger themes!
http://clk.atdmt.com/MSN/go/msnnkwme0020000001msn/direct/01/?href=http://imagine-msn.com/themes/vibe... =
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: ADO, set returning functions, ms acccess
2006-10-02 17:42 ADO, set returning functions, ms acccess brian stapel <brians_224@hotmail.com>
@ 2006-10-03 02:26 ` Andreas <maps.on@gmx.net>
2006-10-03 08:36 ` Re: ADO, set returning functions, ms acccess Sim Zacks <sim@compulab.co.il>
0 siblings, 1 reply; 3+ messages in thread
From: Andreas @ 2006-10-03 02:26 UTC (permalink / raw)
To: brian stapel <brians_224@hotmail.com>; +Cc: pgsql-odbc
brian stapel schrieb:
>
> When I try to incorporate this function into my ado application, it
> doesn't seem to return a recordset.
> [...]
>
> rs record count is -1.
I write without any testing or even looking at your stuff.
At least the 8.1.xx ODBC driver didn't support the recordcount of
returned recordsets.
It showed -1 regardless how many records were produced.
Try to read the recordset anyway and catch EOF to prevent a runtime-error.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: ADO, set returning functions, ms acccess
2006-10-02 17:42 ADO, set returning functions, ms acccess brian stapel <brians_224@hotmail.com>
2006-10-03 02:26 ` Re: ADO, set returning functions, ms acccess Andreas <maps.on@gmx.net>
@ 2006-10-03 08:36 ` Sim Zacks <sim@compulab.co.il>
0 siblings, 0 replies; 3+ messages in thread
From: Sim Zacks @ 2006-10-03 08:36 UTC (permalink / raw)
To: pgsql-odbc
Aside from recordcount not working, your function wouldn't work from
the sql editor either because you don't have a final return statement.
Also, does Execute return a recordset or do you need to call an Open
function?
Sim
________________________________________________________________________________
brian stapel schrieb:
>
> When I try to incorporate this function into my ado application, it
> doesn't seem to return a recordset.
> [...]
>
> rs record count is -1.
I write without any testing or even looking at your stuff.
At least the 8.1.xx ODBC driver didn't support the recordcount of
returned recordsets.
It showed -1 regardless how many records were produced.
Try to read the recordset anyway and catch EOF to prevent a runtime-error.
---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?
http://archives.postgresql.org
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2006-10-03 08:36 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-10-02 17:42 ADO, set returning functions, ms acccess brian stapel <brians_224@hotmail.com>
2006-10-03 02:26 ` Andreas <maps.on@gmx.net>
2006-10-03 08:36 ` Sim Zacks <sim@compulab.co.il>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox