Use a bigger default chunk size when constructing the query.
The default is 112 bytes, or 56 characters. With this commit we start using 992 bytes, or 496 characters, which should be enough to fit most queries without needing reallocations or memory copies.
This commit is contained in:
parent
b46d34cff4
commit
b0329b05dc
@ -339,7 +339,7 @@ rawSelectSource mode query = src
|
|||||||
|
|
||||||
run conn =
|
run conn =
|
||||||
uncurry withStmt $
|
uncurry withStmt $
|
||||||
first (TL.toStrict . TLB.toLazyText) $
|
first builderToText $
|
||||||
toRawSql mode (fromDBName conn) query
|
toRawSql mode (fromDBName conn) query
|
||||||
|
|
||||||
massage = do
|
massage = do
|
||||||
@ -451,7 +451,7 @@ rawExecute :: ( MonadLogger m
|
|||||||
rawExecute mode query = do
|
rawExecute mode query = do
|
||||||
conn <- SqlPersist R.ask
|
conn <- SqlPersist R.ask
|
||||||
uncurry execute $
|
uncurry execute $
|
||||||
first (TL.toStrict . TLB.toLazyText) $
|
first builderToText $
|
||||||
toRawSql mode (fromDBName conn) query
|
toRawSql mode (fromDBName conn) query
|
||||||
|
|
||||||
|
|
||||||
@ -508,6 +508,12 @@ update = rawExecute UPDATE . from
|
|||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
builderToText :: TLB.Builder -> T.Text
|
||||||
|
builderToText = TL.toStrict . TLB.toLazyTextWith defaultChunkSize
|
||||||
|
where
|
||||||
|
defaultChunkSize = 1024 - 32
|
||||||
|
|
||||||
|
|
||||||
-- | (Internal) Pretty prints a 'SqlQuery' into a SQL query.
|
-- | (Internal) Pretty prints a 'SqlQuery' into a SQL query.
|
||||||
--
|
--
|
||||||
-- Note: if you're curious about the SQL query being generated by
|
-- Note: if you're curious about the SQL query being generated by
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user