Topic: Trying to get pdo_sqlite up and running

Hookais, so I've been coding a pdo_sqlite db abstraction layer, and I've managed to get to the point where install.php runs, creats the sqlite3 database, and spits out a config.php. When I go the the index.php page (or any of the other pages), I get this error:

There is no valid language pack '' installed. Please reinstall a language of that name.

I've managed to narrow down the cause of the error to include/functions.php in function set_default_user() (line 103-128)

    $pun_user['disp_topics'] = $pun_config['o_disp_topics_default'];
    $pun_user['disp_posts'] = $pun_config['o_disp_posts_default'];
    $pun_user['timezone'] = $pun_config['o_server_timezone'];
    $pun_user['language'] = $pun_config['o_default_lang'];
    $pun_user['style'] = $pun_config['o_default_style'];
    $pun_user['is_guest'] = true;

Before assigning $pun_config['o_default_lang'] to $pun_user, pun_user uses lang English, but after it uses NULL or "" as the language.

$ sqlite3 <database path> ".dump"
...
INSERT INTO "config" VALUES('o_default_lang', 'English');
INSERT INTO "config" VALUES('o_default_style', 'Oxygen');
INSERT INTO "config" VALUES('o_default_user_group', '4');
...

Looks like the database knows it's there... and the db abstraction layer has no trouble pulling out the info from table users, row guest (or row 0).

Anyone know where in the code pun_config get's it's assignment? I've tried greping, but couldn't find the line hmm

echo "deadram"; echo; fortune;

Re: Trying to get pdo_sqlite up and running

cache_config.php

Re: Trying to get pdo_sqlite up and running

Thanks, now I have a moderatly functioning punbb with pdo_sqlite support big_smile

PS: Your not stalking me smatys, your stalking EVERYBODY!!! AHAHAHAHA Runnnnnnnnnaaaaaawaaay!

tongue

echo "deadram"; echo; fortune;

Re: Trying to get pdo_sqlite up and running

Could the value returned from $db->query be a private data structure that can only be viewed with $db->fetch_assoc or $db->fetch_row or $db->result? I'm having the odd error, here and there. Makes me wonder if the $result data is expected to be an array when returned from $db->query on occation.

echo "deadram"; echo; fortune;

Re: Trying to get pdo_sqlite up and running

$db->query() should always return a public MySQL resource.

Re: Trying to get pdo_sqlite up and running

elbekko wrote:

$db->query() should always return a public MySQL resource.

Sorry, I'm brain dead... by public MySQL resource, you meen something that print_r($result) would spit out:

Array (
    [apple] => [red]
    [orange] => [orange]
)

Or could I return, say a PDOStatement object, for use in each call to $db->fetch_assoc?

I'mah try with the PDOStatement object and see what happends o.0

echo "deadram"; echo; fortune;

Re: Trying to get pdo_sqlite up and running

Sorry, I forgot you weren't using MySQL tongue

A resource is not an array, but a data stream of sorts that can be read by one of your database's functions. for example, $db->fetch_assoc() would read your resource and return an array.

8 (edited by deadram 2006-09-13 13:43)

Re: Trying to get pdo_sqlite up and running

Sweet yah... now the pdo_sqlite dblayer is a litle more functional... lol ~.~

Now I have to track down a problem with loading up the $pun_user variable 0.o

EDIT --

Is it safe to assume that only non-altering sql commands (ie: SELECT is good, but DROP TABLE, or INSERT are things that alter the database) will use a call to $db->fetch_row or $db->fetch_assoc or $db->num_rows or $db->result?
With pdo, every fetch removes a row of data permanently, and the command needs to be executed again to re-populate the data of a SELECT, or what not.

EDIT --

Anyone have a premade "test_dblayer.php"? I need to find out what my pdo_sqlite isn't doing right that the sqlite backend is doing right. It's got to do with the differnt ways that sqlite (which I based my backend on) and pdo return fetches, and alter thier data structures after doing said fetch.

echo "deadram"; echo; fortune;