How to work with Sqlite and CMSMS 1.02
How to work with Sqlite and CMSMS 1.02
At first download the original (big) adodb, because adodb lite has several big errors in his sqlite driver and did not work.
Copy the complete big adodb distribution in the folder lib/adodb_lite
Delete the folder modules/Search , because if you will install this module the max_execution time was reached and the server can hang.
60 seconds of max_execution time can be too low.
You can use module Piserach instead of module Search - Pisearch works.
Change a part of class.global.inc.php function GetDb to this:
#return $dbinstance;
$db =& $this->db;
if ($config['dbms'] == 'sqlite')
$db->Execute("PRAGMA short_column_names = 1;");
return ($db);
These
if ($config['dbms'] == 'sqlite')
$db->Execute("PRAGMA short_column_names = 1;");
are the additional lines.
Open the install.php and delete the comments near the sqlite options so it looks
if (extension_loaded('sqlite'))
{
echo 'SQLite';
$valid_database = true;
}
Now you can install the cmsms.
Instead of hostname and databasename you must use a full path with the databasename you are wishing, as example
c:\www\xampp\htdocs\102sqlite\cms.dat
The part of config.php looks after installation with this example so:
$config['dbms'] = 'sqlite';
$config['db_hostname'] = 'c:\www\xampp\htdocs\102sqlite\cms.dat';
$config['db_username'] = 'admin';
$config['db_password'] = 'admin';
$config['db_name'] = 'c:\www\xampp\htdocs\102sqlite\cms.dat';
By me sqlite works 50% faster as mysql and i have found no further problems.
Copy the complete big adodb distribution in the folder lib/adodb_lite
Delete the folder modules/Search , because if you will install this module the max_execution time was reached and the server can hang.
60 seconds of max_execution time can be too low.
You can use module Piserach instead of module Search - Pisearch works.
Change a part of class.global.inc.php function GetDb to this:
#return $dbinstance;
$db =& $this->db;
if ($config['dbms'] == 'sqlite')
$db->Execute("PRAGMA short_column_names = 1;");
return ($db);
These
if ($config['dbms'] == 'sqlite')
$db->Execute("PRAGMA short_column_names = 1;");
are the additional lines.
Open the install.php and delete the comments near the sqlite options so it looks
if (extension_loaded('sqlite'))
{
echo 'SQLite';
$valid_database = true;
}
Now you can install the cmsms.
Instead of hostname and databasename you must use a full path with the databasename you are wishing, as example
c:\www\xampp\htdocs\102sqlite\cms.dat
The part of config.php looks after installation with this example so:
$config['dbms'] = 'sqlite';
$config['db_hostname'] = 'c:\www\xampp\htdocs\102sqlite\cms.dat';
$config['db_username'] = 'admin';
$config['db_password'] = 'admin';
$config['db_name'] = 'c:\www\xampp\htdocs\102sqlite\cms.dat';
By me sqlite works 50% faster as mysql and i have found no further problems.
Re: How to work with Sqlite and CMSMS 1.02
That wont' work, it shows notices ($config is not defined there). Instead addPiratos wrote: Change a part of class.global.inc.php function GetDb to this:
#return $dbinstance;
$db =& $this->db;
if ($config['dbms'] == 'sqlite')
$db->Execute("PRAGMA short_column_names = 1;");
return ($db);
These
if ($config['dbms'] == 'sqlite')
$db->Execute("PRAGMA short_column_names = 1;");
are the additional lines.
Code: Select all
if ($config['dbms'] == 'sqlite')
{
$dbinstance->Execute("PRAGMA short_column_names = 1;");
}
Code: Select all
if (FALSE == $connect_result)
{
die('Database Connection failed');
}
$dbinstance->SetFetchMode(ADODB_FETCH_ASSOC);
http://viewsvn.cmsmadesimple.org/viewsv ... 2&view=rev
Re: How to work with Sqlite and CMSMS 1.02

I think you need some glasses:
Code: Select all
function & GetDb()
{
#static $dbinstance;
//Check to see if it hasn't been
//instantiated yet. If not, connect
//and return it
#if (!isset($dbinstance) && !isset($this->db))
global $DONT_LOAD_DB;
if (!isset($this->db) && !isset($DONT_LOAD_DB))
{
$config =& $this->GetConfig();
$dbinstance = &ADONewConnection($config['dbms'], 'pear:date:extend:transaction');
if (isset($config['persistent_db_conn']) && $config['persistent_db_conn'] == true)
{
$connect_result = $dbinstance->PConnect($config["db_hostname"],$config["db_username"],$config["db_password"],$config["db_name"]);
}
else
{
$connect_result = $dbinstance->Connect($config["db_hostname"],$config["db_username"],$config["db_password"],$config["db_name"]);
}
if (FALSE == $connect_result)
{
die('Database Connection failed');
}
$dbinstance->SetFetchMode(ADODB_FETCH_ASSOC);
//$dbinstance->debug = true;
if ($config['debug'] == true)
{
$dbinstance->debug = true;
#$dbinstance->LogSQL();
}
$this->db =& $dbinstance;
}
#return $dbinstance;
$db =& $this->db;
if ($config['dbms'] == 'sqlite')
{
$db->Execute("PRAGMA short_column_names = 1;");
}
return ($db);
}
Re: How to work with Sqlite and CMSMS 1.02
My eyes are fine and my PHP's error reporting level is set to show notices:
Notice: Undefined variable: config in /path/to/cmsms/lib/classes/class.global.inc.php on line 189
Notice: Undefined variable: config in /path/to/cmsms/lib/classes/class.global.inc.php on line 189
Last edited by Anonymous on Sun Oct 08, 2006 11:02 pm, edited 1 time in total.
Re: How to work with Sqlite and CMSMS 1.02
php as interpreter defines variables if you should use one and it get a Null value.
so if config is not loaded with getconfig the database connection exists.
and so this statement if ($config['dbms'] == 'sqlite') is always false , because $config['dbms'] is empty and the pragma statement are never in action.
if the database connection does not exists ($config['dbms'] gets the value of the config.php and if the driver is sqlite the prgama statement works.
take a look with or not with glasses in the php handbook.
and so since 3 days i work very fine with cmsms 1.02 and sqlite.
so if config is not loaded with getconfig the database connection exists.
and so this statement if ($config['dbms'] == 'sqlite') is always false , because $config['dbms'] is empty and the pragma statement are never in action.
if the database connection does not exists ($config['dbms'] gets the value of the config.php and if the driver is sqlite the prgama statement works.
take a look with or not with glasses in the php handbook.
and so since 3 days i work very fine with cmsms 1.02 and sqlite.
Re: How to work with Sqlite and CMSMS 1.02
Addtional information - my standard of error_reporting is error_reporting = E_ALL & ~E_NOTICE
and NO error was shown like you reported.
if a set it to error_reporting = E_ALL & ~E_NOTICE | E_STRICT i will have many messages of Strict standards but no error and no error or warning like you reported.
Debugging - No error
and NO error was shown like you reported.
if a set it to error_reporting = E_ALL & ~E_NOTICE | E_STRICT i will have many messages of Strict standards but no error and no error or warning like you reported.
Debugging - No error
Re: How to work with Sqlite and CMSMS 1.02
Try E_ALL, it will show the notice(s). E_ALL & ~E_NOTICE means PHP will show all errors, except for notices.Piratos wrote: Addtional information - my standard of error_reporting is error_reporting = E_ALL & ~E_NOTICE
and NO error was shown like you reported.
Re: How to work with Sqlite and CMSMS 1.02
I know what you mean but notice is nothing, no warning , no error it is only a little helper.
Re: How to work with Sqlite and CMSMS 1.02
Maybe it would be of more use if you were to test the changes made to SVN to see if they work (I think they should):
http://viewsvn.cmsmadesimple.org/viewsv ... p?rev=3462
http://viewsvn.cmsmadesimple.org/viewsv ... p?rev=3462
Re: How to work with Sqlite and CMSMS 1.02
Make it shorter:
and don't forget adodb lite with sqlite does not work !!
Code: Select all
function & GetDb()
{
global $DONT_LOAD_DB;
if (!isset($this->db) && !isset($DONT_LOAD_DB))
{
$config =& $this->GetConfig();
$this->db = &ADONewConnection($config['dbms'], 'pear:date:extend');
if (isset($config['persistent_db_conn']) && $config['persistent_db_conn'] == true)
$connect_result = $this->db->PConnect($config["db_hostname"],$config["db_username"],$config["db_password"],$config["db_name"]);
else
$connect_result = $this->db->Connect($config["db_hostname"],$config["db_username"],$config["db_password"],$config["db_name"]);
if (FALSE == $connect_result) die('Database Connection failed');
$this->db->SetFetchMode(ADODB_FETCH_ASSOC);
if ($config['debug'] == true) $this->db->debug = true;
if ($config['dbms'] == 'sqlite') $this->db->Execute("PRAGMA short_column_names = 1;");
}
return $this->db;
}
Last edited by Piratos on Mon Oct 09, 2006 5:29 pm, edited 1 time in total.
Re: How to work with Sqlite and CMSMS 1.02
Here one of the best values on a free webspace page Home
You can see CMSMS 1.02 with Sqlite and BIG Adodb in action here : http://piratos.byethost33.com/cmsms/Generated in 0.175264 seconds by CMS Made Simple (not cached) using SQL queries and 5341856 bytes of memory
Re: How to work with Sqlite and CMSMS 1.02
How come ADOdb Lite and SQLite won't work? ADOdb Lite does have drivers for SQLite.
I'm trying to get CMSMS to work with SQLite and full ADOdb, but keep getting "Could not create a table. Verify that the user has privileges to create tables in the given database.". Any ideas?
I'm trying to get CMSMS to work with SQLite and full ADOdb, but keep getting "Could not create a table. Verify that the user has privileges to create tables in the given database.". Any ideas?
Re: How to work with Sqlite and CMSMS 1.02
Yup there are drivers but there hav several bugs, i count 5 and than i decided to test it with Adodb full - and it works.How come ADOdb Lite and SQLite won't work
Re: How to work with Sqlite and CMSMS 1.02
i have reported this to the developer of adodb lite and he do his best to solve the driver problems.
Re: How to work with Sqlite and CMSMS 1.02
OK, untill it's fixed we'll make the install script show an error if ADOdb Lite is used:
http://viewsvn.cmsmadesimple.org/viewsv ... 7&view=rev
http://viewsvn.cmsmadesimple.org/viewsv ... 7&view=rev