note 104954 deleted from book.mysql by danbrown
| From: | danbrown@php.net | Date: | Mon, 18 Jul 2011 18:17:03 +0000 |
| Subject: | note 104954 deleted from book.mysql by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-181672@lists.php.net to get a copy of this message | ||
Note Submitter: spark at limao com br
----
I've created 2 classes, the first one is MySQL, it has a private attribute called link, the
other one is called Result, and has a private attribute of the same name.
In the first class there's a private method that uses mysql_error and mysql_errno to assemble a
message and throw an Exception with it. The method is called everytime the class "talks"
to the database and something returns false when it shouldn't. Also it's constructor has
the same methods as the connect function, except for $new_link which is always true.
The second class is composed by all mysql_ functions that don't need a link resource but a
result resource, and that is suplied by the private atribute.
In both cases the resource link/result is returned by the toString method, which is called by the
__toString magic method as well.
I guess that fixes it for now... (will zip and send it later)