Thanks a lot Andrew !!

It never occurred to me but you were absolutely correct.

In my connect I turned off auto-commit.  Maybe that had some bearing on the
behaviour.

Anyway, my solution was to simply issue a rollback immediately before
polling the table of interest.  Works !!

Thanks for taking the time to respond.  You saved me a ton of frustration.

Cheers,

Steve

On Tue, Apr 24, 2012 at 4:46 AM, Andrew Sigmund <asigm...@altera.com> wrote:

> 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:stbald...@multiservice.com]
> 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.
>
>


---------------------------------------------------------------------------------------
This email is intended solely for the use of the addressee and may
contain information that is confidential, proprietary, or both.
If you receive this email in error please immediately notify the
sender and delete the email.
---------------------------------------------------------------------------------------

Reply via email to