Re: Polling a table using DBD::mysql

Michael Ludwig <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.general
Message-ID <20120423193407.GI5168@Dago>
Steve Baldwin schrieb am 23.04.2012 um 20:53 (+1000):
> 
> 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.

Try setting AutoCommit => 1 to run each statement in its own
transaction. This should be the default, though.

https://metacpan.org/module/DBI#AutoCommit

Michael
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.