Steve,
First, a caveat: I've never used mysql, so I could be totally off-base
here.
Perhaps this behavior is the result of some implicit transaction, so
the first SELECT begins a transaction, and the DBMS wants to present a
consistent view of the database (that is, return the same results), until the
transaction finishes, which it never does until you kill the program. If this
is true, then a simple work-around might be to wrap your SELECT statement in a
BEGIN TRAN and END TRAN, or mysql might have some way to "turn-off" the
implicit transaction.
Andy
-----Original Message-----
From: Steve Baldwin [mailto:[email protected]]
Sent: Monday, April 23, 2012 03:54
To: dbi users
Subject: Polling a table using DBD::mysql
Hi all,
This is driving me nuts.
I have a simple test case where I do something like this :
loop
select count(*) from some_table
sleep 2 seconds
end loop
My problem is that the count shows the number of rows the first time it
executes and from that point never changes.
While the program is running, I insert rows into the table from another
session but the count never changes. If I kill the program and restart it,
it shows the new count but again never changes.
Is this some quirk with mysql? It certainly doesn't behave that way using
DBD::Oracle.
I've tried several different methods of selecting the data but I always see
the same behaviour.
I'm using :
mysql version 5.5,
DBI version 1.609,
DBD::mysql version 4.013
Perl 5.10.1 (on Centos 6)
Thanks,
Steve
Confidentiality Notice.
This message may contain information that is confidential or otherwise
protected from disclosure. If you are not the intended recipient, you are
hereby notified that any use, disclosure, dissemination, distribution, or
copying of this message, or any attachments, is strictly prohibited. If you
have received this message in error, please advise the sender by reply e-mail,
and delete the message and any attachments. Thank you.