| @@ -306,16 +306,8 @@ | ||
| 306 | 306 | if ( isset( $GLOBALS['@pdo'] ) ) { |
| 307 | 307 | $pdo = $GLOBALS['@pdo']; |
| 308 | 308 | } |
| 309 | 309 | if ( defined( 'WP_SQLITE_AST_DRIVER' ) && WP_SQLITE_AST_DRIVER ) { |
| 310 | - if ( null === $this->dbname || '' === $this->dbname ) { | |
| 311 | - $this->bail( | |
| 312 | - 'The database name was not set. The SQLite driver requires a database name to be set to emulate MySQL information schema tables.', | |
| 313 | - 'db_connect_fail' | |
| 314 | - ); | |
| 315 | - return false; | |
| 316 | - } | |
| 317 | - | |
| 318 | 310 | require_once __DIR__ . '/../../wp-includes/parser/class-wp-parser-grammar.php'; |
| 319 | 311 | require_once __DIR__ . '/../../wp-includes/parser/class-wp-parser.php'; |
| 320 | 312 | require_once __DIR__ . '/../../wp-includes/parser/class-wp-parser-node.php'; |
| 321 | 313 | require_once __DIR__ . '/../../wp-includes/parser/class-wp-parser-token.php'; |
| @@ -407,14 +399,8 @@ | ||
| 407 | 399 | * @return int|bool Boolean true for CREATE, ALTER, TRUNCATE and DROP queries. Number of rows |
| 408 | 400 | * affected/selected for all other queries. Boolean false on error. |
| 409 | 401 | */ |
| 410 | 402 | public function query( $query ) { |
| 411 | - // Query Monitor integration: | |
| 412 | - $query_monitor_active = defined( 'SQLITE_QUERY_MONITOR_LOADED' ) && SQLITE_QUERY_MONITOR_LOADED; | |
| 413 | - if ( $query_monitor_active && $this->show_errors ) { | |
| 414 | - $this->hide_errors(); | |
| 415 | - } | |
| 416 | - | |
| 417 | 403 | if ( ! $this->ready ) { |
| 418 | 404 | return false; |
| 419 | 405 | } |
| 420 | 406 | |
| @@ -432,11 +418,8 @@ | ||
| 432 | 418 | |
| 433 | 419 | // Keep track of the last query for debug. |
| 434 | 420 | $this->last_query = $query; |
| 435 | 421 | |
| 436 | - // Save the query count before running another query. | |
| 437 | - $last_query_count = count( $this->queries ?? array() ); | |
| 438 | - | |
| 439 | 422 | /* |
| 440 | 423 | * @TODO: WPDB uses "$this->check_current_query" to check table/column |
| 441 | 424 | * charset and strip all invalid characters from the query. |
| 442 | 425 | * This is an involved process that we can bypass for SQLite, |
| @@ -486,37 +469,8 @@ | ||
| 486 | 469 | $this->num_rows = $num_rows; |
| 487 | 470 | $return_val = $num_rows; |
| 488 | 471 | } |
| 489 | 472 | |
| 490 | - // Query monitor integration: | |
| 491 | - if ( $query_monitor_active && class_exists( 'QM_Backtrace' ) ) { | |
| 492 | - if ( did_action( 'qm/cease' ) ) { | |
| 493 | - $this->queries = array(); | |
| 494 | - } | |
| 495 | - | |
| 496 | - $i = $last_query_count; | |
| 497 | - if ( ! isset( $this->queries[ $i ] ) ) { | |
| 498 | - return $return_val; | |
| 499 | - } | |
| 500 | - | |
| 501 | - $this->queries[ $i ]['trace'] = new QM_Backtrace(); | |
| 502 | - if ( ! isset( $this->queries[ $i ][3] ) ) { | |
| 503 | - $this->queries[ $i ][3] = $this->time_start; | |
| 504 | - } | |
| 505 | - | |
| 506 | - if ( $this->last_error && ! $this->suppress_errors ) { | |
| 507 | - $this->queries[ $i ]['result'] = new WP_Error( 'qmdb', $this->last_error ); | |
| 508 | - } else { | |
| 509 | - $this->queries[ $i ]['result'] = (int) $return_val; | |
| 510 | - } | |
| 511 | - | |
| 512 | - // Add SQLite query data. | |
| 513 | - if ( $this->dbh instanceof WP_SQLite_Driver ) { | |
| 514 | - $this->queries[ $i ]['sqlite_queries'] = $this->dbh->get_last_sqlite_queries(); | |
| 515 | - } else { | |
| 516 | - $this->queries[ $i ]['sqlite_queries'] = $this->dbh->executed_sqlite_queries; | |
| 517 | - } | |
| 518 | - } | |
| 519 | 473 | return $return_val; |
| 520 | 474 | } |
| 521 | 475 | |
| 522 | 476 | /** |
| @@ -566,30 +520,9 @@ | ||
| 566 | 520 | protected function load_col_info() { |
| 567 | 521 | if ( $this->col_info ) { |
| 568 | 522 | return; |
| 569 | 523 | } |
| 570 | - if ( $this->dbh instanceof WP_SQLite_Driver ) { | |
| 571 | - $this->col_info = array(); | |
| 572 | - foreach ( $this->dbh->get_last_column_meta() as $column ) { | |
| 573 | - $this->col_info[] = (object) array( | |
| 574 | - 'name' => $column['name'], | |
| 575 | - 'orgname' => $column['mysqli:orgname'], | |
| 576 | - 'table' => $column['table'], | |
| 577 | - 'orgtable' => $column['mysqli:orgtable'], | |
| 578 | - 'def' => '', // Unused, always ''. | |
| 579 | - 'db' => $column['mysqli:db'], | |
| 580 | - 'catalog' => 'def', // Unused, always 'def'. | |
| 581 | - 'max_length' => 0, // As of PHP 8.1, this is always 0. | |
| 582 | - 'length' => $column['len'], | |
| 583 | - 'charsetnr' => $column['mysqli:charsetnr'], | |
| 584 | - 'flags' => $column['mysqli:flags'], | |
| 585 | - 'type' => $column['mysqli:type'], | |
| 586 | - 'decimals' => $column['precision'], | |
| 587 | - ); | |
| 588 | - } | |
| 589 | - } else { | |
| 590 | - $this->col_info = $this->dbh->get_columns(); | |
| 591 | - } | |
| 524 | + $this->col_info = $this->dbh->get_columns(); | |
| 592 | 525 | } |
| 593 | 526 | |
| 594 | 527 | /** |
| 595 | 528 | * Method to return what the database can do. |