mirror of
https://github.com/aljazceru/turso.git
synced 2026-02-14 20:44:29 +01:00
fix: count characters in string in length function
`length` function should count characters, not bytes. https://www.sqlite.org/lang_corefunc.html#length
This commit is contained in:
@@ -2537,7 +2537,7 @@ fn exec_lower(reg: &OwnedValue) -> Option<OwnedValue> {
|
||||
fn exec_length(reg: &OwnedValue) -> OwnedValue {
|
||||
match reg {
|
||||
OwnedValue::Text(_) | OwnedValue::Integer(_) | OwnedValue::Float(_) => {
|
||||
OwnedValue::Integer(reg.to_string().len() as i64)
|
||||
OwnedValue::Integer(reg.to_string().chars().count() as i64)
|
||||
}
|
||||
OwnedValue::Blob(blob) => OwnedValue::Integer(blob.len() as i64),
|
||||
OwnedValue::Agg(aggctx) => exec_length(aggctx.final_value()),
|
||||
|
||||
Reference in New Issue
Block a user