Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 293104

Adding backticks instead of quotation marks in query creation for field names

$
0
0

Problem/Motivation

In web/core/lib/Drupal/Core/Lock/DatabaseLockBackend.php function tableExists tries to check `information_schema.tables` but the field names are given in quotation marks instead of backticks. It produces an error below:

SQLSTATE[HY000]: General error: 2000 Unknown or undefined error code: SELECT 1 FROM information_schema.tables WHERE ("table_schema" = :db_condition_placeholder_0) AND ("table_name" = :db_condition_placeholder_1); Array ( [:db_condition_placeholder_0] => tdxhilyswq_drupalfilharmonia [:db_condition_placeholder_1] => semaphore ) w Drupal\Core\Lock\DatabaseLockBackend->catchException() (linia 207 w /home/tdxhilyswq/domains/tdxhilyswq.cfolks.pl/public_html/web/core/lib/Drupal/Core/Lock/DatabaseLockBackend.php)
#0 /home/tdxhilyswq/domains/tdxhilyswq.cfolks.pl/public_html/web/core/lib/Drupal/Core/Database/Connection.php(883): Drupal\mysql\Driver\Database\mysql\ExceptionHandler->handleExecutionException(Object(PDOException), Object(Drupal\Core\Database\StatementWrapperIterator), Array, Array)
#1 /home/tdxhilyswq/domains/tdxhilyswq.cfolks.pl/public_html/web/core/lib/Drupal/Core/Database/Schema.php(178): Drupal\Core\Database\Connection->query('SELECT 1 FROM i...', Array)
#2 /home/tdxhilyswq/domains/tdxhilyswq.cfolks.pl/public_html/web/core/lib/Drupal/Core/Lock/DatabaseLockBackend.php(207): Drupal\Core\Database\Schema->tableExists('semaphore')
#3 /home/tdxhilyswq/domains/tdxhilyswq.cfolks.pl/public_html/web/core/lib/Drupal/Core/Lock/DatabaseLockBackend.php(154): Drupal\Core\Lock\DatabaseLockBackend->catchException(Object(Drupal\Core\Database\DatabaseExceptionWrapper))
#4 /home/tdxhilyswq/domains/tdxhilyswq.cfolks.pl/public_html/web/core/lib/Drupal/Core/ProxyClass/Lock/DatabaseLockBackend.php(91): Drupal\Core\Lock\DatabaseLockBackend->release('locale:pl::anon...')
#5 /home/tdxhilyswq/domains/tdxhilyswq.cfolks.pl/public_html/web/core/lib/Drupal/Core/Cache/CacheCollector.php(268): Drupal\Core\ProxyClass\Lock\DatabaseLockBackend->release('locale:pl::anon...')
#6 /home/tdxhilyswq/domains/tdxhilyswq.cfolks.pl/public_html/web/core/lib/Drupal/Core/Cache/CacheCollector.php(339): Drupal\Core\Cache\CacheCollector->updateCache()
#7 /home/tdxhilyswq/domains/tdxhilyswq.cfolks.pl/public_html/web/core/modules/locale/src/LocaleTranslation.php(158): Drupal\Core\Cache\CacheCollector->destruct()
#8 /home/tdxhilyswq/domains/tdxhilyswq.cfolks.pl/public_html/web/core/lib/Drupal/Core/DrupalKernel.php(723): Drupal\locale\LocaleTranslation->destruct()
#9 /home/tdxhilyswq/domains/tdxhilyswq.cfolks.pl/public_html/web/index.php(22): Drupal\Core\DrupalKernel->terminate(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Render\HtmlResponse))
#10 {main}

Manualy entering this query produces always 0 results. When quptation marks are changed to backticks query results are correct.
It produces an error witch logs and bother our clients and developers.

Proposed resolution

The query generation should be changed so that the field names in the table are always between backtick characters.


Viewing all articles
Browse latest Browse all 293104

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>