pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Calling a function via ODBC
3+ messages / 2 participants
[nested] [flat]

* Calling a function via ODBC
@ 2002-11-06 16:36  Valerio Ferrucci <valfer@flashnet.it>
  0 siblings, 1 reply; 3+ messages in thread

From: Valerio Ferrucci @ 2002-11-06 16:36 UTC (permalink / raw)
  To: pgsql-odbc

Hi,
I have postgres installed on my Machine (MacOSX) and connect to it via 
ODBC from my C app.
All works ok (select, insert, update and so on).

Now I made the following simple function:
CREATE OR REPLACE FUNCTION concat_text (TEXT, TEXT) RETURNS TEXT AS '
	BEGIN
		RETURN $1 || $2;
	END;
' LANGUAGE 'plpgsql';

and called it succesfully doing:
SQLExecDirect(... ""select concat_text('val', 'erio')"" ...)
and fetching the result with SQLFetchScroll etc..., all works ok.

SO WHICH IS THE QUESTION?
THE QUESTION IS:
Is there a way to call my func using the ODBC syntax:
{? =  CALL concat_text(?, ?)}
using SQLBindParameter to bind variable (input/output) to '?' and 
getting return value directly in a bound var (without any Fetch) (see 
http://www.ddart.net/mssql/sql70/odbcht10_1.htm )?

Does someone have an example in using SQLBindParameter to set parameter 
IN and get return value OUT?

Thanks for help
==================================================================
Valerio Ferrucci                        Tabasoft Sas
ferrucci@tabasoft.it                    http://www.tabasoft.it

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Calling a function via ODBC
@ 2002-11-08 02:40  Hiroshi Inoue <Inoue@tpf.co.jp>
  parent: Valerio Ferrucci <valfer@flashnet.it>
  0 siblings, 1 reply; 3+ messages in thread

From: Hiroshi Inoue @ 2002-11-08 02:40 UTC (permalink / raw)
  To: Valerio Ferrucci <valfer@flashnet.it>; +Cc: pgsql-odbc

Valerio Ferrucci wrote:
> 
> Hi,
> I have postgres installed on my Machine (MacOSX) and connect to it via ODBC from my C app.
> All works ok (select, insert, update and so on).
> 
> Now I made the following simple function:
> CREATE OR REPLACE FUNCTION concat_text (TEXT, TEXT) RETURNS TEXT AS '
> BEGIN
> RETURN $1 || $2;
> END;
> ' LANGUAGE 'plpgsql';
> 
> and called it succesfully doing:
> SQLExecDirect(... ""select concat_text('val', 'erio')"" ...)
> and fetching the result with SQLFetchScroll etc..., all works ok.
> 
> SO WHICH IS THE QUESTION?
> THE QUESTION IS:
> Is there a way to call my func using the ODBC syntax:
> {? = CALL concat_text(?, ?)}
> using SQLBindParameter to bind variable (input/output) to '?'
> and getting return value directly in a bound var (without any
> Fetch) (see http://www.ddart.net/mssql/sql70/odbcht10_1.htm )?

Yes. As for your example, bind the 1st parameter
as SQL_PARAM_OUTPUT and 2nd/3rd paramters as SQL_
PARAM_INPUT.

regards,
Hiroshi Inoue
	http://w2422.nsk.ne.jp/~inoue/



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Calling a function via ODBC
@ 2002-11-08 07:29  Valerio Ferrucci <valfer@flashnet.it>
  parent: Hiroshi Inoue <Inoue@tpf.co.jp>
  0 siblings, 0 replies; 3+ messages in thread

From: Valerio Ferrucci @ 2002-11-08 07:29 UTC (permalink / raw)
  To: Hiroshi Inoue <Inoue@tpf.co.jp>; +Cc: pgsql-odbc

Can you point me to some C examples?
Thanks

>?Valerio Ferrucci wrote:
>>
>>  Hi,
>>  I have postgres installed on my Machine (MacOSX) and connect to it 
>>via ODBC from my C app.
>>  All works ok (select, insert, update and so on).
>>
>>  Now I made the following simple function:
>>  CREATE OR REPLACE FUNCTION concat_text (TEXT, TEXT) RETURNS TEXT AS '
>>  BEGIN
>>  RETURN $1 || $2;
>>  END;
>>  ' LANGUAGE 'plpgsql';
>>
>>  and called it succesfully doing:
>>  SQLExecDirect(... ""select concat_text('val', 'erio')"" ...)
>>  and fetching the result with SQLFetchScroll etc..., all works ok.
>>
>>  SO WHICH IS THE QUESTION?
>>  THE QUESTION IS:
>>  Is there a way to call my func using the ODBC syntax:
>  > {? = CALL concat_text(?, ?)}
>>  using SQLBindParameter to bind variable (input/output) to '?'
>>  and getting return value directly in a bound var (without any
>>  Fetch) (see http://www.ddart.net/mssql/sql70/odbcht10_1.htm )?
>
>Yes. As for your example, bind the 1st parameter
>as SQL_PARAM_OUTPUT and 2nd/3rd paramters as SQL_
>PARAM_INPUT.
>
>regards,
>Hiroshi Inoue
>	http://w2422.nsk.ne.jp/?inoue/


-- 
==================================================================
Valerio Ferrucci                        Tabasoft Sas
ferrucci@tabasoft.it                    http://www.tabasoft.it



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2002-11-08 07:29 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-11-06 16:36 Calling a function via ODBC Valerio Ferrucci <valfer@flashnet.it>
2002-11-08 02:40 ` Hiroshi Inoue <Inoue@tpf.co.jp>
2002-11-08 07:29   ` Valerio Ferrucci <valfer@flashnet.it>

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