Re: Sigleton DB connection tripping on itself
| From: | Chris | Date: | Wed, 19 Jul 2006 07:57:08 +0000 |
| Subject: | Re: Sigleton DB connection tripping on itself | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-42232@lists.php.net to get a copy of this message | ||
Vandegrift, Ken wrote:
Well, I have a situation where an Order object holds a collection of LineItem objects and of course they all use the same DB connection via a singleton. The Order object has a method that creates new LineItem objects from an ORDER_DTL table. Code snippet: // SET ORDER ITEMS $stmt = $this->db->prepare($detailSQL); $stmt->execute(array(':orderid' => $orderID)); while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { $lineItem = new GCLineItem($row['item_id']); $lineItem->__set('quantity', $row['quantity']); $lineItem->__set('price', $row['price']); $this->items[] = $lineItem; }So the code you posted before has nothing to do with the problem? That makes it kinda hard to work out what's going on.
Within the while loop I am loading GCLineItem objects that themselves try to create a statement object which is where the error is triggered since both share the same DB connection and the statement objects trip over themselves.Code ? Just the constructor and load method should do.
I get an SQL error HY090 Buffer error...What sort of database is it? (I'm guessing db2, mssql or oracle). Not that it really matters of course. -- Postgresql & php tutorials http://www.designmagick.com/