mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 18:51:41 +09:00
Updated DB classes for supporting prepared statements - SQL string can now be returned with '?' instead of argument values.
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0-DB@8458 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
313bfca8e8
commit
b6a1088995
14 changed files with 107 additions and 52 deletions
|
|
@ -11,6 +11,11 @@
|
|||
var $orderby;
|
||||
var $limit;
|
||||
|
||||
var $arguments = array();
|
||||
|
||||
function addArgument($argument){
|
||||
$this->arguments[] = $argument;
|
||||
}
|
||||
|
||||
function setQueryId($queryID){
|
||||
$this->queryID = $queryID;
|
||||
|
|
@ -106,28 +111,28 @@
|
|||
return $this->action;
|
||||
}
|
||||
|
||||
function getSelectString(){
|
||||
function getSelectString($with_values = true){
|
||||
$select = '';
|
||||
foreach($this->columns as $column){
|
||||
if($column->show())
|
||||
$select .= $column->getExpression() . ', ';
|
||||
$select .= $column->getExpression($with_values) . ', ';
|
||||
}
|
||||
if(trim($select) == '') return '';
|
||||
$select = substr($select, 0, -2);
|
||||
return $select;
|
||||
}
|
||||
|
||||
function getUpdateString(){
|
||||
return $this->getSelectString();
|
||||
function getUpdateString($with_values = true){
|
||||
return $this->getSelectString($with_values);
|
||||
}
|
||||
|
||||
function getInsertString(){
|
||||
function getInsertString($with_values = true){
|
||||
$columnsList = '';
|
||||
$valuesList = '';
|
||||
foreach($this->columns as $column){
|
||||
if($column->show()){
|
||||
$columnsList .= $column->getColumnName() . ', ';
|
||||
$valuesList .= $column->getValue() . ', ';
|
||||
$valuesList .= $column->getValue($with_values) . ', ';
|
||||
}
|
||||
}
|
||||
$columnsList = substr($columnsList, 0, -2);
|
||||
|
|
@ -140,23 +145,23 @@
|
|||
return $this->tables;
|
||||
}
|
||||
|
||||
function getFromString(){
|
||||
function getFromString($with_values = true){
|
||||
$from = '';
|
||||
$simple_table_count = 0;
|
||||
foreach($this->tables as $table){
|
||||
if($table->isJoinTable() || !$simple_table_count) $from .= $table->toString() . ' ';
|
||||
else $from .= ', '.$table->toString() . ' ';
|
||||
if($table->isJoinTable() || !$simple_table_count) $from .= $table->toString($with_values) . ' ';
|
||||
else $from .= ', '.$table->toString($with_values) . ' ';
|
||||
$simple_table_count++;
|
||||
}
|
||||
if(trim($from) == '') return '';
|
||||
return $from;
|
||||
}
|
||||
|
||||
function getWhereString(){
|
||||
function getWhereString($with_values = true){
|
||||
$where = '';
|
||||
if(count($this->conditions) > 0){
|
||||
foreach($this->conditions as $conditionGroup){
|
||||
$where .= $conditionGroup->toString();
|
||||
$where .= $conditionGroup->toString($with_values);
|
||||
}
|
||||
if(trim($where) == '') return '';
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue