mirror of
https://github.com/isar/rusqlite.git
synced 2024-11-26 19:41:37 +08:00
Rustfmt
This commit is contained in:
parent
0740620ffe
commit
cbc479c484
@ -109,7 +109,9 @@ impl fmt::Display for Error {
|
||||
Error::QueryReturnedNoRows => write!(f, "Query returned no rows"),
|
||||
Error::InvalidColumnIndex(i) => write!(f, "Invalid column index: {}", i),
|
||||
Error::InvalidColumnName(ref name) => write!(f, "Invalid column name: {}", name),
|
||||
Error::InvalidColumnType(i, t) => write!(f, "Invalid column type {} at index: {}", t, i),
|
||||
Error::InvalidColumnType(i, t) => {
|
||||
write!(f, "Invalid column type {} at index: {}", t, i)
|
||||
}
|
||||
Error::StatementChangedRows(i) => write!(f, "Query changed {} rows", i),
|
||||
Error::StatementFailedToInsertRow => write!(f, "Statement failed to insert new row"),
|
||||
|
||||
|
@ -88,7 +88,10 @@ pub trait FromSql: Sized {
|
||||
}
|
||||
}
|
||||
|
||||
unsafe fn column_has_expected_typed(stmt: *mut sqlite3_stmt, col: c_int, expected_type: c_int) -> Result<()> {
|
||||
unsafe fn column_has_expected_typed(stmt: *mut sqlite3_stmt,
|
||||
col: c_int,
|
||||
expected_type: c_int)
|
||||
-> Result<()> {
|
||||
let actual_type = sqlite3_column_type(stmt, col);
|
||||
if actual_type == expected_type {
|
||||
Ok(())
|
||||
|
@ -244,7 +244,8 @@ mod test {
|
||||
assert_eq!(vec!["rowid", "colA", "colB", "colC"], headers);
|
||||
}
|
||||
|
||||
let ids: Result<Vec<i32>> = s.query_map(&[], |row| row.get::<i32, i32>(0)).unwrap().collect();
|
||||
let ids: Result<Vec<i32>> =
|
||||
s.query_map(&[], |row| row.get::<i32, i32>(0)).unwrap().collect();
|
||||
let sum = ids.unwrap().iter().fold(0, |acc, &id| acc + id);
|
||||
assert_eq!(sum, 15);
|
||||
}
|
||||
@ -258,8 +259,9 @@ mod test {
|
||||
db.execute_batch("CREATE VIRTUAL TABLE vtab USING csv('test.csv', HAS_HEADERS)").unwrap();
|
||||
|
||||
{
|
||||
let mut s = db.prepare("SELECT v1.rowid, v1.* FROM vtab v1 NATURAL JOIN vtab v2 \
|
||||
WHERE v1.rowid < v2.rowid")
|
||||
let mut s =
|
||||
db.prepare("SELECT v1.rowid, v1.* FROM vtab v1 NATURAL JOIN vtab v2 WHERE \
|
||||
v1.rowid < v2.rowid")
|
||||
.unwrap();
|
||||
|
||||
let mut rows = s.query(&[]).unwrap();
|
||||
|
@ -31,8 +31,9 @@ pub fn drop_int_array(conn: &Connection, name: &str) -> Result<()> {
|
||||
conn.execute_batch(&format!("DROP TABLE temp.\"{0}\"", escape_double_quote(name)))
|
||||
// http://www.mail-archive.com/sqlite-users%40mailinglists.sqlite.org/msg08423.html
|
||||
// "Once a virtual table module has been created, it cannot be modified or destroyed, except by closing the database connection."
|
||||
/*let aux: Option<()> = None;
|
||||
conn.create_module(name, ptr::null() as *const ffi::sqlite3_module, aux)*/
|
||||
// let aux: Option<()> = None;
|
||||
// conn.create_module(name, ptr::null() as *const ffi::sqlite3_module, aux)
|
||||
|
||||
}
|
||||
|
||||
init_module!(INT_ARRAY_MODULE,
|
||||
|
Loading…
Reference in New Issue
Block a user