Re: Req #11104 [Opn->Bgs]: Have access to the actual SQL query performed
| From: | Luis Pabón | Date: | Wed, 30 Jan 2008 11:12:59 +0000 |
| Subject: | Re: Req #11104 [Opn->Bgs]: Have access to the actual SQL query performed | ||
| References: | 1 2 | Groups: | php.pear.qa |
| Request: | Send a blank email to pear-qa+get-4786@lists.php.net to get a copy of this message | ||
Sorry bud, IIRC the form timed out when I sent it the first time, and all I
wrote was lost... so I rewrote and resubmitted hence the slightly different
wording!
On 30 Jan 2008 02:34:15 -0000, PEAR Bug Database <pear-qa@lists.php.net>
wrote:
>
> ATTENTION! Do NOT reply to this email!
> To reply, use the web interface found at
> http://pear.php.net/bugs/bug.php?id=11104&edit=2
>
>
> ID: 11104
> Updated by: alan@akbkhome.com
> Reported By: copong at gmail dot com
> Summary: Have access to the actual SQL query performed
> -Status: Open
> +Status: Bogus
> Type: Feature/Change Request
> Package: DB_DataObject
> Operating System: Linux
> Package Version: 1.8.5
> PHP Version: 5.2.1
> New Comment:
>
> Please do not submit the same bug more than once. An existing
>
> bug report already describes this very problem. Even if you feel
>
> that your issue is somewhat different, the resolution is likely
>
> to be the same. Because of this, we hope you add your comments
>
> to the existing bug instead.
>
>
>
> Thank you for your interest in PEAR.
>
> .
>
>
> Previous Comments:
> ------------------------------------------------------------------------
>
> [2007-05-23 08:04:20] copong
>
> Description:
> ------------
> I wanted to perform a subquery and I wanted to construct the subquery
> using DB_DataObject; however I could not find a public var on the class
> that allowed me to have access to the actual SQL statement (I mean, an
> actual STRING containing the query itself). I have created a patch that
> allows this for the last stable version of DB_DataObject.
>
>
>
> * A new public var, $sql, is created.
>
>
>
> * A new function, sql($n = false), is created. Here $sql will be set.
>
>
>
> * The function find($n = false) is refactored.
>
>
>
> Long story short, I stripped all the code in find() that creates the
> SQL query, put it apart on another function and avoided code duplication
> by making find() use this new function.
>
>
>
> So you can use $object->sql(); and $object->sql will be populated with
> a SQL statement.
>
> Please see attached diff.
>
> ------------------------------------------------------------------------
>
>
>
--
Luis Pabón