Open elincognito opened 8 years ago
Nevermind frozen brain in the morning, properly escaping max reserved keyword will do the trick :facepunch:
This is one of most frequent syntax problem of AlaSQL. Unfortunately, I do not know how to minimize it effect.
I will try to place it early in readme
What about including a list of the reserved key words with the Parse Error msg. Or a link to the reserved words. At least that way a newbie, like me, can than realize that this could be the problem. Because a parse error really could be caused by two major problems: 1) an actual syntax error 2) use of a reserved word (which than causes a syntax error).
@Cyberider I like your idea.
What if the error was structured like this:
Error: Have you used a reserved keyword without `escaping` it? Parse error on line 1:
...T name as Nome, max as Maximo INTO XLSX(
-----------------------^
Expecting 'LPAR', got 'AS'
Is this doable?
Error: Parse error on line 1:
...T name as Nome, max as Maximo INTO XLSX(
-----------------------^
Have you used a Reserved Keyword without escaping it with [square_brackets] or `back_quotes`?
Expecting 'LPAR', got 'AS'
Ill look into it. Im looking into how we can intercept the error throwing winthout having too much of a a peformance hit
My first try did not work.
I just found an example: https://gist.github.com/GerHobbelt/e18f2ef8ee575d4ff49d
leaving it here to use it as a template.
I have the following `alasql('SELECT name as Nome, max as Maximo INTO XLSX("email-types.xlsx",{headers:true}) FROM ?', [$scope.data.types]);``
its giving me the the syntax error
Error: Parse error on line 1:
...T name as Nome, max as Maximo INTO XLSX(
-----------------------^
Expecting 'LPAR', got 'AS'