Re: adding bug info infront of sql query

From: Date: Sun, 11 Jan 2004 14:05:53 +0000
Subject: Re: adding bug info infront of sql query
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-24978@lists.php.net to get a copy of this message
Lukas Smith wrote:
I just thought this idea was somewhat interesting and maybe warranted a more generak discussion: http://pear.php.net/bugs/bug.php?id=430
I am use this construction of my sql-queries (mySQL) with comments line. (Comfortable to find errors in sql-requests) php code example: $sql = '#'.__FILE__.'::'.__LINE__.'
         UPDATE table SET ... ';
Function DB::_isManip returns false. Should be true.
Why not provide manipQuery() and selectQuery() --- i.e. let the developer choose which one to use. (i.e. like JDBC/Creole us executeQuery() and executeUpdate()). Alternatively maybe a _stripComments() function should be added to the Common class. Unfortunately (as you know, I'm sure) supported comment syntax differs quite a bit between databases; there might be a combination of patterns that could be replaced, though, so that a method in MDB_Common wouldn't have to be overridden. The only problem IMO w/ this option is that it's a lot of parsing overhead for every query. Generally developers know whether they're performing an update/insert query or a select query, so that's why I suggested an option that allows them to specify. Keeping a generic function + using _isManip() and something like _stripComments() is probably also a good idea. Hans

« previous php.pear.dev (#24978) next »