[ASTPPCOM-212] Database Error when trying to save origination rate Created: 15/Jul/17  Updated: 24/Jun/21  Resolved: 01/Apr/21

Status: Done
Project: ASTPP Community
Component/s: None
Affects Version/s: None
Fix Version/s: v3.5

Type: New Feature
Reporter: dedayoa Assignee: Samir Doshi
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: 2.5h
Original Estimate: Not Specified


 Description   

Hello,
I've saved origination rates in the past and have 100s of them setup infact. However, I tried to add a new rate this evening and nothing happened.
I discovered that the AJAX call to origination_rate_save/ was returning an E500 and the error is duplicated below.

`A Database Error Occurred

Error Number: 1064

You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'net','0','0','0','10','1','1','','2017-07-15 19:51:40') ON DUPLICATE KEY UPDATE' at line 1

Insert into routes (pricelist_id,pattern,comment,status,connectcost,includedseconds,cost,init_inc,inc,trunk_id,creation_date) values('1','^0220.','NG T'net','0','0','0','10','1','1','','2017-07-15 19:51:40') ON DUPLICATE KEY UPDATE pricelist_id = '1',pattern = '^0220.',comment = 'NG T'net',status = '0',connectcost = '0',includedseconds = '0',cost = '10',init_inc = '1',inc = '1',trunk_id = '',creation_date = '2017-07-15 19:51:40'

Filename: /var/www/html/astpp/modules/rates/models/rates_model.php

Line Number: 355`

I have done an update 5 mins ago and it did not help.



 Comments   
Comment by dedayoa [ 15/Jul/17 ]

OK, so i discovered what the problem is. The "Destination", stored in the database in column "comment" does not accept the "'" - the apostrophe. My guess is that it's not being properly escaped before being sent to the database or the query builder (if there's one) has a bug.

Comment by Samir Doshi [ 05/Sep/17 ]

Issue has been fixed in version v3.5. Upgrade to latest version and test it out.

Generated at Sat Feb 10 07:15:09 CET 2024 using Jira 8.13.3#813003-sha1:22ebedbb75c99b147c66f14e031dd8a2d214753a.