<?php
/**
* This script contains the database information needed by a db object.
* It will return as Array :
* DBRef, the reference to the DB options set to use to connect to the database,
* @see db.opt.php
* table, Table used by object to store his data.
* struct, An associative array with internal / dbfield associations.
* func, An associative array with object method / dbmethod, dbqueries associations.
* These informations are available to the object using the CORE::getcnf('object') method
*
* @author Benjamin Gillissen <hide@address.com>
*
* **************************************************************
Copyright (C) 2007 Benjamin Gillissen
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details at:
http://www.gnu.org/copyleft/gpl.html
* **************************************************************
*/
$o['table'] = configs::get('db', 'table_prefix').'hellarpcs';
//intkeys //tablefield
$o['struct'] = Array( 'rid' => 'rid',
'name' => 'name',
'host' => 'host',
'port' => 'port',
'user' => 'user',
'pass' => 'pass',
'conTO' => 'conTO',
'staTO' => 'staTO',
'cachepol' => 'cachepol',
'actif' => 'actif',
'repo' => 'repo',
'baseurl' => 'baseurl'
);
//DB vendor //object method //db method //db query
$o['mysql']= Array( 'isrpc' => Array ('ispresent', "SELECT COUNT(*) FROM %table% WHERE `%struct_rid%`='%arg_id%'"),
'getconfarg' => Array ('getonefield',"SELECT %struct_%arg_info%% FROM `%table%` WHERE `%struct_rid%`='%arg_id%'"),
'getfirst' => Array ('getonefield',"SELECT %struct_rid% FROM `%table%` WHERE 1 LIMIT 1"),
'listall' => Array ('fetchfield', "SELECT %struct_rid% FROM `%table%` WHERE 1 LIMIT %arg_start%, %arg_end%"),
'countall' => Array ('getcount', "SELECT COUNT(*) FROM %table% WHERE 1")
);
$o['create']['mysql'] = "CREATE TABLE `%table%` (`%struct_rid%` int(3) NOT NULL auto_increment,
`%struct_name%` varchar(255) NOT NULL,
`%struct_host%` varchar(15) NULL,
`%struct_port%` varchar(5) NOT NULL,
`%struct_user%` varchar(255) NOT NULL,
`%struct_pass%` varchar(255) NOT NULL,
`%struct_conTO%` int(3) NOT NULL,
`%struct_staTO%` int(3) NOT NULL,
`%struct_cachepol%` enum('-1', '1', '0') NOT NULL,
`%struct_actif%` int(1) NOT NULL,
`%struct_repo%` varchar(255) NOT NULL,
`%struct_baseurl%` varchar(255) NOT NULL,
PRIMARY KEY (`%struct_rid%`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;";
$o['sqlite']= Array();
$o['create']['sqlite'] = "";
return $o;