summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2011-02-25 16:37:22 +0000
committerthomascube <thomas@roundcube.net>2011-02-25 16:37:22 +0000
commite6bb836e053913ec8a5930a6d51af1fa55eb08e2 (patch)
tree92fe8cdb0529d8543d488b3164202e2d7833c0f6 /program
parentb8f14ce7442c3a7e1a9e081b88c3108405c7a86e (diff)
Create interactive update script with improved DB schema check; udated installer with new features and styles
Diffstat (limited to 'program')
-rw-r--r--program/include/rcube_mdb2.php17
-rw-r--r--program/lib/MDB2/Driver/Reverse/sqlite.php2
2 files changed, 18 insertions, 1 deletions
diff --git a/program/include/rcube_mdb2.php b/program/include/rcube_mdb2.php
index c56a86e37..85a70cad3 100644
--- a/program/include/rcube_mdb2.php
+++ b/program/include/rcube_mdb2.php
@@ -413,6 +413,23 @@ class rcube_mdb2
/**
+ * Wrapper for SHOW COLUMNS command
+ *
+ * @param string Table name
+ * @return array List of table cols
+ */
+ function list_cols($table)
+ {
+ $this->db_handle->loadModule('Manager');
+ if (!PEAR::isError($result = $this->db_handle->listTableFields($table))) {
+ return $result;
+ }
+
+ return null;
+ }
+
+
+ /**
* Formats input so it can be safely used in a query
*
* @param mixed $input Value to quote
diff --git a/program/lib/MDB2/Driver/Reverse/sqlite.php b/program/lib/MDB2/Driver/Reverse/sqlite.php
index c88ad0ddb..43cec992a 100644
--- a/program/lib/MDB2/Driver/Reverse/sqlite.php
+++ b/program/lib/MDB2/Driver/Reverse/sqlite.php
@@ -95,7 +95,7 @@ class MDB2_Driver_Reverse_sqlite extends MDB2_Driver_Reverse_Common
return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
'unexpected empty table column definition list', __FUNCTION__);
}
- $regexp = '/^\s*([^\s]+) +(CHAR|VARCHAR|VARCHAR2|TEXT|BOOLEAN|SMALLINT|INT|INTEGER|DECIMAL|BIGINT|DOUBLE|FLOAT|DATETIME|DATE|TIME|LONGTEXT|LONGBLOB)( ?\(([1-9][0-9]*)(:([1-9][0-9]*))?\))?( NULL| NOT NULL)?( UNSIGNED)?( NULL| NOT NULL)?( PRIMARY KEY)?( DEFAULT (\'[^\']*\'|[^ ]+))?( NULL| NOT NULL)?( PRIMARY KEY)?(\s*\-\-.*)?$/i';
+ $regexp = '/^\s*([^\s]+) +(CHAR|VARCHAR|VARCHAR2|TEXT|BOOLEAN|SMALLINT|INT|INTEGER|DECIMAL|TINYINT|BIGINT|DOUBLE|FLOAT|DATETIME|DATE|TIME|LONGTEXT|LONGBLOB)( ?\(([1-9][0-9]*)(:([1-9][0-9]*))?\))?( NULL| NOT NULL)?( UNSIGNED)?( NULL| NOT NULL)?( PRIMARY KEY)?( DEFAULT (\'[^\']*\'|[^ ]+))?( NULL| NOT NULL)?( PRIMARY KEY)?(\s*\-\-.*)?$/i';
$regexp2 = '/^\s*([^ ]+) +(PRIMARY|UNIQUE|CHECK)$/i';
for ($i=0, $j=0; $i<$count; ++$i) {
if (!preg_match($regexp, trim($column_sql[$i]), $matches)) {