aaemnnosttv / wp-sqlite-db

A single file drop-in for using a SQLite database with WordPress. Based on the original SQLite Integration plugin.
561 stars 94 forks source link

WordPress 6.1 adds new method call wpdb->db_server_info() in dbDelta #44

Closed andreasnrb closed 1 year ago

andreasnrb commented 2 years ago

The SQLite drop in is missing the implementation of function db_server_info() {}.

        /**
         * Retrieves full database server information.
         *
         * @since 5.5.0
         *
         * @return string|false Server info on success, false on failure.
         */
        public function db_server_info() {
            return 'somestring';
        }
aaemnnosttv commented 1 year ago

Hi there! Our class extends wpdb so it isn't missing the implementation, but it seems that the core implementation depends on one of the mysql functions which would raise an error. We need to override this with a value that returns a string in a similar format to mysqli_get_server_info.

Feel free to open a PR, otherwise I'll try to address this soon.

andreasnrb commented 1 year ago

The function call is just used to detect if MariaDb is used due to it not supporting table columns with ( ) as MySQL does. So any string will do I think. Returning SQLite3 is prudent I think. Did not seem that it should return MariaDb based on the SQLite docs.

joy-software commented 1 year ago

Hi, I was facing the same issue. I fixed it by adding this small portion of code at the end of the class wpsqlitedb like @andreasnrb suggested.

          /**
           * Retrieves full database server information.
           *
           * @since 5.5.0
           *
           * @return string Server info on success, false on failure.
           */
          public function db_server_info() {
              return 'SQLite3';
          }