Skip to content
This repository was archived by the owner on Jul 11, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions redisql_lib/src/community_statement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,10 @@ impl<'a> StatementTrait<'a> for Statement {
)
} {
ffi::SQLITE_OK => Ok(SQLiteOK::OK),

// it means that a statement requires less than $index paramenter, it is fine to just
// shortcut it to Ok.
ffi::SQLITE_RANGE => Ok(SQLiteOK::OK),
_ => Err(self.get_last_error()),
}
}
Expand Down
15 changes: 12 additions & 3 deletions test/correctness/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,14 @@ def test_multi_statement_multi_table_single_bind(self):
result = self.exec_cmd("A", "SELECT * FROM t2 ORDER BY A;")
self.assertEquals(result, [[2], [4]])

def test_multi_statement_different_bindings(self):
with DB(self, "A"):
with Table(self, "t1", "(A INTEGER)", key = "A"):
ok = self.exec_naked("REDISQL.CREATE_STATEMENT", "A", "insert", "insert into t1 values(?1); insert into t1 values(?2 + 1); select * from t1;")
self.assertEquals(ok, "OK")
result = self.exec_naked("REDISQL.EXEC_STATEMENT", "A", "insert", "3", "8")
self.assertEquals(result, [[3], [9]])


def test_update_statement(self):
with DB(self, "A"):
Expand Down Expand Up @@ -434,12 +442,13 @@ def test100(self):
self.assertEquals(done, ["DONE", 0L])
for i in xrange(catty):
self.exec_naked("HSET", "cat:" + str(i), "meow", i)
time.sleep(0.5)
result = self.exec_naked("REDISQL.EXEC", "A", "SELECT * FROM cats")
self.assertEquals(catty, len(result))

def test_rdb_persistency(self):
with DB(self, "A"):
done = self.exec_naked("REDISQL.EXEC", "A", "CREATE VIRTUAL TABLE cats USING REDISQL_TABLES_BRUTE_HASH(cat, meow)")
with DB(self, "Y"):
done = self.exec_naked("REDISQL.EXEC", "Y", "CREATE VIRTUAL TABLE cats USING REDISQL_TABLES_BRUTE_HASH(cat, meow)")

for i in xrange(5):
self.exec_naked("HSET", "cat:" + str(i), "meow", i)
Expand All @@ -448,7 +457,7 @@ def test_rdb_persistency(self):
pass
time.sleep(0.5)

result = self.exec_naked("REDISQL.EXEC", "A", "SELECT rowid, cat, meow FROM cats")
result = self.exec_naked("REDISQL.EXEC", "Y", "SELECT rowid, cat, meow FROM cats")
self.assertEquals(5, len(result))
self.assertTrue([0L, "cat:0", "0"] in result)
self.assertTrue([1L, "cat:1", "1"] in result)
Expand Down