diff options
| author | thomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2011-02-25 16:37:22 +0000 |
|---|---|---|
| committer | thomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2011-02-25 16:37:22 +0000 |
| commit | d297de1c27c94088e674198baf60ad8a2914b954 (patch) | |
| tree | f24314bf499158c67685201f2f7ee757014e74c3 /roundcubemail/program | |
| parent | 0272fac2f7af3a930d6fd2288f590c27470e13b3 (diff) | |
Create interactive update script with improved DB schema check; udated installer with new features and styles
git-svn-id: https://svn.roundcube.net/trunk@4573 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program')
| -rw-r--r-- | roundcubemail/program/include/rcube_mdb2.php | 17 | ||||
| -rw-r--r-- | roundcubemail/program/lib/MDB2/Driver/Reverse/sqlite.php | 2 |
2 files changed, 18 insertions, 1 deletions
diff --git a/roundcubemail/program/include/rcube_mdb2.php b/roundcubemail/program/include/rcube_mdb2.php index c56a86e37..85a70cad3 100644 --- a/roundcubemail/program/include/rcube_mdb2.php +++ b/roundcubemail/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/roundcubemail/program/lib/MDB2/Driver/Reverse/sqlite.php b/roundcubemail/program/lib/MDB2/Driver/Reverse/sqlite.php index c88ad0ddb..43cec992a 100644 --- a/roundcubemail/program/lib/MDB2/Driver/Reverse/sqlite.php +++ b/roundcubemail/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)) { |
