From 7f264a7b97c3062163cde0ec0d47593348b8d0ab Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Wed, 21 Oct 2015 13:48:22 +0300 Subject: [PATCH] Small fixes in Sqlite::describeIndexes --- phalcon/db/adapter/pdo/sqlite.zep | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/phalcon/db/adapter/pdo/sqlite.zep b/phalcon/db/adapter/pdo/sqlite.zep index b83a6de3148..3e4c072aa5f 100644 --- a/phalcon/db/adapter/pdo/sqlite.zep +++ b/phalcon/db/adapter/pdo/sqlite.zep @@ -294,9 +294,13 @@ class Sqlite extends PdoAdapter implements AdapterInterface /** * Lists table indexes * - * @param string table - * @param string schema - * @return Phalcon\Db\IndexInterface[] + * + * print_r($connection->describeIndexes('robots_parts')); + * + * + * @param string table + * @param string schema + * @return \Phalcon\Db\IndexInterface[] */ public function describeIndexes(table, schema = null) -> { @@ -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));