mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-24 12:52:19 +09:00
#19008530 mysql 컬럼 및 인덱스에 (`) 구분자 추가
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@7692 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
4168891a34
commit
1fa2e99408
3 changed files with 18 additions and 18 deletions
|
|
@ -223,7 +223,7 @@
|
|||
$type = $this->column_type[$type];
|
||||
if(strtoupper($type)=='INTEGER') $size = '';
|
||||
|
||||
$query = sprintf("alter table %s%s add %s ", $this->prefix, $table_name, $column_name);
|
||||
$query = sprintf("alter table `%s%s` add `%s` ", $this->prefix, $table_name, $column_name);
|
||||
if($size) $query .= sprintf(" %s(%s) ", $type, $size);
|
||||
else $query .= sprintf(" %s ", $type);
|
||||
if($default) $query .= sprintf(" default '%s' ", $default);
|
||||
|
|
@ -236,7 +236,7 @@
|
|||
* @brief 특정 테이블에 특정 column 제거
|
||||
**/
|
||||
function dropColumn($table_name, $column_name) {
|
||||
$query = sprintf("alter table %s%s drop %s ", $this->prefix, $table_name, $column_name);
|
||||
$query = sprintf("alter table `%s%s` drop `%s` ", $this->prefix, $table_name, $column_name);
|
||||
$this->_query($query);
|
||||
}
|
||||
|
||||
|
|
@ -244,7 +244,7 @@
|
|||
* @brief 특정 테이블의 column의 정보를 return
|
||||
**/
|
||||
function isColumnExists($table_name, $column_name) {
|
||||
$query = sprintf("show fields from %s%s", $this->prefix, $table_name);
|
||||
$query = sprintf("show fields from `%s%s`", $this->prefix, $table_name);
|
||||
$result = $this->_query($query);
|
||||
if($this->isError()) return;
|
||||
$output = $this->_fetch($result);
|
||||
|
|
@ -266,7 +266,7 @@
|
|||
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));
|
||||
$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);
|
||||
}
|
||||
|
||||
|
|
@ -274,7 +274,7 @@
|
|||
* @brief 특정 테이블의 특정 인덱스 삭제
|
||||
**/
|
||||
function dropIndex($table_name, $index_name, $is_unique = false) {
|
||||
$query = sprintf("alter table %s%s drop index %s;", $this->prefix, $table_name, $index_name);
|
||||
$query = sprintf("alter table `%s%s` drop index `%s`", $this->prefix, $table_name, $index_name);
|
||||
$this->_query($query);
|
||||
}
|
||||
|
||||
|
|
@ -284,7 +284,7 @@
|
|||
**/
|
||||
function isIndexExists($table_name, $index_name) {
|
||||
//$query = sprintf("show indexes from %s%s where key_name = '%s' ", $this->prefix, $table_name, $index_name);
|
||||
$query = sprintf("show indexes from %s%s", $this->prefix, $table_name);
|
||||
$query = sprintf("show indexes from `%s%s`", $this->prefix, $table_name);
|
||||
$result = $this->_query($query);
|
||||
if($this->isError()) return;
|
||||
$output = $this->_fetch($result);
|
||||
|
|
|
|||
|
|
@ -233,7 +233,7 @@
|
|||
$type = $this->column_type[$type];
|
||||
if(strtoupper($type)=='INTEGER') $size = '';
|
||||
|
||||
$query = sprintf("alter table %s%s add %s ", $this->prefix, $table_name, $column_name);
|
||||
$query = sprintf("alter table `%s%s` add `%s` ", $this->prefix, $table_name, $column_name);
|
||||
if($size) $query .= sprintf(" %s(%s) ", $type, $size);
|
||||
else $query .= sprintf(" %s ", $type);
|
||||
if($default) $query .= sprintf(" default '%s' ", $default);
|
||||
|
|
@ -246,7 +246,7 @@
|
|||
* @brief 특정 테이블에 특정 column 제거
|
||||
**/
|
||||
function dropColumn($table_name, $column_name) {
|
||||
$query = sprintf("alter table %s%s drop %s ", $this->prefix, $table_name, $column_name);
|
||||
$query = sprintf("alter table `%s%s` drop `%s` ", $this->prefix, $table_name, $column_name);
|
||||
$this->_query($query);
|
||||
}
|
||||
|
||||
|
|
@ -254,7 +254,7 @@
|
|||
* @brief 특정 테이블의 column의 정보를 return
|
||||
**/
|
||||
function isColumnExists($table_name, $column_name) {
|
||||
$query = sprintf("show fields from %s%s", $this->prefix, $table_name);
|
||||
$query = sprintf("show fields from `%s%s`", $this->prefix, $table_name);
|
||||
$result = $this->_query($query);
|
||||
if($this->isError()) return;
|
||||
$output = $this->_fetch($result);
|
||||
|
|
@ -276,7 +276,7 @@
|
|||
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));
|
||||
$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);
|
||||
}
|
||||
|
||||
|
|
@ -284,7 +284,7 @@
|
|||
* @brief 특정 테이블의 특정 인덱스 삭제
|
||||
**/
|
||||
function dropIndex($table_name, $index_name, $is_unique = false) {
|
||||
$query = sprintf("alter table %s%s drop index %s;", $this->prefix, $table_name, $index_name);
|
||||
$query = sprintf("alter table `%s%s` drop index `%s`", $this->prefix, $table_name, $index_name);
|
||||
$this->_query($query);
|
||||
}
|
||||
|
||||
|
|
@ -293,7 +293,7 @@
|
|||
**/
|
||||
function isIndexExists($table_name, $index_name) {
|
||||
//$query = sprintf("show indexes from %s%s where key_name = '%s' ", $this->prefix, $table_name, $index_name);
|
||||
$query = sprintf("show indexes from %s%s", $this->prefix, $table_name);
|
||||
$query = sprintf("show indexes from `%s%s`", $this->prefix, $table_name);
|
||||
$result = $this->_query($query);
|
||||
if($this->isError()) return;
|
||||
$output = $this->_fetch($result);
|
||||
|
|
|
|||
|
|
@ -212,7 +212,7 @@
|
|||
$type = $this->column_type[$type];
|
||||
if(strtoupper($type)=='INTEGER') $size = '';
|
||||
|
||||
$query = sprintf("alter table %s%s add %s ", $this->prefix, $table_name, $column_name);
|
||||
$query = sprintf("alter table `%s%s` add `%s` ", $this->prefix, $table_name, $column_name);
|
||||
if($size) $query .= sprintf(" %s(%s) ", $type, $size);
|
||||
else $query .= sprintf(" %s ", $type);
|
||||
if($default) $query .= sprintf(" default '%s' ", $default);
|
||||
|
|
@ -225,7 +225,7 @@
|
|||
* @brief 특정 테이블에 특정 column 제거
|
||||
**/
|
||||
function dropColumn($table_name, $column_name) {
|
||||
$query = sprintf("alter table %s%s drop %s ", $this->prefix, $table_name, $column_name);
|
||||
$query = sprintf("alter table `%s%s` drop `%s` ", $this->prefix, $table_name, $column_name);
|
||||
$this->_query($query);
|
||||
}
|
||||
|
||||
|
|
@ -233,7 +233,7 @@
|
|||
* @brief 특정 테이블의 column의 정보를 return
|
||||
**/
|
||||
function isColumnExists($table_name, $column_name) {
|
||||
$query = sprintf("show fields from %s%s", $this->prefix, $table_name);
|
||||
$query = sprintf("show fields from `%s%s`", $this->prefix, $table_name);
|
||||
$result = $this->_query($query);
|
||||
if($this->isError()) return;
|
||||
$output = $this->_fetch($result);
|
||||
|
|
@ -255,7 +255,7 @@
|
|||
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));
|
||||
$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);
|
||||
}
|
||||
|
||||
|
|
@ -263,7 +263,7 @@
|
|||
* @brief 특정 테이블의 특정 인덱스 삭제
|
||||
**/
|
||||
function dropIndex($table_name, $index_name, $is_unique = false) {
|
||||
$query = sprintf("alter table %s%s drop index %s;", $this->prefix, $table_name, $index_name);
|
||||
$query = sprintf("alter table `%s%s` drop index `%s`", $this->prefix, $table_name, $index_name);
|
||||
$this->_query($query);
|
||||
}
|
||||
|
||||
|
|
@ -273,7 +273,7 @@
|
|||
**/
|
||||
function isIndexExists($table_name, $index_name) {
|
||||
//$query = sprintf("show indexes from %s%s where key_name = '%s' ", $this->prefix, $table_name, $index_name);
|
||||
$query = sprintf("show indexes from %s%s", $this->prefix, $table_name);
|
||||
$query = sprintf("show indexes from `%s%s`", $this->prefix, $table_name);
|
||||
$result = $this->_query($query);
|
||||
if($this->isError()) return;
|
||||
$output = $this->_fetch($result);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue