Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
narfbg committed Nov 25, 2012
1 parent b8c4e48 commit 3545102
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 13 deletions.
17 changes: 14 additions & 3 deletions system/database/DB_forge.php
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ protected function _create_table($table, $if_not_exists)
// Are indexes created from within the CREATE TABLE statement? (e.g. in MySQL)
if ($this->_create_table_keys === TRUE)
{
$columns .= $this->_process_indexes();
$columns .= $this->_process_indexes($table);
}

// _create_table will usually have the following format: "%s %s (%s\n)"
Expand Down Expand Up @@ -962,14 +962,25 @@ protected function _process_primary_keys($table)
* @param string $table
* @return string
*/
protected function _process_indexes($table = NULL)
protected function _process_indexes($table)
{
$table = $this->db->escape_identifiers($table);
$sqls = array();

for ($i = 0, $c = count($this->keys); $i < $c; $i++)
{
if ( ! isset($this->fields[$this->keys[$i]]))
if (is_array($this->keys[$i]))
{
for ($i2 = 0, $c2 = count($this->keys[$i]); $i2 < $c2; $i2++)
{
if ( ! isset($this->fields[$this->keys[$i][$i2]]))
{
unset($this->keys[$i][$i2]);
continue;
}
}
}
elseif ( ! isset($this->fields[$this->keys[$i]]))
{
unset($this->keys[$i]);
continue;
Expand Down
15 changes: 13 additions & 2 deletions system/database/drivers/cubrid/cubrid_forge.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,24 @@ protected function _attr_type(&$attributes)
* @param string $table (ignored)
* @return string
*/
protected function _process_indexes($table = NULL)
protected function _process_indexes($table)
{
$sql = '';

for ($i = 0, $c = count($this->keys); $i < $c; $i++)
{
if ( ! isset($this->fields[$this->keys[$i]]))
if (is_array($this->keys[$i]))
{
for ($i2 = 0, $c2 = count($this->keys[$i]); $i2 < $c2; $i2++)
{
if ( ! isset($this->fields[$this->keys[$i][$i2]]))
{
unset($this->keys[$i][$i2]);
continue;
}
}
}
elseif ( ! isset($this->fields[$this->keys[$i]]))
{
unset($this->keys[$i]);
continue;
Expand Down
15 changes: 13 additions & 2 deletions system/database/drivers/mysql/mysql_forge.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,24 @@ protected function _process_column($field)
* @param string $table (ignored)
* @return string
*/
protected function _process_indexes($table = NULL)
protected function _process_indexes($table)
{
$sql = '';

for ($i = 0, $c = count($this->keys); $i < $c; $i++)
{
if ( ! isset($this->fields[$this->keys[$i]]))
if (is_array($this->keys[$i]))
{
for ($i2 = 0, $c2 = count($this->keys[$i]); $i2 < $c2; $i2++)
{
if ( ! isset($this->fields[$this->keys[$i][$i2]]))
{
unset($this->keys[$i][$i2]);
continue;
}
}
}
elseif ( ! isset($this->fields[$this->keys[$i]]))
{
unset($this->keys[$i]);
continue;
Expand Down
15 changes: 13 additions & 2 deletions system/database/drivers/mysqli/mysqli_forge.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,24 @@ protected function _process_column($field)
* @param string $table (ignored)
* @return string
*/
protected function _process_indexes($table = NULL)
protected function _process_indexes($table)
{
$sql = '';

for ($i = 0, $c = count($this->keys); $i < $c; $i++)
{
if ( ! isset($this->fields[$this->keys[$i]]))
if (is_array($this->keys[$i]))
{
for ($i2 = 0, $c2 = count($this->keys[$i]); $i2 < $c2; $i2++)
{
if ( ! isset($this->fields[$this->keys[$i][$i2]]))
{
unset($this->keys[$i][$i2]);
continue;
}
}
}
elseif ( ! isset($this->fields[$this->keys[$i]]))
{
unset($this->keys[$i]);
continue;
Expand Down
15 changes: 13 additions & 2 deletions system/database/drivers/pdo/subdrivers/pdo_cubrid_forge.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,24 @@ protected function _attr_type(&$attributes)
* @param string $table (ignored)
* @return string
*/
protected function _process_indexes($table = NULL)
protected function _process_indexes($table)
{
$sql = '';

for ($i = 0, $c = count($this->keys); $i < $c; $i++)
{
if ( ! isset($this->fields[$this->keys[$i]]))
if (is_array($this->keys[$i]))
{
for ($i2 = 0, $c2 = count($this->keys[$i]); $i2 < $c2; $i2++)
{
if ( ! isset($this->fields[$this->keys[$i][$i2]]))
{
unset($this->keys[$i][$i2]);
continue;
}
}
}
elseif ( ! isset($this->fields[$this->keys[$i]]))
{
unset($this->keys[$i]);
continue;
Expand Down
15 changes: 13 additions & 2 deletions system/database/drivers/pdo/subdrivers/pdo_mysql_forge.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,24 @@ protected function _process_column($field)
* @param string $table (ignored)
* @return string
*/
protected function _process_indexes($table = NULL)
protected function _process_indexes($table)
{
$sql = '';

for ($i = 0, $c = count($this->keys); $i < $c; $i++)
{
if ( ! isset($this->fields[$this->keys[$i]]))
if (is_array($this->keys[$i]))
{
for ($i2 = 0, $c2 = count($this->keys[$i]); $i2 < $c2; $i2++)
{
if ( ! isset($this->fields[$this->keys[$i][$i2]]))
{
unset($this->keys[$i][$i2]);
continue;
}
}
}
elseif ( ! isset($this->fields[$this->keys[$i]]))
{
unset($this->keys[$i]);
continue;
Expand Down

0 comments on commit 3545102

Please sign in to comment.