mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 02:31:40 +09:00
Fix - read table prefix from db_config file instead of always using default "xe_".
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@8700 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
4ead81754f
commit
abf5a1f5a3
5 changed files with 70 additions and 70 deletions
|
|
@ -685,7 +685,7 @@
|
|||
}
|
||||
|
||||
function getParser(){
|
||||
return new DBParser('"');
|
||||
return new DBParser('"', '"', $this->prefix);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@
|
|||
$this->_setDBInfo();
|
||||
$this->_connect();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief create an instance of this class
|
||||
*/
|
||||
|
|
@ -601,7 +601,7 @@
|
|||
// auto_increment in Firebird creates a generator which activates a trigger when insert occurs
|
||||
// the generator increases the value of the generator and then insert to the table
|
||||
// The trigger below acts like auto_increment however I commented the below because the trigger cannot be defined by a query statement
|
||||
// php api has a function to increase a generator, so
|
||||
// php api has a function to increase a generator, so
|
||||
// no need to use auto increment in XE
|
||||
/*
|
||||
$schema = 'SET TERM ^ ; ';
|
||||
|
|
@ -640,7 +640,7 @@
|
|||
* @brief handles deleteAct
|
||||
**/
|
||||
function _executeDeleteAct($queryObject) {
|
||||
$query = $this->getDeleteSql($queryObject);
|
||||
$query = $this->getDeleteSql($queryObject);
|
||||
if(is_a($query, 'Object')) return;
|
||||
return $this->_query($query);
|
||||
}
|
||||
|
|
@ -653,15 +653,15 @@
|
|||
**/
|
||||
function _executeSelectAct($queryObject) {
|
||||
$query = $this->getSelectSql($queryObject);
|
||||
|
||||
if(is_a($query, 'Object')) return;
|
||||
|
||||
if(is_a($query, 'Object')) return;
|
||||
$query .= (__DEBUG_QUERY__&1 && $queryObject->query_id)?sprintf(' '.$this->comment_syntax,$this->query_id):'';
|
||||
$result = $this->_query ($query);
|
||||
|
||||
|
||||
if ($this->isError ()) return $this->queryError($queryObject);
|
||||
else return $this->queryPageLimit($queryObject, $result);
|
||||
else return $this->queryPageLimit($queryObject, $result);
|
||||
}
|
||||
|
||||
|
||||
function queryError($queryObject) {
|
||||
if ($queryObject->getLimit() && $queryObject->getLimit()->isPageHandler()) {
|
||||
$buff = new Object ();
|
||||
|
|
@ -696,7 +696,7 @@
|
|||
$virtual_no = $total_count - ($queryObject->getLimit()->page - 1) * $queryObject->getLimit()->list_count;
|
||||
while ($tmp = ibase_fetch_object($result))
|
||||
$data[$virtual_no--] = $tmp;
|
||||
|
||||
|
||||
if (!$this->transaction_started)
|
||||
@ibase_commit($this->fd);
|
||||
|
||||
|
|
@ -715,7 +715,7 @@
|
|||
}
|
||||
|
||||
function getParser() {
|
||||
return new DBParser('"');
|
||||
return new DBParser('"', '"', $this->prefix);
|
||||
}
|
||||
|
||||
function getSelectSql($query, $with_values = true) {
|
||||
|
|
|
|||
|
|
@ -515,7 +515,7 @@
|
|||
}
|
||||
|
||||
function getParser(){
|
||||
return new DBParser("[", "]");
|
||||
return new DBParser("[", "]", $this->prefix);
|
||||
}
|
||||
|
||||
function queryError($queryObject){
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@
|
|||
$this->_setDBInfo();
|
||||
$this->_connect();
|
||||
}
|
||||
|
||||
|
||||
function create() {
|
||||
return new DBMysql;
|
||||
}
|
||||
|
|
@ -171,7 +171,7 @@
|
|||
else $output[] = $tmp;
|
||||
}
|
||||
if(count($output)==1){
|
||||
if(isset($arrayIndexEndValue)) return $output;
|
||||
if(isset($arrayIndexEndValue)) return $output;
|
||||
else return $output[0];
|
||||
}
|
||||
return $output;
|
||||
|
|
@ -411,9 +411,9 @@
|
|||
**/
|
||||
function _executeDeleteAct($queryObject) {
|
||||
$query = $this->getDeleteSql($queryObject);
|
||||
|
||||
|
||||
if(is_a($query, 'Object')) return;
|
||||
|
||||
|
||||
//priority setting
|
||||
// TODO Check what priority does
|
||||
//$priority = '';
|
||||
|
|
@ -429,17 +429,17 @@
|
|||
**/
|
||||
function _executeSelectAct($queryObject) {
|
||||
$query = $this->getSelectSql($queryObject);
|
||||
|
||||
|
||||
if(is_a($query, 'Object')) return;
|
||||
|
||||
|
||||
$query .= (__DEBUG_QUERY__&1 && $queryObject->query_id)?sprintf(' '.$this->comment_syntax,$this->query_id):'';
|
||||
|
||||
|
||||
// TODO Add support for click count
|
||||
// TODO Add code for pagination
|
||||
|
||||
// TODO Add code for pagination
|
||||
|
||||
$result = $this->_query ($query);
|
||||
if ($this->isError ()) return $this->queryError($queryObject);
|
||||
else return $this->queryPageLimit($queryObject, $result);
|
||||
else return $this->queryPageLimit($queryObject, $result);
|
||||
}
|
||||
|
||||
function db_insert_id()
|
||||
|
|
@ -451,11 +451,11 @@
|
|||
{
|
||||
return mysql_fetch_object($result);
|
||||
}
|
||||
|
||||
function getParser(){
|
||||
return new DBParser('`');
|
||||
|
||||
function getParser(){
|
||||
return new DBParser('`', '`', $this->prefix);
|
||||
}
|
||||
|
||||
|
||||
function queryError($queryObject){
|
||||
if ($queryObject->getLimit() && $queryObject->getLimit()->isPageHandler()){
|
||||
$buff = new Object ();
|
||||
|
|
@ -465,10 +465,10 @@
|
|||
$buff->data = array ();
|
||||
$buff->page_navigation = new PageHandler (/*$total_count*/0, /*$total_page*/1, /*$page*/1, /*$page_count*/10);//default page handler values
|
||||
return $buff;
|
||||
}else
|
||||
}else
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
function queryPageLimit($queryObject, $result){
|
||||
if ($queryObject->getLimit() && $queryObject->getLimit()->isPageHandler()) {
|
||||
// Total count
|
||||
|
|
@ -481,12 +481,12 @@
|
|||
$result_count = $this->_query($count_query);
|
||||
$count_output = $this->_fetch($result_count);
|
||||
$total_count = (int)$count_output->count;
|
||||
|
||||
|
||||
// Total pages
|
||||
if ($total_count) {
|
||||
$total_page = (int) (($total_count - 1) / $queryObject->getLimit()->list_count) + 1;
|
||||
} else $total_page = 1;
|
||||
|
||||
|
||||
$virtual_no = $total_count - ($queryObject->getLimit()->page - 1) * $queryObject->getLimit()->list_count;
|
||||
$data = $this->_fetch($result, $virtual_no);
|
||||
|
||||
|
|
@ -495,11 +495,11 @@
|
|||
$buff->total_page = $total_page;
|
||||
$buff->page = $queryObject->getLimit()->page->getValue();
|
||||
$buff->data = $data;
|
||||
$buff->page_navigation = new PageHandler($total_count, $total_page, $queryObject->getLimit()->page->getValue(), $queryObject->getLimit()->page_count);
|
||||
$buff->page_navigation = new PageHandler($total_count, $total_page, $queryObject->getLimit()->page->getValue(), $queryObject->getLimit()->page_count);
|
||||
}else{
|
||||
$data = $this->_fetch($result);
|
||||
$buff = new Object ();
|
||||
$buff->data = $data;
|
||||
$buff->data = $data;
|
||||
}
|
||||
return $buff;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,19 +26,19 @@ class DBPostgresql extends DB
|
|||
var $comment_syntax = '/* %s */';
|
||||
|
||||
/**
|
||||
* @brief column type used in postgresql
|
||||
* @brief column type used in postgresql
|
||||
*
|
||||
* Becasue a common column type in schema/query xml is used for colum_type,
|
||||
* it should be replaced properly for each DBMS
|
||||
**/
|
||||
var $column_type = array(
|
||||
'bignumber' => 'bigint',
|
||||
'bignumber' => 'bigint',
|
||||
'number' => 'integer',
|
||||
'varchar' => 'varchar',
|
||||
'char' => 'char',
|
||||
'text' => 'text',
|
||||
'varchar' => 'varchar',
|
||||
'char' => 'char',
|
||||
'text' => 'text',
|
||||
'bigtext' => 'text',
|
||||
'date' => 'varchar(14)',
|
||||
'date' => 'varchar(14)',
|
||||
'float' => 'real',
|
||||
);
|
||||
|
||||
|
|
@ -50,7 +50,7 @@ class DBPostgresql extends DB
|
|||
$this->_setDBInfo();
|
||||
$this->_connect();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief create an instance of this class
|
||||
*/
|
||||
|
|
@ -194,12 +194,12 @@ class DBPostgresql extends DB
|
|||
$query = implode(" ",$l_query_array);
|
||||
}
|
||||
}
|
||||
else if ($l_query_array[0] = "delete")
|
||||
else if ($l_query_array[0] = "delete")
|
||||
{
|
||||
if (strtolower($l_query_array[3]) == "as")
|
||||
{
|
||||
$l_query_array[3] = "";
|
||||
$l_query_array[4] = "";
|
||||
$l_query_array[4] = "";
|
||||
$query = implode(" ",$l_query_array);
|
||||
}
|
||||
}
|
||||
|
|
@ -233,12 +233,12 @@ class DBPostgresql extends DB
|
|||
return;
|
||||
while ($tmp = pg_fetch_object($result)) {
|
||||
if($arrayIndexEndValue) $output[$arrayIndexEndValue--] = $tmp;
|
||||
else $output[] = $tmp;
|
||||
else $output[] = $tmp;
|
||||
}
|
||||
if(count($output)==1){
|
||||
if(isset($arrayIndexEndValue)) return $output;
|
||||
if(isset($arrayIndexEndValue)) return $output;
|
||||
else return $output[0];
|
||||
}
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
|
@ -295,7 +295,7 @@ class DBPostgresql extends DB
|
|||
}
|
||||
if ($notnull) {
|
||||
$query = sprintf("update %s%s set %s = %s ", $this->prefix, $table_name, $column_name, $default);
|
||||
$this->_query($query);
|
||||
$this->_query($query);
|
||||
$query = sprintf("alter table %s%s alter %s set not null ", $this->prefix, $table_name, $column_name);
|
||||
$this->_query($query);
|
||||
}
|
||||
|
|
@ -497,7 +497,7 @@ class DBPostgresql extends DB
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Handle the insertAct
|
||||
**/
|
||||
|
|
@ -505,7 +505,7 @@ class DBPostgresql extends DB
|
|||
{
|
||||
$query = $this->getInsertSql($queryObject);
|
||||
if(is_a($query, 'Object')) return;
|
||||
|
||||
|
||||
return $this->_query($query);
|
||||
}
|
||||
|
||||
|
|
@ -525,13 +525,13 @@ class DBPostgresql extends DB
|
|||
function _executeDeleteAct($queryObject)
|
||||
{
|
||||
$query = $this->getDeleteSql($queryObject);
|
||||
|
||||
|
||||
if(is_a($query, 'Object')) return;
|
||||
return $this->_query($query);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* override
|
||||
* @param $queryObject
|
||||
*/
|
||||
|
|
@ -539,26 +539,26 @@ class DBPostgresql extends DB
|
|||
$select = $query->getSelectString();
|
||||
if($select == '') return new Object(-1, "Invalid query");
|
||||
$select = 'SELECT ' .$select;
|
||||
|
||||
|
||||
$from = $query->getFromString();
|
||||
if($from == '') return new Object(-1, "Invalid query");
|
||||
$from = ' FROM '.$from;
|
||||
|
||||
|
||||
$where = $query->getWhereString();
|
||||
if($where != '') $where = ' WHERE ' . $where;
|
||||
|
||||
|
||||
$groupBy = $query->getGroupByString();
|
||||
if($groupBy != '') $groupBy = ' GROUP BY ' . $groupBy;
|
||||
|
||||
|
||||
$orderBy = $query->getOrderByString();
|
||||
if($orderBy != '') $orderBy = ' ORDER BY ' . $orderBy;
|
||||
|
||||
|
||||
$limit = $query->getLimitString();
|
||||
if($limit != '') $limit = ' LIMIT ' . $query->getLimit()->getLimit() . ' OFFSET ' . $query->getLimit()->getOffset();
|
||||
|
||||
return $select . ' ' . $from . ' ' . $where . ' ' . $groupBy . ' ' . $orderBy . ' ' . $limit;
|
||||
return $select . ' ' . $from . ' ' . $where . ' ' . $groupBy . ' ' . $orderBy . ' ' . $limit;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Handle selectAct
|
||||
*
|
||||
|
|
@ -568,14 +568,14 @@ class DBPostgresql extends DB
|
|||
function _executeSelectAct($queryObject)
|
||||
{
|
||||
$query = $this->getSelectSql($queryObject);
|
||||
|
||||
|
||||
if(is_a($query, 'Object')) return;
|
||||
|
||||
|
||||
$query .= (__DEBUG_QUERY__&1 && $queryObject->query_id)?sprintf(' '.$this->comment_syntax,$this->query_id):'';
|
||||
|
||||
|
||||
// TODO Add support for click count
|
||||
// TODO Add code for pagination
|
||||
|
||||
// TODO Add code for pagination
|
||||
|
||||
$result = $this->_query ($query);
|
||||
if ($this->isError ()) {
|
||||
if ($limit && $output->limit->isPageHandler()){
|
||||
|
|
@ -586,7 +586,7 @@ class DBPostgresql extends DB
|
|||
$buff->data = array ();
|
||||
$buff->page_navigation = new PageHandler (/*$total_count*/0, /*$total_page*/1, /*$page*/1, /*$page_count*/10);//default page handler values
|
||||
return $buff;
|
||||
}else
|
||||
}else
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -601,13 +601,13 @@ class DBPostgresql extends DB
|
|||
$result_count = $this->_query($count_query);
|
||||
$count_output = $this->_fetch($result_count);
|
||||
$total_count = (int)$count_output->count;
|
||||
|
||||
|
||||
// Total pages
|
||||
if ($total_count) {
|
||||
$total_page = (int) (($total_count - 1) / $queryObject->getLimit()->list_count) + 1;
|
||||
} else $total_page = 1;
|
||||
|
||||
|
||||
|
||||
|
||||
$virtual_no = $total_count - ($queryObject->getLimit()->page - 1) * $queryObject->getLimit()->list_count;
|
||||
$data = $this->_fetch($result, $virtual_no);
|
||||
|
||||
|
|
@ -616,18 +616,18 @@ class DBPostgresql extends DB
|
|||
$buff->total_page = $total_page;
|
||||
$buff->page = $queryObject->getLimit()->page->getValue();
|
||||
$buff->data = $data;
|
||||
$buff->page_navigation = new PageHandler($total_count, $total_page, $queryObject->getLimit()->page->getValue(), $queryObject->getLimit()->page_count);
|
||||
$buff->page_navigation = new PageHandler($total_count, $total_page, $queryObject->getLimit()->page->getValue(), $queryObject->getLimit()->page_count);
|
||||
}else{
|
||||
$data = $this->_fetch($result);
|
||||
$buff = new Object ();
|
||||
$buff->data = $data;
|
||||
$buff->data = $data;
|
||||
}
|
||||
|
||||
return $buff;
|
||||
return $buff;
|
||||
}
|
||||
|
||||
|
||||
function getParser(){
|
||||
return new DBParser('"');
|
||||
return new DBParser('"', '"', $this->prefix);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue