mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-01 00:02:21 +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
|
|
@ -434,6 +434,42 @@
|
|||
return $this->_query($query);
|
||||
}
|
||||
|
||||
function getSelectSql($query){
|
||||
$with_value = false;
|
||||
|
||||
//$limitOffset = $query->getLimit()->getOffset();
|
||||
//if($limitOffset)
|
||||
// TODO Implement Limit with offset with subquery
|
||||
$limit = '';$limitCount = '';
|
||||
if($query->getLimit())
|
||||
$limitCount = $query->getLimit()->getLimit();
|
||||
if($limitCount != '') $limit = 'SELECT TOP ' . $limitCount;
|
||||
|
||||
$select = $query->getSelectString($with_values);
|
||||
if($select == '') return new Object(-1, "Invalid query");
|
||||
if($limit != '')
|
||||
$select = $limit.' '.$select;
|
||||
else
|
||||
$select = 'SELECT ' .$select;
|
||||
|
||||
$from = $query->getFromString($with_values);
|
||||
if($from == '') return new Object(-1, "Invalid query");
|
||||
$from = ' FROM '.$from;
|
||||
|
||||
$where = $query->getWhereString($with_values);
|
||||
if($where != '') $where = ' WHERE ' . $where;
|
||||
|
||||
$groupBy = $query->getGroupByString();
|
||||
if($groupBy != '') $groupBy = ' GROUP BY ' . $groupBy;
|
||||
|
||||
$orderBy = $query->getOrderByString();
|
||||
if($orderBy != '') $orderBy = ' ORDER BY ' . $orderBy;
|
||||
|
||||
|
||||
|
||||
return $select . ' ' . $from . ' ' . $where . ' ' . $groupBy . ' ' . $orderBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Handle selectAct
|
||||
*
|
||||
|
|
@ -451,6 +487,9 @@
|
|||
return $buff;
|
||||
}
|
||||
|
||||
function getParser(){
|
||||
return new DBParser("[", "]");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue