mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-07-07 12:35:00 +00:00
only pass collations for index in cursor + adhere to order of columns in index
This commit is contained in:
parent
22b6b88f68
commit
52533cab40
3 changed files with 28 additions and 9 deletions
|
@ -408,7 +408,7 @@ pub struct BTreeCursor {
|
|||
/// Store whether the Cursor is in a valid state. Meaning if it is pointing to a valid cell index or not
|
||||
valid_state: CursorValidState,
|
||||
/// Colations for Index Btree constraint checks
|
||||
/// Contains the Collation Seq for the whole Table
|
||||
/// Contains the Collation Seq for the whole Index
|
||||
/// This Vec should be empty for Table Btree
|
||||
collations: Vec<CollationSeq>,
|
||||
}
|
||||
|
|
|
@ -940,10 +940,17 @@ pub fn op_open_read(
|
|||
.get_table(&index.table_name)
|
||||
.map_or(None, |table| table.btree());
|
||||
let collations = table.map_or(Vec::new(), |table| {
|
||||
table
|
||||
.column_collations()
|
||||
.into_iter()
|
||||
.map(|c| c.unwrap_or_default())
|
||||
index
|
||||
.columns
|
||||
.iter()
|
||||
.map(|c| {
|
||||
table
|
||||
.columns
|
||||
.get(c.pos_in_table)
|
||||
.unwrap()
|
||||
.collation
|
||||
.unwrap_or_default()
|
||||
})
|
||||
.collect()
|
||||
});
|
||||
let cursor = BTreeCursor::new_index(
|
||||
|
@ -4245,10 +4252,17 @@ pub fn op_open_write(
|
|||
.get_table(&index.table_name)
|
||||
.map_or(None, |table| table.btree());
|
||||
let collations = table.map_or(Vec::new(), |table| {
|
||||
table
|
||||
.column_collations()
|
||||
.into_iter()
|
||||
.map(|c| c.unwrap_or_default())
|
||||
index
|
||||
.columns
|
||||
.iter()
|
||||
.map(|c| {
|
||||
table
|
||||
.columns
|
||||
.get(c.pos_in_table)
|
||||
.unwrap()
|
||||
.collation
|
||||
.unwrap_or_default()
|
||||
})
|
||||
.collect()
|
||||
});
|
||||
let cursor = BTreeCursor::new_index(
|
||||
|
|
|
@ -45,3 +45,8 @@ do_execsql_test_in_memory_any_error collate_unique_constraint {
|
|||
CREATE TABLE t(a TEXT COLLATE NOCASE PRIMARY KEY);
|
||||
INSERT INTO t VALUES ('lol'), ('LOL'), ('lOl');
|
||||
}
|
||||
|
||||
do_execsql_test_in_memory_any_error collate_unique_constraint {
|
||||
CREATE TABLE t(a TEXT COLLATE NOCASE PRIMARY KEY);
|
||||
INSERT INTO t VALUES ('lol'), ('LOL'), ('lOl');
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue