Error with unescaped database query

During Step 7, there is an unescaped database query that is throwing errors during migration. See the error below:
CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘FALLON’ LIMIT 1′ at line 1. The SQL statement executed was:
SELECT * FROM `sales_order_tax` `t` WHERE order_id = 83134 AND code = ‘US-MO-63368-O’ FALLON’ LIMIT 1

1 answer

Profile photo of Mall Staff 184060.00 $tone January 25, 2019
Public

Hi there,

MySQL server version for the right syntax to use near ‘FALLON’ LIMIT 1′ at line 1. The SQL statement executed was:
SELECT * FROM `sales_order_tax` `t` WHERE order_id = 83134 AND code = ‘US-MO-63368-O’ FALLON’ LIMIT 1

That issue relates to a special case of data value on ‘code’ field in table ‘sales_order_tax’ in your M1 database.
To handle for that case, please try steps below:
+ Open the PHP file at path: pub/ub-tool/protected/controllers/Step7Controller.php
and find to the code line: 

$condition = "order_id = {$parentId2} AND code = '{$model->code}'";

and replace it by code line:

$condition = "order_id = {$parentId2} AND code = '". addslashes($model->code) ."'";

+ Once done, you could continue with data migration in the step #7
Regards,
Mall.

#

Please login or Register to Submit Answer

Written By

Comments