macobo / sqlcomplete

Smart autocomplete for sql
MIT License
4 stars 3 forks source link

Handling strings #7

Open macobo opened 9 years ago

macobo commented 9 years ago

More info at http://www.postgresql.org/docs/8.2/static/sql-syntax-lexical.html

Tricky bit is handling escape codes, this will complicate the query tokenizing logic quite a bit.

macobo commented 9 years ago

For the tokenization process, this class seems like an useful reference: https://github.com/wvanbergen/sql_tree/blob/master/lib/sql_tree/tokenizer.rb

macobo commented 9 years ago

String tockenizing is a bit tricky in any case: http://stackoverflow.com/questions/19812597/postgresql-string-escaping-settings.

https://github.com/andialbrecht/sqlparse/blob/master/sqlparse/lexer.py#L194 does use a regex for this though.