rfc on general database api
| From: | Sascha Schumann | Date: | Thu, 04 Mar 1999 01:33:22 +0000 |
| Subject: | rfc on general database api | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-4466@lists.php.net to get a copy of this message | ||
There exists a long standing need for a more general approach to store data
using PHP3. Since there was a short discussion about file based databases I've
written an abstraction layer which could be used together with the db family
(ndbm, db, gdbm), relational databases and plain text files.
The API was designed in such a way that it could be handled by almost
everything. Arbitrary database handlers can be registered, so the limit which
is imposed by the current db.c code, is lifted.
management
int db_open(string path, string mode, string handlername)
opens path using the specified handler in mode
void db_close(int handle)
close database
void db_optimize(int handle)
optimize (e.g. clean up, vacuum) database
updates/delete
bool db_delete(int handle, string key)
deletes the entry associated with key
bool db_insert(int handle, string key, string value)
inserts value as key, returns false, if key exists already
bool db_replace(int handle, string key, string value)
inserts value as key, replaces key, if key exists already
data retrieval
bool db_exists(int handle, string key)
checks, if the specified key exists
string db_fetch(int handle, string key)
fetches the data associated with key
data traversal
string db_firstkey(int handle)
resets the internal key pointer and returns the first key
string db_nextkey(int handle, string key)
returns the next key
Comments?
--
Regards,
Sascha Schumann |
Consultant | finger sas@schell.de
| for PGP public key
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net