New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse `query()` queries #510

Closed
borekb opened this Issue Oct 26, 2015 · 2 comments

Comments

Projects
None yet
3 participants
@borekb
Copy link
Member

borekb commented Oct 26, 2015

This is an imported issue, original reference WP-510, created on 09 Oct 2015.

Right now, we track DB queries that go through the insert(), update() and delete() methods but sometimes, some data are stored via the query() method (relatively rare in WP core, we expect this to be used more by the plugins).

Query is harder to handle because it receives only a string that we need to reverse engineer into some useful data.

@borekb

This comment has been minimized.

Copy link
Member

borekb commented Feb 22, 2016

Thanks @octopuss for looking into this. Here's a list of things that come to mind that should be done as part of this ticket:

  • Create a list of cases where WordPress core issues plain query() instead of insert() or update(). @pavelevap might help with this.
  • Write End2End tests for at least some of those cases.
  • Implement the query parsing alone (together with unit tests, of course).

@borekb borekb added the in progress label Feb 23, 2016

octopuss added a commit that referenced this issue Mar 4, 2016

[#510] -
- Composer dependency moved from dev
- EntityName resolving is part of query parsing
- INSERT INGNORED query support is no longer needed
- Tests refactor

octopuss added a commit that referenced this issue Mar 8, 2016

[#510] - removed parsing of unnecessary parts. Refactor of method nam…
…es and tests. Removed 2 hooks on delete_post_meta and add_option.

octopuss added a commit that referenced this issue Mar 10, 2016

octopuss added a commit that referenced this issue Mar 10, 2016

octopuss added a commit that referenced this issue Mar 11, 2016

[#510] fixed error when post meta was deleted. Adjusted Delete method…
… which now gathers parentIds of child entities before delete. Created Tests for postMeta deletion.
@octopuss

This comment has been minimized.

Copy link
Contributor

octopuss commented Mar 14, 2016

I've analyzed usage of query() method in WordPress. It is mostly used in functionality which is not supported by VersionPress (old WordPress versions or multisite). Whole analysis is in attached table
Wordpress wp-db.query() method usage.xlsx
. I've pointed out relevant query() calls which will be covered by solution of this issue.

File Query info
link.php update links using IN
comment.php update posts using trim replace
option.php insert on duplicate update
meta.php delete using IN

@octopuss octopuss referenced this issue Mar 14, 2016

Merged

Parsing `query()` method #782

2 of 2 tasks complete

@octopuss octopuss added in review and removed in progress labels Mar 14, 2016

octopuss added a commit that referenced this issue Mar 15, 2016

[#510] - refactoring according to hints from PR
- added phpdoc
- slight refactor of WpdbMirrorBridge - finding parent ids is now in one method.
- method vp_query renamed to vp_direct_query

octopuss added a commit that referenced this issue Mar 15, 2016

@borekb borekb referenced this issue Mar 18, 2016

Merged

785 wpdb facade #788

2 of 2 tasks complete

@octopuss octopuss referenced this issue Mar 22, 2016

Merged

Reopened sql query parsing #799

1 of 1 task complete

@octopuss octopuss reopened this Mar 22, 2016

@octopuss octopuss referenced this issue Mar 22, 2016

Merged

Fixed typo in variable name #802

1 of 1 task complete

@borekb borekb removed the in review label Apr 28, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment