mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-02 01:52:10 +09:00
Updated the way DB class files are included.
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@9034 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
03b5c9a365
commit
833dcfae37
18 changed files with 270 additions and 242 deletions
|
|
@ -1,74 +1,65 @@
|
|||
<?php
|
||||
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/tags/column/ColumnTag.class.php');
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/tags/column/SelectColumnsTag.class.php');
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/tags/column/InsertColumnsTag.class.php');
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/tags/column/UpdateColumnsTag.class.php');
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/tags/table/TablesTag.class.php');
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/tags/condition/ConditionsTag.class.php');
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/tags/condition/JoinConditionsTag.class.php');
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/tags/group/GroupsTag.class.php');
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/tags/navigation/NavigationTag.class.php');
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/tags/navigation/IndexTag.class.php');
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/tags/query/QueryTag.class.php');
|
||||
class QueryParser {
|
||||
|
||||
class QueryParser {
|
||||
var $queryTag;
|
||||
|
||||
function QueryParser($query, $isSubQuery = false){
|
||||
$this->queryTag = new QueryTag($query, $isSubQuery);
|
||||
}
|
||||
|
||||
function getTableInfo($query_id, $table_name){
|
||||
$column_type = array();
|
||||
|
||||
$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('modules','addons','widgets'))) return;
|
||||
$module = $id_args[1];
|
||||
$id = $id_args[2];
|
||||
}
|
||||
|
||||
// get column properties from the table
|
||||
$table_file = sprintf('%s%s/%s/schemas/%s.xml', _XE_PATH_, 'modules', $module, $table_name);
|
||||
if(!file_exists($table_file)) {
|
||||
$searched_list = FileHandler::readDir(_XE_PATH_.'modules');
|
||||
$searched_count = count($searched_list);
|
||||
for($i=0;$i<$searched_count;$i++) {
|
||||
$table_file = sprintf('%s%s/%s/schemas/%s.xml', _XE_PATH_, 'modules', $searched_list[$i], $table_name);
|
||||
if(file_exists($table_file)) break;
|
||||
var $queryTag;
|
||||
|
||||
function QueryParser($query, $isSubQuery = false) {
|
||||
$this->queryTag = new QueryTag($query, $isSubQuery);
|
||||
}
|
||||
|
||||
function getTableInfo($query_id, $table_name) {
|
||||
$column_type = array();
|
||||
|
||||
$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('modules', 'addons', 'widgets')))
|
||||
return;
|
||||
$module = $id_args[1];
|
||||
$id = $id_args[2];
|
||||
}
|
||||
}
|
||||
|
||||
if(file_exists($table_file)) {
|
||||
$table_xml = FileHandler::readFile($table_file);
|
||||
$xml_parser = new XmlParser();
|
||||
$table_obj = $xml_parser->parse($table_xml);
|
||||
if($table_obj->table) {
|
||||
if(isset($table_obj->table->column) && !is_array($table_obj->table->column))
|
||||
{
|
||||
$table_obj->table->column = array($table_obj->table->column);
|
||||
}
|
||||
|
||||
foreach($table_obj->table->column as $k => $v) {
|
||||
$column_type[$v->attrs->name] = $v->attrs->type;
|
||||
// get column properties from the table
|
||||
$table_file = sprintf('%s%s/%s/schemas/%s.xml', _XE_PATH_, 'modules', $module, $table_name);
|
||||
if (!file_exists($table_file)) {
|
||||
$searched_list = FileHandler::readDir(_XE_PATH_ . 'modules');
|
||||
$searched_count = count($searched_list);
|
||||
for ($i = 0; $i < $searched_count; $i++) {
|
||||
$table_file = sprintf('%s%s/%s/schemas/%s.xml', _XE_PATH_, 'modules', $searched_list[$i], $table_name);
|
||||
if (file_exists($table_file))
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $column_type;
|
||||
}
|
||||
|
||||
function toString(){
|
||||
return "<?php if(!defined('__ZBXE__')) exit();\n"
|
||||
.$this->queryTag->toString()
|
||||
. 'return $query; ?>';
|
||||
}
|
||||
}
|
||||
|
||||
if (file_exists($table_file)) {
|
||||
$table_xml = FileHandler::readFile($table_file);
|
||||
$xml_parser = new XmlParser();
|
||||
$table_obj = $xml_parser->parse($table_xml);
|
||||
if ($table_obj->table) {
|
||||
if (isset($table_obj->table->column) && !is_array($table_obj->table->column)) {
|
||||
$table_obj->table->column = array($table_obj->table->column);
|
||||
}
|
||||
|
||||
foreach ($table_obj->table->column as $k => $v) {
|
||||
$column_type[$v->attrs->name] = $v->attrs->type;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $column_type;
|
||||
}
|
||||
|
||||
function toString() {
|
||||
return "<?php if(!defined('__ZBXE__')) exit();\n"
|
||||
. $this->queryTag->toString()
|
||||
. 'return $query; ?>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue