Skip to content

Commit

Permalink
- moved UNIQUE mgmt to createConstraint()
Browse files Browse the repository at this point in the history
- removed dupe queryCol call


git-svn-id: http://svn.php.net/repository/pear/packages/MDB2/trunk@203500 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information
quipo committed Dec 22, 2005
1 parent bb8842c commit 0e9142d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions MDB2/Driver/Manager/ibase.php
Expand Up @@ -615,9 +615,7 @@ function createIndex($table, $name, $definition)
return $db;
}
$query = 'CREATE';
if (array_key_exists('unique', $definition) && $definition['unique']) {
$query.= ' UNIQUE';
}

$query_sort = '';
foreach ($definition['fields'] as $field) {
if (!strcmp($query_sort, '') && isset($field['sorting'])) {
Expand Down Expand Up @@ -660,7 +658,6 @@ function listTableIndexes($table)
}
$table = strtoupper($table);
$query = "SELECT RDB\$INDEX_NAME FROM RDB\$INDICES WHERE RDB\$RELATION_NAME='$table'";
$result = $db->queryCol($query);
$indexes = $db->queryCol($query, 'text');
if (PEAR::isError($indexes)) {
return $indexes;
Expand Down Expand Up @@ -720,6 +717,9 @@ function createConstraint($table, $name, $definition)
$query.= ' PRIMARY KEY';
} else {
$query.= ' CONSTRAINT '. $name;
if (array_key_exists('unique', $definition) && $definition['unique']) {
$query.= ' UNIQUE';
}
}
$fields = array();
foreach (array_keys($definition['fields']) as $field) {
Expand Down

0 comments on commit 0e9142d

Please sign in to comment.