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

drush sqlq --db-prefix doesn't work any more. #1441

Closed
greg-1-anderson opened this issue Jun 13, 2015 · 4 comments
Closed

drush sqlq --db-prefix doesn't work any more. #1441

greg-1-anderson opened this issue Jun 13, 2015 · 4 comments

Comments

@greg-1-anderson
Copy link
Member

Drush 6 behavior (correct):

$ drush sqlq 'select * from users;'
0|||||||0|0|0|0|||0||
1|admin|...|admin@example.com||||1434161704|1434161729|1434161729|1|UTC||0|admin@example.com|b:0;
$ drush sqlq 'select * from {users};'
Error: near line 1: unrecognized token: "{"
Query failed.                                                        [error]
$ drush sqlq 'select * from {users};' --db-prefix
0|||||||0|0|0|0|||0||
1|admin|...|admin@example.com||||1434161704|1434161729|1434161729|1|UTC||0|admin@example.com|b:0;

Drush 7 and Drush 8 behavior:

$ drush sqlq 'select * from users;'
0|||||||0|0|0|0|||0||
1|admin|...|admin@example.com||||1434161704|1434161729|1434161729|1|UTC||0|admin@example.com|b:0;
$ drush sqlq 'select * from {users};' 
Query failed.                                                        [error]
$ drush sqlq 'select * from {users};' --db-prefix

Fatal error: Class 'Drush\Sql\Database' not found in /Users/ga/.composer/vendor/drush/drush/lib/Drush/Sql/SqlBase.php on line 201

Just leaving this here. I'm not really fond of db prefixes myself, but ideally this would still work.

@weitzman
Copy link
Member

I see an attempt to prefix in the code. My hunch is that we only don't prefix when an input file is provided (as opposed to a string). I think that other commands use sql-query internally and provide and input file or --file option so they would suffer this same issue. The example given would not fall into this category so no idea on the example shown above.

@greg-1-anderson
Copy link
Member Author

I had a better solution to this problem.

Ideally, Drush would still work with db prefixes, but I don't know if anyone will take the time to circle back here.

@drzraf
Copy link

drzraf commented Sep 4, 2017

same (blocking) issue drush sql-sanitize which, sadly, will just NOT work without --db-prefix
What to do?

@weitzman
Copy link
Member

weitzman commented Sep 5, 2017

db prefixes are no longer supported in drush

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

3 participants