On 12/12/13 09:57, Carter Schonwald wrote:
as another point in the design space, a pretty idiom for SQL style dbs
in haskell is the *-simple family of libs
postgres simple
http://hackage.haskell.org/package/postgresql-simple-0.3.7.0/docs/Database-PostgreSQL-Simple.html
mysql-simple
http://hackage.haskell.org/package/mysql-simple-0.2.2.4/docs/Database-MySQL-Simple.html
and
sqlite-simple
https://hackage.haskell.org/package/sqlite-simple-0.4.4.0/docs/Database-SQLite-Simple.html
the common pattern is a nice way to write query strings and
argument/result tuples in a type safe way, and are only really related
in being a nice pattern for sql db interaction.
note that by type safe, i mean injection safe! I think similar could
be adapted to rust, perhaps with a wee bit of help using macros (which
maybe aren't needed once higher kinded types/ traits) are around?
FWIW, I believe SQL tokenises, so a macro like
let x = 10;
let y = "foo";
// injection-safe substitution.
let query = sql!(SELECT relevant_column FROM table WHERE
search_column = $y LIMIT $x);
let result = db_driver.execute(&query);
might be possible (if anyone is interested in a raw SQL interface). Of
course, it is extremely unlikely to be possible as a structural macro
(i.e. macro_rules), it probably requires a full blown procedural one
(i.e. a syntax extension, which have to be hard-coded into libsyntax for
the moment).
Huon
On Wed, Dec 11, 2013 at 3:27 PM, spir <[email protected]
<mailto:[email protected]>> wrote:
On 12/11/2013 06:04 PM, Patrick Walton wrote:
We aren't likely to block 1.0 on this. Instead of stabilizing
all libraries once
and for all in 1.0 like Go did, we're taking a gradual
approach to libraries
similar to that of node.js, in which 1.0 will have some
library modules stable
and some modules unstable, and releases 1.1, 1.2, and beyond
will stabilize more
and more libraries as time goes on.
A good thing, I guess, especially in that the latest trend in Rust
seems to be moving primitives into the library.
Denis
_______________________________________________
Rust-dev mailing list
[email protected] <mailto:[email protected]>
https://mail.mozilla.org/listinfo/rust-dev
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev