Topic: Problem with SQLite and Postgres in integrated CMS

I have a problem with SQLITE and Postgres within my CMF - I making a CMF called RkCMF which from incoming release will be integrated with punBB - users, db classes and... forum smile
- structure:

/rkcmf
-- forum/ (pun here)
-- other/
-- some files

- in punBB install I've added the core tables like:

switch ($db_type)
    {
        case 'mysql':
        case 'mysqli':
            $sql = 'CREATE TABLE '.$db_prefix.'cmf_blocks (id smallint(5) unsigned NOT NULL auto_increment, location varchar(20) default NULL, number smallint(5) unsigned default NULL, title varchar(255) default NULL, content text,  PRIMARY KEY  (id))';
            break;
        case 'pgsql':
            $db->start_transaction();
            $sql = 'CREATE TABLE '.$db_prefix.'cmf_blocks (id SERIAL, location varchar(20), number int, title varchar(255), content text, PRIMARY KEY  (id))';
            break;
        case 'sqlite':
            $db->start_transaction();
            $sql = 'CREATE TABLE '.$db_prefix.'cmf_blocks (id int NOT NULL, location varchar(20), number smallint(5), title varchar(255), content text,  PRIMARY KEY  (id))';
            break;
    }
$db->query($sql) or error('Unable to create table '.$db_prefix.'cmf_blocks. Please check your settings and try again.',  __FILE__, __LINE__, $db->error());

and core data like:

$db->query('INSERT INTO  '.$db->prefix."cmf_groups  VALUES (1, 'YXJyYXkoJ3JrJyA9PiBhcnJheSgnYWxsJykpOw==')") or error('ERROR', __FILE__, __LINE__, $db->error());

It installs on all DB (Mysql + i, SQLite and postgres) and after creating the config.php script redirect to /rkcmf/install.php:

define('INDEX', true);
define('PUN_ROOT', 'forum/');

ob_start();
require_once PUN_ROOT.'include/common.php';

include_once 'config.php';
include_once 'kernel/database/'.$config['db'].'.php';
$action = new db($db);

$query = $action->query("SELECT lang_string FROM ".$tables['rk_global_lang']." LIMIT 3");
IF (count($query) >= 2) { die('DATA ALREADY INSTALLED'); }

include 'kernel/classes/admin.class.php';
$adm = new admin();
$adm->add_link('modconf', 'config', '<div class="folder">[TRA=modconf]
                        <div class="doc"><a href="admin.php?mod=modconf&act=edit">[TRA=edit_modconf]</a></div>
                        <div class="doc"><a href="admin.php?mod=modconf&act=add">[TRA=add_modconf]</a></div>
                    </div>');
$adm->global_lang_add('config', array('Polish' => 'Konfiguracja', 'English' => 'Config'));
$adm->global_lang_add('modconf', array('Polish' => 'Konfiguracja Modu????w', 'English' => 'Modules Config'));
/*and so on */
echo '<B>Kernel zainstalowany<BR>Kernel installed</B>';
echo '<META HTTP-EQUIV="Refresh" CONTENT="1; URL=index.php">';

BUG: only mysql and mysqli work here - postgres and SQLite won't instert data hmm with no error
"add_link" in admin class looks like this:

function add_link($title, $node, $link)
    {
    $link = base64_encode($link);
    IF($this->action->query("INSERT INTO ".$this->tables['rk_admin']." (ad_title, ad_node, ad_links) VALUES ('".$title."', '".$node."', '".$link."')"))
        {
        return true;
        }
    else
        {
        die('ADMIN TREE MENU LINK NOT ADDED - INSERT SQL ERROR<BR>NIE DODANO LINKA DO MENU ADMINA Z PODOWU PROBLEM??W Z BAZÄ?');
        }
    }

and RkCMF db class:

class db
{
function db($base)
    {
    $this->base = $base;
    }
function query($query)
    {
    IF(ereg('SELECT', $query))
        {
        IF($make = $this->base->query($query))
            {
            while ($row = $this->base->fetch_obj($make))
                {
                $return[] = $row;
                }
            }
        else
            {
            echo '<pre>'.$query;
            print_r($this->base->error());
            exit();
            }
        return $return;
        }
    else
        {
        // NON SELECT HERE
        IF(!$this->base->query($query))
            {
            echo '<pre>'.$query;
            print_r($this->base->error());
            exit();
            }
        else
            {
            return true;
            }
        }
    }
function insert()
    {
    return $this->base->insert_id();
    }
}

(in earlier releases it was a normal multiDB class...). I have no idea why it doesn't want to INSERT data hmm any ideas? OS: SuSE 9.2, XAMPP PHP 5.03

My site [PHP, Python, Linux]

Re: Problem with SQLite and Postgres in integrated CMS

ok, fixed big_smile no start / end transaction... You can expect RkCMF (Polish and English lang supported) to show up in 1-2 days.

My site [PHP, Python, Linux]