I'm having trouble getting the like clause to work. It seems to work fine in
the MySQL Control Center 9.4.beta. I'm using MySQL 4.0.23-debug.
use DBH;
my $sth = DBH->prepare("SELECT 'David!' LIKE '%D%v%'");
$sth->execute();
my $row;
print join(@$row,",")."\n" while ($row = $sth->fetch);
This does not print a "1" in perl. It just prints a ",".
I've posted a query on this in [EMAIL PROTECTED] with no luck.
Anybody have any suggestions?
Thanks,
Siegfried
Here is DBH.pm. Below that is my original post in [EMAIL PROTECTED]
package DBH;
use DBI;
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT = qw(DBH); # Symbols to be exported by default
our @EXPORT_OK = qw(); # Symbols to exported by request
our $VERSION = 0.1;
our $dbh;
sub DBH{
unless ( $dbh && $dbh->ping ) {
$dbh = DBI->connect ( 'dbi:mysql:dbname=hotjobs;host=SALES', 'xyz',
'xyz' ) ;
die DBI->errstr unless $dbh && $dbh->ping;
}
return $dbh;
}
1;
----------------------------------------------------------------------------
--------------------------------------------------------
The following code works with Activestate perl 8.4/MySQL. If I comment the
second line, however, it does not work. No error messages and no results.
If I use the MySQL Enterprise console and type in my first SELECT statement
that includes the LIKE clause, it works.
I'm stumped. There must be something strange with that "%", but I cannot
figure it out.
Anyone got any suggestions?
Siegfried
my $sJobTitle = "SELECT sName FROM keywords ORDER BY sName WHERE sName LIKE
'%'";
$sJobTitle = q[SELECT sName FROM keywords ORDER BY sName];
my $sth = DBH->prepare($sJobTitle);
$sth->execute();
my $row;
while ($row = $sth->fetch){
push @sResult,"<li>".join( "", @$row)."</li>\n";
}
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]