From 5ecebe211bce490aa776ad3f3cc9e8a5b2088b6f Mon Sep 17 00:00:00 2001 From: Thomas Mueller Date: Sat, 2 Nov 2013 20:21:19 +0100 Subject: [PATCH 1/6] mssql: fixing lastInsertId() implementation --- lib/private/db/adaptersqlsrv.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/private/db/adaptersqlsrv.php b/lib/private/db/adaptersqlsrv.php index d0a67af28a7..88fa2fc9f9e 100644 --- a/lib/private/db/adaptersqlsrv.php +++ b/lib/private/db/adaptersqlsrv.php @@ -11,10 +11,8 @@ namespace OC\DB; class AdapterSQLSrv extends Adapter { public function lastInsertId($table) { - if($table !== null) { - $table = $this->conn->replaceTablePrefix( $table ); - } - return $this->conn->lastInsertId($table); + + return $this->conn->realLastInsertId($table); } public function fixupStatement($statement) { From e37047b2a0aebec25e8e2933f5233306e9aff16b Mon Sep 17 00:00:00 2001 From: Thomas Mueller Date: Sat, 2 Nov 2013 20:22:12 +0100 Subject: [PATCH 2/6] WIN: fixing Fatal error: Call to a member function logicToPhysical() on a non-object in C:\jenkins2\workspace\server-stable5-windows\database\mssql\label\WINDOWS\lib\files\storage\mappedlocal.php on line 311 --- lib/private/files/storage/home.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/private/files/storage/home.php b/lib/private/files/storage/home.php index 47a76c1b840..bf1d6017cbf 100644 --- a/lib/private/files/storage/home.php +++ b/lib/private/files/storage/home.php @@ -19,10 +19,9 @@ class Home extends Local { public function __construct($arguments) { $this->user = $arguments['user']; - $this->datadir = $this->user->getHome(); - if (substr($this->datadir, -1) !== '/') { - $this->datadir .= '/'; - } + $datadir = $this->user->getHome(); + + parent::__construct(array('datadir' => $datadir)); } public function getId() { From 998211f7a3a6b497b3b14a53bbc950b1bba6fdc2 Mon Sep 17 00:00:00 2001 From: Thomas Mueller Date: Sat, 2 Nov 2013 20:31:29 +0100 Subject: [PATCH 3/6] WIN: fixing unit test for testStreamCopy() --- tests/lib/helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/lib/helper.php b/tests/lib/helper.php index babafab52c0..c548631ac16 100644 --- a/tests/lib/helper.php +++ b/tests/lib/helper.php @@ -239,7 +239,7 @@ class Test_Helper extends PHPUnit_Framework_TestCase { return array( array(0, false, false, false), array(0, false, \OC::$SERVERROOT . '/tests/data/lorem.txt', false), - array(446, true, \OC::$SERVERROOT . '/tests/data/lorem.txt', \OC::$SERVERROOT . '/tests/data/lorem-copy.txt'), + array(filesize(\OC::$SERVERROOT . '/tests/data/lorem.txt'), true, \OC::$SERVERROOT . '/tests/data/lorem.txt', \OC::$SERVERROOT . '/tests/data/lorem-copy.txt'), ); } } From 2e6f339886d6d06c1af351c17b4c93eb0d22c9c4 Mon Sep 17 00:00:00 2001 From: Thomas Mueller Date: Mon, 4 Nov 2013 17:17:32 +0100 Subject: [PATCH 4/6] ignore test files --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index be69107ca1f..8c8b61d701b 100644 --- a/.gitignore +++ b/.gitignore @@ -90,3 +90,5 @@ nbproject /tests/coverage* /tests/autoconfig* /tests/autotest* +/tests/data/lorem-copy.txt +/tests/data/testimage-copy.png From 665b7571f42d840eda53b29c2c58876d9afa76e3 Mon Sep 17 00:00:00 2001 From: Thomas Mueller Date: Mon, 4 Nov 2013 17:19:04 +0100 Subject: [PATCH 5/6] adding test for binary file to test \OC_Helper::streamCopy() --- tests/lib/helper.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/lib/helper.php b/tests/lib/helper.php index c548631ac16..4311215795c 100644 --- a/tests/lib/helper.php +++ b/tests/lib/helper.php @@ -240,6 +240,7 @@ class Test_Helper extends PHPUnit_Framework_TestCase { array(0, false, false, false), array(0, false, \OC::$SERVERROOT . '/tests/data/lorem.txt', false), array(filesize(\OC::$SERVERROOT . '/tests/data/lorem.txt'), true, \OC::$SERVERROOT . '/tests/data/lorem.txt', \OC::$SERVERROOT . '/tests/data/lorem-copy.txt'), + array(3670, true, \OC::$SERVERROOT . '/tests/data/testimage.png', \OC::$SERVERROOT . '/tests/data/testimage-copy.png'), ); } } From 8274d9f91c4fbe98ad06ec7f44cd73cd7417ab03 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Mon, 4 Nov 2013 22:28:41 +0100 Subject: [PATCH 6/6] Inherit lastInsertId() from Adapter. --- lib/private/db/adaptersqlsrv.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lib/private/db/adaptersqlsrv.php b/lib/private/db/adaptersqlsrv.php index 88fa2fc9f9e..a6bc0e21052 100644 --- a/lib/private/db/adaptersqlsrv.php +++ b/lib/private/db/adaptersqlsrv.php @@ -10,11 +10,6 @@ namespace OC\DB; class AdapterSQLSrv extends Adapter { - public function lastInsertId($table) { - - return $this->conn->realLastInsertId($table); - } - public function fixupStatement($statement) { $statement = preg_replace( "/\`(.*?)`/", "[$1]", $statement ); $statement = str_ireplace( 'NOW()', 'CURRENT_TIMESTAMP', $statement );