A bug in a parser for sqlite dsn ?

black.myst at free.fr black.myst at free.fr
Fri Dec 15 14:24:23 CET 2006


Hello

I don't know if it's a bug, but I have lost many time yesterday with that.

First, I installed a roundcube with sqlite and the sample configuration
"sqlite://./sqlite.db". It work :-).

Yesterday, I want to move my db to another directory,
"/var/roundcube/roundcube.bd". I updated my db.inc.php with the new db_dsnw
"sqlite:///var/roundcube/roundcube.db". It doesn't work :-(, I have the screen
with error "Error No. 1f4)".

After research, config is parsed by "parseDSN()" of DB.php with the patern
"phptype://hostspec/database".

sqlite://./sqlite.db
  phptype = sqlite
  hostspec = .
  database = sqlite.db
 ==> sqlite use the file "sqlite.db" (In fact, it's the same that
'./sqlite.db').

sqlite:///var/roundcube/roundcube.db
  phptype = sqlite
  hostspec =
  database = var/roundcube/roundcube.db
 ==> this config doesn't work.

sqlite:////var/roundcube/roundcube.db
  phptype = sqlite
  hostspec =
  database = /var/roundcube/roundcube.db
 ==> this config works.

Maybe I'm an idot to try 'sqlite:///var/roundcube/roundcube.db' but I think it
is more intuitive than 'sqlite:////var/roundcube/roundcube.db'.

I'm not sure that is possible to fixe the function 'parseDSN()' because we can't
do a generic solution for parse "mysql://localhost/db" and
"sqlite://path/to/db".
The solution is maybe to add a note to db.inc.php.dist to explain the problem.

Black Myst.

PS : If you think it's a bug, I will open new ticket tomorrow




More information about the Dev mailing list