Exemplo n.º 1
0
        public void test_stmt_busy()
        {
            using (sqlite3 db = ugly.open(":memory:"))
            {
                db.exec("CREATE TABLE foo (x int);");
                db.exec("INSERT INTO foo (x) VALUES (1);");
                db.exec("INSERT INTO foo (x) VALUES (2);");
                db.exec("INSERT INTO foo (x) VALUES (3);");
                const string sql = "SELECT x FROM foo";
                using (sqlite3_stmt stmt = db.prepare(sql))
                {
                    Assert.AreEqual(sql, stmt.sql());

                    Assert.AreEqual(stmt.stmt_busy(), 0);
                    stmt.step();
                    Assert.IsTrue(stmt.stmt_busy() != 0);
                    stmt.step();
                    Assert.IsTrue(stmt.stmt_busy() != 0);
                    stmt.step();
                    Assert.IsTrue(stmt.stmt_busy() != 0);
                    stmt.step();
                    Assert.IsTrue(stmt.stmt_busy() == 0);
                }
            }
        }