Re: DB package... mysql: LOAD DATA LOCAL INFILE
| From: | Justin Patrin | Date: | Tue, 08 Mar 2005 02:32:53 +0000 |
| Subject: | Re: DB package... mysql: LOAD DATA LOCAL INFILE | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-17918@lists.php.net to get a copy of this message | ||
On Mon, 07 Mar 2005 13:43:49 -0800, Brian Anderson
<banderson623@yahoo.com> wrote:
> First, thanks to all PEAR developers! I am looking for a way to
> successfully execute the following SQL via the pear DB package:
>
> LOAD DATA INFILE 'tmp/myfile.csv' INTO TABLE
my_table
> FIELDS
> TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' ESCAPED BY '\\'
> LINES
> TERMINATED BY '\r\n'
>
> The DB packages converts this (escapes the quotes and slashes) to this:
> LOAD DATA INFILE "tmp/myfile.csv"
> INTO TABLE my_table
> FIELDS TERMINATED BY ","
> OPTIONALLY ENCLOSED BY \'"\'
> ESCAPED BY "\\"
> LINES TERMINATED BY "\\r\\n"
>
> Is there a way to use the DB object with out having it touch the query I
> put in the $db->query()?
>
I don't see any code in query() that would alter the query to do that.
In fact, I would be very surprised if it did. All quoting is done in
quoteSmart and such, DB won't escape things unless you want it to.
Perhaps you're submitting this via a web form and magic_quotes is on?
Show some code.
--
Justin Patrin