Skip to content

Commit 8fd7368

Browse files
authored
Update main.rs
1 parent 0a95449 commit 8fd7368

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/main.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
mod bindings;
22

3+
use std::env;
4+
35
fn main() {
4-
let query = "SELECT version()";
5-
let format = "CSV";
6+
let args: Vec<String> = env::args().collect();
7+
let query = args.get(1).unwrap_or(&"SELECT version()".to_string());
8+
let format = args.get(2).unwrap_or(&"CSV".to_string());
69

710
match bindings::execute(query, format) {
811
Some(result) => println!("{}", result),
912
None => println!("Query execution failed."),
1013
}
1114
}
12-

0 commit comments

Comments
 (0)