* @package AgileBill
* @version 1.4.93
*/
class CORE_database
{
function add($VAR, &$construct, $type)
{
include_once(PATH_CORE . 'database_add.inc.php');
return CORE_database_add($VAR, $construct, $type);
}
function update($VAR, &$construct, $type)
{
include_once(PATH_CORE . 'database_update.inc.php');
return CORE_database_update($VAR, $construct, $type);
}
function search_form($VAR, &$construct, $type)
{
include_once(PATH_CORE . 'database_search_form.inc.php');
return CORE_database_search_form($VAR, $construct, $type);
}
function search($VAR, &$construct, $type)
{
include_once(PATH_CORE . 'database_search.inc.php');
return CORE_database_search($VAR, $construct, $type);
}
function search_show($VAR, &$construct, $type)
{
include_once(PATH_CORE . 'database_search_show.inc.php');
return CORE_database_search_show($VAR, $construct, $type);
}
function view($VAR, &$construct, $type)
{
include_once(PATH_CORE . 'database_view.inc.php');
return CORE_database_view($VAR, $construct, $type);
}
function mass_delete($VAR, &$construct, $type)
{
include_once(PATH_CORE . 'database_mass_delete.inc.php');
return CORE_database_mass_delete($VAR, $construct, $type);
}
function delete($VAR, &$construct, $type)
{
include_once(PATH_CORE . 'database_delete.inc.php');
return CORE_database_delete($VAR, $construct, $type);
}
function join_fields($result, $linked)
{
include_once(PATH_CORE . 'database_join_fields.inc.php');
return CORE_database_join_fields($result, $linked);
}
// replaced in v1.4.91 (use sqlSelect)
function sql_select($TableList, $FieldList, $Conditions, $Order, &$db) {
return sqlSelect( $db, $TableList, $FieldList, $Conditions, $Order);
}
/**
* Remove fields from the standard construct type to ingore insert/select/validation rules set in construct
*
* @param array $ignore_fields
* @param string $construct_fields
* @return array
*/
function ignore_fields($ignore_fields,$construct_fields) {
if(!is_array($construct_fields)) $fields = explode(",", $construct_fields); else $fields = $construct_fields;
foreach($fields as $id=>$fld) {
if(in_array($fld,$ignore_fields)) {
unset($fields[$id]);
}
}
return $fields;
}
}
class CORE_debugger
{
var $sql_count;
function sql_count() {
if(!isset($this->sql_count)) $this->sql_count = 0;
$this->sql_count++;
}
function alert($message) {
$this->alert = Array ($message);
}
function error($module, $method, $message) {
$this->error = $module . ':'. $method . ' =>   ' . $message . '
';
if(defined("ERROR_REPORTING") && ERROR_REPORTING > 0) $this->alert($this->error);
$db = &DB();
$this->record_id = $db->GenID(AGILE_DB_PREFIX . "" . 'log_error_id');
$q = "INSERT INTO ".AGILE_DB_PREFIX."log_error
SET
id = ". $db->qstr($this->record_id).",
date_orig = ". $db->qstr(time()).",
account_id = ". @$db->qstr(SESS_ACCOUNT).",
module = ". $db->qstr($module).",
method = ". $db->qstr($method).",
message = ". $db->qstr($message).",
site_id = ". @$db->qstr(DEFAULT_SITE);
$result = $db->Execute($q);
}
}
function &DB($debug=false) {
static $saved_db_conn;
if (isset($saved_db_conn) && defined("AGILE_DB_CACHE")) {
#echo 'Cached:
'.print_r($saved_db_conn,true).'
'.print_r($saved_db_conn,true).'