Commit 0881e207 authored by catch's avatar catch
Browse files

Revert "Issue #3362726 by alexpott, oily, jrb, neclimdul: READ COMMITTED...

Revert "Issue #3362726 by alexpott, oily, jrb, neclimdul: READ COMMITTED requirement check doesn't account for database views"

This reverts commit 4a1d887a.
parent 4a1d887a
Loading
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -25394,6 +25394,12 @@
	'count' => 1,
	'path' => __DIR__ . '/modules/mysql/src/Driver/Database/mysql/Schema.php',
];
$ignoreErrors[] = [
	'message' => '#^Method Drupal\\\\mysql\\\\Driver\\\\Database\\\\mysql\\\\Schema\\:\\:getComment\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
	'count' => 1,
	'path' => __DIR__ . '/modules/mysql/src/Driver/Database/mysql/Schema.php',
];
$ignoreErrors[] = [
	'message' => '#^Method Drupal\\\\mysql\\\\Driver\\\\Database\\\\mysql\\\\Schema\\:\\:processField\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
@@ -27230,6 +27236,12 @@
	'count' => 1,
	'path' => __DIR__ . '/modules/pgsql/src/Driver/Database/pgsql/Schema.php',
];
$ignoreErrors[] = [
	'message' => '#^Method Drupal\\\\pgsql\\\\Driver\\\\Database\\\\pgsql\\\\Schema\\:\\:getComment\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
	'count' => 1,
	'path' => __DIR__ . '/modules/pgsql/src/Driver/Database/pgsql/Schema.php',
];
$ignoreErrors[] = [
	'message' => '#^Method Drupal\\\\pgsql\\\\Driver\\\\Database\\\\pgsql\\\\Schema\\:\\:processField\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
+0 −2
Original line number Diff line number Diff line
@@ -194,7 +194,6 @@ protected function buildTableNameCondition($table_name, $operator = '=', $add_pr
   */
  public function tableExists($table, bool $add_prefix = TRUE) {
    $condition = $this->buildTableNameCondition($table, '=', $add_prefix);
    $condition->condition('table_type', 'BASE TABLE');
    $condition->compile($this->connection, $this);
    // Normally, we would heartily discourage the use of string
    // concatenation for conditionals like this however, we
@@ -222,7 +221,6 @@ public function findTables($table_expression) {
    // Load all the tables up front in order to take into account per-table
    // prefixes. The actual matching is done at the bottom of the method.
    $condition = $this->buildTableNameCondition('%', 'LIKE');
    $condition->condition('table_type', 'BASE TABLE');
    $condition->compile($this->connection, $this);

    $prefix = $this->connection->getPrefix();
+4 −16
Original line number Diff line number Diff line
@@ -671,33 +671,21 @@ public function prepareComment($comment, $length = NULL) {
  }

  /**
   * Retrieves a table or column comment.
   *
   * @param string $table
   *   The table name.
   * @param string|null $column
   *   (optional) The column name.
   *
   * @return string|false
   *   The table or column comment. FALSE if the table or column does not exist.
   * Retrieve a table or column comment.
   */
  public function getComment($table, $column = NULL) {
    $condition = $this->buildTableNameCondition($table);
    if (isset($column)) {
      if (!$this->tableExists($table)) {
        // If the table is a view it will be present in
        // information_schema.columns so we need to check if the table exists.
        return FALSE;
      }
      $condition->condition('column_name', $column);
      $condition->compile($this->connection, $this);
      // Don't use {} around information_schema.columns table.
      return $this->connection->query("SELECT column_comment AS column_comment FROM information_schema.columns WHERE " . (string) $condition, $condition->arguments())->fetchField();
    }
    $condition->condition('table_type', 'BASE TABLE');
    $condition->compile($this->connection, $this);
    // Don't use {} around information_schema.tables table.
    return $this->connection->query("SELECT table_comment AS table_comment FROM information_schema.tables WHERE " . (string) $condition, $condition->arguments())->fetchField();
    $comment = $this->connection->query("SELECT table_comment AS table_comment FROM information_schema.tables WHERE " . (string) $condition, $condition->arguments())->fetchField();
    // Work-around for MySQL 5.0 bug http://bugs.mysql.com/bug.php?id=11379
    return preg_replace('/; InnoDB free:.*$/', '', $comment);
  }

}
+1 −1
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ class SchemaTest extends DriverSpecificSchemaTestBase {
  /**
   * {@inheritdoc}
   */
  public function checkSchemaComment(string|false $description, string $table, ?string $column = NULL): void {
  public function checkSchemaComment(string $description, string $table, ?string $column = NULL): void {
    $comment = $this->schema->getComment($table, $column);
    $max_length = $column ? 255 : 60;
    $description = Unicode::truncate($description, $max_length, TRUE, TRUE);
+3 −11
Original line number Diff line number Diff line
@@ -1056,24 +1056,16 @@ protected function _createKeys($table, $new_keys) {
  }

  /**
   * Retrieves a table or column comment.
   *
   * @param string $table
   *   The table name.
   * @param string|null $column
   *   (optional) The column name.
   *
   * @return string|false
   *   The table or column comment. FALSE if the table or column does not exist.
   * Retrieve a table or column comment.
   */
  public function getComment($table, $column = NULL) {
    $info = $this->getPrefixInfo($table);
    // Don't use {} around pg_class, pg_attribute tables.
    if (isset($column)) {
      return $this->connection->query('SELECT col_description(oid, attnum) FROM pg_class, pg_attribute WHERE attrelid = oid AND relname = ? AND attname = ?', [$info['table'], $column])->fetchField() ?? FALSE;
      return $this->connection->query('SELECT col_description(oid, attnum) FROM pg_class, pg_attribute WHERE attrelid = oid AND relname = ? AND attname = ?', [$info['table'], $column])->fetchField();
    }
    else {
      return $this->connection->query('SELECT obj_description(oid, ?) FROM pg_class WHERE relname = ?', ['pg_class', $info['table']])->fetchField() ?? FALSE;
      return $this->connection->query('SELECT obj_description(oid, ?) FROM pg_class WHERE relname = ?', ['pg_class', $info['table']])->fetchField();
    }
  }

Loading