On Mon, Nov 3, 2008 at 11:43 AM, Chas. Owens <[EMAIL PROTECTED]> wrote:

> On Mon, Nov 3, 2008 at 00:58, Amit Saxena <[EMAIL PROTECTED]> wrote:
> > Hi
> >
> > What's the difference between passing "?" versus ":1", ":2", ":3" etc in
> > prepare in Perl DBI ?
> >
> > For example, what's the difference between following two scenarios :-
> >
> > *Scenario 1*
> >
> > $sth = $dbh->prepare("insert into tablename values (:1, :2, :3)");
> >
> > $sth->execute($var1,$var2,$var3);
> >
> > *Scenario 2*
> >
> > $sth = $dbh->prepare("insert into tablename values (?, ?, ?)");
> >
> > $sth->execute($var1,$var2,$var3);
> >
> > Thanks & Regards,
> > Amit Saxena
> >
>
> from
> http://search.cpan.org/~timb/DBI-1.607/DBI.pm#Placeholders_and_Bind_Values<http://search.cpan.org/%7Etimb/DBI-1.607/DBI.pm#Placeholders_and_Bind_Values>
>   Some drivers also allow placeholders like :name and :N (e.g., :1,
> :2, and so on) in
>   addition to ?, but their use is not portable.
>
>   If the :N form of placeholder is supported by the driver you're
> using, then you
>   should be able to use either "bind_param" or "execute" to bind
> values. Check your
>   driver documentation.
>
> --
> Chas. Owens
> wonkden.net
> The most important skill a programmer can have is the ability to read.
>


Thanks for the help.

I am not clear with both of them.

Regards,
Amit Saxena

Reply via email to