[Patch] DB: buildSelectSQL
| From: | Gregor Gramlich | Date: | Sat, 07 Feb 2004 19:02:26 +0000 |
| Subject: | [Patch] DB: buildSelectSQL | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-25536@lists.php.net to get a copy of this message | ||
Hi PEAR developers
Thanks for the great DB Package.
I saw, that there is a public method buildManipSQL() which is not in the docs.
It's called by autoPrepare. I wondered, why you don't have a method for
building a SELECT query from an array of field names. Probably, because most
SELECT queries are more complex and join over several tables.
But wouldn't it be nice, to have an array of fieldnames, resp. hash of
fieldnames->value, so you can automatically build the query to SELECT and
later on (e.g. after form processing) INSERT or UPDATE from the same $array,
resp. array_keys($array).
New methods in common.php:
buildSelectSQL() with the functionality described above
buildSQL() either calling buildSelectSQL() or buildManipSQL() depending on
$mode parameter.
Introducing new Constant in DB.php:
define('DB_AUTOQUERY_SELECT', 3);
Best regards,
Gregor Gramlich
Attachment: [text/x-diff] DB.diff
Attachment: [text/x-diff] DB.diff