j0sh / ocaml-gensqlite Goto Github PK
View Code? Open in Web Editor NEWOCaml ppx preprocessor to generate SQLite3 prepared statements and query functions
License: Other
OCaml ppx preprocessor to generate SQLite3 prepared statements and query functions
License: Other
Adding a sigil or some other built-in support to return the last inserted rowid would avoid having to carry the DB handle around in the application alongside gensqlite's generated query functions.
Hi j0sh,
First of all, awesome work on gensqlite! It's been super convenient to use for my projects thus far. Anyways, the package available on OPAM corresponds to the initial commit for this repo (August 12, 2015). However, there were some changes made since then that aren't officially released to OPAM. I'm not sure if they're considered incomplete (in which case I could help out keeping them up-to-date), but would you be willing to update the release on OPAM?
Thanks, nv
I see you started working on a replacement for sigils. Do you mind if I propose a syntax I like?
It is interesting or desirable to use familiar idioms, like the ${…}
string interpolation. Some widespread languages (the shell, BSD Make at least) use a suffix introduced by a semicolon to add pepper and salt to a variable, such as default values or various transformations. Here are the various SQL statements found in sample.ml
with a proposal for another syntax:
insert into users(name) values(>@name)
–> INSERT INTO users(name) values(${name:%s})
select <:id, <@name, strftime('%s', <?created) from users where name = >@name
–> SELECT ${id:@d}, ${name:@s}, strftime('%s', ${created:@h}) FROM users WHERE name = ${name:%s}
This also use the @
vs %
convention for formatting input and output fields, as sqlexpr
does.
I am currently giving gensqlite
a try and it looks very promising, thanks for writing it!
This package uses internal parsetree
definitions that changed in 4.03.
See the opam-builder report in http://opam.ocamlpro.com/builder/html/gensqlite/gensqlite.0.1/4e11133f38685ec7bdbb1630e8ff1c83.
Would it be possible to make a new release that is compatible with 4.03 and above?
Duplicate named params of the same type should only be bound once. (What to do if there are params with the same name but different type?)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.