in reply to DBI and like statment

I think that seeing more of the actual code would be helpful. The question is, why is your DBD::CSV::Statement object not a valid SQL::Statement object?

It may be that $query contains some metacharacter that is causing problems. Using either $dbh->quote() or placeholders will avoid this problem: my $sql = "select title from $TABLE2 where astype like " . $dbh->quote("%$query"); I generally prefer using placeholders:

my $sql = "select title from $TABLE2 where astype like ?"; my $sth = $dbh->prepare($sql) or die "Cannot prepare: " . $dbh->errstr +(); $sth->execute("%$query") or die "Cannot execute: " . $sth->errstr();
Note that, if you use a placeholder, the placeholder must substitute for the entire string being matched, including any wildcards.

P.S. $ and @ interpolate in double-quoted strings, but % does not.

Replies are listed 'Best First'.
Re: Re: DBI and like statment
by sixcolors (Initiate) on May 31, 2001 at 08:49 UTC
    Actualy that one I figured out... it was pulling info from one db and then using it to ret data from another... the issue that was causing the error was Taint... so I did $astype =~ /(.*)/; and then it worked also to fix the % issue I did $whatever = "\%" . $whatever . "\%";