aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
authorTeddy Wing2022-03-19 16:19:26 +0100
committerTeddy Wing2022-03-19 16:19:26 +0100
commitbb9f0ee38809ab0b41d66ced950c034101862a59 (patch)
tree87e5330f2e6fd78dd970aa754169e6047025a7dd /src/main.rs
parent38f70de064fd9ed1e66a5da4007e7364a4a7d363 (diff)
downloadyaqlite-bb9f0ee38809ab0b41d66ced950c034101862a59.tar.bz2
main: If `primary_key` option is given, select by given column name
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index d3c286b..6c87a0b 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -79,7 +79,20 @@ fn main() {
} => {
let dbconn = rusqlite::Connection::open(database).unwrap();
- yaqlite::select(&dbconn, &table_name, &record_id).unwrap();
+ match primary_key {
+ Some(pk) => yaqlite::select_by_column(
+ &dbconn,
+ &table_name,
+ &pk,
+ &record_id,
+ ).unwrap(),
+
+ None => yaqlite::select(
+ &dbconn,
+ &table_name,
+ &record_id,
+ ).unwrap(),
+ };
dbconn.close().unwrap();
},