I'm trying to find a way to run this query in a custom drush command to dump chunks of data from the DB into CVS files.
The query works fine directly in the terminal but I was wondering how would you do it in code for Drupal 7? I guess I can transform a PHP array to a CVS file but wanted to know if Drupal has a way to write more complex queries like this :)
Big thanks in advance!
SELECT uid, name, mail INTO OUTFILE '/path/sqldumps/result.csv' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' ESCAPED BY '\\' LINES TERMINATED BY '\n' FROM users WHERE uid != 0