Try to fix count()

This commit is contained in:
Billy Chan 2021-08-06 10:48:37 +08:00
parent bc7264587c
commit 9c865cbb31
No known key found for this signature in database
GPG Key ID: A2D690CAC7DF3CC7

View File

@ -63,7 +63,11 @@ where
Some(res) => res, Some(res) => res,
None => return Ok(0), None => return Ok(0),
}; };
let num_items = result.try_get::<i32>("", "num_items")? as usize; let num_items = match self.db {
#[cfg(feature = "sqlx-postgres")]
DatabaseConnection::SqlxPostgresPoolConnection(_) => result.try_get::<i64>("", "num_items")? as usize,
_ => result.try_get::<i32>("", "num_items")? as usize
};
Ok(num_items) Ok(num_items)
} }