SMF Support > PostgreSQL and SQLite Support
SMF SQLite3 Wrapper
tinoest:
--- Quote from: nend on August 17, 2012, 12:55:39 PM ---I am thinking of making a class so anybody that is on SQLite2 can use it to. I am going to make the SQLite3 class that is found on all newer PHP versions if it is not found, but need some help making the class.
--- Code: ---if (!class_exists('SQLite3')) {
class SQLite3 {
var $handle;
function SQLite3($data) {
$this->handle = sqlite_open($data);
}
public function exec($data) {
return sqlite_exec($this->handle, $data);
}
public function querySingle($data, $type = false) {
if ($type == true) {$type = false;} else {$type = true;}
return sqlite_single_query($this->handle, $data, $type);
}
public function escapeString($data) {
return sqlite_escape_string($data);
}
public function lastErrorCode() {
return sqlite_last_error();
}
}
}
--- End code ---
Some of the problems I am facing is finding the SQLite3 alternative like for sqlite_udf_encode_binary().
Just tested and it sort of works
--- End quote ---
Do you know that you can invoke the SQLite as an object like you can in SQLite3 ( well you don't have a choice in that function )
So you can SQLite->queryExec for example.
Methods are at the top , although they are all mentioned in the procedural counterparts.
http://www.php.net/manual/en/ref.sqlite.php
nend:
Yeah, already knew that. When I first started missing with SQLite I used to use those statements. Then I moved to SQLite3. I don't think I will use PDO though, don't like how it is set up for SQLite.
tinoest:
Its not actually the PDO , that's something entirely different.
Although I have to admit , I prefer the procedural way for DB connections over the objects.
You probably need to add a check to ensure $this->handle still exists in your quoted code btw , atleast that was a problem I had with the SQLite3 and SMF 2.0
emanuele:
--- Quote from: tinoest on August 13, 2012, 04:32:43 PM ---Although by default , if you are using sqlite_ then I would hazard a guess at you know something about databases as MySQL if by far the norm in the open source environment , especially with php.
--- End quote ---
There are two kind of people that could use SQLite:
1) those who know what they are doing,
2) those that don't even know what a database is.
There is also a third category: those that did a mistake while installing and didn't notice until later, but that is rather small group.
Considering the timing (well...yeah...I know), I think that for 2.1 we will be still stuck with SQLite 2.8. The idea of a mod or seems the way to for now, that way there will be enough time to test different cases and include the support in 2.2. :)
I feel support the two versions in parallel could be a nightmare the moment we decide to drop 2.8 in favour of 3.x...
juscheqin:
FWIW: today did a fresh install of latest SMF 2.0.4 on PHP 5.3.22 using SQLite 3.7.3 and above wrapper with edit to Subs-Db-sqlite.php as in first post before running install.php.
As far as I can tell it all works flawlessly - may fall over it host upgrades PHP of course. Just for feedback and thanks very much for the wrapper (only SQLite available for free hosting).
Navigation
[0] Message Index
[*] Previous page
Go to full version