commit 7f78ef2c77fee508f6f9c281cebc819962c1bf97 from: Omar Polo date: Sun Dec 31 11:02:56 2023 UTC sqlite3: add a README commit - 772b72c555d5ba59b495ef5eba5a72ba1117a07f commit + 7f78ef2c77fee508f6f9c281cebc819962c1bf97 blob - /dev/null blob + 38c14de1fcfed162f0a94cf8de690bf1b46fe57a (mode 644) --- /dev/null +++ sqlite3/README @@ -0,0 +1,24 @@ +The sqlite3 module provides Hare bindings to the sqlite3 library. By +design, the wrapper functions resembles the underlying sqlite3 APIs so +that it is possible to use this module while reading the sqlite3 +official documentation. However, it is not a perfect 1:1 mapping, as +the exported functions should feel nice to use in Hare and not just +mirorr the C APIs. + +Sample code: + + use fmt; + use sqlite3; + + let db = sqlite3::open("./db.sqlite3")?; + defer sqlite3::close(db)?; + + let stmt = sqlite3::prepare("select $foo")?; + defer sqlite3::finalize(stmt)?; + + sqlite3::bind(stmt, "$foo", 42); + + for (sqlite3::step(stmt)!) { + fmt::printfln("The answer is {}", + sqlite3::column_text(stmt, 0)); + };