summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/adodb-sqlite3.inc.php32
1 files changed, 7 insertions, 25 deletions
diff --git a/drivers/adodb-sqlite3.inc.php b/drivers/adodb-sqlite3.inc.php
index 6fdf2ab8..ead8c168 100644
--- a/drivers/adodb-sqlite3.inc.php
+++ b/drivers/adodb-sqlite3.inc.php
@@ -439,17 +439,6 @@ class ADODB_sqlite3 extends ADOConnection {
}
$table = strtolower($table);
- $pragmaData = array();
-
- /*
- * If we want the primary key, we must extract
- * it from the table statement, and the pragma
- */
- if ($primary)
- {
- $sql = 'PRAGMA table_info(?)';
- $pragmaData = $this->getAll($sql, [$table]);
- }
// Exclude the empty entry for the primary index
$sql = "SELECT name,sql
@@ -487,21 +476,9 @@ class ADODB_sqlite3 extends ADOConnection {
$indexes[$row[0]]['columns'] = array_map('trim',explode(',',$indexExpression[1][0]));
}
- if (isset($savem)) {
- $this->SetFetchMode($savem);
- $ADODB_FETCH_MODE = $save;
- }
-
- /*
- * If we want primary, add it here
- */
+ // If we want the primary key, we must extract it from the pragma
if ($primary){
-
- /*
- * Check the previously retrieved pragma to search
- * with a closure
- */
-
+ $pragmaData = $this->getAll('PRAGMA table_info(?);', [$table]);
$pkIndexData = array('unique'=>1,'columns'=>array());
$pkCallBack = function ($value, $key) use (&$pkIndexData) {
@@ -526,6 +503,11 @@ class ADODB_sqlite3 extends ADOConnection {
$indexes['PRIMARY'] = $pkIndexData;
}
+ if (isset($savem)) {
+ $this->SetFetchMode($savem);
+ $ADODB_FETCH_MODE = $save;
+ }
+
return $indexes;
}