mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 00:55:28 +00:00
drop options not in use
This commit is contained in:
parent
6684b09ae2
commit
4370d1d971
8 changed files with 14 additions and 69 deletions
|
|
@ -3,7 +3,6 @@ use sqlite::{Error, Transaction};
|
|||
pub struct Table {
|
||||
pub id: i64,
|
||||
// pub app_browser_window_tab_id: i64, not in use
|
||||
pub is_initially_current: bool,
|
||||
}
|
||||
|
||||
pub struct Database {
|
||||
|
|
@ -17,8 +16,7 @@ impl Database {
|
|||
(
|
||||
`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||
`app_browser_window_tab_id` INTEGER NOT NULL,
|
||||
`page_number` INTEGER NOT NULL,
|
||||
`is_initially_current` INTEGER NOT NULL
|
||||
`page_number` INTEGER NOT NULL
|
||||
)",
|
||||
[],
|
||||
)
|
||||
|
|
@ -28,36 +26,28 @@ impl Database {
|
|||
tx: &Transaction,
|
||||
app_browser_window_tab_id: &i64,
|
||||
page_number: &u32,
|
||||
is_initially_current: &bool,
|
||||
) -> Result<usize, Error> {
|
||||
tx.execute(
|
||||
"INSERT INTO `app_browser_window_tab_item` (
|
||||
`app_browser_window_tab_id`,
|
||||
`page_number`,
|
||||
`is_initially_current`
|
||||
) VALUES (?, ?, ?)",
|
||||
[
|
||||
app_browser_window_tab_id,
|
||||
&(*page_number as i64),
|
||||
&(*is_initially_current as i64),
|
||||
],
|
||||
`page_number`
|
||||
) VALUES (?, ?)",
|
||||
[app_browser_window_tab_id, &(*page_number as i64)],
|
||||
)
|
||||
}
|
||||
|
||||
pub fn records(tx: &Transaction, app_browser_window_tab_id: &i64) -> Result<Vec<Table>, Error> {
|
||||
let mut stmt = tx.prepare(
|
||||
"SELECT `id`,
|
||||
`app_browser_window_tab_id`,
|
||||
`is_initially_current` FROM `app_browser_window_tab_item`
|
||||
WHERE `app_browser_window_tab_id` = ?
|
||||
ORDER BY `page_number` ASC", // just order by, no store in struct wanted
|
||||
`app_browser_window_tab_id` FROM `app_browser_window_tab_item`
|
||||
WHERE `app_browser_window_tab_id` = ?
|
||||
ORDER BY `page_number` ASC", // just order by, no store in struct wanted
|
||||
)?;
|
||||
|
||||
let result = stmt.query_map([app_browser_window_tab_id], |row| {
|
||||
Ok(Table {
|
||||
id: row.get(0)?,
|
||||
// app_browser_window_tab_id: row.get(1)?, not in use
|
||||
is_initially_current: row.get(2)?,
|
||||
})
|
||||
})?;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue