MySQL DB에서 특정 테이블의 index체크시 서버 버전에 따라 where 절이 먹히지 않아서 전체 목록을 가져와 하나씩 비교하는 방식으로 구현방법 수정

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@2421 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
zero 2007-08-30 01:39:11 +00:00
parent a6358e6e95
commit f06a43f148
2 changed files with 14 additions and 6 deletions

View file

@ -260,12 +260,16 @@
* @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);
//$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);
$result = $this->_query($query);
if($this->isError()) return;
$output = $this->_fetch($result);
if(!$output) return false;
return true;
for($i=0;$i<count($output);$i++) {
if($output[$i]->Key_name == $index_name) return true;
}
return false;
}
/**

View file

@ -269,12 +269,16 @@
* @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);
//$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);
$result = $this->_query($query);
if($this->isError()) return;
$output = $this->_fetch($result);
if(!$output) return false;
return true;
for($i=0;$i<count($output);$i++) {
if($output[$i]->Key_name == $index_name) return true;
}
return false;
}
/**