On Mon, 31 Mar 2003 12:41:48 -0500 Ronald J Kimball <[EMAIL PROTECTED]> wrote:
> On Mon, Mar 31, 2003 at 11:42:37AM -0600, Michael Muratet wrote: > > > I have discovered that it is the placement of single quotes around the > > key value in the query: > > > > > my $rth = $dbh->prepare("SELECT * FROM demographics_1 WHERE > > > KEY1=$key"); > > > > that makes the difference. The above takes 90 secs. > > > > The below takes milliseconds (as it does from the command line): > > > > > my $rth = $dbh->prepare("SELECT * FROM demographics_1 WHERE > > > KEY1='$key'"); > > > > Without the single quotes, the command line interface will tell you that > > you have a bogus column name. I guess the DBI interface is able to > > figure it out, but it takes awhile. > > What is the value of $key? > > Anyway, you should probably be using placeholders. Or if placeholders are absolutely unavailable, $dbh->quote(). Both are described in the fine DBI manual. -- Mac :}) ** I normally forward private questions to the appropriate mail list. ** Ask Smarter: http://www.catb.org/~esr/faqs/smart-questions.html Give a hobbit a fish and he eats fish for a day. Give a hobbit a ring and he eats fish for an age.