Page 2 of 2

Re: How to work with Sqlite and CMSMS 1.02

Posted: Tue Oct 10, 2006 6:19 pm
by Piratos
Ok  but - the Module Search Writer must do something  do let it run with sqlite.  he can use adodb in the meantime to test.

Re: How to work with Sqlite and CMSMS 1.02

Posted: Wed Oct 11, 2006 5:10 pm
by Piratos
It must be something in the functions GetRow and GetCol  with adodb lite, here hangs the installation.

Re: How to work with Sqlite and CMSMS 1.02

Posted: Thu Nov 23, 2006 7:33 pm
by brady
I was trying to follow these instructions and ran into some problems with stylesheets. It seems the file stylesheet.php was coded to not use ADOdb. I modified it to support SQLite.

Code: Select all

	else if($config['dbms'] == 'sqlite'){
		$db = sqlite_open($config['db_hostname']);
		sqlite_exec($db,'PRAGMA short_column_names = 1;');
		if ($name != '')
			$sql="SELECT css_text, css_name FROM ".$config['db_prefix']."css WHERE css_name = '" . sqlite_escape_string($name) . "'";
		else
			$sql="SELECT c.css_text, c.css_id, c.css_name FROM ".$config['db_prefix']."css c,".$config['db_prefix']."css_assoc ac WHERE ac.assoc_type='template' AND ac.assoc_to_id = $templateid AND ac.assoc_css_id = c.css_id AND c.media_type = '" . sqlite_escape_string($mediatype) . "' ORDER BY ac.create_date";
		$result=sqlite_array_query($db,$sql,SQLITE_ASSOC);
		foreach($result as $row)
		{
			$css .= "/* Start of CMSMS style sheet '{$row['css_name']}' */\n{$row['css_text']}\n/* End of '{$row['css_name']}' */\n\n";
		}
	}
I added that code between

Code: Select all

	if ($config['dbms'] == 'mysqli' || $config['dbms'] == 'mysql')
{
...
}
and

Code: Select all

	else

Re: How to work with Sqlite and CMSMS 1.02

Posted: Thu Nov 23, 2006 8:10 pm
by Dee
Added to SVN. Thanks!

Re: How to work with Sqlite and CMSMS 1.02

Posted: Fri Nov 24, 2006 6:34 pm
by brady
Another small addition. If you would like to use the Calender module(and maybe others, a quick search shows Kalender needs this,too), you need to change the following in include.php
change(about line 148)

Code: Select all

if (!isset($DONT_LOAD_DB))
{
    $db =& $gCms->GetDB();
}
to

Code: Select all

if (!isset($DONT_LOAD_DB))
{
    $db =& $gCms->GetDB();
	if($config['dbms'] == 'sqlite'){
		sqlite_create_function($db->_connectionID,'now','time',0);
	}
}
These modifications will allow you to add events.

Re: How to work with Sqlite and CMSMS 1.02

Posted: Tue Nov 28, 2006 10:10 am
by Dee
brady wrote: Another small addition.
Added that to SVN too, eventhough modules shouldn't use the now() function, but should use $db->DBTimeStamp(); instead.