Location: PHPKode > projects > Simple Way to Usenet > swun/config/CNF/site_sessions.cnf.php
<?php

$o['table'] = configs::get('db', 'table_prefix').'sessions';
$o['struct'] = Array(	'sessid' 	=> 'sessid',
						'createdat'	=> 'date',
						'lastreq'	=> 'update',
						'sessref' 	=> 'sessref',	
						'data'		=> 'data');

$o['mysql']	= Array(	'exists'	=> Array ('ispresent',	"SELECT COUNT(*) FROM `%table%` WHERE `%struct_sessid%`='%arg_id%' AND `%struct_sessref%`='%arg_sessref%'"), 
						'creat'		=> Array ('insert',		"INSERT INTO `%table%` (`%struct_sessid%`, `%struct_createdat%`, `%struct_lastreq%`, `%struct_sessref%`) VALUES ('%arg_id%', '%arg_time%', '%arg_time%', '%arg_sessref%')"),
						'store'		=> Array ('update',		"UPDATE `%table%` SET `%struct_data%`='%arg_data%', `%struct_lastreq%`='%arg_time%' WHERE `%struct_sessid%`='%arg_id%' AND `%struct_sessref%`='%arg_sessref%'"),
						'load'		=> Array ('getonefield',"SELECT `%struct_data%` FROM `%table%` WHERE `%struct_sessid%`='%arg_id%' AND `%struct_sessref%`='%arg_sessref%'"),
						'tocleanup'	=> Array ('fetchfield',	"SELECT `%struct_sessid%` FROM `%table%` WHERE ( `%struct_createdat%`<'%arg_lt%' OR `%struct_lastreq%`<'%arg_to%' ) AND `%struct_sessref%`='%arg_sessref%'"),
						'cleanup'	=> Array ('delete',		"DELETE FROM `%table%` WHERE ( `%struct_createdat%`<'%arg_lt%' OR `%struct_lastreq%`<'%arg_to%' ) AND `%struct_sessref%`='%arg_sessref%'"),
						'destroy'	=> Array ('delete',		"DELETE FROM `%table%` WHERE `%struct_sessid%`='%arg_id%' AND `%struct_sessref%`='%arg_sessref%'"));

$o['sqlite']= Array(	'exists'	=> Array ('ispresent',	"SELECT COUNT(*) FROM %table% WHERE \"%struct_sessid%\"='%arg_id%' AND \"%struct_sessref%\"='%arg_sessref%'"), 
						'creat'		=> Array ('insert',		"INSERT INTO %table% (\"%struct_sessid%\", \"%struct_createdat%\", \"%struct_lastreq%\", \"%struct_sessref%\") VALUES ('%arg_id%', '%arg_time%', '%arg_time%', '%arg_sessref%')"),
						'store'		=> Array ('update',		"UPDATE %table% SET \"%struct_data%\"='%arg_data%', \"%struct_lastreq%\"='%arg_time%' WHERE \"%struct_sessid%\"='%arg_id%' AND \"%struct_sessref%\"='%arg_sessref%'"),
						'load'		=> Array ('getonefield',"SELECT \"%struct_data%\" FROM %table% WHERE \"%struct_sessid%\"='%arg_id%' AND \"%struct_sessref%\"='%arg_sessref%'"),
						'tocleanup'	=> Array ('fetchfield', "SELECT \"%struct_sessid%\" FROM %table% WHERE ( \"%struct_createdat%\"<'%arg_lt%' OR \"%struct_lastreq%\"<'%arg_to%' ) AND \"%struct_sessref%\"='%arg_sessref%'"),
						'cleanup'	=> Array ('delete',		"DELETE FROM %table% WHERE ( %struct_createdat%<'%arg_lt%' OR \"%struct_lastreq%\"<'%arg_to%' ) AND \"%struct_sessref%\"='%arg_sessref%'"),
						'destroy'	=> Array ('delete',		"DELETE FROM %table% WHERE \"%struct_sessid%\"='%arg_id%' AND \"%struct_sessref%\"='%arg_sessref%'"));

$o['create']['mysql'] = "CREATE TABLE `%table%` (
  								`%struct_sessid%`		varchar(32) NOT NULL,
  								`%struct_createdat%` 	int(16) NOT NULL,
  								`%struct_lastreq%` 		int(16) NOT NULL,
  								`%struct_sessref%` 		varchar(40) NOT NULL,
  								`%struct_data%` 		text NOT NULL ) 
  							ENGINE=MyISAM DEFAULT CHARSET=utf8;";

$o['create']['sqlite'] = "CREATE TABLE %table% (
  								\"%struct_sessid%\"		TEXT,
  								\"%struct_createdat%\" 	NUMERIC,
  								\"%struct_lastreq%\" 	NUMERIC,
  								\"%struct_sessref%\" 	TEXT,
  								\"%struct_data%\" 		BLOB );";
return $o;
Return current item: Simple Way to Usenet