Skip to content

Make is_text_col's search case-insensitive for sqlite support#177

Merged
danielbachhuber merged 1 commit intowp-cli:mainfrom
stuartlangridge:patch-1
Feb 15, 2023
Merged

Make is_text_col's search case-insensitive for sqlite support#177
danielbachhuber merged 1 commit intowp-cli:mainfrom
stuartlangridge:patch-1

Conversation

@stuartlangridge
Copy link
Copy Markdown
Contributor

When using wp-sqlite-db as the back end for WordPress, wpcli's search-replace command fails because wp-sqlite-db returns text column types as TEXT, and wpcli search-replace checks whether a column is textual in is_text_col with strpos for "text" or "varchar". If this were stripos instead of strpos then this problem would be resolved, which would be nice, and I don't believe there would be any backward compatibility implications. So, here's a one-character PR :-)

(Of course, sqlite as backend isn't actually supported, but this is a fairly small change which should make things better for that without affecting the mainline code. I've also proposed aaemnnosttv/wp-sqlite-db#56 to wp-sqlite-db to have that return lowercase "text" for column types as well, thus hopefully fixing the problem at both ends.)

When using wp-sqlite-db as the back end for WordPress, wpcli's `search-replace` command fails because wp-sqlite-db returns text column types as `TEXT`, and wpcli search-replace checks whether a column is textual in `is_text_col` with `strpos` for "text" or "varchar". If this were `stripos` instead of `strpos` then this problem would be resolved, which would be nice, and I don't believe there would be any backward compatibility implications. So, here's a one-character PR :-)

(Of course, sqlite as backend isn't actually supported, but this is a fairly small change which should make things better for that without affecting the mainline code. I've also proposed aaemnnosttv/wp-sqlite-db#56 to wp-sqlite-db to have that return lowercase "text" for column types as well, thus hopefully fixing the problem at both ends.)
@stuartlangridge stuartlangridge requested a review from a team as a code owner February 14, 2023 23:49
@danielbachhuber danielbachhuber added the command:search-replace Related to 'search-replace' command label Feb 15, 2023
@danielbachhuber danielbachhuber added this to the 2.0.20 milestone Feb 15, 2023
Copy link
Copy Markdown
Member

@danielbachhuber danielbachhuber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine to me 😊 Thanks for the pull request!

@danielbachhuber danielbachhuber merged commit 2ac4568 into wp-cli:main Feb 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

command:search-replace Related to 'search-replace' command

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants