Re: Sqlite wrapper for Log package

From: Date: Mon, 05 Jan 2004 00:14:41 +0000
Subject: Re: Sqlite wrapper for Log package
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-24751@lists.php.net to get a copy of this message
<danielc@analysisandsolutions.com> wrote : > Hi Bertrand: > > On Sun, Jan 04, 2004 at 12:58:36AM +0100, Bertrand Mansion wrote: >> >> It uses the native PHP sqlite functions so it is faster than the DB package >> (which anyway I couldn't make work due to a PEAR Error being raised when the >> database is set to persistent because of a missing 'persistent' option in >> the options instance var). > > I'm confused as to what you're saying about the "persistent" option being > missing. It's there and is set to false by default. If you want it to be > true, instantiate your DB class like this, for example: > > $DbOptions['persistent'] = true; > $this->db =& DB::connect($this->DSN, $DbOptions); > > Perhaps you misspoke and meant the 'mode' element of the DSN? I just > fixed the missing index problem in CVS (see DB.php). Do note, there is no > DSN format for where and how to place a mode option. I'll have to think > about this. > > Please let me know if this solved your problem or if not, please clarify > the issue at hand. I first tried to use the sqlite wrapper in DB with the Log_sql class which actually uses the PEAR DB package. It raised PEAR Errors because of some getOption('persistent'), IIRC, not being available. This was with the last release of DB. Apparently, things have changed a bit since then and maybe it is fixed in the current CVS version, I haven't tried. As I didn't want to spend too much time trying to track this bug down, I wrote a complete wrapper for sqlite. This was done very quickly because there already is a DB wrapper in Log for inspiration and I know how to use sqlite. Whether it is to be included in Log or not, I don't know. If you tell me that Log_sql works with sqlite, then fine. If you tell me if it's as fast as my implementation, fine too. I am very interested in using sqlite for logs because if it is setup correctly, it is faster than most dbs. But the main reason is that I like to be able to manipulate the db file as I want and this can be done very easily with sqlite, as a db is a file. It can be created with sqlite_open(). It can be deleted with a 'rm file.db' or moved or copied... Bertrand Mansion Mamasam

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