Included some missing classes.

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0-DB@8383 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
mosmartin 2011-05-19 15:31:47 +00:00
parent 9a2c0a8ff9
commit 0f61e5d499
8 changed files with 55 additions and 48 deletions

View file

@ -319,13 +319,16 @@
require_once(_XE_PATH_.'classes/db/queryparts/expression/Expression.class.php'); require_once(_XE_PATH_.'classes/db/queryparts/expression/Expression.class.php');
require_once(_XE_PATH_.'classes/db/queryparts/expression/SelectExpression.class.php'); require_once(_XE_PATH_.'classes/db/queryparts/expression/SelectExpression.class.php');
require_once(_XE_PATH_.'classes/db/queryparts/expression/InsertExpression.class.php'); require_once(_XE_PATH_.'classes/db/queryparts/expression/InsertExpression.class.php');
require_once(_XE_PATH_.'classes/db/queryparts/expression/UpdateExpression.class.php');
require_once(_XE_PATH_.'classes/db/queryparts/table/Table.class.php'); require_once(_XE_PATH_.'classes/db/queryparts/table/Table.class.php');
require_once(_XE_PATH_.'classes/db/queryparts/table/JoinTable.class.php'); require_once(_XE_PATH_.'classes/db/queryparts/table/JoinTable.class.php');
require_once(_XE_PATH_.'classes/db/queryparts/condition/ConditionGroup.class.php'); require_once(_XE_PATH_.'classes/db/queryparts/condition/ConditionGroup.class.php');
require_once(_XE_PATH_.'classes/db/queryparts/condition/Condition.class.php'); require_once(_XE_PATH_.'classes/db/queryparts/condition/Condition.class.php');
require_once(_XE_PATH_.'classes/db/queryparts/expression/StarExpression.class.php'); require_once(_XE_PATH_.'classes/db/queryparts/expression/StarExpression.class.php');
require_once(_XE_PATH_.'classes/db/queryparts/order/OrderByColumn.class.php');
$output = @include($cache_file);
$output = include($cache_file);
if( (is_a($output, 'Object') || is_subclass_of($output, 'Object')) && !$output->toBool()) return $output; if( (is_a($output, 'Object') || is_subclass_of($output, 'Object')) && !$output->toBool()) return $output;
$output->_tables = ($output->_tables && is_array($output->_tables)) ? $output->_tables : array(); $output->_tables = ($output->_tables && is_array($output->_tables)) ? $output->_tables : array();

View file

@ -669,20 +669,20 @@
$columnsList = substr($columnsList, 0, -2); $columnsList = substr($columnsList, 0, -2);
$valuesList = substr($valuesList, 0, -2); $valuesList = substr($valuesList, 0, -2);
// TODO Make sure column values are escaped. Preferably directly from the cache file and not in here $query = "INSERT INTO $tableName \n ($columnsList) \n VALUES ($valuesList)";
$query = "INSERT INTO $tableName ($columnsList) VALUES ($valuesList)";
$query .= (__DEBUG_QUERY__&1 && $output->query_id)?sprintf (' '.$this->comment_syntax, $this->query_id):'';
return $query;
/*$query .= (__DEBUG_QUERY__&1 && $output->query_id)?sprintf (' '.$this->comment_syntax, $this->query_id):'';
$result = $this->_query ($query); $result = $this->_query ($query);
if ($result && !$this->transaction_started) { if ($result && !$this->transaction_started) {
@cubrid_commit ($this->fd); @cubrid_commit ($this->fd);
} }
return $result; return $result;
*/ }
}
/**
* @brief handles updateAct
**/
function _executeUpdateAct ($output) function _executeUpdateAct ($output)
{ {
$query = ''; $query = '';
@ -690,34 +690,35 @@
$tableName = $output->tables[0]->getName(); $tableName = $output->tables[0]->getName();
$columnsList = ''; $columnsList = '';
$valuesList = '';
foreach($output->columns as $column){ foreach($output->columns as $column){
if($column->show()){ if($column->show()){
$columnsList .= $column->getColumnName() . ', '; $columnsList .= $column->getExpression() . ', ';
$valuesList .= $column->getValue() . ', ';
} }
} }
$columnsList = substr($columnsList, 0, -2); $columnsList = substr($columnsList, 0, -2);
$valuesList = substr($valuesList, 0, -2);
$where = '';
if(count($output->conditions) > 0){
$where = 'WHERE ';
foreach($output->conditions as $conditionGroup){
$where .= $conditionGroup->toString();
}
}
// TODO Make sure column values are escaped. Preferably directly from the cache file and not in here $query = "UPDATE $tableName SET $columnsList ".$where;
$query = "UPDATE INTO $tableName ($columnsList) VALUES ($valuesList)";
return $query;
/*$query .= (__DEBUG_QUERY__&1 && $output->query_id)?sprintf (' '.$this->comment_syntax, $this->query_id):'';
$result = $this->_query ($query); $result = $this->_query ($query);
if ($result && !$this->transaction_started) { if ($result && !$this->transaction_started) @cubrid_commit ($this->fd);
@cubrid_commit ($this->fd);
}
return $result; return $result;
*/ }
}
/** /**
* @brief handles deleteAct * @brief handles deleteAct
**/ **/
function _executeDeleteAct($output){ function _executeDeleteAct ($output)
{
$query = ''; $query = '';
$select = 'DELETE '; $select = 'DELETE ';
@ -737,23 +738,12 @@
$where .= $conditionGroup->toString(); $where .= $conditionGroup->toString();
} }
} }
/*
$groupBy = '';
if($output->groups) if($output->groups[0] !== "")
$groupBy = 'GROUP BY ' . implode(', ', $output->groups);
$orderBy = '';
if(count($output->orderby) > 0){
$orderBy = 'ORDER BY ';
foreach($output->orderby as $order){
$orderBy .= $order->toString() .', ';
}
$orderBy = substr($orderBy, 0, -2);
}
*/
$query = $select . ' ' . $from . ' ' . $where . ' ' . $groupBy . ' ' . $orderBy; $query = $select . ' ' . $from . ' ' . $where . ' ' . $groupBy . ' ' . $orderBy;
return $query; $result = $this->_query ($query);
if ($result && !$this->transaction_started) @cubrid_commit ($this->fd);
return $result;
} }
/** /**
@ -775,9 +765,14 @@
$from = 'FROM '; $from = 'FROM ';
$simple_table_count = 0; $simple_table_count = 0;
foreach($output->tables as $table){ foreach($output->tables as $table){
if($simple_table_count > 0) $from .= ', '; /*if($simple_table_count > 0) $from .= ', ';
$from .= $table->toString() . ' '; $from .= $table->toString() . ' ';
if(!$table->isJoinTable()) $simple_table_count++; if(!$table->isJoinTable()) $simple_table_count++;
*/
if($table->isJoinTable() || !$simple_table_count) $from .= $table->toString() . ' ';
else $from .= ', '.$table->toString() . ' ';
$simple_table_count++;
} }
$where = ''; $where = '';
@ -803,8 +798,18 @@
$query = $select . ' ' . $from . ' ' . $where . ' ' . $groupBy . ' ' . $orderBy; $query = $select . ' ' . $from . ' ' . $where . ' ' . $groupBy . ' ' . $orderBy;
return $query;
} //$query = sprintf ("select %s from %s %s %s %s", $columns, implode (',',$table_list), implode (' ',$left_join), $condition, //$groupby_query.$orderby_query);
//$query .= (__DEBUG_QUERY__&1 && $output->query_id)?sprintf (' '.$this->comment_syntax, $this->query_id):'';
$result = $this->_query ($query);
if ($this->isError ()) return;
$data = $this->_fetch ($result);
$buff = new Object ();
$buff->data = $data;
return $buff;
}
/*function _executeSelectAct ($output) /*function _executeSelectAct ($output)
{ {
// tables // tables

View file

@ -36,7 +36,7 @@
if(!$this->dbParser){ if(!$this->dbParser){
//$oDB = &DB::getParser(); //$oDB = &DB::getParser();
//$dbParser = $oDB->getParser(); //$dbParser = $oDB->getParser();
$this->dbParser = new DBParser('`'); $this->dbParser = new DBParser('"');
} }
return $this->dbParser; return $this->dbParser;
} }

View file

@ -19,6 +19,7 @@
if(!isset($this->value)) return; if(!isset($this->value)) return;
$str_pos = strpos($this->value, '('); $str_pos = strpos($this->value, '(');
// TODO Replace this with parseExpression
if($str_pos===false) return '"'.$this->value.'"'; if($str_pos===false) return '"'.$this->value.'"';
$func_name = substr($this->value, 0, $str_pos); $func_name = substr($this->value, 0, $str_pos);

View file

@ -25,8 +25,6 @@
$validator = ''; $validator = '';
if(isset($this->default_value)){ if(isset($this->default_value)){
$this->default_value = new DefaultValue($this->argument_name, $this->default_value); $this->default_value = new DefaultValue($this->argument_name, $this->default_value);
//$v = new DefaultCheck($this->argument_name, $this->default_value);
//$validator .= $v->toString();
$validator .= sprintf("$%s_argument->ensureDefaultValue(%s);\n" $validator .= sprintf("$%s_argument->ensureDefaultValue(%s);\n"
, $this->argument_name , $this->argument_name
, $this->default_value->toString() , $this->default_value->toString()

View file

@ -12,7 +12,7 @@
function IndexTag($index, $dbParser){ function IndexTag($index, $dbParser){
$this->dbParser = $dbParser; $this->dbParser = $dbParser;
$this->argument_name = $index->attrs->var; $this->argument_name = $index->attrs->var;
$index->attrs->default = $this->dbParser->parseExpression($index->attrs->default); //$index->attrs->default = $this->dbParser->parseExpression($index->attrs->default);
$this->default = $index->attrs->default; $this->default = $index->attrs->default;
require_once(_XE_PATH_.'classes/xml/xmlquery/queryargument/QueryArgument.class.php'); require_once(_XE_PATH_.'classes/xml/xmlquery/queryargument/QueryArgument.class.php');
$this->argument = new QueryArgument($index); $this->argument = new QueryArgument($index);
@ -23,7 +23,7 @@
$this->sort_order_argument = new QueryArgument($arg); $this->sort_order_argument = new QueryArgument($arg);
$this->sort_order = "\$args->".$this->sort_order; $this->sort_order = "\$args->".$this->sort_order;
} }
//else $this->sort_order = '"'.$this->sort_order.'"'; else $this->sort_order = '"'.$this->sort_order.'"';
} }
function toString(){ function toString(){

View file

@ -97,7 +97,7 @@
* 1: Enabled * 1: Enabled
* Only particular servers may have a problem in IE browser when sending a compression * Only particular servers may have a problem in IE browser when sending a compression
**/ **/
if(!defined('__OB_GZHANDLER_ENABLE__')) define('__OB_GZHANDLER_ENABLE__', 1); if(!defined('__OB_GZHANDLER_ENABLE__')) define('__OB_GZHANDLER_ENABLE__', 0);
/** /**
* @brief decide to use/not use the php unit test (Path/tests/index.php) * @brief decide to use/not use the php unit test (Path/tests/index.php)

View file

@ -10,6 +10,6 @@
</columns> </columns>
<conditions> <conditions>
<condition operation="equal" column="member_autologin.autologin_key" var="autologin_key" notnull="notnull" /> <condition operation="equal" column="member_autologin.autologin_key" var="autologin_key" notnull="notnull" />
<condition operation="equal" column="member.member_srl" var="member_autologin.member_srl" notnull="notnull" pipe="and" /> <condition operation="equal" column="member.member_srl" default="member_autologin.member_srl" notnull="notnull" pipe="and" />
</conditions> </conditions>
</query> </query>