Fixed Importer: prepareImportSql doesn't work with UPDATE (sub-queries)

DragonByte Tech

Well-known member
Affected version
2.0.2
Given the following code:

PHP:
$this->prepareImportSql($this->prefix, "
    UPDATE dbtech_vbecommerce_discountpointslog
        AS discountpointslog
    SET ipaddress = IFNULL((
            SELECT ipaddress
            FROM user
            WHERE username = discountpointslog.username
        ), '')
    WHERE ipaddress = ''
");

Expected output:
SQL:
UPDATE vb_dbtech_vbecommerce_discountpointslog
    AS discountpointslog
SET ipaddress = IFNULL((
        SELECT ipaddress
        FROM vb_user
        WHERE username = discountpointslog.username
    ), '')
WHERE ipaddress = ''

Actual output:
SQL:
UPDATE dbtech_vbecommerce_discountpointslog
    AS discountpointslog
SET ipaddress = IFNULL((
        SELECT ipaddress
        FROM vb_user
        WHERE username = discountpointslog.username
    ), '')
WHERE ipaddress = ''

To fix, add UPDATE| to line 418 of /src/XF/Import/Importer/AbstractImporter.php

Can I count on this fix being in 2.0.3 or should I implement a custom function to fix this bug?


Fillip
 
Back
Top Bottom