revDataFromQuery, Rev cgi & mySQL

Ken Ray kray at sonsothunder.com
Sun Jan 7 22:05:38 EST 2007


On Jan 5, 2007, at 6:54 AM, jbv wrote:

> Hi list,
>
> For some reasons too long to explain here, I need to dump
> large amounts of data from a mySQL table to a txt file (for instance
> 15 columns for 35000 records that represents about 1.5 Mb).
>
> I'm using Rev cgi 2.5 and mySQL 3.23.
> I use revDataFromQuery which happens to be VERY slow
> (about 20 sec to get 1.5 Mb of data from mySQL)...
>
> I was wondering if there was any way to speed up such data
> transfer between mySQL and Rev cgi, or may be to send to
> mySQL (may be via the shell)  an SQL request to dump the
> content of some columns of a table into a txt file that could be
> opened later from Rev cgi...
>
> Any help on this domain would be greatly apreciated...

You can use a standard SELECT statement, but just add this:

   INTO OUTFILE <filePath>

Note that this dumps the file to the server host, not the client, so  
you'll need to have the FILE privilege assigned to the logged-in user  
to be able to execute it. This writes it out tab-delimited, with  
tabs, newlines, or "\" that occur in field values escaped with a  
preceding "\".

If you want the file generated on the client, then you'll have to do  
a SELECT and put that into a Rev variable, then output the data from  
the variable to the text file.

HTH,

Ken Ray
Sons of Thunder Software, Inc.
Web Site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com






More information about the use-livecode mailing list