[Solar-talk] SQLite Adapter
Paul M Jones
pmjones at solarphp.com
Tue Sep 26 06:31:35 PDT 2006
On Sep 25, 2006, at 2:42 PM, Michael Caplan wrote:
> Hey there,
>
> I'm wondering if this is a bug, but I cannot get a valid DSN built
> for sqlite. Using the Bookmarks app example, I have the following
> config entry:
>
> $config['Solar_Sql'] = array(
> 'adapter' => 'Solar_Sql_Adapter_Sqlite',
> 'config' => array(
> 'file' => LABNET_DB,
> 'mode' => '0666',
> )
> );
>
> where LABNET_DB is a constant holding the absolute path to the db.
>
> The resulting dsn is:
>
> sqlite:
>
> which of course is not valid. Am I missing something here?
Try 'name' instead of 'file', let me know if that works.
One of the things I've tried to do is keep the config keys the same
across SQL adapters; in general, the keys are:
host -- hostname to connect to
user -- username for connection
pass -- password for connection
name -- database name
So in the case of SQLite, the host is always the localhost, and the
name would be the file name. Hope this makes sense.
Also, per the PDO-SQLite docs, the "mode" parameter appears to be
ignored ...
<http://us2.php.net/manual/en/ref.pdo-sqlite.connection.php>
... at least, it is entirely unmentioned.
Hope this helps, let me know if it does not.
--
Paul M. Jones <http://paul-m-jones.com>
Solar: Simple Object Library and Application Repository
for PHP5. <http://solarphp.com>
Savant: The simple, elegant, and powerful solution for
templates in PHP. <http://phpsavant.com>
More information about the solar-talk
mailing list