Renamed the Mssql driver to Sqlserver.

This commit is contained in:
Juan Basso 2011-05-22 23:19:13 -04:00
parent 846634d729
commit 39320ef352
10 changed files with 80 additions and 80 deletions

View file

@ -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

View file

@ -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') {

View file

@ -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

View file

@ -1,6 +1,6 @@
<?php
/**
* MS SQL layer for DBO
* MS SQL Server layer for DBO
*
* PHP 5
*
@ -26,14 +26,14 @@ App::uses('DboSource', 'Model/Datasource');
*
* @package cake.libs.model.datasources.dbo
*/
class Mssql extends DboSource {
class Sqlserver extends DboSource {
/**
* Driver description
*
* @var string
*/
public $description = "MS SQL DBO Driver";
public $description = "SQL Server DBO Driver";
/**
* Starting quote character for quoted identifiers

View file

@ -431,8 +431,8 @@ class TranslateBehaviorTest extends CakeTestCase {
$expected = array(1 => '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);

View file

@ -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);

View file

@ -1,6 +1,6 @@
<?php
/**
* MssqlTest file
* SqlserverTest file
*
* PHP 5
*
@ -18,14 +18,14 @@
*/
App::uses('Model', 'Model');
App::uses('Mssql', 'Model/Datasource/Database');
App::uses('Sqlserver', 'Model/Datasource/Database');
/**
* MssqlTestDb class
* SqlserverTestDb class
*
* @package cake.tests.cases.libs.model.datasources.dbo
*/
class MssqlTestDb extends Mssql {
class SqlserverTestDb extends Sqlserver {
/**
* simulated property
@ -102,18 +102,18 @@ class MssqlTestDb extends Mssql {
}
/**
* MssqlTestModel class
* SqlserverTestModel class
*
* @package cake.tests.cases.libs.model.datasources
*/
class MssqlTestModel extends Model {
class SqlserverTestModel extends Model {
/**
* name property
*
* @var string 'MssqlTestModel'
* @var string 'SqlserverTestModel'
*/
public $name = 'MssqlTestModel';
public $name = 'SqlserverTestModel';
/**
* useTable property
@ -154,7 +154,7 @@ class MssqlTestModel extends Model {
* @var array
*/
public $belongsTo = array(
'MssqlClientTestModel' => 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);
}

View file

@ -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();

View file

@ -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);

View file

@ -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,