Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions wp-includes/sqlite/class-wp-sqlite-translator.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ class WP_SQLite_Translator {
* @var array
*/
private $table_name = array();

/**
* The type of the executed query (SELECT, INSERT, etc).
*
Expand Down Expand Up @@ -613,7 +613,7 @@ public function query( $statement, $mode = PDO::FETCH_OBJ, ...$fetch_mode_args )
}
}
} while ( $error );

/**
* Notifies that a query has been translated and executed.
*
Expand All @@ -638,7 +638,7 @@ public function query( $statement, $mode = PDO::FETCH_OBJ, ...$fetch_mode_args )

// Commit the nested transaction.
$this->commit();

return $this->return_value;
} catch ( Exception $err ) {
// Rollback the nested transaction.
Expand Down Expand Up @@ -1464,7 +1464,9 @@ private function execute_select() {
*/
private function execute_truncate() {
$this->rewriter->skip(); // TRUNCATE.
$this->rewriter->skip(); // TABLE.
if ( 'TABLE' === strtoupper( $this->rewriter->peek()->value ) ) {
$this->rewriter->skip(); // TABLE.
}
Comment on lines +1467 to +1469
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will now skip only if the value is TABLE

$this->rewriter->add( new WP_SQLite_Token( 'DELETE', WP_SQLite_Token::TYPE_KEYWORD ) );
$this->rewriter->add( new WP_SQLite_Token( ' ', WP_SQLite_Token::TYPE_WHITESPACE ) );
$this->rewriter->add( new WP_SQLite_Token( 'FROM', WP_SQLite_Token::TYPE_KEYWORD ) );
Expand Down Expand Up @@ -1549,7 +1551,7 @@ private function execute_update() {
) {
$this->table_name = $token->value;
}

$this->remember_last_reserved_keyword( $token );

if (
Expand Down Expand Up @@ -3631,7 +3633,7 @@ public function begin_transaction() {
++$this->transaction_level;
/**
* Notifies that a transaction-related query has been translated and executed.
*
*
* @param string $command The SQL statement (one of "START TRANSACTION", "COMMIT", "ROLLBACK").
* @param bool $success Whether the SQL statement was successful or not.
* @param int $nesting_level The nesting level of the transaction.
Expand Down