Hey all,
I am having difficulty getting SQLite to work with Fuel. I have my DSN configured, correctly to my knowledge as I did see a previous forum post about this. Even finding documentation about CodeIgniter working with SQLite has been hard to find, and even straight PDO. I don't understand why PHP frameworks are so underdocumented with SQLite when Rails and Django use it by default.
I am just trying to get my application working out of the box, so in my development/db.php:
'default' => array(
'connection' => array(
'dsn' => 'sqlite:'.APPPATH.'database'.DS.'szreg',
'username' => '',
'password' => '',
),
),
I have created just an a quick and dirty model using Oil, and when I attempt to migrate, I get this error:
Error - invalid data source name in COREPATH/classes/database/pdo/connection.php on line 86
Thanks in advance!
There's a new database layer in the making that will solve platform support issues.
The current layer is very MySQL centric, which causes these kind of issues. For the DSN, the driver will split it into the variables needed for PDO to connect to MySQL, which fails for SQLite as that contains different values.
As a quick fix, copy core/classes/database/pdo to core/classes/database/sqlite, change the name of the connection class to read "Database_Sqlite_Connection", and modify the code so that it works.
In your db.php, you'll have to change 'pdo' to 'sqlite' to load your new connection class.
p.s. you can probably copy it to app/classes/database/sqlite too, and remove the namespace. That might work, and is better then altering the core.