aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorrtz12 <koenig@fagott.pw>2015-12-28 19:13:45 (UTC)
committerrtz12 <koenig@fagott.pw>2015-12-28 19:13:45 (UTC)
commitd3c49b165825369ce5bbd1efbbad2afab39e7cda (patch)
tree4b48087a143d22d33891b7d8998321c32b5f037a /tools
parent489b3a33fd696c5b6f8431f6535df37f4638c602 (diff)
Mehr Logging und so
Diffstat (limited to 'tools')
-rw-r--r--tools/importer/main.go29
1 files changed, 20 insertions, 9 deletions
diff --git a/tools/importer/main.go b/tools/importer/main.go
index 42e7538..7f12d78 100644
--- a/tools/importer/main.go
+++ b/tools/importer/main.go
@@ -32,6 +32,12 @@ func GetGrilReader(rType string) GrilReader {
32 return nil 32 return nil
33} 33}
34 34
35func LogErr(err error) {
36 if err != nil {
37 fmt.Fprintf(os.Stderr, "%s\n", err)
38 }
39}
40
35func main() { 41func main() {
36 var path string 42 var path string
37 var sourceType string 43 var sourceType string
@@ -114,19 +120,24 @@ func main() {
114 source, source_id) VALUES ($1, $2, $3);`, 120 source, source_id) VALUES ($1, $2, $3);`,
115 dbID, r.ID(), g.Gril.ID) 121 dbID, r.ID(), g.Gril.ID)
116 if g.Gril.KanjiName != "" { 122 if g.Gril.KanjiName != "" {
117 db.Exec(`INSERT INTO grilist.gril_names 123 _, err := db.Exec(`INSERT INTO
118 (gril_id, name, name_type) VALUES ($1, $2, 124 grilist.gril_names (gril_id, name, name_type)
119 $3);`, dbID, g.Gril.KanjiName, 0) 125 VALUES ($1, $2, $3);`, dbID, g.Gril.KanjiName,
126 0)
127 LogErr(err)
120 } 128 }
121 if g.Gril.RomajiName != "" { 129 if g.Gril.RomajiName != "" {
122 db.Exec(`INSERT INTO grilist.gril_names 130 _, err := db.Exec(`INSERT INTO
123 (gril_id, name, name_type) VALUES ($1, $2, 131 grilist.gril_names (gril_id, name, name_type)
124 $3);`, dbID, g.Gril.RomajiName, 1) 132 VALUES ($1, $2, $3);`, dbID, g.Gril.RomajiName,
133 1)
134 LogErr(err)
125 } 135 }
126 for _, v := range g.Gril.OtherNames { 136 for _, v := range g.Gril.OtherNames {
127 db.Exec(`INSERT INTO grilist.gril_names 137 _, err := db.Exec(`INSERT INTO
128 (gril_id, name, name_type) VALUES ($1, $2, 138 grilist.gril_names (gril_id, name, name_type)
129 $3);`, dbID, v, 2) 139 VALUES ($1, $2, $3);`, dbID, v, 2)
140 LogErr(err)
130 } 141 }
131 if exportFile != nil { 142 if exportFile != nil {
132 if g.Image != "" { 143 if g.Image != "" {