Interesting project https://github.com/facebookincubator/CG-SQL
(1) By Domingo (mingodad) on 2020-10-09 12:40:42 [link]
Hello ! Today I found this interesting project https://github.com/facebookincubator/CG-SQL that is a kind of DSL for stored procedures for sqlite. Cheers !
(2) By Stephan Beal (stephan) on 2020-10-09 13:16:37 in reply to 1
> ... a kind of DSL for stored procedures for sqlite. To save the next person some searching, as the intro page doesn't properly hyperlink link to its documentation, the "most interesting bit" is: <https://github.com/facebookincubator/CG-SQL/blob/master/CQL_Guide/guide.md> Management summary: it implements what appears to be a fairly sophisticated DSL for SQL procedures. The DSL gets compiled to C and linked in to the application as a routine which can be called from C, as opposed to an SQL-bound UDF (which it's not, though wrapping such a call in a UDF looks like it would be trivial).
(3) By ddevienne on 2020-10-09 14:09:16 in reply to 2 [link]
Thanks. Unfortunately (for some at least), and as usual for Facebook, the generator appears to be *Unix-only*. We can hope the generated code is not similarly *Unix-only*, but my expectations aren't high. Perhaps portability will appear later, for once. This does look very interesting though. Thanks for sharing.
(4) By Rowan Worth (sqweek) on 2020-10-12 12:10:18 in reply to 3 [link]
What makes you say it's unix-only? Considering the tool is effectively reading some text files and spitting out other text files I was stunned by the notion of it being bound to a particular OS and wanted to know what atrocities the code must be committing, but lo and behold it builds and runs on windows. I mean it definitely wasn't the smoothest build I've ever experienced, with the main pain point being finding compatible versions of bison/flex that run on windows (I only tried one version before giving up and running those build steps using bison/flex from WSL). But I've had worse build experiences just trying to tell cmake where I built a custom version of a dependent library XD
(5) By anonymous on 2020-10-12 12:17:27 in reply to 4 [link]
Perhaps you're on Cygwin? Is linking with PThreads Windows friendly?
(6) By Rowan Worth (sqweek) on 2020-10-12 22:56:17 in reply to 5 [link]
Seems the cql build itself doesn't require pthreads. -lpthreads is mentioned in the Makefile but only used for the test targets. That said I'm using gcc from MinGW-W64 and a basic pthreads test does work. It provides a small libwinpthread-1.dll (~51K) but that's the only dependency of the resulting executable.