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:
Felipe Lessa 2012-09-06 14:18:42 -03:00
parent b46d34cff4
commit b0329b05dc

View File

@ -339,7 +339,7 @@ rawSelectSource mode query = src
run conn =
uncurry withStmt $
first (TL.toStrict . TLB.toLazyText) $
first builderToText $
toRawSql mode (fromDBName conn) query
massage = do
@ -451,7 +451,7 @@ rawExecute :: ( MonadLogger m
rawExecute mode query = do
conn <- SqlPersist R.ask
uncurry execute $
first (TL.toStrict . TLB.toLazyText) $
first builderToText $
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.
--
-- Note: if you're curious about the SQL query being generated by