Skip to content
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

SQL mode compat logic is missing for SQL from STDIN #171

Open
schlessera opened this issue Apr 18, 2020 · 2 comments
Open

SQL mode compat logic is missing for SQL from STDIN #171

schlessera opened this issue Apr 18, 2020 · 2 comments

Comments

@schlessera
Copy link
Member

Bug Report

Describe the current, buggy behavior

For #168 we've added logic to emulate WordPress Core's SQL mode compatibility hacks for the commands where we run the mysql binary directly.

PR #170 adds this for the db import command, except for the use case where we have mysql feed directly from STDIN.

For this use case, right now, WordPress Core is not compatible with MySQL 5.7+ because of its incompatible default SQL modes.

Describe what you would expect as the correct outcome

WP-CLI should behave similar to WordPress Core in all scenarios, even when having SQL code be fed to db import via STDIN.

This should not jus read the entire STDIN into memory, as that can lead to out-of-memory errors or create issues over networks.

Provide a possible solution

This might be doable (read: needs a POC, as unsure) by using proc_open to create a new process and handing it a pipe as STDIN that we control from PHP.

Then we could fwrite() our compact code into the pipe first, and then stream_copy_contents from actual STDIN into that pipe.

@MaybeThisIsRu
Copy link

Since the related PR has been merged, should this be closed?

@schlessera
Copy link
Member Author

No, this problem is still present. As the issue above mentions:

PR #170 adds this for the db import command, except for the use case where we have mysql feed directly from STDIN.

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

No branches or pull requests

2 participants