public void test_blob_write() { using (sqlite3 db = ugly.open(":memory:")) { const int len = 100; db.exec("CREATE TABLE foo (b blob);"); using (sqlite3_stmt stmt = db.prepare("INSERT INTO foo (b) VALUES (?)")) { stmt.bind_zeroblob(1, len); stmt.step(); } long rowid = db.last_insert_rowid(); using (sqlite3_blob bh = db.blob_open("main", "foo", "b", rowid, 1)) { int len2 = bh.bytes(); Assert.AreEqual(len, len2); int passes = 10; Assert.AreEqual(len % passes, 0); int sublen = len / passes; byte[] buf = new byte[sublen]; for (int i = 0; i < sublen; i++) { buf[i] = (byte)(i % 256); } for (int q = 0; q < passes; q++) { bh.write(buf, q * sublen); } } } }