<?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').'nzbdelay';
//intkeys //tablefield
$o['struct'] = Array( 'data' => 'data'
);
//DB vendor //object method //db method //db query
$o['mysql']= Array( 'getfirst' => Array ('getonefield',"SELECT `%struct_data%` FROM `%table%` WHERE 1 LIMIT 1"),
'add' => Array ('insert', "INSERT INTO `%table%` (`%struct_data%`) VALUES ('%arg_data%')"),
'del' => Array ('delete', "DELETE FROM `%table%` WHERE `%struct_data%`='%arg_data%' LIMIT 1"),
'count' => Array ('getcount', "SELECT COUNT(*) FROM `%table%` WHERE 1"),
'listall' => Array ('fetchfield', "SELECT `%struct_data%` FROM `%table%` WHERE 1")
);
$o['sqlite']= Array('getfirst' => Array ('getonefield',"SELECT * FROM %table% WHERE 1 LIMIT 1"),
'add' => Array ('insert', "INSERT INTO %table% (\"%struct_data%\") VALUES ('%arg_data%')"),
'del' => Array ('delete', "DELETE FROM %table% WHERE \"%struct_data%\"='%arg_data%'"),
'count' => Array ('getcount', "SELECT COUNT(*) FROM %table% WHERE 1"),
'listall' => Array ('fetchfield', "SELECT * FROM %table% WHERE 1"),
);
$o['create']['mysql'] = "CREATE TABLE `%table%` ( `%struct_data%` text NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8;";
$o['create']['sqlite'] = "CREATE TABLE %table% (\"%struct_data%\" TEXT)";
return $o;