1. Import
This commit is contained in:
90
html/illt/DB/IDEAS
Normal file
90
html/illt/DB/IDEAS
Normal file
@@ -0,0 +1,90 @@
|
||||
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
|
||||
... RETURNING".
|
||||
|
||||
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:
|
||||
|
||||
1)
|
||||
$sql = "INSERT INTO table VALUES (?, ?, ?)";
|
||||
$sth = $db->prepare($sql, array('int(4)', 'bool', 'date');
|
||||
$res = $db->execute($sth, array($a, $b, $c);
|
||||
|
||||
2)
|
||||
$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.
|
||||
Reference in New Issue
Block a user