Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Code refactoring. Replaced N loop with native CUBRID SQL.

  • Loading branch information...
commit c97fbcfca3e30af60a3b3a4ba8cf837ad656387e 1 parent 15069b2
@kadishmal kadishmal authored
Showing with 2 additions and 3 deletions.
  1. +2 −3 RedBean/QueryWriter/CUBRID.php
View
5 RedBean/QueryWriter/CUBRID.php
@@ -414,9 +414,8 @@ public function addIndex($type, $name, $column) {
$table = $this->safeTable($table);
$name = preg_replace('/\W/','',$name);
$column = $this->safeColumn($column);
- foreach( $this->adapter->get("SHOW INDEX FROM $table ") as $ind) {
- if ($ind['Key_name']===$name) return;
- }
+ $index = $this->adapter->get("SELECT 1 as `exists` FROM db_index WHERE index_name = ? ",array($name));
+ if ($index && $index['exists']) return; // positive number will return, 0 will continue.
try{ $this->adapter->exec("CREATE INDEX $name ON $table ($column) "); }catch(Exception $e){}
}
Please sign in to comment.
Something went wrong with that request. Please try again.