CSNW / sql-bricks

Transparent, Schemaless SQL Generation
http://csnw.github.io/sql-bricks
MIT License
203 stars 25 forks source link

Autoquoting non-overridable #101

Open Suor opened 6 years ago

Suor commented 6 years ago

This makes impossible e.g. adding a reserved word, see https://github.com/Suor/sql-bricks-postgres/issues/13

prust commented 6 years ago

@Suor: Yeah, it should be possible to add binary to the list by doing something like:

sql._reserved.binary = 'binary';

But that pollutes the global namespace, it'd be nice to add a way to extend this while leaving the original namespace alone, like we want to do for converters (#62). That'll be breaking change in 3.0, though, not something we can slip into 2.x.

Suor commented 6 years ago

Ah, yes this is possible. I looked that sql._reserved is never used and forget about shallowness of a copy. I will hack it for now. Same as with conversions. We are struggling without proper inheritance here.

prust commented 6 years ago

@Suor: Thanks

We are struggling without proper inheritance here.

Understood, that's next on my 3.x list.

tamarzil commented 6 years ago

Also - it would be great if we could set a custom value for '_autoQuoteChar' for the extension. In mysql identifiers are quoted with a backtick, not double quotes (unless setting a specific SQL mode).

prust commented 6 years ago

thx @tamarzil! I created a new Issue to track this (#104).