Use accept header version to set schema

This commit is contained in:
Joe Nelson
2014-07-18 00:22:39 -07:00
parent c4550f97b0
commit dd1547adea
4 changed files with 23 additions and 11 deletions
+3 -3
View File
@@ -16,8 +16,8 @@ import Database.HDBC.PostgreSQL
import Network.HTTP.Types.URI
selectWhere :: T.Text -> Query -> Connection -> IO BL.ByteString
selectWhere table qq conn = do
selectWhere :: T.Text -> T.Text -> Query -> Connection -> IO BL.ByteString
selectWhere ver table qq conn = do
s <- selectSql
w <- whereClause conn qq
r <- quickQuery conn (BS.unpack $ s <> w) []
@@ -29,7 +29,7 @@ selectWhere table qq conn = do
selectSql = pgFormat conn
"select array_to_json(array_agg(row_to_json(t)))\
\ from (select * from %I.%I) t"
[toSql (T.pack "base"), toSql table]
[toSql ver, toSql table]
whereClause :: Connection -> Query -> IO BS.ByteString