Skip site navigation (1) Skip section navigation (2)

Re: Bound parameter is not substituted

From: Adrian Klaver <aklaver(at)comcast(dot)net>
To: pgsql-odbc(at)postgresql(dot)org
Cc: ning <mailxiening(at)gmail(dot)com>
Subject: Re: Bound parameter is not substituted
Date: 2009-04-16 14:20:19
Message-ID: 200904160720.19407.aklaver@comcast.net (view raw or flat)
Thread:
Lists: pgsql-odbc
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(at)comcast(dot)net

In response to

pgsql-odbc by date

Next:From: ningDate: 2009-04-17 05:52:44
Subject: Re: Bound parameter is not substituted
Previous:From: Tom LaneDate: 2009-04-16 14:07:15
Subject: Re: Bound parameter is not substituted

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group