Re: Sigleton DB connection tripping on itself

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux