mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
fix records error handle
This commit is contained in:
parent
a83b28bcc1
commit
a291ef9e3d
1 changed files with 12 additions and 7 deletions
|
|
@ -30,16 +30,21 @@ impl Database {
|
|||
}
|
||||
|
||||
pub fn records(&self) -> Result<Vec<Table>, Error> {
|
||||
let mut records: Vec<Table> = Vec::new();
|
||||
|
||||
let mut statement = self.connection.prepare("SELECT `id`, `time` FROM `app`")?;
|
||||
let _ = statement.query_map([], |row| {
|
||||
records.push(Table {
|
||||
|
||||
let result = statement.query_map([], |row| {
|
||||
Ok(Table {
|
||||
id: row.get(0)?,
|
||||
time: row.get(1)?,
|
||||
});
|
||||
Ok(())
|
||||
});
|
||||
})
|
||||
})?;
|
||||
|
||||
let mut records: Vec<Table> = Vec::new();
|
||||
|
||||
for record in result {
|
||||
let table = record?;
|
||||
records.push(table);
|
||||
}
|
||||
|
||||
Ok(records)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue