Chris Ella Sun Jun 24 14:01:10 -0400 2012

Subject: LOAD DATA INFILE, getting affected rows

Hey,
I'm using the ::query() method to call an SQL statement along these lines :

LOAD DATA LOCAL INFILE '$loadDataFileName'
REPLACE INTO TABLE `xxx`
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\r\n'
IGNORE 1 LINES
( `xxx`, `xxx`, `xxx`, `xxx` );

I need to know how many lines were affected (inserted or overwritten) by the statement.

This call is occurring every 5 minutes and processing 75,000+ records every 5 minutes, so every bit of performance counts.

Cheers for any suggestions on the preferred method.


Chris Ella Sun Jun 24 14:14:11 -0400 2012

Ahha after hours of wondering, and within 10 minutes of posting this I work it out :D

Mode::query() returns a PDOStatement and I can just call rowCount() on the PDOStatement.

(1-1/1)