@@ -176,7 +176,7 @@ class WP_SQLite_Translator {
176
176
* @var array
177
177
*/
178
178
private $ table_name = array ();
179
-
179
+
180
180
/**
181
181
* The type of the executed query (SELECT, INSERT, etc).
182
182
*
@@ -613,7 +613,7 @@ public function query( $statement, $mode = PDO::FETCH_OBJ, ...$fetch_mode_args )
613
613
}
614
614
}
615
615
} while ( $ error );
616
-
616
+
617
617
/**
618
618
* Notifies that a query has been translated and executed.
619
619
*
@@ -638,7 +638,7 @@ public function query( $statement, $mode = PDO::FETCH_OBJ, ...$fetch_mode_args )
638
638
639
639
// Commit the nested transaction.
640
640
$ this ->commit ();
641
-
641
+
642
642
return $ this ->return_value ;
643
643
} catch ( Exception $ err ) {
644
644
// Rollback the nested transaction.
@@ -1464,7 +1464,9 @@ private function execute_select() {
1464
1464
*/
1465
1465
private function execute_truncate () {
1466
1466
$ this ->rewriter ->skip (); // TRUNCATE.
1467
- $ this ->rewriter ->skip (); // TABLE.
1467
+ if ( 'TABLE ' === strtoupper ( $ this ->rewriter ->peek ()->value ) ) {
1468
+ $ this ->rewriter ->skip (); // TABLE.
1469
+ }
1468
1470
$ this ->rewriter ->add ( new WP_SQLite_Token ( 'DELETE ' , WP_SQLite_Token::TYPE_KEYWORD ) );
1469
1471
$ this ->rewriter ->add ( new WP_SQLite_Token ( ' ' , WP_SQLite_Token::TYPE_WHITESPACE ) );
1470
1472
$ this ->rewriter ->add ( new WP_SQLite_Token ( 'FROM ' , WP_SQLite_Token::TYPE_KEYWORD ) );
@@ -1549,7 +1551,7 @@ private function execute_update() {
1549
1551
) {
1550
1552
$ this ->table_name = $ token ->value ;
1551
1553
}
1552
-
1554
+
1553
1555
$ this ->remember_last_reserved_keyword ( $ token );
1554
1556
1555
1557
if (
@@ -3631,7 +3633,7 @@ public function begin_transaction() {
3631
3633
++$ this ->transaction_level ;
3632
3634
/**
3633
3635
* Notifies that a transaction-related query has been translated and executed.
3634
- *
3636
+ *
3635
3637
* @param string $command The SQL statement (one of "START TRANSACTION", "COMMIT", "ROLLBACK").
3636
3638
* @param bool $success Whether the SQL statement was successful or not.
3637
3639
* @param int $nesting_level The nesting level of the transaction.
0 commit comments