How do I escape Variables? - VisualCron - Forum

Community forum

blaxus
2014-03-14T23:20:49Z
Okay, I'm loving this application i'm testing it, but let's get straight to the point here.

My job error log said this:
Quote:

Exception in Task: 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 's new policies are more crowdfunding friendly'
,'link here'
)'
at line 3



So I have no idea how to escape that variable. Thank you for your help out front.
Support
2014-03-17T08:03:43Z
If you get that kind of error you need to paste the whole SQL text here, otherwise it is hard for us to debug the cause. Also, if you use a Variable inside we need to know the exact value of the Variable as well.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
blaxus
2014-03-17T13:09:04Z
This was my query.

INSERT INTO test_entries (feed,guid,timestamp,title,link) VALUES ('{USERVAR(feed14)}'
,'{TRIGGER(Active|LastTrigger|RSS.Result.Id)}'
,'{TRIGGER(Active|LastTrigger|RSS.Result.PubDate|yyyy-d-M h:mm:ss)}'
,'{TRIGGER(Active|LastTrigger|RSS.Result.Title)}'
,'{TRIGGER(Active|LastTrigger|RSS.Result.Link)}'
)


Uservar contains a the RSS feed URL that is currently being crawled.

The title held something along the lines of Paypal's new policies are more crowdfunding friendly As you can see, no escaping cut off the sentence and throw me an error, and ultimately failing the task.

Which leads me to ask the question I had already asked once. How do I escape variables?
Support
2014-03-17T15:14:55Z
So, the problem is the quote. And escaping that is the same way you would escape an quotein MySQL. I see two alternatives:

1. use double quote instead of single quote if you have a single quote inside the value; something like this; VALUES ("{USERVAR(feed14)}"
2. or, if that does not work, you need to find the escape character in MySQL and use the replace function in VisualCron to exchange that value
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Scroll to Top