From 39320ef352171aa26810b4d77c4d56421d7b08a2 Mon Sep 17 00:00:00 2001 From: Juan Basso Date: Sun, 22 May 2011 23:19:13 -0400 Subject: [PATCH] Renamed the Mssql driver to Sqlserver. --- app/Config/database.php.default | 4 +- .../Console/Command/Task/DbConfigTask.php | 2 +- .../skel/Config/database.php.default | 4 +- .../Database/{Mssql.php => Sqlserver.php} | 6 +- .../Model/Behavior/TranslateBehaviorTest.php | 4 +- .../Case/Model/BehaviorCollectionTest.php | 4 +- .../{MssqlTest.php => SqlserverTest.php} | 116 +++++++++--------- .../Test/Case/Model/ModelIntegrationTest.php | 4 +- lib/Cake/Test/Case/Model/ModelReadTest.php | 12 +- .../Test/Case/Network/CakeRequestTest.php | 4 +- 10 files changed, 80 insertions(+), 80 deletions(-) rename lib/Cake/Model/Datasource/Database/{Mssql.php => Sqlserver.php} (99%) rename lib/Cake/Test/Case/Model/Datasource/Database/{MssqlTest.php => SqlserverTest.php} (79%) diff --git a/app/Config/database.php.default b/app/Config/database.php.default index 81d3fa12c..234df8ea4 100644 --- a/app/Config/database.php.default +++ b/app/Config/database.php.default @@ -2,7 +2,7 @@ /** * This is core configuration file. * - * Use it to configure core behaviour ofCake. + * Use it to configure core behaviour of Cake. * * PHP 5 * @@ -31,7 +31,7 @@ * Database/Mysql - MySQL 4 & 5, * Database/Sqlite - SQLite (PHP5 only), * Database/Postgres - PostgreSQL 7 and higher, - * Database/Mssql - Microsoft SQL Server 2000 and higher, + * Database/Sqlserver - Microsoft SQL Server 2005 and higher, * Database/Oracle - Oracle 8 and higher * * You can add custom database drivers (or override existing drivers) by adding the diff --git a/lib/Cake/Console/Command/Task/DbConfigTask.php b/lib/Cake/Console/Command/Task/DbConfigTask.php index 7fb1064c8..e425f391f 100644 --- a/lib/Cake/Console/Command/Task/DbConfigTask.php +++ b/lib/Cake/Console/Command/Task/DbConfigTask.php @@ -104,7 +104,7 @@ class DbConfigTask extends Shell { } } - $driver = $this->in(__d('cake_console', 'Driver:'), array('Mssql', 'Mysql', 'Oracle', 'Postgres', 'Sqlite'), 'Mysql'); + $driver = $this->in(__d('cake_console', 'Driver:'), array('Mysql', 'Oracle', 'Postgres', 'Sqlite', 'Sqlserver'), 'Mysql'); $persistent = $this->in(__d('cake_console', 'Persistent Connection?'), array('y', 'n'), 'n'); if (strtolower($persistent) == 'n') { diff --git a/lib/Cake/Console/templates/skel/Config/database.php.default b/lib/Cake/Console/templates/skel/Config/database.php.default index 81d3fa12c..234df8ea4 100644 --- a/lib/Cake/Console/templates/skel/Config/database.php.default +++ b/lib/Cake/Console/templates/skel/Config/database.php.default @@ -2,7 +2,7 @@ /** * This is core configuration file. * - * Use it to configure core behaviour ofCake. + * Use it to configure core behaviour of Cake. * * PHP 5 * @@ -31,7 +31,7 @@ * Database/Mysql - MySQL 4 & 5, * Database/Sqlite - SQLite (PHP5 only), * Database/Postgres - PostgreSQL 7 and higher, - * Database/Mssql - Microsoft SQL Server 2000 and higher, + * Database/Sqlserver - Microsoft SQL Server 2005 and higher, * Database/Oracle - Oracle 8 and higher * * You can add custom database drivers (or override existing drivers) by adding the diff --git a/lib/Cake/Model/Datasource/Database/Mssql.php b/lib/Cake/Model/Datasource/Database/Sqlserver.php similarity index 99% rename from lib/Cake/Model/Datasource/Database/Mssql.php rename to lib/Cake/Model/Datasource/Database/Sqlserver.php index fafdb6553..669cdf631 100644 --- a/lib/Cake/Model/Datasource/Database/Mssql.php +++ b/lib/Cake/Model/Datasource/Database/Sqlserver.php @@ -1,6 +1,6 @@ 'Titel #1', 2 => 'Titel #2', 3 => 'Titel #3'); $this->assertEqual($expected, $result); - // MSSQL trigger an error and stops the page even if the debug = 0 - if ($this->db instanceof Mssql) { + // SQL Server trigger an error and stops the page even if the debug = 0 + if ($this->db instanceof Sqlserver) { $debug = Configure::read('debug'); Configure::write('debug', 0); diff --git a/lib/Cake/Test/Case/Model/BehaviorCollectionTest.php b/lib/Cake/Test/Case/Model/BehaviorCollectionTest.php index 017e8027d..bce2d2a73 100644 --- a/lib/Cake/Test/Case/Model/BehaviorCollectionTest.php +++ b/lib/Cake/Test/Case/Model/BehaviorCollectionTest.php @@ -606,7 +606,7 @@ class BehaviorCollectionTest extends CakeTestCase { * @return void */ function testBehaviorFindCallbacks() { - $this->skipIf($this->db instanceof Mssql, 'This test is not compatible with Mssql.'); + $this->skipIf($this->db instanceof Sqlserver, 'This test is not compatible with SQL Server.'); $Apple = new Apple(); $expected = $Apple->find('all'); @@ -807,7 +807,7 @@ class BehaviorCollectionTest extends CakeTestCase { * @return void */ function testBehaviorBelongsToFindCallbacks() { - $this->skipIf($this->db instanceof Mssql, 'This test is not compatible with Mssql.'); + $this->skipIf($this->db instanceof Sqlserver, 'This test is not compatible with SQL Server.'); $Apple = new Apple(); $Apple->unbindModel(array('hasMany' => array('Child'), 'hasOne' => array('Sample')), false); diff --git a/lib/Cake/Test/Case/Model/Datasource/Database/MssqlTest.php b/lib/Cake/Test/Case/Model/Datasource/Database/SqlserverTest.php similarity index 79% rename from lib/Cake/Test/Case/Model/Datasource/Database/MssqlTest.php rename to lib/Cake/Test/Case/Model/Datasource/Database/SqlserverTest.php index a252cf84f..7b4d7a7fa 100644 --- a/lib/Cake/Test/Case/Model/Datasource/Database/MssqlTest.php +++ b/lib/Cake/Test/Case/Model/Datasource/Database/SqlserverTest.php @@ -1,6 +1,6 @@ array( + 'SqlserverClientTestModel' => array( 'foreignKey' => 'client_id' ) ); @@ -186,17 +186,17 @@ class MssqlTestModel extends Model { } /** - * MssqlClientTestModel class + * SqlserverClientTestModel class * * @package cake.tests.cases.libs.model.datasources */ -class MssqlClientTestModel extends Model { +class SqlserverClientTestModel extends Model { /** * name property * - * @var string 'MssqlAssociatedTestModel' + * @var string 'SqlserverAssociatedTestModel' */ - public $name = 'MssqlClientTestModel'; + public $name = 'SqlserverClientTestModel'; /** * useTable property @@ -220,11 +220,11 @@ class MssqlClientTestModel extends Model { } /** - * MssqlTestResultIterator class + * SqlserverTestResultIterator class * * @package cake.tests.cases.libs.model.datasources */ -class MssqlTestResultIterator extends ArrayIterator { +class SqlserverTestResultIterator extends ArrayIterator { /** * closeCursor method * @@ -234,11 +234,11 @@ class MssqlTestResultIterator extends ArrayIterator { } /** - * MssqlTest class + * SqlserverTest class * * @package cake.tests.cases.libs.model.datasources.dbo */ -class MssqlTest extends CakeTestCase { +class SqlserverTest extends CakeTestCase { /** * The Dbo instance to be tested @@ -267,11 +267,11 @@ class MssqlTest extends CakeTestCase { */ public function setUp() { $this->Dbo = ConnectionManager::getDataSource('test'); - if (!($this->Dbo instanceof Mssql)) { + if (!($this->Dbo instanceof Sqlserver)) { $this->markTestSkipped('Please configure the test datasource to use SQL Server.'); } - $this->db = new MssqlTestDb($this->Dbo->config); - $this->model = new MssqlTestModel(); + $this->db = new SqlserverTestDb($this->Dbo->config); + $this->model = new SqlserverTestModel(); } /** @@ -318,24 +318,24 @@ class MssqlTest extends CakeTestCase { */ public function testFields() { $fields = array( - '[MssqlTestModel].[id] AS [MssqlTestModel__0]', - '[MssqlTestModel].[client_id] AS [MssqlTestModel__1]', - '[MssqlTestModel].[name] AS [MssqlTestModel__2]', - '[MssqlTestModel].[login] AS [MssqlTestModel__3]', - '[MssqlTestModel].[passwd] AS [MssqlTestModel__4]', - '[MssqlTestModel].[addr_1] AS [MssqlTestModel__5]', - '[MssqlTestModel].[addr_2] AS [MssqlTestModel__6]', - '[MssqlTestModel].[zip_code] AS [MssqlTestModel__7]', - '[MssqlTestModel].[city] AS [MssqlTestModel__8]', - '[MssqlTestModel].[country] AS [MssqlTestModel__9]', - '[MssqlTestModel].[phone] AS [MssqlTestModel__10]', - '[MssqlTestModel].[fax] AS [MssqlTestModel__11]', - '[MssqlTestModel].[url] AS [MssqlTestModel__12]', - '[MssqlTestModel].[email] AS [MssqlTestModel__13]', - '[MssqlTestModel].[comments] AS [MssqlTestModel__14]', - 'CONVERT(VARCHAR(20), [MssqlTestModel].[last_login], 20) AS [MssqlTestModel__15]', - '[MssqlTestModel].[created] AS [MssqlTestModel__16]', - 'CONVERT(VARCHAR(20), [MssqlTestModel].[updated], 20) AS [MssqlTestModel__17]' + '[SqlserverTestModel].[id] AS [SqlserverTestModel__0]', + '[SqlserverTestModel].[client_id] AS [SqlserverTestModel__1]', + '[SqlserverTestModel].[name] AS [SqlserverTestModel__2]', + '[SqlserverTestModel].[login] AS [SqlserverTestModel__3]', + '[SqlserverTestModel].[passwd] AS [SqlserverTestModel__4]', + '[SqlserverTestModel].[addr_1] AS [SqlserverTestModel__5]', + '[SqlserverTestModel].[addr_2] AS [SqlserverTestModel__6]', + '[SqlserverTestModel].[zip_code] AS [SqlserverTestModel__7]', + '[SqlserverTestModel].[city] AS [SqlserverTestModel__8]', + '[SqlserverTestModel].[country] AS [SqlserverTestModel__9]', + '[SqlserverTestModel].[phone] AS [SqlserverTestModel__10]', + '[SqlserverTestModel].[fax] AS [SqlserverTestModel__11]', + '[SqlserverTestModel].[url] AS [SqlserverTestModel__12]', + '[SqlserverTestModel].[email] AS [SqlserverTestModel__13]', + '[SqlserverTestModel].[comments] AS [SqlserverTestModel__14]', + 'CONVERT(VARCHAR(20), [SqlserverTestModel].[last_login], 20) AS [SqlserverTestModel__15]', + '[SqlserverTestModel].[created] AS [SqlserverTestModel__16]', + 'CONVERT(VARCHAR(20), [SqlserverTestModel].[updated], 20) AS [SqlserverTestModel__17]' ); $result = $this->db->fields($this->model); @@ -343,7 +343,7 @@ class MssqlTest extends CakeTestCase { $this->assertEqual($expected, $result); $this->db->clearFieldMappings(); - $result = $this->db->fields($this->model, null, 'MssqlTestModel.*'); + $result = $this->db->fields($this->model, null, 'SqlserverTestModel.*'); $expected = $fields; $this->assertEqual($expected, $result); @@ -355,13 +355,13 @@ class MssqlTest extends CakeTestCase { $this->assertEqual($expected, $result); $this->db->clearFieldMappings(); - $result = $this->db->fields($this->model, null, array('*', 'MssqlClientTestModel.*')); + $result = $this->db->fields($this->model, null, array('*', 'SqlserverClientTestModel.*')); $expected = array_merge($fields, array( - '[MssqlClientTestModel].[id] AS [MssqlClientTestModel__18]', - '[MssqlClientTestModel].[name] AS [MssqlClientTestModel__19]', - '[MssqlClientTestModel].[email] AS [MssqlClientTestModel__20]', - 'CONVERT(VARCHAR(20), [MssqlClientTestModel].[created], 20) AS [MssqlClientTestModel__21]', - 'CONVERT(VARCHAR(20), [MssqlClientTestModel].[updated], 20) AS [MssqlClientTestModel__22]')); + '[SqlserverClientTestModel].[id] AS [SqlserverClientTestModel__18]', + '[SqlserverClientTestModel].[name] AS [SqlserverClientTestModel__19]', + '[SqlserverClientTestModel].[email] AS [SqlserverClientTestModel__20]', + 'CONVERT(VARCHAR(20), [SqlserverClientTestModel].[created], 20) AS [SqlserverClientTestModel__21]', + 'CONVERT(VARCHAR(20), [SqlserverClientTestModel].[updated], 20) AS [SqlserverClientTestModel__22]')); $this->assertEqual($expected, $result); } @@ -387,7 +387,7 @@ class MssqlTest extends CakeTestCase { */ public function testDistinctWithLimit() { $this->db->read($this->model, array( - 'fields' => array('DISTINCT MssqlTestModel.city', 'MssqlTestModel.country'), + 'fields' => array('DISTINCT SqlserverTestModel.city', 'SqlserverTestModel.country'), 'limit' => 5 )); $result = $this->db->getLastQuery(); @@ -400,7 +400,7 @@ class MssqlTest extends CakeTestCase { * @return void */ public function testDescribe() { - $MssqlTableDescription = new MssqlTestResultIterator(array( + $SqlserverTableDescription = new SqlserverTestResultIterator(array( (object) array( 'Default' => '((0))', 'Field' => 'count', @@ -410,7 +410,7 @@ class MssqlTest extends CakeTestCase { 'Type' => 'integer' ) )); - $this->db->executeResultsStack = array($MssqlTableDescription); + $this->db->executeResultsStack = array($SqlserverTableDescription); $dummyModel = $this->model; $result = $this->db->describe($dummyModel); $expected = array( @@ -512,13 +512,13 @@ class MssqlTest extends CakeTestCase { * @return void */ public function testUpdateAllSyntax() { - $fields = array('MssqlTestModel.client_id' => '[MssqlTestModel].[client_id] + 1'); - $conditions = array('MssqlTestModel.updated <' => date('2009-01-01 00:00:00')); + $fields = array('SqlserverTestModel.client_id' => '[SqlserverTestModel].[client_id] + 1'); + $conditions = array('SqlserverTestModel.updated <' => date('2009-01-01 00:00:00')); $this->db->update($this->model, $fields, null, $conditions); $result = $this->db->getLastQuery(); - $this->assertNoPattern('/MssqlTestModel/', $result); - $this->assertPattern('/^UPDATE \[mssql_test_models\]/', $result); + $this->assertNoPattern('/SqlserverTestModel/', $result); + $this->assertPattern('/^UPDATE \[sqlserver_test_models\]/', $result); $this->assertPattern('/SET \[client_id\] = \[client_id\] \+ 1/', $result); } @@ -556,10 +556,10 @@ class MssqlTest extends CakeTestCase { $this->db->insertMulti($this->model, $fields, $values); $result = $this->db->simulated; $expected = array( - 'SET IDENTITY_INSERT [mssql_test_models] ON', - "INSERT INTO [mssql_test_models] ([id], [name], [login]) VALUES (1, 'Larry', 'PhpNut')", - "INSERT INTO [mssql_test_models] ([id], [name], [login]) VALUES (2, 'Renan', 'renan.saddam')", - 'SET IDENTITY_INSERT [mssql_test_models] OFF' + 'SET IDENTITY_INSERT [sqlserver_test_models] ON', + "INSERT INTO [sqlserver_test_models] ([id], [name], [login]) VALUES (1, 'Larry', 'PhpNut')", + "INSERT INTO [sqlserver_test_models] ([id], [name], [login]) VALUES (2, 'Renan', 'renan.saddam')", + 'SET IDENTITY_INSERT [sqlserver_test_models] OFF' ); $this->assertEqual($expected, $result); @@ -571,8 +571,8 @@ class MssqlTest extends CakeTestCase { $this->db->insertMulti($this->model, $fields, $values); $result = $this->db->simulated; $expected = array( - "INSERT INTO [mssql_test_models] ([name], [login]) VALUES ('Larry', 'PhpNut')", - "INSERT INTO [mssql_test_models] ([name], [login]) VALUES ('Renan', 'renan.saddam')", + "INSERT INTO [sqlserver_test_models] ([name], [login]) VALUES ('Larry', 'PhpNut')", + "INSERT INTO [sqlserver_test_models] ([name], [login]) VALUES ('Renan', 'renan.saddam')", ); $this->assertEqual($expected, $result); } diff --git a/lib/Cake/Test/Case/Model/ModelIntegrationTest.php b/lib/Cake/Test/Case/Model/ModelIntegrationTest.php index 8ff92174d..e9d4c66fa 100644 --- a/lib/Cake/Test/Case/Model/ModelIntegrationTest.php +++ b/lib/Cake/Test/Case/Model/ModelIntegrationTest.php @@ -634,7 +634,7 @@ class ModelIntegrationTest extends BaseModelTest { * @return void */ function testDeconstructFieldsTime() { - $this->skipIf($this->db instanceof Mssql, 'This test is not compatible with Mssql.'); + $this->skipIf($this->db instanceof Sqlserver, 'This test is not compatible with SQL Server.'); $this->loadFixtures('Apple'); $TestModel = new Apple(); @@ -723,7 +723,7 @@ class ModelIntegrationTest extends BaseModelTest { * @return void */ function testDeconstructFieldsDateTime() { - $this->skipIf($this->db instanceof Mssql, 'This test is not compatible with Mssql.'); + $this->skipIf($this->db instanceof Sqlserver, 'This test is not compatible with SQL Server.'); $this->loadFixtures('Apple'); $TestModel = new Apple(); diff --git a/lib/Cake/Test/Case/Model/ModelReadTest.php b/lib/Cake/Test/Case/Model/ModelReadTest.php index 71f68af80..f0518e83a 100644 --- a/lib/Cake/Test/Case/Model/ModelReadTest.php +++ b/lib/Cake/Test/Case/Model/ModelReadTest.php @@ -79,7 +79,7 @@ class ModelReadTest extends BaseModelTest { */ function testGroupBy() { $db = ConnectionManager::getDataSource('test'); - $isStrictGroupBy = $this->db instanceof Postgres || $this->db instanceof Sqlite || $this->db instanceof Oracle || $this->db instanceof Mssql; + $isStrictGroupBy = $this->db instanceof Postgres || $this->db instanceof Sqlite || $this->db instanceof Oracle || $this->db instanceof Sqlserver; $message = 'Postgres, Oracle, SQLite and SQL Server have strict GROUP BY and are incompatible with this test.'; if ($this->skipIf($isStrictGroupBy, $message )) { @@ -390,7 +390,7 @@ class ModelReadTest extends BaseModelTest { * @return void */ function testRecursiveUnbind() { - if ($this->skipIf($this->db instanceof Mssql, 'The test of testRecursiveUnbind test is not compatible with Mssql, because it check for time columns.')) { + if ($this->skipIf($this->db instanceof Sqlserver, 'The test of testRecursiveUnbind test is not compatible with SQL Server, because it check for time columns.')) { return; } @@ -3648,7 +3648,7 @@ class ModelReadTest extends BaseModelTest { * @return void */ function testFindCombinedRelations() { - if ($this->skipIf($this->db instanceof Mssql, 'The test of testRecursiveUnbind test is not compatible with Mssql, because it check for time columns.')) { + if ($this->skipIf($this->db instanceof Sqlserver, 'The test of testRecursiveUnbind test is not compatible with SQL Server, because it check for time columns.')) { return; } @@ -6228,7 +6228,7 @@ class ModelReadTest extends BaseModelTest { // These tests are expected to fail on SQL Server since the LIMIT/OFFSET // hack can't handle small record counts. - if (!($this->db instanceof Mssql)) { + if (!($this->db instanceof Sqlserver)) { $result = $TestModel->find('all', array('limit' => 3, 'page' => 2)); $expected = array( array( @@ -6623,7 +6623,7 @@ class ModelReadTest extends BaseModelTest { */ function testFindCountDistinct() { $this->skipIf($this->db instanceof Sqlite, 'SELECT COUNT(DISTINCT field) is not compatible with SQLite'); - $this->skipIf($this->db instanceof Mssql, 'This test is not compatible with Mssql.'); + $this->skipIf($this->db instanceof Sqlserver, 'This test is not compatible with SQL Server.'); $this->loadFixtures('Project'); $TestModel = new Project(); @@ -7396,7 +7396,7 @@ class ModelReadTest extends BaseModelTest { $this->assertEqual($result['Post']['two'], 2); // SQL Server does not support operators in expressions - if (!($this->db instanceof Mssql)) { + if (!($this->db instanceof Sqlserver)) { $Post->Author->virtualFields = array('false' => '1 = 2'); $result = $Post->find('first'); $this->assertEqual($result['Post']['two'], 2); diff --git a/lib/Cake/Test/Case/Network/CakeRequestTest.php b/lib/Cake/Test/Case/Network/CakeRequestTest.php index 25c9c8ab2..589dee1f6 100644 --- a/lib/Cake/Test/Case/Network/CakeRequestTest.php +++ b/lib/Cake/Test/Case/Network/CakeRequestTest.php @@ -172,7 +172,7 @@ class CakeRequestTestCase extends CakeTestCase { function testFILESParsing() { $_FILES = array('data' => array('name' => array( 'File' => array( - array('data' => 'cake_mssql_patch.patch'), + array('data' => 'cake_sqlserver_patch.patch'), array('data' => 'controller.diff'), array('data' => ''), array('data' => ''), @@ -221,7 +221,7 @@ class CakeRequestTestCase extends CakeTestCase { $expected = array( 'File' => array( array('data' => array( - 'name' => 'cake_mssql_patch.patch', + 'name' => 'cake_sqlserver_patch.patch', 'type' => '', 'tmp_name' => '/private/var/tmp/phpy05Ywj', 'error' => 0,