aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/db/setup.go
diff options
context:
space:
mode:
authorMatthew Lemon <lemon@matthewlemon.com>2020-07-20 21:14:53 +0100
committerMatthew Lemon <lemon@matthewlemon.com>2020-07-20 21:14:53 +0100
commit9f5398b1aa338404403c8de4f48d343a90fe2428 (patch)
tree2d9470edb6faebfed2421a67d4a2708692e4dd01 /pkg/db/setup.go
parent341f0bd5dfd640a0adf7cceb61fabeab7e2cebb1 (diff)
better handling of setup but by no means perfect
Diffstat (limited to '')
-rw-r--r--pkg/db/setup.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/pkg/db/setup.go b/pkg/db/setup.go
index d0c0064..e5179ed 100644
--- a/pkg/db/setup.go
+++ b/pkg/db/setup.go
@@ -3,6 +3,7 @@ package db
import (
"database/sql"
"errors"
+ "fmt"
"log"
"os"
"time"
@@ -37,12 +38,14 @@ func SetupDB(path string) (*sql.DB, error) {
pragma := "PRAGMA foreign_keys = ON;"
_, err = db.Exec(pragma)
if err != nil {
- log.Printf("%q: %s\n", err, pragma)
+ // log.Printf("%q: %s\n", err, pragma)
+ return nil, err
}
_, err = db.Exec(stmt_base)
if err != nil {
- log.Printf("%q: %s\n", err, stmt_base)
+ // log.Printf("%q: %s\n", err, stmt_base)
+ return nil, err
}
return db, nil
@@ -50,7 +53,7 @@ func SetupDB(path string) (*sql.DB, error) {
//DatamapToDB takes a slice of DatamapLine and writes it to a sqlite3 db file.
func DatamapToDB(data []reader.DatamapLine, dm_name string, dm_path string) error {
- log.Printf("Importing Datamap")
+ fmt.Printf("Importing datamap file %s and naming it %s.\n", dm_path, dm_name)
db, err := SetupDB("/home/lemon/.config/datamaps-go/datamaps.db")
if err != nil {
return err