Reverted rev 10009 and 10010 related to db classes - will commit changes to 1.6.0 branch.

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@10012 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
ucorina 2012-01-05 12:08:50 +00:00
parent 1f5e256339
commit 00d2fdf2b1
8 changed files with 38 additions and 175 deletions

View file

@ -175,12 +175,6 @@
* @return list of supported db
**/
function _getSupportedList() {
static $get_supported_list = '';
if(is_array($get_supported_list)) {
$this->supported_list = $get_supported_list;
return $this->supported_list;
}
$get_supported_list = array();
$db_classes_path = _XE_PATH_."classes/db/";
$filter = "/^DB([^\.]+)\.class\.php/i";
$supported_list = FileHandler::readDir($db_classes_path, $filter, true);
@ -207,9 +201,9 @@
$obj->db_type = $db_type;
$obj->enable = $oDB->isSupported() ? true : false;
$get_supported_list[] = $obj;
$this->supported_list[] = $obj;
}
$this->supported_list = $get_supported_list;
return $this->supported_list;
}
@ -337,7 +331,6 @@
* @remarks this function finds xml file or cache file of $query_id, compiles it and then execute it
**/
function executeQuery($query_id, $args = NULL, $arg_columns = NULL) {
static $cache_file = array();
if(!$query_id) return new Object(-1, 'msg_invalid_queryid');
if(!$this->db_type) return;
@ -345,40 +338,38 @@
$this->query_id = $query_id;
if(!isset($cache_file[$query_id])) {
$id_args = explode('.', $query_id);
if(count($id_args) == 2) {
$target = 'modules';
$module = $id_args[0];
$id = $id_args[1];
} elseif(count($id_args) == 3) {
$target = $id_args[0];
if(!in_array($target, array('addons','widgets'))){
$this->actDBClassFinish();
return;
}
$module = $id_args[1];
$id = $id_args[2];
}
if(!$target || !$module || !$id){
$this->actDBClassFinish();
return new Object(-1, 'msg_invalid_queryid');
}
$id_args = explode('.', $query_id);
if(count($id_args) == 2) {
$target = 'modules';
$module = $id_args[0];
$id = $id_args[1];
} elseif(count($id_args) == 3) {
$target = $id_args[0];
if(!in_array($target, array('addons','widgets'))){
$this->actDBClassFinish();
return;
}
$module = $id_args[1];
$id = $id_args[2];
}
if(!$target || !$module || !$id){
$this->actDBClassFinish();
return new Object(-1, 'msg_invalid_queryid');
}
$xml_file = sprintf('%s%s/%s/queries/%s.xml', _XE_PATH_, $target, $module, $id);
if(!file_exists($xml_file)){
$this->actDBClassFinish();
return new Object(-1, 'msg_invalid_queryid');
}
$xml_file = sprintf('%s%s/%s/queries/%s.xml', _XE_PATH_, $target, $module, $id);
if(!file_exists($xml_file)){
$this->actDBClassFinish();
return new Object(-1, 'msg_invalid_queryid');
}
// look for cache file
$cache_file[$query_id] = $this->checkQueryCacheFile($query_id, $xml_file);
}
$result = $this->_executeQuery($cache_file[$query_id], $args, $query_id, $arg_columns);
// look for cache file
$cache_file = $this->checkQueryCacheFile($query_id, $xml_file);
$result = $this->_executeQuery($cache_file, $args, $query_id, $arg_columns);
$this->actDBClassFinish();
// execute query
return $result;
$this->actDBClassFinish();
// execute query
return $result;
}

View file

@ -92,10 +92,6 @@
$this->tables = $tables;
}
function setSubquery($subquery){
$this->subquery = $subquery;
}
function setConditions($conditions){
$this->conditions = array();
@ -189,20 +185,6 @@
function getInsertString($with_values = true){
$columnsList = '';
if($this->subquery){ // means we have insert-select
foreach($this->columns as $column){
$columnsList .= $column->getColumnName() . ', ';
}
$columnsList = substr($columnsList, 0, -2);
$selectStatement = $this->subquery->toString($with_values);
$selectStatement = substr($selectStatement, 1, -1);
return "($columnsList) \n $selectStatement";
}
$valuesList = '';
foreach($this->columns as $column){
if($column->show()){