remove extra title member

This commit is contained in:
yggverse 2025-01-23 16:11:19 +02:00
parent 176d24da4f
commit 054c30b238
4 changed files with 26 additions and 43 deletions

View file

@ -3,7 +3,6 @@ use sqlite::{Error, Transaction};
pub struct Table {
pub id: i64,
// pub app_browser_window_tab_item_id: i64, not in use,
pub title: String,
}
pub fn init(tx: &Transaction) -> Result<usize, Error> {
@ -12,7 +11,6 @@ pub fn init(tx: &Transaction) -> Result<usize, Error> {
(
`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
`app_browser_window_tab_item_id` INTEGER NOT NULL,
`title` VARCHAR(1024),
FOREIGN KEY (`app_browser_window_tab_item_id`) REFERENCES `app_browser_window_tab_item`(`id`)
)",
@ -20,25 +18,19 @@ pub fn init(tx: &Transaction) -> Result<usize, Error> {
)
}
pub fn insert(
tx: &Transaction,
app_browser_window_tab_item_id: i64,
title: &str,
) -> Result<usize, Error> {
pub fn insert(tx: &Transaction, app_browser_window_tab_item_id: i64) -> Result<usize, Error> {
tx.execute(
"INSERT INTO `app_browser_window_tab_item_page` (
`app_browser_window_tab_item_id`,
`title`
) VALUES (?, ?)",
(app_browser_window_tab_item_id, title),
`app_browser_window_tab_item_id`
) VALUES (?)",
[app_browser_window_tab_item_id],
)
}
pub fn select(tx: &Transaction, app_browser_window_tab_item_id: i64) -> Result<Vec<Table>, Error> {
let mut stmt = tx.prepare(
"SELECT `id`,
`app_browser_window_tab_item_id`,
`title`
`app_browser_window_tab_item_id`
FROM `app_browser_window_tab_item_page`
WHERE `app_browser_window_tab_item_id` = ?",
)?;
@ -47,7 +39,6 @@ pub fn select(tx: &Transaction, app_browser_window_tab_item_id: i64) -> Result<V
Ok(Table {
id: row.get(0)?,
// app_browser_window_tab_item_id: row.get(1)?, not in use
title: row.get(2)?,
})
})?;