Skip to content


Subversion checkout URL

You can clone with
Download ZIP
91 lines (72 sloc) 3.34 KB
Abstracted Types (Stig)
DB needs a set of types representing the most commonly used types in
all backends. This type set could also be geared towards integration
with things like XML-RPC/SOAP implementations, HTML form classes, etc.
Real Query Parser (Stig)
With a real query parser, DB can implement more of its portability
based on the query, instead of having support functions for
everything. One example would be LIMIT, another "INSERT
Portable transactions (Stig)
If DB can parse queries enough to determine what tables are affected
by queries, it should be possible to make a replayable transaction
log. GNOME uses an XML format for configuration data that lets you
checkpoint state once in a while, and revert to that state later.
With a similar approach for transactions in DB we can implement
portable transactions and checkpointing even for the databases that
don't support them.
Error reporting clean-up/debug (Tomas)
Now each driver has its own raiseError method, common has a raiseError and
DB has a DB_error class and its own isError() method. This error stuff
overhead could be simplified with only one raiseError, droping the DB Error
class and also the DB::isError() (use the PEAR.php ones instead).
Other idea could be to add a system for allowing people access to all the
queries sended by PEAR DB to the backend. Also a new PEAR_ERROR_DEBUG
flag that automatically (show|triggers) debug info, perhaps
with a new PEAR_(Warning|Debug) object.
Quote clean-up (Stig)
1. Keep quote and quoteString, but move quoting of strings back into
quoteString and make quote call it for strings.
2. Add an optional "operator" parameter to quote that is one of "=",
"<", ">" or "<>" that will be inserted in front of the quoted value
unless it is NULL, in which case it will be converted to "IS" (for
"=") or "IS NOT" (for the others).
Auto free statements (Tomas)
By setting a param in query() or for the hole DB instance, PEAR DB
could auto-free results in DB_result->fetch(Into|Row) when the driver
returns false.
Datatypes in prepare syntax (Tomas)
Extend the actual prepare/execute placeholders to support data types, both
to check the data introduced to the query and to "cast" the result
to native php data types. Ex:
$sql = "INSERT INTO table VALUES ({{int(4)}}, {{bool}}, {{date('Y-m-d')}})";
$row = $db->query($sql, array(8, 't', '2001-04-1'));
Format: {{<data_type>(<param1>,<param2>)}}
"param" could be the max lenght of the data, date formats, not_null
checks or default values.
Other ideas could be:
$sql = "INSERT INTO table VALUES (?, ?, ?)";
$sth = $db->prepare($sql, array('int(4)', 'bool', 'date');
$res = $db->execute($sth, array($a, $b, $c);
$sql = "INSERT INTO table VALUES (?, ?, ?)";
$params = array(
0 => array($a, 'int(4)'),
1 => array($b, 'bool')
$res = $db->query($sql, $params);
Auto connect feature (Tomas)
Add the ability to create for example a light and dump DB object which
will only set up the connection when needed. With that people could
create the DB object in a common prepend or default file without the
need to waste system resources if the use of the database is finally
not needed.
Jump to Line
Something went wrong with that request. Please try again.