From fcfff27a762ec50175c649b7d9fadcbc7d2c620c Mon Sep 17 00:00:00 2001 From: lsmith Date: Wed, 30 Jan 2008 23:03:56 +0000 Subject: [PATCH] - fixes #519 and #761 (patch provided by RQuadling) --- lib/Doctrine/DataDict/Mssql.php | 4 +++- lib/Doctrine/Import/Mssql.php | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/Doctrine/DataDict/Mssql.php b/lib/Doctrine/DataDict/Mssql.php index 3bfb7f249..27c5d6620 100644 --- a/lib/Doctrine/DataDict/Mssql.php +++ b/lib/Doctrine/DataDict/Mssql.php @@ -123,7 +123,7 @@ class Doctrine_DataDict_Mssql extends Doctrine_DataDict */ public function getPortableDeclaration($field) { - $db_type = preg_replace('/\d/','', strtolower($field['type']) ); + $db_type = preg_replace('/[\d\(\)]/','', strtolower($field['type']) ); $length = (isset($field['length']) && $field['length'] > 0) ? $field['length'] : null; $type = array(); @@ -137,6 +137,8 @@ class Doctrine_DataDict_Mssql extends Doctrine_DataDict case 'bit': $type[0] = 'boolean'; break; + case 'tinyint': + case 'smallint': case 'int': $type[0] = 'integer'; if ($length == 1) { diff --git a/lib/Doctrine/Import/Mssql.php b/lib/Doctrine/Import/Mssql.php index efcbafcc8..cbfce769d 100644 --- a/lib/Doctrine/Import/Mssql.php +++ b/lib/Doctrine/Import/Mssql.php @@ -73,6 +73,8 @@ class Doctrine_Import_Mssql extends Doctrine_Import $type .= '(' . $val['length'] . ')'; } + $val['type'] = $type; + $val['identity'] = $identity; $decl = $this->conn->dataDict->getPortableDeclaration($val); $description = array( @@ -112,7 +114,7 @@ class Doctrine_Import_Mssql extends Doctrine_Import */ public function listTables($database = null) { - $sql = "SELECT name FROM sysobjects WHERE type = 'U' ORDER BY name"; + $sql = "SELECT name FROM sysobjects WHERE type = 'U' AND name <> 'dtproperties' ORDER BY name"; return $this->conn->fetchColumn($sql); } @@ -196,4 +198,4 @@ class Doctrine_Import_Mssql extends Doctrine_Import return $this->conn->fetchColumn($query); } -} \ No newline at end of file +}