test-sqlite3-blob.nut 503 B

12345678910111213141516
  1. auto db = SQLite3(":memory:");
  2. db.exec_dml("create table if not exists test(id integer primary key, data blob);");
  3. auto stmt_insert = db.prepare("insert into test(data) values(?)");
  4. for(auto i=0; i < 10; ++i)
  5. {
  6. stmt_insert.bind_zeroblob(1, 2048);
  7. stmt_insert.step();
  8. stmt_insert.reset();
  9. }
  10. print(db.exec_get_one("select count(*) from test"));
  11. auto dbblob = db.blob_open("main", "test", "data", 1, 1);
  12. print(dbblob);
  13. print(dbblob.bytes());
  14. dbblob.write("Hello");
  15. print(dbblob.read(5));