I have a perl script that generates a user report for our site by hitting the MySQL database. Normally, I would use straight SQL to generate the report, but that query takes FOREVER because you wind up joining a particular table to itself several times. (For the record, I didn't design this, we're using drupal.)
Now, the report runs fine on the test and staging servers. However, when I move to the production server, there is a problem. At one point, I build a query to his the user profile tables to grab a value for the user:
# Open cursor $imm_qy = "SELECT pv.value FROM profile_values pv, profile_fields pf + WHERE pv.uid = $uid and pv.fid = pf.fid and pf.name = 'profile_magaz +ine'"; print "\$imm_qy is $imm_qy .\n"; $immh = $dbh->prepare($imm_qy) or die "Cannot prepare magazine query +: " . $dbh->errstr . "\n"; # Execute query $immh->execute or die "Cannot execute magazine query: " . $dbh->errs +tr . "\n"; $imm = $immh->fetchrow_array; $immh->finish; print "For uid of $uid, \$imm is $imm .\n";
Note: the prints are in there to make sure that I'm acutally building these queries correctly, and apparently I am:
imm_qy is SELECT pv.value FROM profile_values pv, profile_fields pf WH +ERE pv.uid = 17 and pv.fid = pf.fid and pf.name = 'profile_magazine' + . For uid of 17, $imm is .
This is odd, because $imm should have a value at this point. In fact, if I go into a mysql session and copy-and-paste that command, I get the value of '1'. But for some users, it returns nothing. And here's the kicker: it's always the same users and it is 100% repeatable. So it must be an environment issue between the machines.
The test and staging server are identical, using Perl 5.8.6; MySQL Ver 14.7 Distrib 4.1.20, for redhat-linux-gnu (i386) using readline 4.3; and the same version of Red Hat Linux. Ditto for the production server. The only difference I can find is that the production server is using 1.50 of DBI, while the test and staging servers are using 1.48. Now, does ANYONE know of ANYTHING between 1.48 and 1.50 of DBI that *might* cause something like this? I am absolutely at a loss.
Thanks in advance.
--
tbone1, YAPS (Yet Another Perl Schlub)
And remember, if he succeeds, so what.
- Chick McGee
In reply to DBI and MySQL issue by tbone1
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |