From 8e97e5eb5492df842d0ed0190724e2ca9c634db4 Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Thu, 15 Jun 2017 07:04:50 +0000 Subject: [PATCH] dblayeroo: getTableSchema for sqlite if no autoincrement field is defined, the sqlite_sequence table doesn't exists and must not crash the method git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3775 bf3deb0d-5f1a-0410-827f-c0cc1f45334c --- dblayeroo.php | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/dblayeroo.php b/dblayeroo.php index e24552b..6880c44 100644 --- a/dblayeroo.php +++ b/dblayeroo.php @@ -676,12 +676,19 @@ class dblayeroo } ksort ($unique); - $st = self::$instance[$this->dsn]->prepare ( - "SELECT * FROM sqlite_sequence WHERE name='$tableName'"); - $st->execute (); - $content = $st->fetchAll (\PDO::FETCH_ASSOC); - if (count ($content) > 0 && $primary !== "") - $fields[$primary][] = "autoincrement"; + try + { + $st = self::$instance[$this->dsn]->prepare ( + "SELECT * FROM sqlite_sequence WHERE name='$tableName'"); + $st->execute (); + $content = $st->fetchAll (\PDO::FETCH_ASSOC); + if (count ($content) > 0 && $primary !== "") + $fields[$primary][] = "autoincrement"; + } + catch (\Exception $e) + { + // If no autoincrement key, the sqlite_sequence table doesn't exists + } $st = self::$instance[$this->dsn]->prepare ( "PRAGMA foreign_key_list('$tableName')");