I'm using the wpdb class to run a LOAD DATA LOCAL INFILE. It works fine and the data is inserted properly - but it still returns 0, so echos 'No Update' in the example. Is this the expected outcome based on the LOAD DATA method? If so, is there some other way of knowing that the process ran and did indeed insert rows?
Thanks much!
Philip
global $wpdb;
$filename = 'file.csv';
$sql = "LOAD DATA LOCAL INFILE '" . $filename . "'
INTO TABLE Stock_Item
FIELDS TERMINATED BY ',' ENCLOSED BY '\"' ESCAPED BY '\"' LINES TERMINATED BY '\n' IGNORE 1 ROWS
(stock_item_code, stock_item_name)";
$result = $wpdb->query($sql);
if ($result === false) { echo 'Query Fail'; }
if ($result === 0) { echo 'No update'; }
if ($result > 0) { echo 'Success'; }