Blob


1 The sqlite3 module provides Hare bindings to the sqlite3 library. By
2 design, the wrapper functions resembles the underlying sqlite3 APIs so
3 that it is possible to use this module while reading the sqlite3
4 official documentation. However, it is not a perfect 1:1 mapping, as
5 the exported functions should feel nice to use in Hare and not just
6 mirror the C APIs.
8 Sample code:
10 use fmt;
11 use sqlite3;
13 let db = sqlite3::open("./db.sqlite3")?;
14 defer sqlite3::close(db)?;
16 let stmt = sqlite3::prepare("select $foo")?;
17 defer sqlite3::finalize(stmt)?;
19 sqlite3::bind(stmt, "$foo", 42)?;
21 for (sqlite3::step(stmt)?) {
22 fmt::printfln("The answer is {}",
23 sqlite3::column_text(stmt, 0))?;
24 };