mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-26 04:24:21 +01:00
This PR's genesis is from investigating #532, but I still can't reliably reproduce it on either `main` or this branch so I don't know if this PR _fixes_ anything, but I guess it aligns us more with sqlite anyway --- Anyway: I looked at DBs created with limbo and with sqlite using [ImHex](https://github.com/WerWolv/ImHex) and the differences seem to be: 1. SQLite uses varint according to [the spec](https://www.sqlite.org/fileformat.html#record_format), whereas limbo always encodes integers as i64 2. Limbo adds 4 bytes of zeros for overflow page pointer (even in cases where the cell doesnt overflow) 3. Limbo adds a space after `CREATE TABLE name` before the `(` even when user doesn't specify it? I implemented the following: - Fix 1: Varint serialization of i8, i16, i24, i32, i48 and i64 according to payload, instead of always using i64 - Fix 2: Removed the 4 bytes reserved for overflow page pointer in non- overflow cases Reviewed-by: Pere Diaz Bou <pere-altea@homail.com> Closes #550