Commits

Luke Plant committed dbb2d90

refactored doInsert to be more reusable

Comments (0)

Files changed (1)

 
 connect = connectSqlite3 Settings.sqlite_path
 
-doInsert conn table columns values = do
-    let sql = mkInsertStatement table columns
+doSql conn sql values = do
     stmnt <- prepare conn sql
     catchSql (do
                execute stmnt values
                                                          "; Part 2: " ++ m2 }
               )
 
+doInsert conn table columns values =
+    let sql = mkInsertStatement table columns
+    in doSql conn sql values
+
 mkInsertStatement table columns = let joinC = concat . intersperse ", "
                                       colSql = joinC columns
                                       valSql = joinC $ take (length columns) $ repeat "?"