Closed mattbucci closed 10 months ago
Mysqli driver is now mostly working. I'm able to load the site, browse it and more. But I can't yet make changes to posts or create new posts. Editing via appearance also fails.
The error log contains this.
UPDATE `wp_posts` SET `guid` = '' WHERE `ID` IS NULL
---- converted to ----
UPDATE wp_posts SET guid = '' WHERE `ID` IS NULL
----> ERROR: syntax error at or near "NULL"
Additionally i'm getting errors about sequences
I was able to switch themes fine, but it gave errors
Warning: pg_query(): Query failed: ERROR: currval of sequence "wp_options_seq" is not yet defined in this session in /mnt/shared/sites/monad/wp-content/plugins/pg4wp/driver_pgsql.php on line 1126
Warning: pg_query(): Query failed: ERROR: currval of sequence "wp_options_seq" is not yet defined in this session in /mnt/shared/sites/monad/wp-content/plugins/pg4wp/driver_pgsql.php on line 1126
Warning: pg_query(): Query failed: ERROR: currval of sequence "wp_options_seq" is not yet defined in this session in /mnt/shared/sites/monad/wp-content/plugins/pg4wp/driver_pgsql.php on line 1126
Here's another hint:
SELECT CURRVAL('wp_blogmeta_seq')
The latest INSERT query was :
'INSERT INTO wp_blogmeta (blog_id, meta_key, meta_value) VALUES ('1', 'db_version', '56657')'
[1699599422.2772] wpsqli_insert_id() was called with 'wp_blogmeta' and 'blog_id' and returned the error:
it looks like something is wrong with wpsqli_insert_id
I think inserts aren't working properly which is what is causing the majority of these issues
The issue was the connection was not shared between the insert and the sequence value call.
Changing all functions to pass by reference, updating the global connection more frequently and changing all functions to prefer passed $connection over global fixed the issue.
From what I can see everything is now working correctly but many parts of the driver such as prepared statements aren't implemented. I'm going to merge this, tag a new release and open issues for each function not implemented in the driver.
For compatibility with WP 6.4 we must implement mysqli functions instead of mysql functions in our driver class
See: https://github.com/PostgreSQL-For-Wordpress/postgresql-for-wordpress/issues/54