mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-25 22:29:55 +09:00
Updated the query parts that work with arguments (conditions, update and insert expressions) to work with QueryArgument objects instead of string values.
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0-DB@8457 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
e41c45433e
commit
313bfca8e8
18 changed files with 120 additions and 169 deletions
|
|
@ -6,6 +6,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
// TODO Fix this class
|
||||
class DeleteExpression extends Expression {
|
||||
var $value;
|
||||
|
||||
|
|
|
|||
|
|
@ -8,19 +8,20 @@
|
|||
*/
|
||||
|
||||
class InsertExpression extends Expression {
|
||||
var $value;
|
||||
var $argument;
|
||||
|
||||
function InsertExpression($column_name, $value){
|
||||
function InsertExpression($column_name, $argument){
|
||||
parent::Expression($column_name);
|
||||
$this->value = $value;
|
||||
$this->argument = $argument;
|
||||
}
|
||||
|
||||
function getValue(){
|
||||
return $this->value;
|
||||
return $this->argument->getValue();
|
||||
}
|
||||
|
||||
function show(){
|
||||
if(!isset($this->value)) return false;
|
||||
$value = $this->argument->getValue();
|
||||
if(!isset($value)) return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,25 +7,35 @@
|
|||
*/
|
||||
|
||||
class UpdateExpression extends Expression {
|
||||
var $value;
|
||||
var $argument;
|
||||
|
||||
function UpdateExpression($column_name, $value){
|
||||
function UpdateExpression($column_name, $argument){
|
||||
parent::Expression($column_name);
|
||||
$this->value = $value;
|
||||
$this->argument = $argument;
|
||||
}
|
||||
|
||||
function getExpression(){
|
||||
return "$this->column_name = $this->value";
|
||||
return $this->getExpressionWithValue();
|
||||
}
|
||||
|
||||
function getExpressionWithValue(){
|
||||
$value = $this->argument->getValue();
|
||||
return "$this->column_name = $value";
|
||||
}
|
||||
|
||||
function getExpressionWithoutValue(){
|
||||
return "$this->column_name = ?";
|
||||
}
|
||||
|
||||
function getValue(){
|
||||
// TODO Escape value according to column type instead of variable type
|
||||
if(!is_numeric($this->value)) return "'".$this->value."'";
|
||||
return $this->value;
|
||||
$value = $this->argument->getValue();
|
||||
if(!is_numeric($value)) return "'".$value."'";
|
||||
return $value;
|
||||
}
|
||||
|
||||
function show(){
|
||||
if(!$this->value) return false;
|
||||
if(!$this->argument->getValue()) return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue