1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-06-27 16:36:00 +00:00

Replace query by executeQuery

This commit is contained in:
Yassine Guedidi 2025-04-01 23:36:56 +02:00
parent 1127b147c0
commit 069c09d8d9
3 changed files with 8 additions and 8 deletions

View file

@ -27,7 +27,7 @@ class Version20161001072726 extends WallabagMigration
// remove all FK from entry_tag // remove all FK from entry_tag
switch (true) { switch (true) {
case $platform instanceof MySQLPlatform: case $platform instanceof MySQLPlatform:
$query = $this->connection->query(" $query = $this->connection->executeQuery("
SELECT CONSTRAINT_NAME SELECT CONSTRAINT_NAME
FROM information_schema.key_column_usage FROM information_schema.key_column_usage
WHERE TABLE_NAME = '" . $this->getTable('entry_tag', WallabagMigration::UN_ESCAPED_TABLE) . "' AND CONSTRAINT_NAME LIKE 'FK_%' WHERE TABLE_NAME = '" . $this->getTable('entry_tag', WallabagMigration::UN_ESCAPED_TABLE) . "' AND CONSTRAINT_NAME LIKE 'FK_%'
@ -40,7 +40,7 @@ class Version20161001072726 extends WallabagMigration
break; break;
case $platform instanceof PostgreSQLPlatform: case $platform instanceof PostgreSQLPlatform:
// http://dba.stackexchange.com/questions/36979/retrieving-all-pk-and-fk // http://dba.stackexchange.com/questions/36979/retrieving-all-pk-and-fk
$query = $this->connection->query(" $query = $this->connection->executeQuery("
SELECT conrelid::regclass AS table_from SELECT conrelid::regclass AS table_from
,conname ,conname
,pg_get_constraintdef(c.oid) ,pg_get_constraintdef(c.oid)
@ -64,7 +64,7 @@ class Version20161001072726 extends WallabagMigration
switch (true) { switch (true) {
case $platform instanceof MySQLPlatform: case $platform instanceof MySQLPlatform:
$query = $this->connection->query(" $query = $this->connection->executeQuery("
SELECT CONSTRAINT_NAME SELECT CONSTRAINT_NAME
FROM information_schema.key_column_usage FROM information_schema.key_column_usage
WHERE TABLE_NAME = '" . $this->getTable('annotation', WallabagMigration::UN_ESCAPED_TABLE) . "' WHERE TABLE_NAME = '" . $this->getTable('annotation', WallabagMigration::UN_ESCAPED_TABLE) . "'
@ -79,7 +79,7 @@ class Version20161001072726 extends WallabagMigration
break; break;
case $platform instanceof PostgreSQLPlatform: case $platform instanceof PostgreSQLPlatform:
// http://dba.stackexchange.com/questions/36979/retrieving-all-pk-and-fk // http://dba.stackexchange.com/questions/36979/retrieving-all-pk-and-fk
$query = $this->connection->query(" $query = $this->connection->executeQuery("
SELECT conrelid::regclass AS table_from SELECT conrelid::regclass AS table_from
,conname ,conname
,pg_get_constraintdef(c.oid) ,pg_get_constraintdef(c.oid)

View file

@ -20,7 +20,7 @@ class Version20170719231144 extends WallabagMigration
} }
// Find tags which need to be merged // Find tags which need to be merged
$dupTags = $this->connection->query(' $dupTags = $this->connection->executeQuery('
SELECT LOWER(label) AS lower_label SELECT LOWER(label) AS lower_label
FROM ' . $this->getTable('tag') . ' FROM ' . $this->getTable('tag') . '
GROUP BY LOWER(label) GROUP BY LOWER(label)
@ -31,7 +31,7 @@ class Version20170719231144 extends WallabagMigration
$label = $duplicates['lower_label']; $label = $duplicates['lower_label'];
// Retrieve all duplicate tags for a given tag // Retrieve all duplicate tags for a given tag
$tags = $this->connection->query(' $tags = $this->connection->executeQuery('
SELECT id SELECT id
FROM ' . $this->getTable('tag') . ' FROM ' . $this->getTable('tag') . '
WHERE LOWER(label) = :label WHERE LOWER(label) = :label

View file

@ -138,7 +138,7 @@ class InstallCommand extends Command
// now check if MySQL isn't too old to handle utf8mb4 // now check if MySQL isn't too old to handle utf8mb4
if ($conn->isConnected() && $conn->getDatabasePlatform() instanceof MySQLPlatform) { if ($conn->isConnected() && $conn->getDatabasePlatform() instanceof MySQLPlatform) {
$version = $conn->query('select version()')->fetchOne(); $version = $conn->executeQuery('select version()')->fetchOne();
$minimalVersion = '5.5.4'; $minimalVersion = '5.5.4';
if (false === version_compare($version, $minimalVersion, '>')) { if (false === version_compare($version, $minimalVersion, '>')) {
@ -151,7 +151,7 @@ class InstallCommand extends Command
// testing if PostgreSQL > 9.1 // testing if PostgreSQL > 9.1
if ($conn->isConnected() && $conn->getDatabasePlatform() instanceof PostgreSQLPlatform) { if ($conn->isConnected() && $conn->getDatabasePlatform() instanceof PostgreSQLPlatform) {
// return version should be like "PostgreSQL 9.5.4 on x86_64-apple-darwin15.6.0, compiled by Apple LLVM version 8.0.0 (clang-800.0.38), 64-bit" // return version should be like "PostgreSQL 9.5.4 on x86_64-apple-darwin15.6.0, compiled by Apple LLVM version 8.0.0 (clang-800.0.38), 64-bit"
$version = $conn->query('SELECT version();')->fetchOne(); $version = $conn->executeQuery('SELECT version();')->fetchOne();
preg_match('/PostgreSQL ([0-9\.]+)/i', $version, $matches); preg_match('/PostgreSQL ([0-9\.]+)/i', $version, $matches);