Re: bind_param for named parameters - clarification sought

Tim Bunce <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.sybase.devel
Message-ID <[email protected]>
On Tue, May 13, 2008 at 01:20:14PM +0100, Martin Evans wrote:
> Tim,
>
> In the thread "problem with DBD::ODBC and placeholders [SEC=UNCLASSIFIED]" 
> on dbi-users recently you said:
>
> > Drivers that support named placeholders like ":N" where N is an
> > integer, could support both forms of binding: bind_param(":1",$v) and
> > execute($v)
> > It's not dis-allowed. Driver docs should clarify this issue.
>
> Is it really your intention that to bind named parameter "fred" as in the 
> SQL "insert into xxx values(:fred)" you call bind_param(":fred",$v)?

That's the way DBD::Oracle has always done it.

> As it happens DBD::ODBC has a bug in its support of named parameters (other 
> than :1, :2 etc) which means it did not work at all but it ALSO expects the 
> name parameter ":fred" above to be passed to bind_param as "fred" i.e. the 
> leading ':' is treated as an introducer and not part of the parameter name. 
> I believe, but am prepared to be put right, other non-perl database drivers 
> also drop the ':' when binding.

Any other driver authors/users care to comment?

> As it didn't work before I can change it to be either - just let me know.

I guess the colon could be made optional without any harm.

Tim.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.