The problem is the string.split() method not functioning properly for some "|" delimeted strings if the strings come back from the database.
Example Code:
Code: Select all
var testStr = "34|1|1|1|22|32|4|1|1|15|1|10|27|1|1|1|1|9|1|1|1|38";
var sql = "UPDATE error_test SET val = '" + testStr + "' WHERE id = 1";
application.db.executeCommand(sql);
var sql = "SELECT * FROM error_test WHERE id = 1";
var q = application.db.executeQuery(sql);
var tempRow = q.get(0);
var tStr = tempRow.getItem("val");
trace("Str:" + tStr);
var t = tStr.split("|");
trace("length:" + t.length);
insert 1 row with id=1
run the code snippet and note that the split function is returning an array of length 51 instead of the correct 22.
if you call the split function with a variable containing the same string it works. If you change the delimeter to anything other than "|" it works also.
unlucky for us, "|" is our standard delimeter
just in case it's in SFS and not jdbc drivers, thought I'd pass it along.
<edit>
forgot to mention we're using mySQL 5 and the beta 5.0 jdbc driver
</edit>