How to work with Sqlite and CMSMS 1.02

General project discussion. NOT for help questions.
Piratos

Re: How to work with Sqlite and CMSMS 1.02

Post 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.
Piratos

Re: How to work with Sqlite and CMSMS 1.02

Post by Piratos »

It must be something in the functions GetRow and GetCol  with adodb lite, here hangs the installation.
brady

Re: How to work with Sqlite and CMSMS 1.02

Post 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
Dee
Power Poster
Power Poster
Posts: 1197
Joined: Sun Mar 19, 2006 8:46 pm

Re: How to work with Sqlite and CMSMS 1.02

Post by Dee »

Added to SVN. Thanks!
brady

Re: How to work with Sqlite and CMSMS 1.02

Post 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.
Dee
Power Poster
Power Poster
Posts: 1197
Joined: Sun Mar 19, 2006 8:46 pm

Re: How to work with Sqlite and CMSMS 1.02

Post 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.
Post Reply

Return to “General Discussion”