in reply to Re: Perl/SQL Query
in thread Perl/SQL Query
Also, methods are not interpolated inside quotes, so $error will not be set to what you think it should be. LIMIT is not portable (the OP didn't mention which database, so this at least is a nitpick). Lastly, $rv is only set to the number of rows affected on non-select statements. Some DBD's might set it to the number of rows selected (I remember a thread about DBD::SQLite recently where the behavior was changing), but that is not necessarily the case. The only reliable way to know the number of rows selected is to fetch and count each one.my $sth = $dbh->prepare("select ... where column like ?"); my $rv = $sth->execute("%$argument%");
|
|---|