SMF Support > PostgreSQL and SQLite Support
SMF SQLite3 Wrapper
tinoest:
Hi,
I recently upgraded my version of php to php-5.4.4 which doesn't include the sqlite_ functions natively anymore , so I wrote a wrapper class that I then load if the functions don't exist.
To change from a sqlite 2.8 to a sqlite 3.x database is quite easy
--- Code: ---sqlite OLD.DB .dump | sqlite3 NEW.DB
--- End code ---
More information is found here http://www.sqlite.org/version3.html
* If you then download the attached file and insert it into your Sources directory.
* Then just include the attached file in the Subs-Db-sqlite.php class
With the following code
--- Code: ---require_once('sqlite_wrapper.php');
--- End code ---
after the
--- Code: ---if (!defined('SMF'))
die('Hacking attempt...');
--- End code ---
I would appreciate if anyone can give any feedback on this, I am not sure if it is classed as a modification? If so I can package it up , it also works for a clean install of SMF.
-- FIXED
--- Quote ---There is one bug with regards to database session handling , in that it currently doesn't work , although I am working on a fix .
But if you disable this option , everything so far seems fine.
--- End quote ---
--- Code: ---UPDATE smf_settings SET value = 0 WHERE variable = 'databaseSession_enable'
--- End code ---
-- FIXED
Edit : Modified to add checks to ensure you can run the class, also fixed db session issue
emanuele:
Hi tinoest!
Great job! :D
While preparing SMF 2.1 we were talking about the possibility to move from the current 2.8 implementation to a 3.x, the two main problems that stopped us were:
1) it was somehow late (at the time lol),
2) the conversion of the database from 2.8 to 3.x using SMF's upgrade script (the command you reported should be run from the command line, but probably shell_exec could be used now that I think about it, but don't know if it is supported by many hosts...I'm not an expert of SQLite...).
I think it could be in the form of a mod or in the form of instructions on how to install it since I assume if the host upgrades php the forum doesn't work any more and a mod could not be installed.
tinoest:
Hi emanuele,
The upgrading of the SQLite DB I did on the command line and would suggest not doing it to a live copy of your database anyway , due to the remote possibility of losing data , you can do it with a shell_exec or a system command through php if you wished.
Is this the correct forum for this btw? Or should it be in the Modifications sections or somewhere similar?
Thanks,
tino
emanuele:
--- Quote from: tinoest on August 13, 2012, 09:34:33 AM ---The upgrading of the SQLite DB I did on the command line and would suggest not doing it to a live copy of your database anyway , due to the remote possibility of losing data
--- End quote ---
Yep, I understand.
That's (one of) the problem(s), because I think people would expect to be able to do it from the script...
--- Quote from: tinoest on August 13, 2012, 09:34:33 AM ---Is this the correct forum for this btw? Or should it be in the Modifications sections or somewhere similar?
--- End quote ---
Here or coding discussion I'd say. Probably coding discussion is more active than this, that's all. :)
tinoest:
Indeed , although before I go to the effort of packaging and thinking about how to handle the conversion from sqlite 2.8 to sqlite 3.x , I will leave it here to be tested in its current form. As I would prefer to have a stable and working wrapper rather than a 'nice' process to upgrade. I have never seen the point in making something 'nice' over stability.
There is no way that I know off other than the command line to upgrade from sqlite 2.8 to sqlite 3.x .
Although that imo, isn't to hard to do. Its alot easier than many other instances I've seen and only requires a small amount of manual labour.
Navigation
[0] Message Index
[#] Next page
Go to full version