diff options
author | Lars Wirzenius <liw@liw.fi> | 2022-05-03 10:05:28 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2022-05-03 10:05:28 +0300 |
commit | 856d32c448a87245234315462d2190c5a9aab549 (patch) | |
tree | 010213f0ad296c14bb584d04a735b6f256293962 | |
parent | aad50a0827b5c74229153395f01e0eafdd64edf6 (diff) | |
download | obnam2-856d32c448a87245234315462d2190c5a9aab549.tar.gz |
feat! only store signed 64-bit plain integers in database
This is a breaking change, but allows to store the largest signed
64-bit integers in SQLite and get it back.
Sponsored-by: author
-rw-r--r-- | src/db.rs | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -354,7 +354,7 @@ impl Column { } /// Type of plain integers that can be stored. -pub type DbInt = u64; +pub type DbInt = i64; /// A value in a named column. #[derive(Debug)] @@ -631,4 +631,17 @@ mod test { } assert_eq!(values, expected); } + + #[test] + fn round_trips_int_max() { + let tmp = tempdir().unwrap(); + let filename = tmp.path().join("test.db"); + let mut db = create_db(&filename); + insert(&mut db, DbInt::MAX); + db.close().unwrap(); + + let db = open_db(&filename); + let values = values(db); + assert_eq!(values, vec![DbInt::MAX]); + } } |