mirror of
https://github.com/nextcloud/server.git
synced 2026-04-15 22:11:17 -04:00
final adoptions for mssql connectivity
This commit is contained in:
parent
bcbf2e667b
commit
78a3625ddf
3 changed files with 19 additions and 6 deletions
|
|
@ -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_" );
|
||||
|
|
|
|||
6
lib/files/cache/cache.php
vendored
6
lib/files/cache/cache.php
vendored
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Reference in a new issue