You are here

public function Truncate::__toString in Drupal 8

Same name in this branch
  1. 8 core/lib/Drupal/Core/Database/Query/Truncate.php \Drupal\Core\Database\Query\Truncate::__toString()
  2. 8 core/lib/Drupal/Core/Database/Driver/sqlite/Truncate.php \Drupal\Core\Database\Driver\sqlite\Truncate::__toString()
Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Database/Driver/sqlite/Truncate.php \Drupal\Core\Database\Driver\sqlite\Truncate::__toString()

Implements PHP magic __toString method to convert the query to a string.

Return value

string The prepared statement.

Overrides Truncate::__toString

File

core/lib/Drupal/Core/Database/Driver/sqlite/Truncate.php, line 15

Class

Truncate
SQLite implementation of \Drupal\Core\Database\Query\Truncate.

Namespace

Drupal\Core\Database\Driver\sqlite

Code

public function __toString() {

  // Create a sanitized comment string to prepend to the query.
  $comments = $this->connection
    ->makeComment($this->comments);
  return $comments . 'DELETE FROM {' . $this->connection
    ->escapeTable($this->table) . '} ';
}