Skip to content

Commit

Permalink
bump deps, fix sqlite parsing (#127)
Browse files Browse the repository at this point in the history
* bump sqlparser, fixed sqlite test

* bump deps

* fix clippy

* migrate better panic
  • Loading branch information
achristmascarl authored Nov 19, 2024
1 parent 68ee783 commit dcaca55
Show file tree
Hide file tree
Showing 8 changed files with 405 additions and 674 deletions.
1,031 changes: 375 additions & 656 deletions Cargo.lock

Large diffs are not rendered by default.

15 changes: 11 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ crossterm = { version = "0.28.0", features = [
derive_deref = "1.1.1"
directories = "5.0.1"
futures = "0.3.28"
human-panic = "1.2.0"
human-panic = "2.0.2"
lazy_static = "1.4.0"
libc = "0.2.148"
log = "0.4.20"
Expand Down Expand Up @@ -78,18 +78,25 @@ tracing = "0.1.37"
tracing-error = "0.2.0"
tracing-subscriber = { version = "0.3.17", features = ["env-filter", "serde"] }
chrono = { version = "0.4", default-features = false }
chrono-tz = { version = "0.5", default-features = false }
chrono-tz = { version = "0.10.0", default-features = false }
indexmap = "2.2.6"
tui-textarea = { version = "0.6.1", features = ["search"] }
sqlparser = "0.49.0"
sqlparser = "0.52.0"
arboard = { version = "3.4.1", optional = true, features = [
"wayland-data-control",
] }
rpassword = "7.3.1"
async-trait = "0.1.83"

[build-dependencies]
vergen = { version = "8.2.6", features = ["build", "git", "gitoxide", "cargo"] }
anyhow = "1.0.93"
vergen = { version = "9.0.1", features = ["build", "cargo", "rustc", "si"] }
vergen-git2 = { version = "1.0.0", features = [
"build",
"cargo",
"rustc",
"si",
] }

[features]
default = ["dep:arboard"]
Expand Down
14 changes: 11 additions & 3 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
vergen::EmitBuilder::builder().all_build().all_git().emit()?;
Ok(())
use anyhow::Result;
use vergen_git2::{BuildBuilder, CargoBuilder, Emitter, Git2Builder, RustcBuilder, SysinfoBuilder};

pub fn main() -> Result<()> {
Emitter::default()
.add_instructions(&BuildBuilder::all_build()?)?
.add_instructions(&CargoBuilder::all_cargo()?)?
.add_instructions(&Git2Builder::all_git()?)?
.add_instructions(&RustcBuilder::all_rustc()?)?
.add_instructions(&SysinfoBuilder::all_sysinfo()?)?
.emit()
}
2 changes: 1 addition & 1 deletion src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ pub struct App<'a, DB: sqlx::Database> {
popup: Option<Box<dyn PopUp<DB>>>,
}

impl<'a, DB> App<'a, DB>
impl<DB> App<'_, DB>
where
DB: Database + database::ValueParser + database::DatabaseQueries,
DB::QueryResult: database::HasRowsAffected,
Expand Down
2 changes: 1 addition & 1 deletion src/components/history.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ impl<DB: sqlx::Database> Component<DB> for History {
.iter()
.enumerate()
.map(|(i, h)| {
let selected = self.list_state.selected().map_or(false, |x| i == x);
let selected = self.list_state.selected() == Some(i);
let color = if selected && focused { Color::Blue } else { Color::default() };
let max_lines = 1_usize.max(area.height.saturating_sub(6) as usize);
let mut lines = h
Expand Down
2 changes: 1 addition & 1 deletion src/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ where
}

#[allow(clippy::type_complexity)]
pub async fn query_stream<'a, DB>(
pub async fn query_stream<DB>(
mut stream: BoxStream<'_, Result<Either<DB::QueryResult, DB::Row>, Error>>,
) -> Result<Rows, DbError>
where
Expand Down
4 changes: 2 additions & 2 deletions src/database/sqlite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,8 @@ mod tests {
("INSERT INTO users (name) VALUES ('John')", ExecutionType::Normal),
("EXPLAIN DELETE FROM users WHERE id = 1", ExecutionType::Normal),
("EXPLAIN SELECT * FROM users", ExecutionType::Normal),
// TODO: why this fail to parse?
// ("EXPLAIN QUERY PLAN SELECT * FROM users", false),
("EXPLAIN QUERY PLAN SELECT * FROM users", ExecutionType::Normal),
("EXPLAIN Query PLAN DELETE FROM users WHERE id = 1", ExecutionType::Normal),
];

for (query, expected) in test_cases {
Expand Down
9 changes: 3 additions & 6 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,9 @@ pub fn initialize_panic_handler() -> Result<()> {
#[cfg(not(debug_assertions))]
{
use human_panic::{handle_dump, print_msg, Metadata};
let meta = Metadata {
version: env!("CARGO_PKG_VERSION").into(),
name: env!("CARGO_PKG_NAME").into(),
authors: env!("CARGO_PKG_AUTHORS").replace(':', ", ").into(),
homepage: env!("CARGO_PKG_HOMEPAGE").into(),
};
let meta = Metadata::new(env!("CARGO_PKG_NAME"), env!("CARGO_PKG_VERSION"))
.authors(env!("CARGO_PKG_AUTHORS").replace(':', ", "))
.homepage(env!("CARGO_PKG_HOMEPAGE"));

let file_path = handle_dump(&meta, panic_info);
// prints human-panic message
Expand Down

0 comments on commit dcaca55

Please sign in to comment.