summaryrefslogtreecommitdiffstats
path: root/lib/private/DB
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/DB')
-rw-r--r--lib/private/DB/Adapter.php6
-rw-r--r--lib/private/DB/AdapterPgSql.php4
-rw-r--r--lib/private/DB/AdapterSqlite.php2
-rw-r--r--lib/private/DB/Connection.php11
-rw-r--r--lib/private/DB/MDB2SchemaReader.php1
-rw-r--r--lib/private/DB/MDB2SchemaWriter.php19
-rw-r--r--lib/private/DB/MigrationService.php3
-rw-r--r--lib/private/DB/Migrator.php4
-rw-r--r--lib/private/DB/MissingColumnInformation.php1
-rw-r--r--lib/private/DB/MissingIndexInformation.php1
-rw-r--r--lib/private/DB/MySQLMigrator.php37
-rw-r--r--lib/private/DB/OCSqlitePlatform.php1
-rw-r--r--lib/private/DB/OracleConnection.php4
-rw-r--r--lib/private/DB/OracleMigrator.php1
-rw-r--r--lib/private/DB/QueryBuilder/CompositeExpression.php3
-rw-r--r--lib/private/DB/QueryBuilder/ExpressionBuilder/MySqlExpressionBuilder.php1
-rw-r--r--lib/private/DB/QueryBuilder/ExpressionBuilder/PgSqlExpressionBuilder.php1
-rw-r--r--lib/private/DB/QueryBuilder/FunctionBuilder/SqliteFunctionBuilder.php1
-rw-r--r--lib/private/DB/QueryBuilder/Literal.php2
-rw-r--r--lib/private/DB/QueryBuilder/QueryBuilder.php2
20 files changed, 43 insertions, 62 deletions
diff --git a/lib/private/DB/Adapter.php b/lib/private/DB/Adapter.php
index f93f5aaf481..0755fa14619 100644
--- a/lib/private/DB/Adapter.php
+++ b/lib/private/DB/Adapter.php
@@ -106,7 +106,7 @@ class Adapter {
. 'FROM `' . $table . '` WHERE ';
$inserts = array_values($input);
- foreach($compare as $key) {
+ foreach ($compare as $key) {
$query .= '`' . $key . '`';
if (is_null($input[$key])) {
$query .= ' IS NULL AND ';
@@ -136,11 +136,11 @@ class Adapter {
try {
$builder = $this->conn->getQueryBuilder();
$builder->insert($table);
- foreach($values as $key => $value) {
+ foreach ($values as $key => $value) {
$builder->setValue($key, $builder->createNamedParameter($value));
}
return $builder->execute();
- } catch(UniqueConstraintViolationException $e) {
+ } catch (UniqueConstraintViolationException $e) {
return 0;
}
}
diff --git a/lib/private/DB/AdapterPgSql.php b/lib/private/DB/AdapterPgSql.php
index dd9c7dc9680..7457ab9a77d 100644
--- a/lib/private/DB/AdapterPgSql.php
+++ b/lib/private/DB/AdapterPgSql.php
@@ -44,7 +44,7 @@ class AdapterPgSql extends Adapter {
* @suppress SqlInjectionChecker
*/
public function insertIgnoreConflict(string $table,array $values) : int {
- if($this->isPre9_5CompatMode() === true) {
+ if ($this->isPre9_5CompatMode() === true) {
return parent::insertIgnoreConflict($table, $values);
}
@@ -60,7 +60,7 @@ class AdapterPgSql extends Adapter {
}
protected function isPre9_5CompatMode(): bool {
- if($this->compatModePre9_5 !== null) {
+ if ($this->compatModePre9_5 !== null) {
return $this->compatModePre9_5;
}
diff --git a/lib/private/DB/AdapterSqlite.php b/lib/private/DB/AdapterSqlite.php
index 2d8715e90f5..66c3aca1d9c 100644
--- a/lib/private/DB/AdapterSqlite.php
+++ b/lib/private/DB/AdapterSqlite.php
@@ -74,7 +74,7 @@ class AdapterSqlite extends Adapter {
. " WHERE NOT EXISTS (SELECT 1 FROM `$table` WHERE ";
$inserts = array_values($input);
- foreach($compare as $key) {
+ foreach ($compare as $key) {
$query .= '`' . $key . '`';
if (is_null($input[$key])) {
$query .= ' IS NULL AND ';
diff --git a/lib/private/DB/Connection.php b/lib/private/DB/Connection.php
index 15c0272915a..3b24703d434 100644
--- a/lib/private/DB/Connection.php
+++ b/lib/private/DB/Connection.php
@@ -139,8 +139,7 @@ class Connection extends ReconnectWrapper implements IDBConnection {
* @throws \Exception
*/
public function __construct(array $params, Driver $driver, Configuration $config = null,
- EventManager $eventManager = null)
- {
+ EventManager $eventManager = null) {
if (!isset($params['adapter'])) {
throw new \Exception('adapter not set');
}
@@ -189,8 +188,7 @@ class Connection extends ReconnectWrapper implements IDBConnection {
*
* @throws \Doctrine\DBAL\DBALException
*/
- public function executeQuery($query, array $params = [], $types = [], QueryCacheProfile $qcp = null)
- {
+ public function executeQuery($query, array $params = [], $types = [], QueryCacheProfile $qcp = null) {
$query = $this->replaceTablePrefix($query);
$query = $this->adapter->fixupStatement($query);
return parent::executeQuery($query, $params, $types, $qcp);
@@ -210,8 +208,7 @@ class Connection extends ReconnectWrapper implements IDBConnection {
*
* @throws \Doctrine\DBAL\DBALException
*/
- public function executeUpdate($query, array $params = [], array $types = [])
- {
+ public function executeUpdate($query, array $params = [], array $types = []) {
$query = $this->replaceTablePrefix($query);
$query = $this->adapter->fixupStatement($query);
return parent::executeUpdate($query, $params, $types);
@@ -372,7 +369,7 @@ class Connection extends ReconnectWrapper implements IDBConnection {
public function dropTable($table) {
$table = $this->tablePrefix . trim($table);
$schema = $this->getSchemaManager();
- if($schema->tablesExist([$table])) {
+ if ($schema->tablesExist([$table])) {
$schema->dropTable($table);
}
}
diff --git a/lib/private/DB/MDB2SchemaReader.php b/lib/private/DB/MDB2SchemaReader.php
index 66a45fb5fc5..b371e1a16b2 100644
--- a/lib/private/DB/MDB2SchemaReader.php
+++ b/lib/private/DB/MDB2SchemaReader.php
@@ -344,5 +344,4 @@ class MDB2SchemaReader {
}
return (bool)$result;
}
-
}
diff --git a/lib/private/DB/MDB2SchemaWriter.php b/lib/private/DB/MDB2SchemaWriter.php
index cccab28f78e..3cabff9d8f1 100644
--- a/lib/private/DB/MDB2SchemaWriter.php
+++ b/lib/private/DB/MDB2SchemaWriter.php
@@ -43,7 +43,7 @@ class MDB2SchemaWriter {
$xml->addChild('name', $config->getSystemValue('dbname', 'owncloud'));
$xml->addChild('create', 'true');
$xml->addChild('overwrite', 'false');
- if($config->getSystemValue('dbtype', 'sqlite') === 'mysql' && $config->getSystemValue('mysql.utf8mb4', false)) {
+ if ($config->getSystemValue('dbtype', 'sqlite') === 'mysql' && $config->getSystemValue('mysql.utf8mb4', false)) {
$xml->addChild('charset', 'utf8mb4');
} else {
$xml->addChild('charset', 'utf8');
@@ -71,13 +71,13 @@ class MDB2SchemaWriter {
private static function saveTable($table, $xml) {
$xml->addChild('name', $table->getName());
$declaration = $xml->addChild('declaration');
- foreach($table->getColumns() as $column) {
+ foreach ($table->getColumns() as $column) {
self::saveColumn($column, $declaration->addChild('field'));
}
- foreach($table->getIndexes() as $index) {
+ foreach ($table->getIndexes() as $index) {
if ($index->getName() == 'PRIMARY') {
$autoincrement = false;
- foreach($index->getColumns() as $column) {
+ foreach ($index->getColumns() as $column) {
if ($table->getColumn($column)->getAutoincrement()) {
$autoincrement = true;
}
@@ -96,7 +96,7 @@ class MDB2SchemaWriter {
*/
private static function saveColumn($column, $xml) {
$xml->addChild('name', $column->getName());
- switch($column->getType()) {
+ switch ($column->getType()) {
case 'SmallInt':
case 'Integer':
case 'BigInt':
@@ -116,8 +116,7 @@ class MDB2SchemaWriter {
$length = '4';
if ($column->getType() == 'SmallInt') {
$length = '2';
- }
- elseif ($column->getType() == 'BigInt') {
+ } elseif ($column->getType() == 'BigInt') {
$length = '8';
}
$xml->addChild('length', $length);
@@ -165,15 +164,13 @@ class MDB2SchemaWriter {
$xml->addChild('name', $index->getName());
if ($index->isPrimary()) {
$xml->addChild('primary', 'true');
- }
- elseif ($index->isUnique()) {
+ } elseif ($index->isUnique()) {
$xml->addChild('unique', 'true');
}
- foreach($index->getColumns() as $column) {
+ foreach ($index->getColumns() as $column) {
$field = $xml->addChild('field');
$field->addChild('name', $column);
$field->addChild('sorting', 'ascending');
-
}
}
diff --git a/lib/private/DB/MigrationService.php b/lib/private/DB/MigrationService.php
index 0104c1be367..18993cadd50 100644
--- a/lib/private/DB/MigrationService.php
+++ b/lib/private/DB/MigrationService.php
@@ -159,7 +159,6 @@ class MigrationService {
// Recreate the schema after the table was dropped.
$schema = new SchemaWrapper($this->connection);
-
} catch (SchemaException $e) {
// Table not found, no need to panic, we will create it.
}
@@ -329,7 +328,7 @@ class MigrationService {
* @return mixed|null|string
*/
public function getMigration($alias) {
- switch($alias) {
+ switch ($alias) {
case 'current':
return $this->getCurrentVersion();
case 'next':
diff --git a/lib/private/DB/Migrator.php b/lib/private/DB/Migrator.php
index bda0720b3bb..2ea365ab294 100644
--- a/lib/private/DB/Migrator.php
+++ b/lib/private/DB/Migrator.php
@@ -302,14 +302,14 @@ class Migrator {
if ($this->noEmit) {
return;
}
- if(is_null($this->dispatcher)) {
+ if (is_null($this->dispatcher)) {
return;
}
$this->dispatcher->dispatch('\OC\DB\Migrator::executeSql', new GenericEvent($sql, [$step+1, $max]));
}
private function emitCheckStep($tableName, $step, $max) {
- if(is_null($this->dispatcher)) {
+ if (is_null($this->dispatcher)) {
return;
}
$this->dispatcher->dispatch('\OC\DB\Migrator::checkTable', new GenericEvent($tableName, [$step+1, $max]));
diff --git a/lib/private/DB/MissingColumnInformation.php b/lib/private/DB/MissingColumnInformation.php
index bcf585848fd..d1c81c2e199 100644
--- a/lib/private/DB/MissingColumnInformation.php
+++ b/lib/private/DB/MissingColumnInformation.php
@@ -27,7 +27,6 @@ declare(strict_types=1);
namespace OC\DB;
class MissingColumnInformation {
-
private $listOfMissingColumns = [];
public function addHintForMissingColumn(string $tableName, string $columnName): void {
diff --git a/lib/private/DB/MissingIndexInformation.php b/lib/private/DB/MissingIndexInformation.php
index ae8be7934d9..04853dcac2d 100644
--- a/lib/private/DB/MissingIndexInformation.php
+++ b/lib/private/DB/MissingIndexInformation.php
@@ -28,7 +28,6 @@ declare(strict_types=1);
namespace OC\DB;
class MissingIndexInformation {
-
private $listOfMissingIndexes = [];
public function addHintForMissingSubject(string $tableName, string $indexName) {
diff --git a/lib/private/DB/MySQLMigrator.php b/lib/private/DB/MySQLMigrator.php
index fe56a9563e2..58c54683a3a 100644
--- a/lib/private/DB/MySQLMigrator.php
+++ b/lib/private/DB/MySQLMigrator.php
@@ -53,25 +53,24 @@ class MySQLMigrator extends Migrator {
return $schemaDiff;
}
- /**
- * Speed up migration test by disabling autocommit and unique indexes check
- *
- * @param \Doctrine\DBAL\Schema\Table $table
- * @throws \OC\DB\MigrationException
- */
- protected function checkTableMigrate(Table $table) {
- $this->connection->exec('SET autocommit=0');
- $this->connection->exec('SET unique_checks=0');
+ /**
+ * Speed up migration test by disabling autocommit and unique indexes check
+ *
+ * @param \Doctrine\DBAL\Schema\Table $table
+ * @throws \OC\DB\MigrationException
+ */
+ protected function checkTableMigrate(Table $table) {
+ $this->connection->exec('SET autocommit=0');
+ $this->connection->exec('SET unique_checks=0');
- try {
- parent::checkTableMigrate($table);
- } catch (\Exception $e) {
- $this->connection->exec('SET unique_checks=1');
- $this->connection->exec('SET autocommit=1');
- throw new MigrationException($table->getName(), $e->getMessage());
- }
- $this->connection->exec('SET unique_checks=1');
- $this->connection->exec('SET autocommit=1');
+ try {
+ parent::checkTableMigrate($table);
+ } catch (\Exception $e) {
+ $this->connection->exec('SET unique_checks=1');
+ $this->connection->exec('SET autocommit=1');
+ throw new MigrationException($table->getName(), $e->getMessage());
}
-
+ $this->connection->exec('SET unique_checks=1');
+ $this->connection->exec('SET autocommit=1');
+ }
}
diff --git a/lib/private/DB/OCSqlitePlatform.php b/lib/private/DB/OCSqlitePlatform.php
index 5649b14d233..be33629e885 100644
--- a/lib/private/DB/OCSqlitePlatform.php
+++ b/lib/private/DB/OCSqlitePlatform.php
@@ -23,5 +23,4 @@
namespace OC\DB;
class OCSqlitePlatform extends \Doctrine\DBAL\Platforms\SqlitePlatform {
-
}
diff --git a/lib/private/DB/OracleConnection.php b/lib/private/DB/OracleConnection.php
index 93a52d1772d..b53ee850149 100644
--- a/lib/private/DB/OracleConnection.php
+++ b/lib/private/DB/OracleConnection.php
@@ -34,7 +34,7 @@ class OracleConnection extends Connection {
private function quoteKeys(array $data) {
$return = [];
$c = $this->getDatabasePlatform()->getIdentifierQuoteCharacter();
- foreach($data as $key => $value) {
+ foreach ($data as $key => $value) {
if ($key[0] !== $c) {
$return[$this->quoteIdentifier($key)] = $value;
} else {
@@ -87,7 +87,7 @@ class OracleConnection extends Connection {
$table = $this->tablePrefix . trim($table);
$table = $this->quoteIdentifier($table);
$schema = $this->getSchemaManager();
- if($schema->tablesExist([$table])) {
+ if ($schema->tablesExist([$table])) {
$schema->dropTable($table);
}
}
diff --git a/lib/private/DB/OracleMigrator.php b/lib/private/DB/OracleMigrator.php
index 86d1f71c2b7..8c8a91f9b1b 100644
--- a/lib/private/DB/OracleMigrator.php
+++ b/lib/private/DB/OracleMigrator.php
@@ -228,5 +228,4 @@ class OracleMigrator extends Migrator {
protected function getFilterExpression() {
return '/^"' . preg_quote($this->config->getSystemValue('dbtableprefix', 'oc_')) . '/';
}
-
}
diff --git a/lib/private/DB/QueryBuilder/CompositeExpression.php b/lib/private/DB/QueryBuilder/CompositeExpression.php
index b6546f3c806..512343662ad 100644
--- a/lib/private/DB/QueryBuilder/CompositeExpression.php
+++ b/lib/private/DB/QueryBuilder/CompositeExpression.php
@@ -87,8 +87,7 @@ class CompositeExpression implements ICompositeExpression, \Countable {
*
* @return string
*/
- public function __toString()
- {
+ public function __toString() {
return (string) $this->compositeExpression;
}
}
diff --git a/lib/private/DB/QueryBuilder/ExpressionBuilder/MySqlExpressionBuilder.php b/lib/private/DB/QueryBuilder/ExpressionBuilder/MySqlExpressionBuilder.php
index e7df321b102..899f9277439 100644
--- a/lib/private/DB/QueryBuilder/ExpressionBuilder/MySqlExpressionBuilder.php
+++ b/lib/private/DB/QueryBuilder/ExpressionBuilder/MySqlExpressionBuilder.php
@@ -52,5 +52,4 @@ class MySqlExpressionBuilder extends ExpressionBuilder {
$y = $this->helper->quoteColumnName($y);
return $this->expressionBuilder->comparison($x, ' COLLATE ' . $this->charset . '_general_ci LIKE', $y);
}
-
}
diff --git a/lib/private/DB/QueryBuilder/ExpressionBuilder/PgSqlExpressionBuilder.php b/lib/private/DB/QueryBuilder/ExpressionBuilder/PgSqlExpressionBuilder.php
index fbf76da8690..141a93ff75a 100644
--- a/lib/private/DB/QueryBuilder/ExpressionBuilder/PgSqlExpressionBuilder.php
+++ b/lib/private/DB/QueryBuilder/ExpressionBuilder/PgSqlExpressionBuilder.php
@@ -55,5 +55,4 @@ class PgSqlExpressionBuilder extends ExpressionBuilder {
$y = $this->helper->quoteColumnName($y);
return $this->expressionBuilder->comparison($x, 'ILIKE', $y);
}
-
}
diff --git a/lib/private/DB/QueryBuilder/FunctionBuilder/SqliteFunctionBuilder.php b/lib/private/DB/QueryBuilder/FunctionBuilder/SqliteFunctionBuilder.php
index 774769bfdbb..6d8e947c407 100644
--- a/lib/private/DB/QueryBuilder/FunctionBuilder/SqliteFunctionBuilder.php
+++ b/lib/private/DB/QueryBuilder/FunctionBuilder/SqliteFunctionBuilder.php
@@ -38,5 +38,4 @@ class SqliteFunctionBuilder extends FunctionBuilder {
public function least($x, $y) {
return new QueryFunction('MIN(' . $this->helper->quoteColumnName($x) . ', ' . $this->helper->quoteColumnName($y) . ')');
}
-
}
diff --git a/lib/private/DB/QueryBuilder/Literal.php b/lib/private/DB/QueryBuilder/Literal.php
index f2e169e7faf..8c8114209ff 100644
--- a/lib/private/DB/QueryBuilder/Literal.php
+++ b/lib/private/DB/QueryBuilder/Literal.php
@@ -24,7 +24,7 @@ namespace OC\DB\QueryBuilder;
use OCP\DB\QueryBuilder\ILiteral;
-class Literal implements ILiteral{
+class Literal implements ILiteral {
/** @var mixed */
protected $literal;
diff --git a/lib/private/DB/QueryBuilder/QueryBuilder.php b/lib/private/DB/QueryBuilder/QueryBuilder.php
index 4845b8b1aa4..a2941950d5c 100644
--- a/lib/private/DB/QueryBuilder/QueryBuilder.php
+++ b/lib/private/DB/QueryBuilder/QueryBuilder.php
@@ -413,7 +413,6 @@ class QueryBuilder implements IQueryBuilder {
* @return $this This QueryBuilder instance.
*/
public function selectAlias($select, $alias) {
-
$this->queryBuilder->addSelect(
$this->helper->quoteColumnName($select) . ' AS ' . $this->helper->quoteColumnName($alias)
);
@@ -435,7 +434,6 @@ class QueryBuilder implements IQueryBuilder {
* @return $this This QueryBuilder instance.
*/
public function selectDistinct($select) {
-
$this->queryBuilder->addSelect(
'DISTINCT ' . $this->helper->quoteColumnName($select)
);