![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
When I use LOAD DATA LOCAL 'file.csv' IGNORE INTO..., is there any way to return a list of the rows that were inserted? My table has about 28,000 rows, and when I run this once a month (via PHP cron), I'll expect 10-20 new rows to be inserted. These rows will need a small amount of manual editing, though, and it would be pretty helpful if I could email myself a list of the new rows instead of trying to remember to check on them manually. |
#3
| |||
| |||
|
|
Look at the .csv file you're importing. It's just plain text. And I would suggest editing the data before you load the file, not wait until after.g |
#4
| |||
| |||
|
|
On Sunday, November 20, 2011 8:55:40 AM UTC-5, Jerry Stuckle wrote: Look at the .csv file you're importing. It's just plain text. And I would suggest editing the data before you load the file, not wait until after.g Do you mean something like, load the table into a PHP array, load the CSV into an array, loop through manually to remove the ones that exist in both, then insert the remainder? That can be done in PHP, sure, but I was hoping there was something more efficient. Like LAST_INSERT_ID(), but for a group of inserts. |
#5
| |||
| |||
|
|
On Sunday, November 20, 2011 8:55:40 AM UTC-5, Jerry Stuckle wrote: Look at the .csv file you're importing. It's just plain text. And I would suggest editing the data before you load the file, not wait until after.g Do you mean something like, load the table into a PHP array, load the CSV into an array, loop through manually to remove the ones that exist in both, then insert the remainder? That can be done in PHP, sure, but I was hoping there was something more efficient. Like LAST_INSERT_ID(), but for a group of inserts. Maybe something like this would work for you: |
#6
| |||
| |||
|
|
When I use LOAD DATA LOCAL 'file.csv' IGNORE INTO..., is there any way to return a list of the rows that were inserted? |
|
My table has about 28,000 rows, and when I run this once a month (via PHP cron), I'll expect 10-20 new rows to be inserted. |
|
These rows will need a small amount of manual editing, though, and it would be pretty helpful if I could email myself a list of the new rows instead of trying to remember to check on them manually. |
#7
| |||
| |||
|
|
Jason C <jwcarlton (AT) gmail (DOT) com> wrote: When I use LOAD DATA LOCAL 'file.csv' IGNORE INTO..., is there any way to return a list of the rows that were inserted? A list? No. Like any other DML statement, LOAD DATA will return the number of affected rows. And if your table has an auto-increment field, then you will get the id of the first inserted row. My table has about 28,000 rows, and when I run this once a month (via PHP cron), I'll expect 10-20 new rows to be inserted. What is "PHP cron" ? |
![]() |
| Thread Tools | |
| Display Modes | |
| |