pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <aklaver@comcast.net>
To: pgsql-odbc@postgresql.org
Cc: ning <mailxiening@gmail.com>
Subject: Re: Bound parameter is not substituted
Date: Thu, 16 Apr 2009 07:20:19 -0700
Message-ID: <200904160720.19407.aklaver@comcast.net> (raw)
In-Reply-To: <27f31620904160102j7668c947ta435601dd8751c6e@mail.gmail.com>
References: <27f31620904160102j7668c947ta435601dd8751c6e@mail.gmail.com>

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



view thread (5+ messages)  latest in thread

Message-ID: <200904160720.19407.aklaver@comcast.net>
Permalink:  ../200904160720.19407.aklaver@comcast.net/
Also on:    postgresql.org/message-id/200904160720.19407.aklaver@comcast.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-odbc@postgresql.org
  Cc: aklaver@comcast.net, mailxiening@gmail.com
  Subject: Re: Bound parameter is not substituted
  In-Reply-To: <200904160720.19407.aklaver@comcast.net>
  References: <27f31620904160102j7668c947ta435601dd8751c6e@mail.gmail.com> <200904160720.19407.aklaver@comcast.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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