Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 55956476075 for ; Thu, 7 Nov 2002 21:38:43 -0500 (EST) Received: from sd.tpf.co.jp (sd.tpf.co.jp [210.161.239.34]) by postgresql.org (Postfix) with SMTP id DBB2E475A71 for ; Thu, 7 Nov 2002 21:38:41 -0500 (EST) Received: (qmail 16079 invoked from network); 8 Nov 2002 02:38:45 -0000 Received: from unknown (HELO viscomail.tpf.co.jp) (100.0.0.108) by sd2.tpf-fw-c.co.jp with SMTP; 8 Nov 2002 02:38:45 -0000 Received: from tpf.co.jp (3d_note1 [126.0.1.61]) by viscomail.tpf.co.jp (8.8.8+Sun/8.8.8) with ESMTP id LAA24297; Fri, 8 Nov 2002 11:38:43 +0900 (JST) Message-ID: <3DCB2403.5D37C42B@tpf.co.jp> Date: Fri, 08 Nov 2002 11:40:03 +0900 From: Hiroshi Inoue X-Mailer: Mozilla 4.73 [ja] (Windows NT 5.0; U) X-Accept-Language: ja MIME-Version: 1.0 To: Valerio Ferrucci Cc: pgsql-odbc@postgresql.org Subject: Re: Calling a function via ODBC References: Content-Type: text/plain; charset=iso-2022-jp Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200211/33 X-Sequence-Number: 2210 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/