NYCPHP Meetup

NYPHP.org

[nycphp-talk] when MySQL "rollback" doesn't

David Mintz dmintz at davidmintz.org
Tue Mar 23 16:04:30 EST 2004


I have a class that does some db access, and I have a subclass of it that
does some db access. Both classes use a reference to the same global
(PEAR) db_mysql instance.

A method in the subclass does some db stuff through an instance of its
parent, and then goes on if it works; if it fails I would like to roll
back, and return. And guess what: it doesn't roll back. In the method body
I am setting autocommit to 0, and saying "start transaction," and doing
everything right that I can think of.

I'm sparing you the code excerpt in the interest of brevity; it would be
hard to provide enough to show the full picture without abusing bandwidth
and patience. I'm hoping that just based on the above description someone
might catch something that I don't. Is there some subtle gotcha with
classes and objects in PHP4 that I'm running into? I'm working with 4.3.4
and Win2K and MySQL 4.0.13-max-nt-log.

I have tried making the relevant methods in both parent and child report
their connection id, and they say they are using the same connection id.

btw I have run little tests where I do stuff with the same tables, and
roll it back, but without using these objects/classes, and it works. So it
isn't something stupid like wrong table type.

Gratefully,


---
David Mintz
http://davidmintz.org/

        "Anybody else got a problem with Webistics?" -- Sopranos 24:17



More information about the talk mailing list