@@ -6,6 +6,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
## Unreleased
|
## Unreleased
|
||||||
### Fixed
|
### Fixed
|
||||||
- Indicate insertable=true for views that are insertable through triggers
|
- Indicate insertable=true for views that are insertable through triggers
|
||||||
|
- Builds under GHC 7.10
|
||||||
|
|
||||||
## [0.2.10.0] - 2015-06-03
|
## [0.2.10.0] - 2015-06-03
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ executable postgrest
|
|||||||
, containers, unordered-containers
|
, containers, unordered-containers
|
||||||
, optparse-applicative == 0.11.*
|
, optparse-applicative == 0.11.*
|
||||||
, regex-base, regex-tdfa
|
, regex-base, regex-tdfa
|
||||||
, regex-tdfa-text
|
|
||||||
, Ranged-sets
|
, Ranged-sets
|
||||||
, transformers, MissingH
|
, transformers, MissingH
|
||||||
, bcrypt >= 0.0.6, base64-string
|
, bcrypt >= 0.0.6, base64-string
|
||||||
@@ -77,7 +76,6 @@ library
|
|||||||
, containers, unordered-containers
|
, containers, unordered-containers
|
||||||
, optparse-applicative
|
, optparse-applicative
|
||||||
, regex-base, regex-tdfa
|
, regex-base, regex-tdfa
|
||||||
, regex-tdfa-text
|
|
||||||
, Ranged-sets
|
, Ranged-sets
|
||||||
, transformers, MissingH
|
, transformers, MissingH
|
||||||
, bcrypt, base64-string
|
, bcrypt, base64-string
|
||||||
@@ -136,7 +134,6 @@ Test-Suite spec
|
|||||||
, regex-base
|
, regex-base
|
||||||
, string-conversions
|
, string-conversions
|
||||||
, http-media, regex-tdfa
|
, http-media, regex-tdfa
|
||||||
, regex-tdfa-text
|
|
||||||
, Ranged-sets
|
, Ranged-sets
|
||||||
, transformers, MissingH, split
|
, transformers, MissingH, split
|
||||||
, bcrypt, base64-string
|
, bcrypt, base64-string
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import Data.List (sortBy)
|
|||||||
import Data.Functor.Identity
|
import Data.Functor.Identity
|
||||||
import qualified Data.Set as S
|
import qualified Data.Set as S
|
||||||
import qualified Data.ByteString.Lazy as BL
|
import qualified Data.ByteString.Lazy as BL
|
||||||
|
import qualified Data.ByteString.Char8 as BS
|
||||||
import qualified Blaze.ByteString.Builder as BB
|
import qualified Blaze.ByteString.Builder as BB
|
||||||
import qualified Data.Csv as CSV
|
import qualified Data.Csv as CSV
|
||||||
|
|
||||||
@@ -256,12 +257,12 @@ contentRangeH from to total =
|
|||||||
requestedSchema :: Text -> RequestHeaders -> Text
|
requestedSchema :: Text -> RequestHeaders -> Text
|
||||||
requestedSchema v1schema hdrs =
|
requestedSchema v1schema hdrs =
|
||||||
case verStr of
|
case verStr of
|
||||||
Just [[_, ver]] -> if ver == "1" then v1schema else ver
|
Just [[_, ver]] -> if ver == "1" then v1schema else cs ver
|
||||||
_ -> v1schema
|
_ -> v1schema
|
||||||
|
|
||||||
where verRegex = "version[ ]*=[ ]*([0-9]+)" :: String
|
where verRegex = "version[ ]*=[ ]*([0-9]+)" :: BS.ByteString
|
||||||
accept = cs <$> lookup hAccept hdrs :: Maybe Text
|
accept = cs <$> lookup hAccept hdrs :: Maybe BS.ByteString
|
||||||
verStr = (=~ verRegex) <$> accept :: Maybe [[Text]]
|
verStr = (=~ verRegex) <$> accept :: Maybe [[BS.ByteString]]
|
||||||
|
|
||||||
jsonH :: Header
|
jsonH :: Header
|
||||||
jsonH = (hContentType, "application/json")
|
jsonH = (hContentType, "application/json")
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import qualified Hasql.Backend as B
|
|||||||
|
|
||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
import Text.Regex.TDFA ( (=~) )
|
import Text.Regex.TDFA ( (=~) )
|
||||||
import Text.Regex.TDFA.Text ()
|
|
||||||
import qualified Network.HTTP.Types.URI as Net
|
import qualified Network.HTTP.Types.URI as Net
|
||||||
import qualified Data.ByteString.Char8 as BS
|
import qualified Data.ByteString.Char8 as BS
|
||||||
import Data.Monoid
|
import Data.Monoid
|
||||||
@@ -252,18 +251,18 @@ pgFmtJsonbPath p =
|
|||||||
pgFmtIdent :: T.Text -> T.Text
|
pgFmtIdent :: T.Text -> T.Text
|
||||||
pgFmtIdent x =
|
pgFmtIdent x =
|
||||||
let escaped = T.replace "\"" "\"\"" (trimNullChars $ cs x) in
|
let escaped = T.replace "\"" "\"\"" (trimNullChars $ cs x) in
|
||||||
if escaped =~ danger
|
if (cs escaped :: BS.ByteString) =~ danger
|
||||||
then "\"" <> escaped <> "\""
|
then "\"" <> escaped <> "\""
|
||||||
else escaped
|
else escaped
|
||||||
|
|
||||||
where danger = "^$|^[^a-z_]|[^a-z_0-9]" :: T.Text
|
where danger = "^$|^[^a-z_]|[^a-z_0-9]" :: BS.ByteString
|
||||||
|
|
||||||
pgFmtLit :: T.Text -> T.Text
|
pgFmtLit :: T.Text -> T.Text
|
||||||
pgFmtLit x =
|
pgFmtLit x =
|
||||||
let trimmed = trimNullChars x
|
let trimmed = trimNullChars x
|
||||||
escaped = "'" <> T.replace "'" "''" trimmed <> "'"
|
escaped = "'" <> T.replace "'" "''" trimmed <> "'"
|
||||||
slashed = T.replace "\\" "\\\\" escaped in
|
slashed = T.replace "\\" "\\\\" escaped in
|
||||||
cs $ if escaped =~ ("\\\\" :: T.Text)
|
if T.isInfixOf "\\\\" escaped
|
||||||
then "E" <> slashed
|
then "E" <> slashed
|
||||||
else slashed
|
else slashed
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user