Poroposal: PEAR:DB package - SQLite
| From: | Urs Gehrig | Date: | Wed, 11 Jun 2003 16:19:29 +0000 |
| Subject: | Poroposal: PEAR:DB package - SQLite | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-17309@lists.php.net to get a copy of this message | ||
dear all
i have been working on a sqlite wrapper for PEAR:DB. sqlite
is different from the other databases in the way, that i does
not need a server to run; on windows it is a single exe file
(sqlite.exe) and on debian e.g. you can install sqlite
like "apt-get install sqlite".
so the dsn is not really used in a way as we need to pass
a username, a password or a host. but the databasename is
used of course.
so i used the PEAR:DB dsn as followed, while dummy as user
and host as host is just not needed:
$dsn = "sqlite://dummy:@host/c:/tmp/database.db"
or
$dsn = array (
'phptype' => "sqlite",
'databse' => "c:/tmp/database.db",
'mode' => 0777
);
or
$dsn = "sqlite:///c:/tmp/database.db"
so far, the wrapper can be called like most db wrappers too.
please have a look at the test script
$db = &new DB_sqlite();
$db->connect("sqlite:///c:/tmp/database.db" );
$result = $db->query("SELECT * FROM table;" );
print_r($result );
$db->disconnect();
you can get more information under the following link:
http://www.circle.ch/php/files/DB_sqlite/20030530/
i would like to propose that wrapper for PEAR. it works as
well on debian linux as on windows 2000, as far as i could
test it.
sqlite is designed to be used in fast applications; nevertheless
there are some good points to have a kind of standardized
calls for those db functions.
running "php -f sqlite1.php" will create a new database
automatically called ./test1.db . within that db, several
tables will be created an altered.
sqlite is availabe through http://sqlite.org too.
thanx for feedback. comments are welcome.
-urs
--
http://circle.ch