SWI-Prolog / packages-cql

High level database interface
6 stars 6 forks source link

sql_tokenizer fails #5

Closed eberkers closed 4 years ago

eberkers commented 4 years ago

The example given in sql_parser.pl of calling the parser with tokenizing first:

sql_tokens(Tokens, "CREATE VIEW foo AS SELECT bar FROM qux", []), sql_parse(view_definition(Definition, Types), TrailingComments, [], Tokens).

fails in sql_tokenizer at the predicate sql_token_1 by returning false.

I ran the tokenizer standalone through yap (v6.2.2), where it runs fine, returning true and yielding: tokens = ['CREATE VIEW foo AS SELECT bar FROM qux'].

Is there a compatibility issue with SWI 8 (using 8.0.3) for this CQL library?

Any help greatly appreciated!

JanWielemaker commented 4 years ago

Use sql_tokens(Tokens, `CREATE VIEW foo AS SELECT bar FROM qux`, []),, i.e., backquotes to get a list of character codes where "xyz" creates a SWI-Prolog string object.

eberkers commented 4 years ago

Thanks Jan, works like a charm now!

/Erwin