Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Mueller <thomas.mueller@tmit.eu>2013-02-15 00:59:24 +0400
committerThomas Mueller <thomas.mueller@tmit.eu>2013-02-15 00:59:24 +0400
commit78a3625ddfc67e7e6743a2ff6fd31e1566b174c8 (patch)
tree620da3a4d8f9e0560f41f8f43f82183f65ccba29
parentbcbf2e667badaae382911f9304d0811b17167af6 (diff)
final adoptions for mssql connectivity
-rw-r--r--lib/db.php7
-rw-r--r--lib/files/cache/cache.php6
-rw-r--r--tests/lib/dbschema.php12
3 files changed, 19 insertions, 6 deletions
diff --git a/lib/db.php b/lib/db.php
index 3ccd51737ae..903f76c8c04 100644
--- a/lib/db.php
+++ b/lib/db.php
@@ -404,6 +404,13 @@ class OC_DB {
$query = self::prepare('SELECT lastval() AS id');
$row = $query->execute()->fetchRow();
return $row['id'];
+ }
+ if( $type == 'mssql' ) {
+ if($table !== null) {
+ $prefix = OC_Config::getValue( "dbtableprefix", "oc_" );
+ $table = str_replace( '*PREFIX*', $prefix, $table );
+ }
+ return self::$connection->lastInsertId($table);
}else{
if($table !== null) {
$prefix = OC_Config::getValue( "dbtableprefix", "oc_" );
diff --git a/lib/files/cache/cache.php b/lib/files/cache/cache.php
index dcb6e8fd39a..b61f1de4483 100644
--- a/lib/files/cache/cache.php
+++ b/lib/files/cache/cache.php
@@ -56,7 +56,7 @@ class Cache {
} else {
$query = \OC_DB::prepare('INSERT INTO `*PREFIX*storages`(`id`) VALUES(?)');
$query->execute(array($this->storageId));
- $this->numericId = \OC_DB::insertid('*PREFIX*filecache');
+ $this->numericId = \OC_DB::insertid('*PREFIX*storages');
}
}
@@ -493,8 +493,8 @@ class Cache {
*/
public function getIncomplete() {
$query = \OC_DB::prepare('SELECT `path` FROM `*PREFIX*filecache` WHERE `storage` = ? AND `size` = -1 ORDER BY `fileid` DESC LIMIT 1');
- $query->execute(array($this->numericId));
- if ($row = $query->fetchRow()) {
+ $result = $query->execute(array($this->numericId));
+ if ($row = $result->fetchRow()) {
return $row['path'];
} else {
return false;
diff --git a/tests/lib/dbschema.php b/tests/lib/dbschema.php
index fb60ce7dbb7..e20a04ef7fd 100644
--- a/tests/lib/dbschema.php
+++ b/tests/lib/dbschema.php
@@ -91,9 +91,15 @@ class Test_DBSchema extends PHPUnit_Framework_TestCase {
break;
case 'pgsql':
$sql = "SELECT tablename AS table_name, schemaname AS schema_name "
- . "FROM pg_tables WHERE schemaname NOT LIKE 'pg_%' "
- . "AND schemaname != 'information_schema' "
- . "AND tablename = '".$table."'";
+ . "FROM pg_tables WHERE schemaname NOT LIKE 'pg_%' "
+ . "AND schemaname != 'information_schema' "
+ . "AND tablename = '".$table."'";
+ $query = OC_DB::prepare($sql);
+ $result = $query->execute(array());
+ $exists = $result && $result->fetchOne();
+ break;
+ case 'mssql':
+ $sql = "SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = '{$table}'";
$query = OC_DB::prepare($sql);
$result = $query->execute(array());
$exists = $result && $result->fetchOne();