![]() |
|
go ahead... be a heretic | |
PerlMonks |
"stale data": mysql, ima-dbi, modperl, masonby rkg (Hermit) |
on Dec 26, 2003 at 17:39 UTC ( #317103=perlquestion: print w/replies, xml ) | Need Help?? |
rkg has asked for the wisdom of the Perl Monks concerning the following question:
Hi folks --
Yet again I am puzzled and turn to the generous and wise folks here for help. Can anyone offer suggestions? I am not sure if my problem is perl, mod_perl, mason, mysql, ima::dbi ..... Here's my situation: I seem to be pulling "stale" data from a mysql table. I am running a query select max(ymdhms) from downloadevent. If I run this though mason and Ima::DBI, I get "stale" data -- that is, rows added since the last apache restart don't get considered.
If I run the query thru Ima::DBI via a command line perl -M -e, I get the correct answer. If I run the query through a sql tool, I get the correct answer. If I run the query through mason and ima::dbi, I get the incorrect answer. If I restart apache, I then get the correct answer. (A clue, I think.) More details: The app uses activestate perl 5.8.2, mason 1.25, Apache 1.3.29 (Win32), and mod_perl 1.29_01-dev. The IMA::DBI statement handle looks like this: which I display in Mason like this My problem is that the data seems to come back "stale" -- if newer rows (which have ymdhms greater than anything in the table) have been added to rktrack.downloadevent since the last time the Apache restarted, mason / ima::dbi doesn't see them. So I figure something is getting cached, so foe debugging I opted to mangle to query temporarily to ensure it changes on each call: Note how I've appended the time to field to ensure it changes. When I display the mason page with this change, mangle field shows the stale downloadevent with the fresh (changing!) time. This indicates to me that the problem is in the database, perhaps. And if I run from the database query tool, I get the correct (the fresh) downloadevent. And if I run the Ima::DBI query from the command line, I get the correct (the fresh) downloadevent. I added the "0" to the end of the set_sql to indicate no caching (yes?); I tried adding a dummy placeholder parameter to see if the problem was execute w/o bind values... I tried issuing "commits" from the sql tool; I tried closing the connection that did the insert (just to make sure the insert really hit the database -- it did.) .... no luck. The ima::dbi / mason query doesn't see new inserts into downloadevent until the apache restarts. I think perhaps I am missing something basic about the database here.... Any suggestions, wise monks?
Back to
Seekers of Perl Wisdom
|
|