Skip to content

Instantly share code, notes, and snippets.

@sam-mccall
Created April 22, 2012 03:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sam-mccall/2444420 to your computer and use it in GitHub Desktop.
Save sam-mccall/2444420 to your computer and use it in GitHub Desktop.
#import("sqlite.dart", prefix:"sqlite"); // https://github.com/sam-mccall/dart/commit/9e2250beb970e0d614091497cd47aedbdcf02206
main() {
var c = new sqlite.Connection("/tmp/test.db");
try {
// [5, HELLO]
print(c.first("SELECT ?+2, UPPER(?)", [3, "Hello"]));
// [Hi!]: Hello, world!
// [Bye!]: Goodbye, cruel world!
// 2 posts total.
var count = c.execute("SELECT * FROM posts", callback: (row) {
print("[${row.title}]: ${row.body}");
});
print("${count} posts total.");
} finally {
c.close();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment