Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 3E63A634B13 for ; Thu, 16 Apr 2009 11:20:30 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 74185-03 for ; Thu, 16 Apr 2009 11:20:22 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from QMTA02.emeryville.ca.mail.comcast.net (qmta02.emeryville.ca.mail.comcast.net [76.96.30.24]) by mail.postgresql.org (Postfix) with ESMTP id 22402634A93 for ; Thu, 16 Apr 2009 11:20:21 -0300 (ADT) Received: from OMTA03.emeryville.ca.mail.comcast.net ([76.96.30.27]) by QMTA02.emeryville.ca.mail.comcast.net with comcast id gCAz1b00A0b6N64A2ELMDo; Thu, 16 Apr 2009 14:20:21 +0000 Received: from tucker.local ([24.17.164.54]) by OMTA03.emeryville.ca.mail.comcast.net with comcast id gELL1b0021Ak4z48PELLVh; Thu, 16 Apr 2009 14:20:20 +0000 From: Adrian Klaver To: pgsql-odbc@postgresql.org Subject: Re: Bound parameter is not substituted Date: Thu, 16 Apr 2009 07:20:19 -0700 User-Agent: KMail/1.9.10 Cc: ning References: <27f31620904160102j7668c947ta435601dd8751c6e@mail.gmail.com> In-Reply-To: <27f31620904160102j7668c947ta435601dd8751c6e@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200904160720.19407.aklaver@comcast.net> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200904/17 X-Sequence-Number: 9836 On Thursday 16 April 2009 1:02:56 am ning wrote: > Hello all, > > I am trying to create a stored function through ODBC connection, > But the parameter marker inside the function is not substituted. > In the following snippet, '?' is not substituted, and I got a syntax > error around it. > If I replace the '?' with '2', it is OK. > The psqlodbc I am using is 08.02.0400 together with unixODBC:2.2.12 on > OpenSUSE 10.3. > Is there a solution or workaround? > > Thank you. > > -------------- > std::stringstream ss; > ss << > "create or replace function plpgsql_setDocAttrs() returns > void as $$ " > "declare " > "pid integer; " > "begin " > "pid := ?; " // parameter marker > "end;" > "$$ language plpgsql volatile;" > "select plpgsql_setDocAttrs();"; > // prepare statement handler > Stmt stmt(); > // prepare the statement > stmt.prepare(ss.str()); > stmt.bindNextParameter( > SQL_PARAM_INPUT, > SQL_C_LONG, > SQL_INTEGER, > 0, > 0, > &id, > 0, > 0); > stmt.execute(); > --------------- > > ning Might want to take a look at this: http://www.commandprompt.com/blogs/joshua_drake/2009/04/escaping_data_madness/ -- Adrian Klaver aklaver@comcast.net