Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 3rdparty
Submodule 3rdparty updated 201 files
13 changes: 8 additions & 5 deletions lib/private/DB/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,13 @@
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Statement;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\Diagnostics\IEventLogger;
use OCP\IRequestId;
use OCP\PreConditionNotMetException;
use OCP\Profiler\IProfiler;
use OC\DB\QueryBuilder\QueryBuilder;
use OC\SystemConfig;
use Psr\Log\LoggerInterface;
use OCP\Profiler\IProfiler;

class Connection extends \Doctrine\DBAL\Connection {
/** @var string */
Expand Down Expand Up @@ -124,12 +125,14 @@ public function __construct(
public function connect() {
try {
if ($this->_conn) {
/** @psalm-suppress InternalMethod */
return parent::connect();
}

// Only trigger the event logger for the initial connect call
$eventLogger = \OC::$server->getEventLogger();
$eventLogger = \OC::$server->get(IEventLogger::class);
$eventLogger->start('connect:db', 'db connection opened');
/** @psalm-suppress InternalMethod */
$status = parent::connect();
$eventLogger->end('connect:db');

Expand Down Expand Up @@ -291,7 +294,7 @@ public function executeStatement($sql, array $params = [], array $types = []): i
$sql = $this->adapter->fixupStatement($sql);
$this->queriesExecuted++;
$this->logQueryToFile($sql);
return parent::executeStatement($sql, $params, $types);
return (int)parent::executeStatement($sql, $params, $types);
}

protected function logQueryToFile(string $sql): void {
Expand Down Expand Up @@ -390,7 +393,7 @@ public function setValues($table, array $keys, array $values, array $updatePreco
return $insertQb->createNamedParameter($value, $this->getType($value));
}, array_merge($keys, $values))
);
return $insertQb->execute();
return $insertQb->executeStatement();
} catch (NotNullConstraintViolationException $e) {
throw $e;
} catch (ConstraintViolationException $e) {
Expand All @@ -416,7 +419,7 @@ public function setValues($table, array $keys, array $values, array $updatePreco
}
}
$updateQb->where($where);
$affected = $updateQb->execute();
$affected = $updateQb->executeStatement();

if ($affected === 0 && !empty($updatePreconditionValues)) {
throw new PreConditionNotMetException();
Expand Down
2 changes: 1 addition & 1 deletion lib/private/DB/Migrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
use OCP\EventDispatcher\IEventDispatcher;

class Migrator {

/** @var Connection */
protected $connection;

Expand Down Expand Up @@ -138,6 +137,7 @@ protected function getDiff(Schema $targetSchema, Connection $connection) {
}
}

/** @psalm-suppress InternalMethod */
$comparator = new Comparator();
return $comparator->compare($sourceSchema, $targetSchema);
}
Expand Down