Merge pull request #411 from thomcc/i128_blob

Add a feature for storing i128 as blobs.
This commit is contained in:
gwenn
2018-10-19 21:49:09 +02:00
committed by GitHub
8 changed files with 98 additions and 0 deletions

View File

@@ -161,6 +161,10 @@ impl<'a, 'stmt> Row<'a, 'stmt> {
///
/// Returns an `Error::InvalidColumnName` if `idx` is not a valid column
/// name for this row.
///
/// If the result type is i128 (which requires the `i128_blob` feature to be
/// enabled), and the underlying SQLite column is a blob whose size is not
/// 16 bytes, `Error::InvalidColumnType` will also be returned.
pub fn get_checked<I: RowIndex, T: FromSql>(&self, idx: I) -> Result<T> {
let idx = try!(idx.idx(self.stmt));
let value = self.stmt.value_ref(idx);
@@ -170,6 +174,10 @@ impl<'a, 'stmt> Row<'a, 'stmt> {
FromSqlError::Other(err) => {
Error::FromSqlConversionFailure(idx as usize, value.data_type(), err)
}
#[cfg(feature = "i128_blob")]
FromSqlError::InvalidI128Size(_) => {
Error::InvalidColumnType(idx, value.data_type())
}
})
}