tags:

views:

33

answers:

2

This question I am asking by proxy (it is for someone else).

He is making a program and have the following problem: He need to input unescaped ";" into a query, he heard that he could ask MySQL to terminate with something else than ";"

So, in pseudocode it would be:

Change_Statement_Ending(;;); SELECT * FROM * WHERE;; //suppose that this was a input query, it is years that I don't use SQL I don't remember... Change_Statement_Ending(;);;

The problem is that he cannot remember the correct syntax for the line that I wrote as "Change_Statement_Ending(ending)"

+2  A: 

You can use DELIMITER . E.g to change the delimiter to // instead of the default ; , issue DELIMITER //

nos
A: 

I had a similar problem a little time back, but someone told me that it's a not very good. I then found that I had a bad query written there and did rewrite it. So maybe you should first look at the query?

I will check for my solution and edit with answer.

I had this query: http://pastebin.com/LZkFF6wR And because of that & inside of it it wouldn't run unless delimiter was changed.
So, I then used htmlspecialchars() - htmlspecialchars() - for my query (since it was PHP generated, don't know about yours) and it fixed the issue.

Tom