[Chicago-talk] perl DBI ?

Pete Krawczyk mongers at bsod.net
Wed Mar 16 09:10:08 PST 2005


Subject: [Chicago-talk] perl DBI ?
From: Richard Reina <richard at rushlogistics.com>
Date: Wed, 16 Mar 2005 09:01:17 -0800 (PST)

}my $q = "CREATE TABLE IF NOT EXISTS CS_? (

You can't bind like that.  Binds can only be used in certain instances:
  SELECT item FROM table WHERE column = ?
  INSERT INTO table (item) VALUES (?)
  UPDATE table SET item = ? WHERE column = ?
...and in a few other cases, but never as keywords, and never as in:
  SELECT item FROM table WHERE column IN ?
  SELECT ? FROM table WHERE column = ?
  SELECT item FROM ? WHERE column = ?
  SELECT item FROM table WHERE ? = ? 

Although, you could do:
  SELECT item FROM table WHERE column IN (?,?)
...and supply multiple bind variables.

But you can't keyword binds, and binds can't be generally be used to 
express nulls (i.e 'column = ?',undef is not the same as 'column IS NULL')

See "Placeholders and Bind Values" in "perldoc DBI".

-Pete K
-- 
Pete Krawczyk
  perl at bsod dot net



More information about the Chicago-talk mailing list