@@ -480,10 +480,16 @@ public function __invoke( $args, $assoc_args ) {
480480 $ tables = Utils \wp_get_table_names ( $ args , $ assoc_args );
481481
482482 // Identify views so they can be skipped; views are dynamic and cannot be directly modified.
483- $ views_args = $ assoc_args ;
484- $ views_args ['views-only ' ] = true ;
485- $ views = Utils \wp_get_table_names ( [], $ views_args );
486- $ view_set = array_flip ( array_intersect ( $ views , $ tables ) );
483+ // The SQLite integration drop-in does not support SHOW FULL TABLES and WordPress
484+ // on SQLite does not use views, so skip the views query entirely.
485+ if ( 'sqlite ' === Utils \get_db_type () ) {
486+ $ view_set = array ();
487+ } else {
488+ $ views_args = $ assoc_args ;
489+ $ views_args ['views-only ' ] = true ;
490+ $ views = Utils \wp_get_table_names ( [], $ views_args );
491+ $ view_set = array_flip ( array_intersect ( $ views , $ tables ) );
492+ }
487493
488494 foreach ( $ tables as $ table ) {
489495 foreach ( $ this ->skip_tables as $ skip_table ) {
@@ -555,12 +561,17 @@ public function __invoke( $args, $assoc_args ) {
555561 $ col_sql = self ::esc_sql_ident ( $ col );
556562 $ wpdb ->last_error = '' ;
557563
558- // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- escaped through self::esc_sql_ident
559- $ serial_row = $ wpdb ->get_row ( "SELECT * FROM $ table_sql WHERE $ col_sql REGEXP '^[aiO]:[1-9]' LIMIT 1 " );
560-
561- // When the regex triggers an error, we should fall back to PHP
562- if ( false !== strpos ( $ wpdb ->last_error , 'ERROR 1139 ' ) ) {
564+ if ( 'sqlite ' === Utils \get_db_type () ) {
565+ // SQLite does not support REGEXP by default, fall back to PHP processing.
563566 $ serial_row = true ;
567+ } else {
568+ // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- escaped through self::esc_sql_ident
569+ $ serial_row = $ wpdb ->get_row ( "SELECT * FROM $ table_sql WHERE $ col_sql REGEXP '^[aiO]:[1-9]' LIMIT 1 " );
570+
571+ // When the regex triggers an error, we should fall back to PHP
572+ if ( false !== strpos ( $ wpdb ->last_error , 'ERROR 1139 ' ) ) {
573+ $ serial_row = true ;
574+ }
564575 }
565576 }
566577
0 commit comments