mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-28 07:39:55 +09:00
merge branche 1.5.0 to trunk (~r10525)
git-svn-id: http://xe-core.googlecode.com/svn/trunk@10534 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
361cd64c16
commit
c9047de30d
15 changed files with 643 additions and 195 deletions
|
|
@ -223,34 +223,36 @@
|
|||
|
||||
function getWhereString($with_values = true, $with_optimization = true){
|
||||
$where = '';
|
||||
$condition_count = 0;
|
||||
|
||||
foreach($this->conditions as $conditionGroup){
|
||||
if($condition_count === 0){
|
||||
$conditionGroup->setPipe("");
|
||||
}
|
||||
$condition_string = $conditionGroup->toString($with_values);
|
||||
$where .= $condition_string;
|
||||
$condition_count++;
|
||||
}
|
||||
|
||||
if($with_optimization &&
|
||||
(strstr($this->getOrderByString(), 'list_order') || strstr($this->getOrderByString(), 'update_order'))){
|
||||
|
||||
if($condition_count !== 0) $where = '(' . $where .') ';
|
||||
|
||||
foreach($this->orderby as $order){
|
||||
$colName = $order->getColumnName();
|
||||
if(strstr($colName, 'list_order') || strstr($colName, 'update_order')){
|
||||
$opt_condition = new ConditionWithoutArgument($colName, 2100000000, 'less', 'and');
|
||||
if ($condition_count === 0) $opt_condition->setPipe("");
|
||||
$where .= $opt_condition->toString($with_values).' ';
|
||||
$condition_count++;
|
||||
$condition_count = 0;
|
||||
|
||||
foreach ($this->conditions as $conditionGroup) {
|
||||
if ($condition_count === 0) {
|
||||
$conditionGroup->setPipe("");
|
||||
}
|
||||
}
|
||||
$condition_string = $conditionGroup->toString($with_values);
|
||||
$where .= $condition_string;
|
||||
$condition_count++;
|
||||
}
|
||||
|
||||
return trim($where);
|
||||
|
||||
if ($with_optimization &&
|
||||
(strstr($this->getOrderByString(), 'list_order') || strstr($this->getOrderByString(), 'update_order'))) {
|
||||
|
||||
if ($condition_count !== 0)
|
||||
$where = '(' . $where . ') ';
|
||||
|
||||
foreach ($this->orderby as $order) {
|
||||
$colName = $order->getColumnName();
|
||||
if (strstr($colName, 'list_order') || strstr($colName, 'update_order')) {
|
||||
$opt_condition = new ConditionWithoutArgument($colName, 2100000000, 'less', 'and');
|
||||
if ($condition_count === 0)
|
||||
$opt_condition->setPipe("");
|
||||
$where .= $opt_condition->toString($with_values) . ' ';
|
||||
$condition_count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return trim($where);
|
||||
}
|
||||
|
||||
function getGroupByString(){
|
||||
|
|
@ -294,6 +296,19 @@
|
|||
if(!isset($this->arguments)){
|
||||
$this->arguments = array();
|
||||
|
||||
// Join table arguments
|
||||
if(count($this->tables) > 0)
|
||||
{
|
||||
foreach($this->tables as $table)
|
||||
{
|
||||
if($table->isJoinTable())
|
||||
{
|
||||
$args = $table->getArguments();
|
||||
if($args) $this->arguments = array_merge($this->arguments, $args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Column arguments
|
||||
if(count($this->columns) > 0){ // The if is for delete statements, all others must have columns
|
||||
foreach($this->columns as $column){
|
||||
|
|
|
|||
|
|
@ -24,13 +24,21 @@
|
|||
}
|
||||
|
||||
function toString($withValue = true){
|
||||
if(!isset($this->_value_to_string)){
|
||||
if(!$this->show()) { $this->_value_to_string = ''; }
|
||||
else if($withValue)
|
||||
$this->_value_to_string = $this->toStringWithValue();
|
||||
else $this->_value_to_string = $this->toStringWithoutValue();
|
||||
}
|
||||
return $this->_value_to_string;
|
||||
if (!isset($this->_value_to_string)) {
|
||||
if (!$this->show())
|
||||
{
|
||||
$this->_value_to_string = '';
|
||||
}
|
||||
else if ($withValue)
|
||||
{
|
||||
$this->_value_to_string = $this->toStringWithValue();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_value_to_string = $this->toStringWithoutValue();
|
||||
}
|
||||
}
|
||||
return $this->_value_to_string;
|
||||
}
|
||||
|
||||
function toStringWithoutValue(){
|
||||
|
|
|
|||
|
|
@ -14,16 +14,27 @@
|
|||
}
|
||||
|
||||
function toStringWithoutValue(){
|
||||
$value = $this->argument->getUnescapedValue();
|
||||
$value = $this->argument->getUnescapedValue();
|
||||
|
||||
if(is_array($value)){
|
||||
$q = '';
|
||||
foreach ($value as $v) $q .= '?,';
|
||||
if($q !== '') $q = substr($q, 0, -1);
|
||||
$q = '(' . $q . ')';
|
||||
}
|
||||
else $q = '?';
|
||||
return $this->pipe . ' ' . $this->getConditionPart($q);
|
||||
if(is_array($value)){
|
||||
$q = '';
|
||||
foreach ($value as $v) $q .= '?,';
|
||||
if($q !== '') $q = substr($q, 0, -1);
|
||||
$q = '(' . $q . ')';
|
||||
}
|
||||
else
|
||||
{
|
||||
// Prepared statements: column names should not be sent as query arguments, but instead concatenated to query string
|
||||
if($this->argument->isColumnName())
|
||||
{
|
||||
$q = $value;
|
||||
}
|
||||
else
|
||||
{
|
||||
$q = '?';
|
||||
}
|
||||
}
|
||||
return $this->pipe . ' ' . $this->getConditionPart($q);
|
||||
}
|
||||
|
||||
function show(){
|
||||
|
|
|
|||
|
|
@ -32,6 +32,15 @@
|
|||
function isJoinTable(){
|
||||
return true;
|
||||
}
|
||||
|
||||
function getArguments()
|
||||
{
|
||||
$args = array();
|
||||
foreach($this->conditions as $conditionGroup)
|
||||
$args = array_merge($args, $conditionGroup->getArguments());
|
||||
return $args;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue