Why do I get a missing ) error with a line containing the exact number of brackets...

    Oct 16 2018 | 9:35 am
    I do get a SyntaxError: missing ) after argument list in line, line 32 the moment I uncomment the first line in that code snippet. I have no idea why, the second line works fine... And I don't know what the "+" around the arguments are for... This is mainly a modification out of Andrew Bensons SQLite examples... // exec("INSERT INTO Piece ('Name','composer') VALUES ('"+arguments[0]+"','"Gerard Pape"')"); exec("INSERT INTO Piece ('Name','Composer') VALUES ('"+arguments[0]+"','"+arguments[1]+"')");
    I appreciate any enlightenment...

    • Oct 16 2018 | 11:21 am
      In the first line the string is not concatenated properly Try this: exec("INSERT INTO Piece ('Name','composer') VALUES ('"+arguments[0]+"','Gerard Pape')");
    • Oct 17 2018 | 6:18 pm
      Thanks, that works. The other question remains though, I do not understand why these argument parts have to be composed like they are...
    • Oct 18 2018 | 11:48 am
      Hi Stefan, if I understand you right, the confusion is about what is a string for what part of the technologies (JavaScript and SQlite). I'll to break it down: With the exec command you are sending a SQL command to the SQlite db that contains strings (or column names) that need to be quoted (in single quotes) in SQL. But for the JavaScript compiler the SQL command itself is a string - and needs to be quoted (in double quotes) as well. The SQL command when sending is directly (without JavaScript) to SQLite would look like this (in bold the parts that SQL requires to be in single quotes) : INSERT INTO Piece ('Name' , 'composer' ) VALUES ('Title Of The Piece' , 'Name Of The Composer' ) If you do not need any changeable arguments you could send the SQL command from Javascript just by wrapping it into double quotes - to tell JavaScript that this is a string (underlined parts are what is a string for JS : exec("INSERT INTO Piece ('Name' , 'composer' ) VALUES ('Some Other String' , 'Gerard Pape' )") ; In your example the JavaScript string is composed of "text parts" and variables that are concatenated with the + operator to create the SQL command. (Again the underlined parts are what is a string for JavaScript, and the italic part the JavaScript variable: exec("INSERT INTO Piece ('Name' , 'composer' ) VALUES (' " + arguments[0] + " ' , 'Gerard Pape' )") ; was that your question?