Anyone tried a MySQL load data infile statement?
| From: | (Miles Thompson) | Date: | Tue, 27 Feb 2001 22:58:26 +0000 |
| Subject: | Anyone tried a MySQL load data infile statement? | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-6996@lists.php.net to get a copy of this message | ||
In the Python language, witht he appropriate module, one can construct a string like:
"load data infile 'pwlist.txt' replace into table subscriber fields terminated by '\t' optionally enclosed by '"' lines terminated by '\r\n' ",
pass it to the cursor.execute() function and it completes.
I've tried this, assingning the string to $sql, and then issuing mysql_query( $sql ), all in the hope that magic would happen. It hasn't. I guess what I was sort of counting on was that mysql_query(), despite its name and obvious function might also be a general purpose execution tool for MySQL commands.
Anyone tried anything similar? It's a really cool way to quickly update a database from a, in this case, tab-delimited file.
Miles Thompson