PEAR:DB package - SQLite

From: Date: Tue, 27 May 2003 10:28:51 +0000
Subject: PEAR:DB package - SQLite
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-16745@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/ i would like to propose that wrapper for PEAR but before i would appreciate any comment on that thing. it also needs testing on linux as it runs on windows. the error handling is not yet golden. an unexisting database can be called and will be created automatically. the testscript on the url shown above creates a database ./var/test1.db, so "./var" has to exist at least. sqlite is availabe through http://sqlite.org too. thanx for feedback. -urs -- http://circle.ch

« previous php.pear.dev (#16745) next »