Browse Source

Merge pull request #3557 from dakota/3.0-sqlserver

Changes to SqlServer drivers
José Lorenzo Rodríguez 12 years ago
parent
commit
57b8876142

+ 1 - 1
src/Database/Schema/SqlserverSchema.php

@@ -291,7 +291,7 @@ class SqlserverSchema extends BaseSchema {
 			'integer' => ' INTEGER',
 			'biginteger' => ' BIGINT',
 			'boolean' => ' BIT',
-			'binary' => ' BINARY',
+			'binary' => ' VARBINARY(MAX)',
 			'float' => ' FLOAT',
 			'decimal' => ' DECIMAL',
 			'text' => ' NVARCHAR(MAX)',

+ 1 - 1
src/TestSuite/Fixture/TestFixture.php

@@ -302,7 +302,7 @@ class TestFixture {
 		}
 		$fields = array_values(array_unique($fields));
 		foreach ($fields as $field) {
-			$types[] = $this->_schema->column($field)['type'];
+			$types[$field] = $this->_schema->column($field)['type'];
 		}
 		$default = array_fill_keys($fields, null);
 		foreach ($this->records as $record) {

+ 4 - 4
tests/TestCase/Database/Schema/SqlserverSchemaTest.php

@@ -43,7 +43,7 @@ class SqlserverSchemaTest extends TestCase {
  */
 	protected function _needsConnection() {
 		$config = ConnectionManager::config('test');
-		$this->skipIf(strpos($config['className'], 'Sqlserver') === false, 'Not using Sqlserver for test config');
+		$this->skipIf(strpos($config['driver'], 'Sqlserver') === false, 'Not using Sqlserver for test config');
 	}
 
 /**
@@ -290,7 +290,7 @@ SQL;
 				'type' => 'biginteger',
 				'null' => false,
 				'default' => null,
-				'length' => 20,
+				'length' => 19,
 				'precision' => null,
 				'unsigned' => null,
 				'autoIncrement' => null,
@@ -343,7 +343,7 @@ SQL;
 				'comment' => null,
 			],
 			'created' => [
-				'type' => 'datetime',
+				'type' => 'timestamp',
 				'null' => true,
 				'default' => null,
 				'length' => null,
@@ -489,7 +489,7 @@ SQL;
 			[
 				'img',
 				['type' => 'binary'],
-				'[img] BINARY'
+				'[img] VARBINARY(MAX)'
 			],
 			// Boolean
 			[

+ 2 - 2
tests/TestCase/TestSuite/TestFixtureTest.php

@@ -234,7 +234,7 @@ class TestFixtureTest extends TestCase {
 
 		$query->expects($this->once())
 			->method('insert')
-			->with(['name', 'created'], ['string', 'datetime'])
+			->with(['name', 'created'], ['name' => 'string', 'created' => 'datetime'])
 			->will($this->returnSelf());
 
 		$query->expects($this->once())
@@ -285,7 +285,7 @@ class TestFixtureTest extends TestCase {
 
 		$query->expects($this->once())
 			->method('insert')
-			->with(['name', 'email', 'age'], ['string', 'string', 'integer'])
+			->with(['name', 'email', 'age'], ['name' => 'string', 'email' => 'string', 'age' => 'integer'])
 			->will($this->returnSelf());
 
 		$query->expects($this->once())