mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 01:01:41 +09:00
#113 DB 클래스에 index 유무 파악과 index추가 method 추가. (mysql만 동작)
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@2387 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
1d2f012c71
commit
749873e6c1
5 changed files with 87 additions and 0 deletions
|
|
@ -236,6 +236,19 @@
|
|||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 테이블에 특정 인덱스 추가
|
||||
* $target_columns = array(col1, col2)
|
||||
* $is_unique? unique : none
|
||||
**/
|
||||
function addIndex($table_name, $index_name, $target_columns, $is_unique = false) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 테이블의 index 정보를 return
|
||||
**/
|
||||
function isIndexExists($table_name, $index_name) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief xml 을 받아서 테이블을 생성
|
||||
|
|
|
|||
|
|
@ -244,6 +244,30 @@
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 테이블에 특정 인덱스 추가
|
||||
* $target_columns = array(col1, col2)
|
||||
* $is_unique? unique : none
|
||||
**/
|
||||
function addIndex($table_name, $index_name, $target_columns, $is_unique = false) {
|
||||
if(!is_array($target_columns)) $target_columns = array($target_columns);
|
||||
|
||||
$query = sprintf("alter table %s%s add %s index %s (%s);", $this->prefix, $table_name, $is_unique?'unique':'', $index_name, implode(',',$target_columns));
|
||||
$this->_query($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 테이블의 index 정보를 return
|
||||
**/
|
||||
function isIndexExists($table_name, $index_name) {
|
||||
$query = sprintf("show indexes from %s%s where key_name = '%s' ", $this->prefix, $table_name, $index_name);
|
||||
$result = $this->_query($query);
|
||||
if($this->isError()) return;
|
||||
$output = $this->_fetch($result);
|
||||
if($output->Key_name == $index_name) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief xml 을 받아서 테이블을 생성
|
||||
**/
|
||||
|
|
|
|||
|
|
@ -253,7 +253,29 @@
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 테이블에 특정 인덱스 추가
|
||||
* $target_columns = array(col1, col2)
|
||||
* $is_unique? unique : none
|
||||
**/
|
||||
function addIndex($table_name, $index_name, $target_columns, $is_unique = false) {
|
||||
if(!is_array($target_columns)) $target_columns = array($target_columns);
|
||||
|
||||
$query = sprintf("alter table %s%s add %s index %s (%s);", $this->prefix, $table_name, $is_unique?'unique':'', $index_name, implode(',',$target_columns));
|
||||
$this->_query($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 테이블의 index 정보를 return
|
||||
**/
|
||||
function isIndexExists($table_name, $index_name) {
|
||||
$query = sprintf("show indexes from %s%s where key_name = '%s' ", $this->prefix, $table_name, $index_name);
|
||||
$result = $this->_query($query);
|
||||
if($this->isError()) return;
|
||||
$output = $this->_fetch($result);
|
||||
if($output->Key_name == $index_name) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief xml 을 받아서 테이블을 생성
|
||||
|
|
|
|||
|
|
@ -227,6 +227,20 @@
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 테이블에 특정 인덱스 추가
|
||||
* $target_columns = array(col1, col2)
|
||||
* $is_unique? unique : none
|
||||
**/
|
||||
function addIndex($table_name, $index_name, $target_columns, $is_unique = false) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 테이블의 index 정보를 return
|
||||
**/
|
||||
function isIndexExists($table_name, $index_name) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief xml 을 받아서 테이블을 생성
|
||||
**/
|
||||
|
|
|
|||
|
|
@ -250,6 +250,20 @@
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 테이블에 특정 인덱스 추가
|
||||
* $target_columns = array(col1, col2)
|
||||
* $is_unique? unique : none
|
||||
**/
|
||||
function addIndex($table_name, $index_name, $target_columns, $is_unique = false) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 테이블의 index 정보를 return
|
||||
**/
|
||||
function isIndexExists($table_name, $index_name) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief xml 을 받아서 테이블을 생성
|
||||
**/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue