Skip to content

Commit

Permalink
Small fixes in Sqlite::describeIndexes
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeyklay authored and pantaovay committed Nov 12, 2015
1 parent ff40314 commit 7f264a7
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions phalcon/db/adapter/pdo/sqlite.zep
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,13 @@ class Sqlite extends PdoAdapter implements AdapterInterface
/**
* Lists table indexes
*
* @param string table
* @param string schema
* @return Phalcon\Db\IndexInterface[]
* <code>
* print_r($connection->describeIndexes('robots_parts'));
* </code>
*
* @param string table
* @param string schema
* @return \Phalcon\Db\IndexInterface[]
*/
public function describeIndexes(table, schema = null) -> <IndexInterface[]>
{
Expand All @@ -307,19 +311,19 @@ class Sqlite extends PdoAdapter implements AdapterInterface
let keyName = index["name"];

if !isset indexes[keyName] {
let indexes[keyName] = [];
}

if !isset indexes[keyName]["columns"] {
let columns = [];
} else {
let columns = indexes[keyName];
let columns = indexes[keyName]["columns"];
}

for describeIndex in this->fetchAll(this->_dialect->describeIndex(keyName), Db::FETCH_ASSOC) {
let columns[] = describeIndex["name"];
}

if (isset(indexes[keyName])) {
let indexes[keyName] = [];
}

let indexes[keyName]["columns"] = columns;
let indexSql = this->fetchColumn(this->_dialect->listIndexesSql(table, schema, keyName));

Expand Down

0 comments on commit 7f264a7

Please sign in to comment.