Skip to content

Commit

Permalink
changed query_ to query; removed debug prints
Browse files Browse the repository at this point in the history
  • Loading branch information
nezbite committed Aug 29, 2020
1 parent 0ed7773 commit bbd264b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions IHP/IDE/Data/Controller.hs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ instance Controller DataController where
tableCols <- fetchTableCols connection tableName
let values :: [Text] = map (\col -> param @Text (cs (get #columnName col))) tableCols
let query = "INSERT INTO " <> tableName <> " VALUES (" <> intercalate "," values <> ")"
putStrLn (query)
PG.execute_ connection (PG.Query . cs $! query)
PG.close connection
redirectTo ShowTableRowsAction { .. }
Expand Down Expand Up @@ -118,9 +117,9 @@ instance Controller DataController where
connection <- connectToAppDb
tableNames <- fetchTableNames connection
tableCols <- fetchTableCols connection tableName
let query = "UPDATE " <> tableName <> " SET " <> targetName <> " = NOT " <> targetName <> " WHERE id = '" <> cs id <> "'"
putStrLn (query)
PG.execute_ connection (PG.Query . cs $! query)
let query = PG.Query ("UPDATE ? SET ? = NOT ? WHERE id = ?")
let params = (PG.Identifier tableName, PG.Identifier targetName, PG.Identifier targetName, id)
PG.execute connection query params
PG.close connection
redirectTo ShowTableRowsAction { .. }

Expand Down

0 comments on commit bbd264b

Please sign in to comment.