summaryrefslogtreecommitdiff
path: root/program/lib/MDB2/Driver/Reverse/sqlite.php
diff options
context:
space:
mode:
Diffstat (limited to 'program/lib/MDB2/Driver/Reverse/sqlite.php')
-rw-r--r--program/lib/MDB2/Driver/Reverse/sqlite.php14
1 files changed, 13 insertions, 1 deletions
diff --git a/program/lib/MDB2/Driver/Reverse/sqlite.php b/program/lib/MDB2/Driver/Reverse/sqlite.php
index 2ba81c7c5..abd9cbcfb 100644
--- a/program/lib/MDB2/Driver/Reverse/sqlite.php
+++ b/program/lib/MDB2/Driver/Reverse/sqlite.php
@@ -43,7 +43,7 @@
// | Lorenzo Alberton <l.alberton@quipo.it> |
// +----------------------------------------------------------------------+
//
-// $Id: sqlite.php,v 1.78 2007/12/01 10:46:13 quipo Exp $
+// $Id: sqlite.php,v 1.79 2008/03/05 11:08:53 quipo Exp $
//
require_once 'MDB2/Driver/Reverse/Common.php';
@@ -393,6 +393,18 @@ class MDB2_Driver_Reverse_sqlite extends MDB2_Driver_Reverse_Common
}
return $definition;
}
+ if (preg_match("/\"([^\"]+)\"[^\,\"]+\bPRIMARY\s+KEY\b[^\,\)]*/i", $sql, $tmp)) {
+ $definition['primary'] = true;
+ $definition['fields'] = array();
+ $column_names = split(',', $tmp[1]);
+ $colpos = 1;
+ foreach ($column_names as $column_name) {
+ $definition['fields'][trim($column_name)] = array(
+ 'position' => $colpos++
+ );
+ }
+ return $definition;
+ }
} else {
// search in table definition for FOREIGN KEYs
$pattern = "/\bCONSTRAINT\b\s+%s\s+