Skip to content

BINARY keyword support #41

Closed
Closed
@batonac

Description

@batonac

I'm getting the following error when running the Rank Math SEO plugin with SQLite:

WordPress database error

MySQL query:

SELECT * FROM wp_rank_math_redirections_cache WHERE ( object_id = 7 and object_type = 'post' ) OR BINARY from_url = 'checkout' ORDER BY object_id DESC

Queries made or created this session were:

Executing: BEGIN | (no parameters)
Executing: SELECT * FROM wp_rank_math_redirections_cache WHERE ( object_id = 7 and object_type = :param0 ) OR BINARY from_url = :param1 ORDER BY object_id DESC | parameters: post, checkout
Executing: ROLLBACK | (no parameters)
Error occurred at line 3378 in Function handle_error. Error message was: SQLSTATE[HY000]: General error: 1 near "from_url": syntax error.
Backtrace:

#0 wp-content/plugins/sqlite-database-integration/wp-includes/sqlite/class-wp-sqlite-db.php(289): WP_SQLite_Translator->get_error_message()
#1 wp-includes/class-wpdb.php(3099): WP_SQLite_DB->query()
#2 wp-content/plugins/seo-by-rank-math/vendor/mythemeshop/wordpress-helpers/src/database/class-query-builder.php(87): wpdb->get_results()
#3 wp-content/plugins/seo-by-rank-math/includes/modules/redirections/class-cache.php(67): MyThemeShop\Database\Query_Builder->get()
#4 wp-content/plugins/seo-by-rank-math/includes/modules/redirections/class-redirector.php(224): RankMath\Redirections\Cache::get_by_object_id_or_url()
#5 wp-content/plugins/seo-by-rank-math/includes/modules/redirections/class-redirector.php(114): RankMath\Redirections\Redirector->from_cache()
#6 wp-content/plugins/seo-by-rank-math/includes/modules/redirections/class-redirector.php(81): RankMath\Redirections\Redirector->flow()
#7 wp-content/plugins/seo-by-rank-math/includes/modules/redirections/class-redirections.php(119): RankMath\Redirections\Redirector->__construct()
#8 wp-includes/class-wp-hook.php(308): RankMath\Redirections\Redirections->do_redirection()
#9 wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters()
#10 wp-includes/plugin.php(565): WP_Hook->do_action()
#11 wp-includes/class-wp.php(797): do_action_ref_array()
#12 wp-includes/functions.php(1334): WP->main()
#13 wp-blog-header.php(16): wp()
#14 index.php(17): require('...')
#15 {main}
for query SELECT * FROM wp_rank_math_redirections_cache WHERE ( object_id = 7 and object_type = 'post' ) OR BINARY from_url = 'checkout' ORDER BY object_id DESC made by require('wp-blog-header.php'), wp, WP->main, do_action_ref_array('wp'), WP_Hook->do_action, WP_Hook->apply_filters, RankMath\Redirections\Redirections->do_redirection, RankMath\Redirections\Redirector->__construct, RankMath\Redirections\Redirector->flow, RankMath\Redirections\Redirector->from_cache, RankMath\Redirections\Cache::get_by_object_id_or_url, MyThemeShop\Database\Query_Builder->get, WP_SQLite_DB->query, WP_SQLite_DB->print_error

According to ChatGPT:

In MySQL, the BINARY keyword is used to force a case-sensitive comparison, but SQLite doesn't support this keyword. If you want a case-sensitive comparison in SQLite, you should use the GLOB operator instead, which is case-sensitive.

If the above is correct, then BINARY should be transposed to GLOB.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions