We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 89e9504 commit 43c700bCopy full SHA for 43c700b
1 file changed
src/io/sqlite_store.rs
@@ -48,7 +48,7 @@ impl SqliteStore {
48
let sql = format!(
49
"CREATE TABLE IF NOT EXISTS {} (
50
namespace TEXT NOT NULL,
51
- key TEXT NOT NULL,
+ key TEXT NOT NULL CHECK (length(key) > 0),
52
value BLOB, PRIMARY KEY ( namespace, key )
53
);",
54
KV_TABLE_NAME
@@ -215,6 +215,10 @@ mod tests {
215
// Test the basic KVStore operations.
216
sqlite_store.write(namespace, key, &data).unwrap();
217
218
+ // Test empty namespace is allowed, but not empty key.
219
+ sqlite_store.write("", key, &data).unwrap();
220
+ assert!(sqlite_store.write(namespace, "", &data).is_err());
221
+
222
let listed_keys = sqlite_store.list(namespace).unwrap();
223
assert_eq!(listed_keys.len(), 1);
224
assert_eq!(listed_keys[0], key);
0 commit comments