| | |
| | | // | Lorenzo Alberton <l.alberton@quipo.it> | |
| | | // +----------------------------------------------------------------------+ |
| | | // |
| | | // $Id: sqlite.php 292715 2009-12-28 14:06:34Z quipo $ |
| | | // $Id: sqlite.php 295587 2010-02-28 17:16:38Z quipo $ |
| | | // |
| | | |
| | | require_once 'MDB2/Driver/Reverse/Common.php'; |
| | |
| | | */ |
| | | function _getTableColumns($sql) |
| | | { |
| | | $db =& $this->getDBInstance(); |
| | | $db = $this->getDBInstance(); |
| | | if (PEAR::isError($db)) { |
| | | return $db; |
| | | } |
| | |
| | | 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)) { |
| | |
| | | */ |
| | | function getTableFieldDefinition($table_name, $field_name) |
| | | { |
| | | $db =& $this->getDBInstance(); |
| | | $db = $this->getDBInstance(); |
| | | if (PEAR::isError($db)) { |
| | | return $db; |
| | | } |
| | |
| | | */ |
| | | function getTableIndexDefinition($table_name, $index_name) |
| | | { |
| | | $db =& $this->getDBInstance(); |
| | | $db = $this->getDBInstance(); |
| | | if (PEAR::isError($db)) { |
| | | return $db; |
| | | } |
| | |
| | | */ |
| | | function getTableConstraintDefinition($table_name, $constraint_name) |
| | | { |
| | | $db =& $this->getDBInstance(); |
| | | $db = $this->getDBInstance(); |
| | | if (PEAR::isError($db)) { |
| | | return $db; |
| | | } |
| | |
| | | */ |
| | | function getTriggerDefinition($trigger) |
| | | { |
| | | $db =& $this->getDBInstance(); |
| | | $db = $this->getDBInstance(); |
| | | if (PEAR::isError($db)) { |
| | | return $db; |
| | | } |
| | |
| | | return parent::tableInfo($result, $mode); |
| | | } |
| | | |
| | | $db =& $this->getDBInstance(); |
| | | $db = $this->getDBInstance(); |
| | | if (PEAR::isError($db)) { |
| | | return $db; |
| | | } |