In the last episode (Feb 06), Michael Boudreau said:
> Here's something weird: text strings containing newlines seem to have a 
> backslash character added when the data is exported from the database. 
> (MySQL 3.23.37 on Solaris--yes we're upgrading to .54)
> 
> However, when I read the data out to a file...
> 
>    mysql> select review into outfile '/tmp/MS55038rev1.txt' from MsReviews where 
>msid=55038 and msreviewid=1;
>    Query OK, 1 row affected (0.00 sec)
>    mysql> quit
>    Bye
> 
> The newline seems to have had a "\" (backslash, octal 134) inserted 
> before it:
> 
>    mss (mrb)% more /tmp/MS55038rev1.txt
>    123\
>    456

This is documented behaviour.  INTO OUTFILE is the inverse of LOAD DATA
INFILE, and escapes fields in exactly the same way.  From the docs:

     `SELECT ...  INTO OUTFILE' is the complement of `LOAD DATA
     INFILE'; the syntax for the `export_options' part of the statement
     consists of the same `FIELDS' and `LINES' clauses that are used
     with the `LOAD DATA INFILE' statement.  *Note `LOAD DATA': LOAD
     DATA.

   * If you use `INTO DUMPFILE' instead of `INTO OUTFILE', MySQL will
     only write one row into the file, without any column or line
     terminations and without any escaping.  This is useful if you want
     to store a blob in a file.

-- 
        Dan Nelson
        [EMAIL PROTECTED]

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to