commit - bcec250b33ce2cad945478aa45389109ea7b5970
commit + ea441465ce55b1bb68015a417c6560f65b3b8007
blob - 37902a1dabbdc48ef964d668ca1a648b1fe3054f
blob + 4a5d24b1d1ef13f2c921d6d1c1277a7cdfa56a33
--- shinsha.ha
+++ shinsha.ha
use ev;
use http;
+use sqlite3;
fn sighandler(sig: signal::sig, data: nullable *opaque) void = {
// Normal signal handler rules don't apply because ev
};
export fn main() void = {
+ let db = sqlite3::open("shinsha.sqlite3")!;
+ defer sqlite3::close(db)!;
+
+ let stmt = sqlite3::prepare(db, "select $first, $second")!;
+ defer sqlite3::finalize(stmt)!;
+
+ sqlite3::bind(stmt, "$first", 42)!;
+ sqlite3::bind(stmt, 2, "hello from hare!")!;
+ // eg. set to null
+ //sqlite3::bind(stmt, "$text", void)!;
+
+ for (sqlite3::step(stmt)!) {
+ fmt::println(sqlite3::column_text(stmt, 0))!;
+ fmt::println(sqlite3::column_text(stmt, 1))!;
+ };
+
+ sqlite3::reset(stmt)!;
+ for (sqlite3::step(stmt)!) {
+ fmt::println(sqlite3::column_text(stmt, 0))!;
+ fmt::println(sqlite3::column_text(stmt, 1))!;
+ };
+
+ sqlite3::reset(stmt)!;
+ sqlite3::clear_bindings(stmt)!;
+ sqlite3::bind(stmt, "$first", "he-he-he!")!;
+ for (sqlite3::step(stmt)!) {
+ fmt::println(sqlite3::column_text(stmt, 0))!;
+ fmt::println(sqlite3::column_text(stmt, 1))!;
+ };
+};
+
+export fn main2() void = {
const cmd = getopt::parse(os::args,
"web manga reader",
('d', "run in the foreground"),