Re: [PHP-DB] Sigleton DB connection tripping on itself

2006-07-19 Thread Chris

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



Re: [PHP-DB] Sigleton DB connection tripping on itself

2006-07-18 Thread Chris

Vandegrift, Ken wrote:

Good Day List,
 
I have a singleton DB connection that I am trying to use throughout my

application but It keeps tripping on itself.
 
My main question is: If I am in the middle of a transaction can I

prepare multiple statements eand execute them or will this cause an
error?


There's no reason why it can't. However, if any of those queries fail 
the whole transaction will get rolled back.


What errors are you getting?

--
Postgresql & php tutorials
http://www.designmagick.com/

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