Skip to content

Commit b38106e

Browse files
committed
Implement CHECK TABLE statement
1 parent dbf54c8 commit b38106e

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

wp-includes/sqlite-ast/class-wp-sqlite-driver.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1665,6 +1665,7 @@ private function execute_use_statement( WP_Parser_Node $node ): void {
16651665
*
16661666
* This emulates the following MySQL statements:
16671667
* - ANALYZE TABLE
1668+
* - CHECK TABLE
16681669
*
16691670
* @param WP_Parser_Node $node A "tableAdministrationStatement" AST node.
16701671
* @throws WP_SQLite_Driver_Exception When the query execution fails.
@@ -1682,6 +1683,13 @@ private function execute_administration_statement( WP_Parser_Node $node ): void
16821683
$stmt = $this->execute_sqlite_query( "ANALYZE $quoted_table_name" );
16831684
$errors = $stmt->fetchAll( PDO::FETCH_COLUMN );
16841685
break;
1686+
case WP_MySQL_Lexer::CHECK_SYMBOL:
1687+
$stmt = $this->execute_sqlite_query( "PRAGMA integrity_check($quoted_table_name)" );
1688+
$errors = $stmt->fetchAll( PDO::FETCH_COLUMN );
1689+
if ( 'ok' === $errors[0] ) {
1690+
array_shift( $errors );
1691+
}
1692+
break;
16851693
default:
16861694
throw $this->new_not_supported_exception(
16871695
sprintf(

0 commit comments

Comments
 (0)