diff options
author | Administrator <Administrator@WINDOWS-2012> | 2013-02-10 13:07:59 +0100 |
---|---|---|
committer | Administrator <Administrator@WINDOWS-2012> | 2013-02-10 13:07:59 +0100 |
commit | 41ec976fd74320c379f95d05d3a490310f06402e (patch) | |
tree | 441ddac9f3c839d9cbe18e07df3462655ee30b01 /lib/db.php | |
parent | d577f790c8cbcf4f8dce74f9991e4bd62e21f949 (diff) | |
download | nextcloud-server-41ec976fd74320c379f95d05d3a490310f06402e.tar.gz nextcloud-server-41ec976fd74320c379f95d05d3a490310f06402e.zip |
Bugfixes and cleanup MS SQL Server installation
Diffstat (limited to 'lib/db.php')
-rw-r--r-- | lib/db.php | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/lib/db.php b/lib/db.php index 58f46c1171f..c3ff481e19e 100644 --- a/lib/db.php +++ b/lib/db.php @@ -284,7 +284,7 @@ class OC_DB { $dsn['database'] = $user; } break; - case 'mssql': + case 'mssql': $dsn = array( 'phptype' => 'sqlsrv', 'username' => $user, @@ -292,7 +292,7 @@ class OC_DB { 'hostspec' => $host, 'database' => $name ); - break; + break; default: return false; } @@ -920,28 +920,30 @@ class PDOStatementWrapper{ * make execute return the result instead of a bool */ public function execute($input=array()) { - $this->lastArguments=$input; - if(count($input)>0) { - if (!isset($type)) { - $type = OC_Config::getValue( "dbtype", "sqlite" ); - } - - if ($type == 'mssql') { - $this->tryFixSubstringLastArgumentDataForMSSQL($input); - } - + $this->lastArguments = $input; + if (count($input) > 0) { + + if (!isset($type)) { + $type = OC_Config::getValue( "dbtype", "sqlite" ); + } + + if ($type == 'mssql') { + $input = $this->tryFixSubstringLastArgumentDataForMSSQL($input); + } + $result=$this->statement->execute($input); - }else{ + } else { $result=$this->statement->execute(); } - if($result) { + + if ($result) { return $this; - }else{ + } else { return false; } } - private function tryFixSubstringLastArgumentDataForMSSQL(&$input) { + private function tryFixSubstringLastArgumentDataForMSSQL($input) { $query = $this->statement->queryString; $pos = stripos ($query, 'SUBSTRING'); @@ -1013,6 +1015,8 @@ class PDOStatementWrapper{ $this->statement = $PDO->prepare($newQuery); $this->lastArguments = $input; + + return $input; } catch (PDOException $e){ $entry = 'PDO DB Error: "'.$e->getMessage().'"<br />'; $entry .= 'Offending command was: '.$this->statement->queryString .'<br />'; |