lexcorp / assql

Automatically exported from code.google.com/p/assql
0 stars 0 forks source link

Syntax error when writing strings with 2 or more apostrophes #105

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Try to insert a string with 2 or more apostrophes (')

What is the expected output? What do you see instead?
mysql returns a syntax error

What version of the product are you using? On what operating system?
2.8

Please provide any additional information below.

these error ocurrs when you try to insert a string with more than one 
apostrophe, assql scapes the first found apostrophe but failst to do this with 
subsecuent one.

had to do this workaround:
//valor = the string i will insert

var parcharParche:Boolean=false;
var valor2:String="";
for(var n:Number=0; n<valor.length; n++)
{
if(parcharParche && valor.charAt(n)=="'") { valor2+='\\'; }
if(valor.charAt(n)=="'") parcharParche=true;
valor2+=valor.charAt(n)
}
valor=valor2;

Original issue reported on code.google.com by mcclone2...@gmail.com on 25 Oct 2011 at 4:20