I have a lot of long queries in an app, and it would be really nice to be able to use line breaks in the query to make it more readable. I can do this in PHP, but every time I do it in Titanium I get a syntax error. Below is a simplified example.
This works:
db.execute("INSERT INTO myTable (column1, column2) VALUES('a','b')");But this gives a syntax error:
db.execute("INSERT INTO myTable (column1, column2) VALUES('a','b')");Any ideas on how I can improve the readability of my queries without incurring errors?
Thanks in advance.
1 Answer
Accepted Answer
javascript doesn't allow any line breaks in strings. You can to concat them together.
db.execute("INSERT INTO myTable " + "(column1, column2) " + "VALUES('a','b')");
Your Answer
Think you can help? Login to answer this question!