1 (edited by deadram 2006-09-13 18:09)

Topic: Deadram's PDO_SQLite support!

Ummm, I request my PDO_SQLite dblayer be a feature big_smile

What's wrong with the current SQLite dblayer? It can only support SQLite v2 databases.
What's new with the PDO_SQLite dblayer? It can support SQLite v3 databases (and v2 databases, if compiled with all the right options).

What's to change? Well gimme a few, and I'll letcha know... have to find a clear copy of punbb 1.2.12...

(PS: I've only tested it lightly, but it should work just fine with a SQLite3 database. Never tried the SQLite v2 database yet; but then again my PDO install doesn't support it)



Username: test
Password: guest

Just incase you want to try it out. I've managed to test most options and such out, all successfully. If you want to post, just toss something in the Off-Topic tongue

I'mah have a cigarette before I pull out the diff (should be just install.php, include/common.php, include/dblayer/common_db.php that are affected, and then the two new dblayer files.)


Hokais, got the diff, some install directions and the 2 new dblayer files big_smile


PS: My server is dirty farking slow atm (~Special~ thanks to my ISP), so if your downloading at 10KBytes/s well... your on turbo speed ;p

The only problem I can see right now is that install.php's CREATE TABLE commands should be different for pdosqlite3, so if anyone wants to optimize them for SQLite3, be my guest big_smile (the pdosqlite2 and sqlite commands should remain the exact same though!). Also, I've only tested PDO_SQLite's SQLite3 database support, SQLite2 database support remains untested.

The pdosqlite3.php file should be able to server as a template to start supporting other database formats that PDO can make use of.

echo "deadram"; echo; fortune;

Re: Deadram's PDO_SQLite support!

I found a bug, didn't update the files in the archive though, so you have to do it yourself.

Just open up ./include/dblayer/pdosqlite3.php and  ./include/dblayer/pdosqlite2.php and replace the escape function with this one

    function escape($str)
        // php really isn't perl, is it? PDO::quote anyone? ;.;
        $retVal = false;
        if ($this->link_id) {
            $retVal = $this->link_id->quote($str);
            $retVal = substr($retVal, 1, strlen($retVal)-2);
        return $retVal;

problem is with this line:
substr($this->link_id->quote($str), 1, strlen($str))

strlen of $str may be, let's say 5, but the quoted $this->link_id->quote($str) is actually longer!

echo "deadram"; echo; fortune;

Re: Deadram's PDO_SQLite support!

Anyone got a copy of this tar file out there since his url no longer works (at least for me)?


Re: Deadram's PDO_SQLite support!

Have you tried emailing deadram?

Looking for a certain modification for your forum? Please take a look here before posting.

Re: Deadram's PDO_SQLite support!

link should work again (although, i think i got your e-mail)

echo "deadram"; echo; fortune;

Re: Deadram's PDO_SQLite support!

I'll try it it would be very usefull for me to deal with some restrcition

Re: Deadram's PDO_SQLite support!

BertrandB wrote:

I'll try it it would be very usefull for me to deal with some restrcition

in admin index i got error with

$db_version = 'PDO_SQLite '.$db->link_id->getAttribute(PDO::ATTR_CLIENT_VERSION);

needed to replace with

$db_version = 'PDO_SQLite '.$db->link_id->getAttribute(constant('PDO::ATTR_CLIENT_VERSION'));

I do not know why