Browse Source

resorting to simpler SQL query

master
Erwan Glasziou 8 months ago
parent
commit
5a6419e699
  1. 4
      Cargo.lock
  2. 2
      Cargo.toml
  3. 11
      src/main.rs

4
Cargo.lock

@ -524,9 +524,9 @@ dependencies = [
[[package]]
name = "quote"
version = "1.0.16"
version = "1.0.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4af2ec4714533fcdf07e886f17025ace8b997b9ce51204ee69b6da831c3da57"
checksum = "632d02bff7f874a36f33ea8bb416cd484b90cc66c1194b1a1110d067a7013f58"
dependencies = [
"proc-macro2",
]

2
Cargo.toml

@ -7,4 +7,4 @@ edition = "2021"
[dependencies]
gtk = { version = "0.4.7", package = "gtk4" }
sqlite = "0.26.0"
sqlite = "0.26.0"

11
src/main.rs

@ -1,6 +1,6 @@
use gtk::prelude::*;
use gtk::{Application, ApplicationWindow, Box, Button, Label};
use sqlite;
//use sqlite;
fn main() {
let connection_prev = sqlite::open("./cards.db");
@ -8,11 +8,10 @@ fn main() {
Ok(a) => a,
Err(error) => panic!("Problem opening the file: {:?}", error),
};
connection.iterate("SELECT * FROM cards WHERE name='Fury Sliver'",|pairs| {
connection.iterate("SELECT * FROM cards WHERE name='Fury Sliver' and lang='fr'",|pairs| {
for &(column, value) in pairs.iter() {
match value {
Some(v) => (), //println!("{} = {}", column, v)
None => (),
if let Some(v) = value {
println!("{} = {}", column, v)
}
}
true
@ -27,7 +26,7 @@ fn main() {
app.run();
}
fn build_ui(app: &Application) -> () {
fn build_ui(app: &Application) {
// Create a button with label and margins
let button = Button::builder()
.label("Press me!")

Loading…
Cancel
Save