aboutsummaryrefslogtreecommitdiff
path: root/src/db.rs
diff options
context:
space:
mode:
authorAkshay <[email protected]>2020-08-24 09:03:06 +0100
committerAkshay <[email protected]>2020-08-24 09:03:06 +0100
commit7308121fa3efc785bf964b8ab32505ba25513fdc (patch)
treee3d32a7adcbb66c65e20e9b3811e117c602969ba /src/db.rs
parent0e56a198c62ed9a9c1812cff1ffa618260535a35 (diff)
add cli opts
Diffstat (limited to 'src/db.rs')
-rw-r--r--src/db.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/db.rs b/src/db.rs
index c67e39e..8503b10 100644
--- a/src/db.rs
+++ b/src/db.rs
@@ -9,7 +9,7 @@ use std::path::Path;
9 9
10pub fn open_connection<P>(p: P) -> Result<Connection> 10pub fn open_connection<P>(p: P) -> Result<Connection>
11where 11where
12 P: AsRef<Path> + fmt::Display, 12 P: AsRef<Path>,
13{ 13{
14 info!("Opened connection to database"); 14 info!("Opened connection to database");
15 Ok(Connection::open_with_flags( 15 Ok(Connection::open_with_flags(
@@ -18,8 +18,8 @@ where
18 )?) 18 )?)
19} 19}
20 20
21pub fn init_db<P: AsRef<Path> + fmt::Display>(p: P) -> Result<()> { 21pub fn init_db<P: AsRef<Path> + fmt::Debug>(p: P) -> Result<()> {
22 debug!("Looking for database at `{}`", p); 22 debug!("Looking for database at `{:?}`", p);
23 let conn = open_connection(&p)?; 23 let conn = open_connection(&p)?;
24 conn.execute( 24 conn.execute(
25 "CREATE TABLE IF NOT EXISTS urls ( 25 "CREATE TABLE IF NOT EXISTS urls (
@@ -28,6 +28,6 @@ pub fn init_db<P: AsRef<Path> + fmt::Display>(p: P) -> Result<()> {
28 )", 28 )",
29 NO_PARAMS, 29 NO_PARAMS,
30 )?; 30 )?;
31 info!("SQLite3 database `{}` initialized", &p); 31 info!("SQLite3 database `{:?}` initialized", &p);
32 Ok(()) 32 Ok(())
33} 33}