Projet

Général

Profil

Révision 01dfd3b5

Ajouté par Assos Assos il y a plus de 3 ans

Udpate to 7.77

Voir les différences:

drupal7/includes/database/sqlite/database.inc
107 107
    $this->sqliteCreateFunction('substring_index', array($this, 'sqlFunctionSubstringIndex'), 3);
108 108
    $this->sqliteCreateFunction('rand', array($this, 'sqlFunctionRand'));
109 109

  
110
    // Enable the Write-Ahead Logging (WAL) option for SQLite if supported.
111
    // @see https://www.drupal.org/node/2348137
112
    // @see https://sqlite.org/wal.html
113
    if (version_compare($version, '3.7') >= 0) {
114
      $connection_options += array(
115
        'init_commands' => array(),
116
      );
117
      $connection_options['init_commands'] += array(
118
        'wal' => "PRAGMA journal_mode=WAL",
119
      );
120
    }
121

  
110 122
    // Execute sqlite init_commands.
111 123
    if (isset($connection_options['init_commands'])) {
112 124
      $this->exec(implode('; ', $connection_options['init_commands']));
......
128 140
          $count = $this->query('SELECT COUNT(*) FROM ' . $prefix . '.sqlite_master WHERE type = :type AND name NOT LIKE :pattern', array(':type' => 'table', ':pattern' => 'sqlite_%'))->fetchField();
129 141

  
130 142
          // We can prune the database file if it doesn't have any tables.
131
          if ($count == 0) {
132
            // Detach the database.
133
            $this->query('DETACH DATABASE :schema', array(':schema' => $prefix));
134
            // Destroy the database file.
143
          if ($count == 0 && $this->connectionOptions['database'] != ':memory:') {
144
            // Detaching the database fails at this point, but no other queries
145
            // are executed after the connection is destructed so we can simply
146
            // remove the database file.
135 147
            unlink($this->connectionOptions['database'] . '-' . $prefix);
136 148
          }
137 149
        }
......
143 155
    }
144 156
  }
145 157

  
158
  /**
159
   * Gets all the attached databases.
160
   *
161
   * @return array
162
   *   An array of attached database names.
163
   *
164
   * @see DatabaseConnection_sqlite::__construct().
165
   */
166
  public function getAttachedDatabases() {
167
    return $this->attachedDatabases;
168
  }
169

  
146 170
  /**
147 171
   * SQLite compatibility implementation for the IF() SQL function.
148 172
   */

Formats disponibles : Unified diff