@@ -1496,7 +1496,7 @@ private function execute_show_columns_statement( WP_Parser_Node $node ): void {
14961496 )->fetchColumn ();
14971497
14981498 if ( ! $ table_exists ) {
1499- throw new PDOException (
1499+ throw $ this -> new_driver_exception (
15001500 sprintf ( "Table '%s.%s' doesn't exist " , $ database , $ table_name ),
15011501 '42S02 '
15021502 );
@@ -2499,7 +2499,8 @@ private function get_sqlite_create_table_statement( string $table_name, ?string
24992499
25002500 if ( false === $ table_info ) {
25012501 throw $ this ->new_driver_exception (
2502- sprintf ( 'Table "%s" not found in information schema ' , $ table_name )
2502+ sprintf ( "Table '%s' doesn't exist " , $ table_name ),
2503+ '42S02 '
25032504 );
25042505 }
25052506
@@ -2909,13 +2910,13 @@ private function set_result_from_affected_rows( int $override = null ): void {
29092910 * Create a new SQLite driver exception.
29102911 *
29112912 * @param string $message The exception message.
2912- * @param int $ code The exception code .
2913+ * @param int|string $code The exception code. For PDO errors, a string representing SQLSTATE .
29132914 * @param Throwable|null $previous The previous exception.
29142915 * @return WP_SQLite_Driver_Exception
29152916 */
29162917 private function new_driver_exception (
29172918 string $ message ,
2918- int $ code = 0 ,
2919+ $ code = 0 ,
29192920 Throwable $ previous = null
29202921 ): WP_SQLite_Driver_Exception {
29212922 return new WP_SQLite_Driver_Exception ( $ this , $ message , $ code , $ previous );
0 commit comments