Loading ...
Sorry, an error occurred while loading the content.

Re: Difference between passing "?" versus ":1", ":2", ":3" etc in prepare in Perl DBI !

Expand Messages
  • Amit Saxena
    ... Thanks for the help. I am not clear with both of them. Regards, Amit Saxena [Non-text portions of this message have been removed]
    Message 1 of 2 , Nov 2, 2008
    • 0 Attachment
      On Mon, Nov 3, 2008 at 11:43 AM, Chas. Owens <chas.owens@...> wrote:

      > On Mon, Nov 3, 2008 at 00:58, Amit Saxena <learn.tech123@...> 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


      [Non-text portions of this message have been removed]
    Your message has been successfully submitted and would be delivered to recipients shortly.