-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | A mid-level MySQL client library.
--   
--   A mid-level client library for the MySQL database, intended to be fast
--   and easy to use.
--   
--   <i>Important licensing note</i>: This library is BSD-licensed under
--   the terms of the MySQL FOSS License Exception
--   <a>http://www.mysql.com/about/legal/licensing/foss-exception/</a>.
--   
--   Since this library links against the GPL-licensed <tt>mysqlclient</tt>
--   library, a non-open-source application that uses it <i>may</i> be
--   subject to the terms of the GPL.
@package mysql-simple
@version 0.4.5


-- | The <a>Result</a> typeclass, for converting a single value in a row
--   returned by a SQL query into a more useful Haskell representation.
--   
--   A Haskell numeric type is considered to be compatible with all MySQL
--   numeric types that are less accurate than it. For instance, the
--   Haskell <a>Type</a> type is compatible with the MySQL <a>Long</a> type
--   because it can represent a <a>Long</a> exactly. On the other hand,
--   since a <a>Type</a> might lose precision if representing a
--   <a>LongLong</a>, the two are <i>not</i> considered compatible.
module Database.MySQL.Simple.Result

-- | A type that may be converted from a SQL type.
class Result a

-- | Convert a SQL value to a Haskell value.
--   
--   Throws a <a>ResultError</a> if conversion fails.
convert :: Result a => Field -> Maybe ByteString -> a

-- | Exception thrown if conversion from a SQL value to a Haskell value
--   fails.
data ResultError

-- | The SQL and Haskell types are not compatible.
Incompatible :: String -> String -> String -> String -> ResultError
[errSQLType] :: ResultError -> String
[errHaskellType] :: ResultError -> String
[errFieldName] :: ResultError -> String
[errMessage] :: ResultError -> String

-- | A SQL <tt>NULL</tt> was encountered when the Haskell type did not
--   permit it.
UnexpectedNull :: String -> String -> String -> String -> ResultError
[errSQLType] :: ResultError -> String
[errHaskellType] :: ResultError -> String
[errFieldName] :: ResultError -> String
[errMessage] :: ResultError -> String

-- | The SQL value could not be parsed, or could not be represented as a
--   valid Haskell value, or an unexpected low-level error occurred (e.g.
--   mismatch between metadata and actual data in a row).
ConversionFailed :: String -> String -> String -> String -> ResultError
[errSQLType] :: ResultError -> String
[errHaskellType] :: ResultError -> String
[errFieldName] :: ResultError -> String
[errMessage] :: ResultError -> String
instance GHC.Show.Show Database.MySQL.Simple.Result.ResultError
instance GHC.Classes.Eq Database.MySQL.Simple.Result.ResultError
instance Database.MySQL.Simple.Result.Result a => Database.MySQL.Simple.Result.Result (GHC.Maybe.Maybe a)
instance Database.MySQL.Simple.Result.Result GHC.Types.Bool
instance Database.MySQL.Simple.Result.Result GHC.Int.Int8
instance Database.MySQL.Simple.Result.Result GHC.Int.Int16
instance Database.MySQL.Simple.Result.Result GHC.Int.Int32
instance Database.MySQL.Simple.Result.Result GHC.Types.Int
instance Database.MySQL.Simple.Result.Result GHC.Int.Int64
instance Database.MySQL.Simple.Result.Result GHC.Integer.Type.Integer
instance Database.MySQL.Simple.Result.Result GHC.Word.Word8
instance Database.MySQL.Simple.Result.Result GHC.Word.Word16
instance Database.MySQL.Simple.Result.Result GHC.Word.Word32
instance Database.MySQL.Simple.Result.Result GHC.Types.Word
instance Database.MySQL.Simple.Result.Result GHC.Word.Word64
instance Database.MySQL.Simple.Result.Result GHC.Types.Float
instance Database.MySQL.Simple.Result.Result GHC.Types.Double
instance Database.MySQL.Simple.Result.Result (GHC.Real.Ratio GHC.Integer.Type.Integer)
instance Database.MySQL.Simple.Result.Result Data.ByteString.Internal.ByteString
instance Database.MySQL.Simple.Result.Result Data.ByteString.Lazy.Internal.ByteString
instance Database.MySQL.Simple.Result.Result Data.Text.Internal.Text
instance Database.MySQL.Simple.Result.Result Data.Text.Internal.Lazy.Text
instance Database.MySQL.Simple.Result.Result [GHC.Types.Char]
instance Database.MySQL.Simple.Result.Result Data.Time.Clock.Internal.UTCTime.UTCTime
instance Database.MySQL.Simple.Result.Result Data.Time.Calendar.Days.Day
instance Database.MySQL.Simple.Result.Result Data.Time.LocalTime.Internal.TimeOfDay.TimeOfDay
instance GHC.Exception.Type.Exception Database.MySQL.Simple.Result.ResultError


-- | Basic types.
module Database.MySQL.Simple.Types

-- | A placeholder for the SQL <tt>NULL</tt> value.
data Null
Null :: Null

-- | A single-value "collection".
--   
--   This is useful if you need to supply a single parameter to a SQL
--   query, or extract a single column from a SQL result.
--   
--   Parameter example:
--   
--   <pre>
--   query c "select x from scores where x &gt; ?" (<a>Only</a> (42::Int))
--   </pre>
--   
--   Result example:
--   
--   <pre>
--   xs &lt;- query_ c "select id from users"
--   forM_ xs $ \(<a>Only</a> id) -&gt; {- ... -}
--   </pre>
newtype Only a
Only :: a -> Only a
[fromOnly] :: Only a -> a

-- | Wrap a list of values for use in an <tt>IN</tt> clause. Replaces a
--   single "<tt>?</tt>" character with a parenthesized list of rendered
--   values.
--   
--   Example:
--   
--   <pre>
--   query c "select * from whatever where id in ?" (Only (In [3,4,5]))
--   </pre>
newtype In a
In :: a -> In a

-- | Wrap a list of values for use in a function with variable arguments.
--   Replaces a single "<tt>?</tt>" character with a non-parenthesized list
--   of rendered values.
--   
--   Example:
--   
--   <pre>
--   query conn
--     "SELECT * FROM example_table ORDER BY field(f,?)"
--     (Only (VaArgs [3,2,1]))
--   </pre>
newtype VaArgs a
VaArgs :: a -> VaArgs a

-- | Wrap a mostly-binary string to be escaped in hexadecimal.
newtype Binary a
Binary :: a -> Binary a

-- | A query string. This type is intended to make it difficult to
--   construct a SQL query by concatenating string fragments, as that is an
--   extremely common way to accidentally introduce SQL injection
--   vulnerabilities into an application.
--   
--   This type is an instance of <a>IsString</a>, so the easiest way to
--   construct a query is to enable the <tt>OverloadedStrings</tt> language
--   extension and then simply write the query in double quotes.
--   
--   <pre>
--   {-# LANGUAGE OverloadedStrings #-}
--   
--   import Database.MySQL.Simple
--   
--   q :: Query
--   q = "select ?"
--   </pre>
--   
--   The underlying type is a <a>ByteString</a>, and literal Haskell
--   strings that contain Unicode characters will be correctly transformed
--   to UTF-8.
newtype Query
Query :: ByteString -> Query
[fromQuery] :: Query -> ByteString
instance GHC.Base.Functor Database.MySQL.Simple.Types.Binary
instance GHC.Show.Show a => GHC.Show.Show (Database.MySQL.Simple.Types.Binary a)
instance GHC.Read.Read a => GHC.Read.Read (Database.MySQL.Simple.Types.Binary a)
instance GHC.Classes.Ord a => GHC.Classes.Ord (Database.MySQL.Simple.Types.Binary a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Database.MySQL.Simple.Types.Binary a)
instance GHC.Base.Functor Database.MySQL.Simple.Types.VaArgs
instance GHC.Show.Show a => GHC.Show.Show (Database.MySQL.Simple.Types.VaArgs a)
instance GHC.Read.Read a => GHC.Read.Read (Database.MySQL.Simple.Types.VaArgs a)
instance GHC.Classes.Ord a => GHC.Classes.Ord (Database.MySQL.Simple.Types.VaArgs a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Database.MySQL.Simple.Types.VaArgs a)
instance GHC.Base.Functor Database.MySQL.Simple.Types.In
instance GHC.Show.Show a => GHC.Show.Show (Database.MySQL.Simple.Types.In a)
instance GHC.Read.Read a => GHC.Read.Read (Database.MySQL.Simple.Types.In a)
instance GHC.Classes.Ord a => GHC.Classes.Ord (Database.MySQL.Simple.Types.In a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Database.MySQL.Simple.Types.In a)
instance GHC.Base.Functor Database.MySQL.Simple.Types.Only
instance GHC.Show.Show a => GHC.Show.Show (Database.MySQL.Simple.Types.Only a)
instance GHC.Read.Read a => GHC.Read.Read (Database.MySQL.Simple.Types.Only a)
instance GHC.Classes.Ord a => GHC.Classes.Ord (Database.MySQL.Simple.Types.Only a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Database.MySQL.Simple.Types.Only a)
instance GHC.Classes.Ord Database.MySQL.Simple.Types.Query
instance GHC.Classes.Eq Database.MySQL.Simple.Types.Query
instance GHC.Show.Show Database.MySQL.Simple.Types.Null
instance GHC.Read.Read Database.MySQL.Simple.Types.Null
instance GHC.Show.Show Database.MySQL.Simple.Types.Query
instance GHC.Read.Read Database.MySQL.Simple.Types.Query
instance Data.String.IsString Database.MySQL.Simple.Types.Query
instance GHC.Base.Semigroup Database.MySQL.Simple.Types.Query
instance GHC.Base.Monoid Database.MySQL.Simple.Types.Query
instance GHC.Classes.Eq Database.MySQL.Simple.Types.Null


-- | The <a>QueryResults</a> typeclass, for converting a row of results
--   returned by a SQL query into a more useful Haskell representation.
--   
--   Predefined instances are provided for tuples containing up to ten
--   elements.
module Database.MySQL.Simple.QueryResults

-- | A collection type that can be converted from a list of strings.
--   
--   Instances should use the <a>convert</a> method of the <a>Result</a>
--   class to perform conversion of each element of the collection.
--   
--   This example instance demonstrates how to convert a two-column row
--   into a Haskell pair. Each field in the metadata is paired up with each
--   value from the row, and the two are passed to <a>convert</a>.
--   
--   <pre>
--   instance (<a>Result</a> a, <a>Result</a> b) =&gt; <a>QueryResults</a> (a,b) where
--       <a>convertResults</a> [fa,fb] [va,vb] = (a,b)
--           where !a = <a>convert</a> fa va
--                 !b = <a>convert</a> fb vb
--       <a>convertResults</a> fs vs  = <a>convertError</a> fs vs 2
--   </pre>
--   
--   Notice that this instance evaluates each element to WHNF before
--   constructing the pair. By doing this, we guarantee two important
--   properties:
--   
--   <ul>
--   <li>Keep resource usage under control by preventing the construction
--   of potentially long-lived thunks.</li>
--   <li>Ensure that any <a>ResultError</a> that might arise is thrown
--   immediately, rather than some place later in application code that
--   cannot handle it.</li>
--   </ul>
--   
--   You can also declare Haskell types of your own to be instances of
--   <a>QueryResults</a>.
--   
--   <pre>
--   data User = User { firstName :: String, lastName :: String }
--   
--   instance <a>QueryResults</a> User where
--       <a>convertResults</a> [fa,fb] [va,vb] = User <a>$</a> a <a>*</a> b
--           where !a = <a>convert</a> fa va
--                 !b = <a>convert</a> fb vb
--       <a>convertResults</a> fs vs  = <a>convertError</a> fs vs 2
--    
--   </pre>
class QueryResults a

-- | Convert values from a row into a Haskell collection.
--   
--   This function will throw a <a>ResultError</a> if conversion of the
--   collection fails.
convertResults :: QueryResults a => [Field] -> [Maybe ByteString] -> a

-- | Throw a <a>ConversionFailed</a> exception, indicating a mismatch
--   between the number of columns in the <a>Field</a> and row, and the
--   number in the collection to be converted to.
convertError :: [Field] -> [Maybe ByteString] -> Int -> a
instance Database.MySQL.Simple.Result.Result a => Database.MySQL.Simple.QueryResults.QueryResults (Database.MySQL.Simple.Types.Only a)
instance (Database.MySQL.Simple.Result.Result a, Database.MySQL.Simple.Result.Result b) => Database.MySQL.Simple.QueryResults.QueryResults (a, b)
instance (Database.MySQL.Simple.Result.Result a, Database.MySQL.Simple.Result.Result b, Database.MySQL.Simple.Result.Result c) => Database.MySQL.Simple.QueryResults.QueryResults (a, b, c)
instance (Database.MySQL.Simple.Result.Result a, Database.MySQL.Simple.Result.Result b, Database.MySQL.Simple.Result.Result c, Database.MySQL.Simple.Result.Result d) => Database.MySQL.Simple.QueryResults.QueryResults (a, b, c, d)
instance (Database.MySQL.Simple.Result.Result a, Database.MySQL.Simple.Result.Result b, Database.MySQL.Simple.Result.Result c, Database.MySQL.Simple.Result.Result d, Database.MySQL.Simple.Result.Result e) => Database.MySQL.Simple.QueryResults.QueryResults (a, b, c, d, e)
instance (Database.MySQL.Simple.Result.Result a, Database.MySQL.Simple.Result.Result b, Database.MySQL.Simple.Result.Result c, Database.MySQL.Simple.Result.Result d, Database.MySQL.Simple.Result.Result e, Database.MySQL.Simple.Result.Result f) => Database.MySQL.Simple.QueryResults.QueryResults (a, b, c, d, e, f)
instance (Database.MySQL.Simple.Result.Result a, Database.MySQL.Simple.Result.Result b, Database.MySQL.Simple.Result.Result c, Database.MySQL.Simple.Result.Result d, Database.MySQL.Simple.Result.Result e, Database.MySQL.Simple.Result.Result f, Database.MySQL.Simple.Result.Result g) => Database.MySQL.Simple.QueryResults.QueryResults (a, b, c, d, e, f, g)
instance (Database.MySQL.Simple.Result.Result a, Database.MySQL.Simple.Result.Result b, Database.MySQL.Simple.Result.Result c, Database.MySQL.Simple.Result.Result d, Database.MySQL.Simple.Result.Result e, Database.MySQL.Simple.Result.Result f, Database.MySQL.Simple.Result.Result g, Database.MySQL.Simple.Result.Result h) => Database.MySQL.Simple.QueryResults.QueryResults (a, b, c, d, e, f, g, h)
instance (Database.MySQL.Simple.Result.Result a, Database.MySQL.Simple.Result.Result b, Database.MySQL.Simple.Result.Result c, Database.MySQL.Simple.Result.Result d, Database.MySQL.Simple.Result.Result e, Database.MySQL.Simple.Result.Result f, Database.MySQL.Simple.Result.Result g, Database.MySQL.Simple.Result.Result h, Database.MySQL.Simple.Result.Result i) => Database.MySQL.Simple.QueryResults.QueryResults (a, b, c, d, e, f, g, h, i)
instance (Database.MySQL.Simple.Result.Result a, Database.MySQL.Simple.Result.Result b, Database.MySQL.Simple.Result.Result c, Database.MySQL.Simple.Result.Result d, Database.MySQL.Simple.Result.Result e, Database.MySQL.Simple.Result.Result f, Database.MySQL.Simple.Result.Result g, Database.MySQL.Simple.Result.Result h, Database.MySQL.Simple.Result.Result i, Database.MySQL.Simple.Result.Result j) => Database.MySQL.Simple.QueryResults.QueryResults (a, b, c, d, e, f, g, h, i, j)
instance (Database.MySQL.Simple.Result.Result a, Database.MySQL.Simple.Result.Result b, Database.MySQL.Simple.Result.Result c, Database.MySQL.Simple.Result.Result d, Database.MySQL.Simple.Result.Result e, Database.MySQL.Simple.Result.Result f, Database.MySQL.Simple.Result.Result g, Database.MySQL.Simple.Result.Result h, Database.MySQL.Simple.Result.Result i, Database.MySQL.Simple.Result.Result j, Database.MySQL.Simple.Result.Result k) => Database.MySQL.Simple.QueryResults.QueryResults (a, b, c, d, e, f, g, h, i, j, k)
instance (Database.MySQL.Simple.Result.Result a, Database.MySQL.Simple.Result.Result b, Database.MySQL.Simple.Result.Result c, Database.MySQL.Simple.Result.Result d, Database.MySQL.Simple.Result.Result e, Database.MySQL.Simple.Result.Result f, Database.MySQL.Simple.Result.Result g, Database.MySQL.Simple.Result.Result h, Database.MySQL.Simple.Result.Result i, Database.MySQL.Simple.Result.Result j, Database.MySQL.Simple.Result.Result k, Database.MySQL.Simple.Result.Result l) => Database.MySQL.Simple.QueryResults.QueryResults (a, b, c, d, e, f, g, h, i, j, k, l)
instance (Database.MySQL.Simple.Result.Result a, Database.MySQL.Simple.Result.Result b, Database.MySQL.Simple.Result.Result c, Database.MySQL.Simple.Result.Result d, Database.MySQL.Simple.Result.Result e, Database.MySQL.Simple.Result.Result f, Database.MySQL.Simple.Result.Result g, Database.MySQL.Simple.Result.Result h, Database.MySQL.Simple.Result.Result i, Database.MySQL.Simple.Result.Result j, Database.MySQL.Simple.Result.Result k, Database.MySQL.Simple.Result.Result l, Database.MySQL.Simple.Result.Result m) => Database.MySQL.Simple.QueryResults.QueryResults (a, b, c, d, e, f, g, h, i, j, k, l, m)
instance (Database.MySQL.Simple.Result.Result a, Database.MySQL.Simple.Result.Result b, Database.MySQL.Simple.Result.Result c, Database.MySQL.Simple.Result.Result d, Database.MySQL.Simple.Result.Result e, Database.MySQL.Simple.Result.Result f, Database.MySQL.Simple.Result.Result g, Database.MySQL.Simple.Result.Result h, Database.MySQL.Simple.Result.Result i, Database.MySQL.Simple.Result.Result j, Database.MySQL.Simple.Result.Result k, Database.MySQL.Simple.Result.Result l, Database.MySQL.Simple.Result.Result m, Database.MySQL.Simple.Result.Result n) => Database.MySQL.Simple.QueryResults.QueryResults (a, b, c, d, e, f, g, h, i, j, k, l, m, n)
instance (Database.MySQL.Simple.Result.Result a, Database.MySQL.Simple.Result.Result b, Database.MySQL.Simple.Result.Result c, Database.MySQL.Simple.Result.Result d, Database.MySQL.Simple.Result.Result e, Database.MySQL.Simple.Result.Result f, Database.MySQL.Simple.Result.Result g, Database.MySQL.Simple.Result.Result h, Database.MySQL.Simple.Result.Result i, Database.MySQL.Simple.Result.Result j, Database.MySQL.Simple.Result.Result k, Database.MySQL.Simple.Result.Result l, Database.MySQL.Simple.Result.Result m, Database.MySQL.Simple.Result.Result n, Database.MySQL.Simple.Result.Result o) => Database.MySQL.Simple.QueryResults.QueryResults (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)
instance (Database.MySQL.Simple.Result.Result a, Database.MySQL.Simple.Result.Result b, Database.MySQL.Simple.Result.Result c, Database.MySQL.Simple.Result.Result d, Database.MySQL.Simple.Result.Result e, Database.MySQL.Simple.Result.Result f, Database.MySQL.Simple.Result.Result g, Database.MySQL.Simple.Result.Result h, Database.MySQL.Simple.Result.Result i, Database.MySQL.Simple.Result.Result j, Database.MySQL.Simple.Result.Result k, Database.MySQL.Simple.Result.Result l, Database.MySQL.Simple.Result.Result m, Database.MySQL.Simple.Result.Result n, Database.MySQL.Simple.Result.Result o, Database.MySQL.Simple.Result.Result p) => Database.MySQL.Simple.QueryResults.QueryResults (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p)
instance (Database.MySQL.Simple.Result.Result a, Database.MySQL.Simple.Result.Result b, Database.MySQL.Simple.Result.Result c, Database.MySQL.Simple.Result.Result d, Database.MySQL.Simple.Result.Result e, Database.MySQL.Simple.Result.Result f, Database.MySQL.Simple.Result.Result g, Database.MySQL.Simple.Result.Result h, Database.MySQL.Simple.Result.Result i, Database.MySQL.Simple.Result.Result j, Database.MySQL.Simple.Result.Result k, Database.MySQL.Simple.Result.Result l, Database.MySQL.Simple.Result.Result m, Database.MySQL.Simple.Result.Result n, Database.MySQL.Simple.Result.Result o, Database.MySQL.Simple.Result.Result p, Database.MySQL.Simple.Result.Result q) => Database.MySQL.Simple.QueryResults.QueryResults (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q)
instance (Database.MySQL.Simple.Result.Result a, Database.MySQL.Simple.Result.Result b, Database.MySQL.Simple.Result.Result c, Database.MySQL.Simple.Result.Result d, Database.MySQL.Simple.Result.Result e, Database.MySQL.Simple.Result.Result f, Database.MySQL.Simple.Result.Result g, Database.MySQL.Simple.Result.Result h, Database.MySQL.Simple.Result.Result i, Database.MySQL.Simple.Result.Result j, Database.MySQL.Simple.Result.Result k, Database.MySQL.Simple.Result.Result l, Database.MySQL.Simple.Result.Result m, Database.MySQL.Simple.Result.Result n, Database.MySQL.Simple.Result.Result o, Database.MySQL.Simple.Result.Result p, Database.MySQL.Simple.Result.Result q, Database.MySQL.Simple.Result.Result r) => Database.MySQL.Simple.QueryResults.QueryResults (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r)
instance (Database.MySQL.Simple.Result.Result a, Database.MySQL.Simple.Result.Result b, Database.MySQL.Simple.Result.Result c, Database.MySQL.Simple.Result.Result d, Database.MySQL.Simple.Result.Result e, Database.MySQL.Simple.Result.Result f, Database.MySQL.Simple.Result.Result g, Database.MySQL.Simple.Result.Result h, Database.MySQL.Simple.Result.Result i, Database.MySQL.Simple.Result.Result j, Database.MySQL.Simple.Result.Result k, Database.MySQL.Simple.Result.Result l, Database.MySQL.Simple.Result.Result m, Database.MySQL.Simple.Result.Result n, Database.MySQL.Simple.Result.Result o, Database.MySQL.Simple.Result.Result p, Database.MySQL.Simple.Result.Result q, Database.MySQL.Simple.Result.Result r, Database.MySQL.Simple.Result.Result s) => Database.MySQL.Simple.QueryResults.QueryResults (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s)
instance (Database.MySQL.Simple.Result.Result a, Database.MySQL.Simple.Result.Result b, Database.MySQL.Simple.Result.Result c, Database.MySQL.Simple.Result.Result d, Database.MySQL.Simple.Result.Result e, Database.MySQL.Simple.Result.Result f, Database.MySQL.Simple.Result.Result g, Database.MySQL.Simple.Result.Result h, Database.MySQL.Simple.Result.Result i, Database.MySQL.Simple.Result.Result j, Database.MySQL.Simple.Result.Result k, Database.MySQL.Simple.Result.Result l, Database.MySQL.Simple.Result.Result m, Database.MySQL.Simple.Result.Result n, Database.MySQL.Simple.Result.Result o, Database.MySQL.Simple.Result.Result p, Database.MySQL.Simple.Result.Result q, Database.MySQL.Simple.Result.Result r, Database.MySQL.Simple.Result.Result s, Database.MySQL.Simple.Result.Result t) => Database.MySQL.Simple.QueryResults.QueryResults (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t)
instance (Database.MySQL.Simple.Result.Result a, Database.MySQL.Simple.Result.Result b, Database.MySQL.Simple.Result.Result c, Database.MySQL.Simple.Result.Result d, Database.MySQL.Simple.Result.Result e, Database.MySQL.Simple.Result.Result f, Database.MySQL.Simple.Result.Result g, Database.MySQL.Simple.Result.Result h, Database.MySQL.Simple.Result.Result i, Database.MySQL.Simple.Result.Result j, Database.MySQL.Simple.Result.Result k, Database.MySQL.Simple.Result.Result l, Database.MySQL.Simple.Result.Result m, Database.MySQL.Simple.Result.Result n, Database.MySQL.Simple.Result.Result o, Database.MySQL.Simple.Result.Result p, Database.MySQL.Simple.Result.Result q, Database.MySQL.Simple.Result.Result r, Database.MySQL.Simple.Result.Result s, Database.MySQL.Simple.Result.Result t, Database.MySQL.Simple.Result.Result u) => Database.MySQL.Simple.QueryResults.QueryResults (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u)
instance (Database.MySQL.Simple.Result.Result a, Database.MySQL.Simple.Result.Result b, Database.MySQL.Simple.Result.Result c, Database.MySQL.Simple.Result.Result d, Database.MySQL.Simple.Result.Result e, Database.MySQL.Simple.Result.Result f, Database.MySQL.Simple.Result.Result g, Database.MySQL.Simple.Result.Result h, Database.MySQL.Simple.Result.Result i, Database.MySQL.Simple.Result.Result j, Database.MySQL.Simple.Result.Result k, Database.MySQL.Simple.Result.Result l, Database.MySQL.Simple.Result.Result m, Database.MySQL.Simple.Result.Result n, Database.MySQL.Simple.Result.Result o, Database.MySQL.Simple.Result.Result p, Database.MySQL.Simple.Result.Result q, Database.MySQL.Simple.Result.Result r, Database.MySQL.Simple.Result.Result s, Database.MySQL.Simple.Result.Result t, Database.MySQL.Simple.Result.Result u, Database.MySQL.Simple.Result.Result v) => Database.MySQL.Simple.QueryResults.QueryResults (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v)
instance (Database.MySQL.Simple.Result.Result a, Database.MySQL.Simple.Result.Result b, Database.MySQL.Simple.Result.Result c, Database.MySQL.Simple.Result.Result d, Database.MySQL.Simple.Result.Result e, Database.MySQL.Simple.Result.Result f, Database.MySQL.Simple.Result.Result g, Database.MySQL.Simple.Result.Result h, Database.MySQL.Simple.Result.Result i, Database.MySQL.Simple.Result.Result j, Database.MySQL.Simple.Result.Result k, Database.MySQL.Simple.Result.Result l, Database.MySQL.Simple.Result.Result m, Database.MySQL.Simple.Result.Result n, Database.MySQL.Simple.Result.Result o, Database.MySQL.Simple.Result.Result p, Database.MySQL.Simple.Result.Result q, Database.MySQL.Simple.Result.Result r, Database.MySQL.Simple.Result.Result s, Database.MySQL.Simple.Result.Result t, Database.MySQL.Simple.Result.Result u, Database.MySQL.Simple.Result.Result v, Database.MySQL.Simple.Result.Result w) => Database.MySQL.Simple.QueryResults.QueryResults (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w)
instance (Database.MySQL.Simple.Result.Result a, Database.MySQL.Simple.Result.Result b, Database.MySQL.Simple.Result.Result c, Database.MySQL.Simple.Result.Result d, Database.MySQL.Simple.Result.Result e, Database.MySQL.Simple.Result.Result f, Database.MySQL.Simple.Result.Result g, Database.MySQL.Simple.Result.Result h, Database.MySQL.Simple.Result.Result i, Database.MySQL.Simple.Result.Result j, Database.MySQL.Simple.Result.Result k, Database.MySQL.Simple.Result.Result l, Database.MySQL.Simple.Result.Result m, Database.MySQL.Simple.Result.Result n, Database.MySQL.Simple.Result.Result o, Database.MySQL.Simple.Result.Result p, Database.MySQL.Simple.Result.Result q, Database.MySQL.Simple.Result.Result r, Database.MySQL.Simple.Result.Result s, Database.MySQL.Simple.Result.Result t, Database.MySQL.Simple.Result.Result u, Database.MySQL.Simple.Result.Result v, Database.MySQL.Simple.Result.Result w, Database.MySQL.Simple.Result.Result x) => Database.MySQL.Simple.QueryResults.QueryResults (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x)


-- | The <a>Param</a> typeclass, for rendering a parameter to a SQL query.
module Database.MySQL.Simple.Param

-- | How to render an element when substituting it into a query.
data Action

-- | Render without escaping or quoting. Use for non-text types such as
--   numbers, when you are <i>certain</i> that they will not introduce
--   formatting vulnerabilities via use of characters such as spaces or
--   "<tt>'</tt>".
Plain :: Builder -> Action

-- | Escape and enclose in quotes before substituting. Use for all
--   text-like types, and anything else that may contain unsafe characters
--   when rendered.
Escape :: ByteString -> Action

-- | Concatenate a series of rendering actions.
Many :: [Action] -> Action

-- | A type that may be used as a single parameter to a SQL query.
class Param a

-- | Prepare a value for substitution into a query string.
render :: Param a => a -> Action

-- | Surround a string with single-quote characters: "<tt>'</tt>"
--   
--   This function <i>does not</i> perform any other escaping.
inQuotes :: Builder -> Builder
instance Database.MySQL.Simple.Param.Param Database.MySQL.Simple.Param.Action
instance Database.MySQL.Simple.Param.Param a => Database.MySQL.Simple.Param.Param (GHC.Maybe.Maybe a)
instance Database.MySQL.Simple.Param.Param a => Database.MySQL.Simple.Param.Param (Database.MySQL.Simple.Types.In [a])
instance Database.MySQL.Simple.Param.Param a => Database.MySQL.Simple.Param.Param (Database.MySQL.Simple.Types.In (Data.Set.Internal.Set a))
instance Database.MySQL.Simple.Param.Param a => Database.MySQL.Simple.Param.Param (Database.MySQL.Simple.Types.VaArgs [a])
instance Database.MySQL.Simple.Param.Param (Database.MySQL.Simple.Types.Binary Data.ByteString.Internal.ByteString)
instance Database.MySQL.Simple.Param.Param (Database.MySQL.Simple.Types.Binary Data.ByteString.Lazy.Internal.ByteString)
instance Database.MySQL.Simple.Param.Param Database.MySQL.Simple.Types.Null
instance Database.MySQL.Simple.Param.Param GHC.Types.Bool
instance Database.MySQL.Simple.Param.Param GHC.Int.Int8
instance Database.MySQL.Simple.Param.Param GHC.Int.Int16
instance Database.MySQL.Simple.Param.Param GHC.Int.Int32
instance Database.MySQL.Simple.Param.Param GHC.Types.Int
instance Database.MySQL.Simple.Param.Param GHC.Int.Int64
instance Database.MySQL.Simple.Param.Param GHC.Integer.Type.Integer
instance Database.MySQL.Simple.Param.Param GHC.Word.Word8
instance Database.MySQL.Simple.Param.Param GHC.Word.Word16
instance Database.MySQL.Simple.Param.Param GHC.Word.Word32
instance Database.MySQL.Simple.Param.Param GHC.Types.Word
instance Database.MySQL.Simple.Param.Param GHC.Word.Word64
instance Database.MySQL.Simple.Param.Param GHC.Types.Float
instance Database.MySQL.Simple.Param.Param GHC.Types.Double
instance Database.MySQL.Simple.Param.Param Data.ByteString.Internal.ByteString
instance Database.MySQL.Simple.Param.Param Data.ByteString.Lazy.Internal.ByteString
instance Database.MySQL.Simple.Param.Param Data.Text.Internal.Text
instance Database.MySQL.Simple.Param.Param [GHC.Types.Char]
instance Database.MySQL.Simple.Param.Param Data.Text.Internal.Lazy.Text
instance Database.MySQL.Simple.Param.Param Data.Time.Clock.Internal.UTCTime.UTCTime
instance Database.MySQL.Simple.Param.Param Data.Time.Calendar.Days.Day
instance Database.MySQL.Simple.Param.Param Data.Time.LocalTime.Internal.TimeOfDay.TimeOfDay
instance GHC.Show.Show Database.MySQL.Simple.Param.Action


-- | The <a>QueryParams</a> typeclass, for rendering a collection of
--   parameters to a SQL query.
--   
--   Predefined instances are provided for tuples containing up to ten
--   elements.
module Database.MySQL.Simple.QueryParams

-- | A collection type that can be turned into a list of rendering
--   <a>Action</a>s.
--   
--   Instances should use the <a>render</a> method of the <a>Param</a>
--   class to perform conversion of each element of the collection.
class QueryParams a

-- | Render a collection of values.
renderParams :: QueryParams a => a -> [Action]
instance Database.MySQL.Simple.QueryParams.QueryParams ()
instance Database.MySQL.Simple.Param.Param a => Database.MySQL.Simple.QueryParams.QueryParams (Database.MySQL.Simple.Types.Only a)
instance (Database.MySQL.Simple.Param.Param a, Database.MySQL.Simple.Param.Param b) => Database.MySQL.Simple.QueryParams.QueryParams (a, b)
instance (Database.MySQL.Simple.Param.Param a, Database.MySQL.Simple.Param.Param b, Database.MySQL.Simple.Param.Param c) => Database.MySQL.Simple.QueryParams.QueryParams (a, b, c)
instance (Database.MySQL.Simple.Param.Param a, Database.MySQL.Simple.Param.Param b, Database.MySQL.Simple.Param.Param c, Database.MySQL.Simple.Param.Param d) => Database.MySQL.Simple.QueryParams.QueryParams (a, b, c, d)
instance (Database.MySQL.Simple.Param.Param a, Database.MySQL.Simple.Param.Param b, Database.MySQL.Simple.Param.Param c, Database.MySQL.Simple.Param.Param d, Database.MySQL.Simple.Param.Param e) => Database.MySQL.Simple.QueryParams.QueryParams (a, b, c, d, e)
instance (Database.MySQL.Simple.Param.Param a, Database.MySQL.Simple.Param.Param b, Database.MySQL.Simple.Param.Param c, Database.MySQL.Simple.Param.Param d, Database.MySQL.Simple.Param.Param e, Database.MySQL.Simple.Param.Param f) => Database.MySQL.Simple.QueryParams.QueryParams (a, b, c, d, e, f)
instance (Database.MySQL.Simple.Param.Param a, Database.MySQL.Simple.Param.Param b, Database.MySQL.Simple.Param.Param c, Database.MySQL.Simple.Param.Param d, Database.MySQL.Simple.Param.Param e, Database.MySQL.Simple.Param.Param f, Database.MySQL.Simple.Param.Param g) => Database.MySQL.Simple.QueryParams.QueryParams (a, b, c, d, e, f, g)
instance (Database.MySQL.Simple.Param.Param a, Database.MySQL.Simple.Param.Param b, Database.MySQL.Simple.Param.Param c, Database.MySQL.Simple.Param.Param d, Database.MySQL.Simple.Param.Param e, Database.MySQL.Simple.Param.Param f, Database.MySQL.Simple.Param.Param g, Database.MySQL.Simple.Param.Param h) => Database.MySQL.Simple.QueryParams.QueryParams (a, b, c, d, e, f, g, h)
instance (Database.MySQL.Simple.Param.Param a, Database.MySQL.Simple.Param.Param b, Database.MySQL.Simple.Param.Param c, Database.MySQL.Simple.Param.Param d, Database.MySQL.Simple.Param.Param e, Database.MySQL.Simple.Param.Param f, Database.MySQL.Simple.Param.Param g, Database.MySQL.Simple.Param.Param h, Database.MySQL.Simple.Param.Param i) => Database.MySQL.Simple.QueryParams.QueryParams (a, b, c, d, e, f, g, h, i)
instance (Database.MySQL.Simple.Param.Param a, Database.MySQL.Simple.Param.Param b, Database.MySQL.Simple.Param.Param c, Database.MySQL.Simple.Param.Param d, Database.MySQL.Simple.Param.Param e, Database.MySQL.Simple.Param.Param f, Database.MySQL.Simple.Param.Param g, Database.MySQL.Simple.Param.Param h, Database.MySQL.Simple.Param.Param i, Database.MySQL.Simple.Param.Param j) => Database.MySQL.Simple.QueryParams.QueryParams (a, b, c, d, e, f, g, h, i, j)
instance (Database.MySQL.Simple.Param.Param a, Database.MySQL.Simple.Param.Param b, Database.MySQL.Simple.Param.Param c, Database.MySQL.Simple.Param.Param d, Database.MySQL.Simple.Param.Param e, Database.MySQL.Simple.Param.Param f, Database.MySQL.Simple.Param.Param g, Database.MySQL.Simple.Param.Param h, Database.MySQL.Simple.Param.Param i, Database.MySQL.Simple.Param.Param j, Database.MySQL.Simple.Param.Param k) => Database.MySQL.Simple.QueryParams.QueryParams (a, b, c, d, e, f, g, h, i, j, k)
instance (Database.MySQL.Simple.Param.Param a, Database.MySQL.Simple.Param.Param b, Database.MySQL.Simple.Param.Param c, Database.MySQL.Simple.Param.Param d, Database.MySQL.Simple.Param.Param e, Database.MySQL.Simple.Param.Param f, Database.MySQL.Simple.Param.Param g, Database.MySQL.Simple.Param.Param h, Database.MySQL.Simple.Param.Param i, Database.MySQL.Simple.Param.Param j, Database.MySQL.Simple.Param.Param k, Database.MySQL.Simple.Param.Param l) => Database.MySQL.Simple.QueryParams.QueryParams (a, b, c, d, e, f, g, h, i, j, k, l)
instance (Database.MySQL.Simple.Param.Param a, Database.MySQL.Simple.Param.Param b, Database.MySQL.Simple.Param.Param c, Database.MySQL.Simple.Param.Param d, Database.MySQL.Simple.Param.Param e, Database.MySQL.Simple.Param.Param f, Database.MySQL.Simple.Param.Param g, Database.MySQL.Simple.Param.Param h, Database.MySQL.Simple.Param.Param i, Database.MySQL.Simple.Param.Param j, Database.MySQL.Simple.Param.Param k, Database.MySQL.Simple.Param.Param l, Database.MySQL.Simple.Param.Param m) => Database.MySQL.Simple.QueryParams.QueryParams (a, b, c, d, e, f, g, h, i, j, k, l, m)
instance (Database.MySQL.Simple.Param.Param a, Database.MySQL.Simple.Param.Param b, Database.MySQL.Simple.Param.Param c, Database.MySQL.Simple.Param.Param d, Database.MySQL.Simple.Param.Param e, Database.MySQL.Simple.Param.Param f, Database.MySQL.Simple.Param.Param g, Database.MySQL.Simple.Param.Param h, Database.MySQL.Simple.Param.Param i, Database.MySQL.Simple.Param.Param j, Database.MySQL.Simple.Param.Param k, Database.MySQL.Simple.Param.Param l, Database.MySQL.Simple.Param.Param m, Database.MySQL.Simple.Param.Param n) => Database.MySQL.Simple.QueryParams.QueryParams (a, b, c, d, e, f, g, h, i, j, k, l, m, n)
instance (Database.MySQL.Simple.Param.Param a, Database.MySQL.Simple.Param.Param b, Database.MySQL.Simple.Param.Param c, Database.MySQL.Simple.Param.Param d, Database.MySQL.Simple.Param.Param e, Database.MySQL.Simple.Param.Param f, Database.MySQL.Simple.Param.Param g, Database.MySQL.Simple.Param.Param h, Database.MySQL.Simple.Param.Param i, Database.MySQL.Simple.Param.Param j, Database.MySQL.Simple.Param.Param k, Database.MySQL.Simple.Param.Param l, Database.MySQL.Simple.Param.Param m, Database.MySQL.Simple.Param.Param n, Database.MySQL.Simple.Param.Param o) => Database.MySQL.Simple.QueryParams.QueryParams (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)
instance (Database.MySQL.Simple.Param.Param a, Database.MySQL.Simple.Param.Param b, Database.MySQL.Simple.Param.Param c, Database.MySQL.Simple.Param.Param d, Database.MySQL.Simple.Param.Param e, Database.MySQL.Simple.Param.Param f, Database.MySQL.Simple.Param.Param g, Database.MySQL.Simple.Param.Param h, Database.MySQL.Simple.Param.Param i, Database.MySQL.Simple.Param.Param j, Database.MySQL.Simple.Param.Param k, Database.MySQL.Simple.Param.Param l, Database.MySQL.Simple.Param.Param m, Database.MySQL.Simple.Param.Param n, Database.MySQL.Simple.Param.Param o, Database.MySQL.Simple.Param.Param p) => Database.MySQL.Simple.QueryParams.QueryParams (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p)
instance (Database.MySQL.Simple.Param.Param a, Database.MySQL.Simple.Param.Param b, Database.MySQL.Simple.Param.Param c, Database.MySQL.Simple.Param.Param d, Database.MySQL.Simple.Param.Param e, Database.MySQL.Simple.Param.Param f, Database.MySQL.Simple.Param.Param g, Database.MySQL.Simple.Param.Param h, Database.MySQL.Simple.Param.Param i, Database.MySQL.Simple.Param.Param j, Database.MySQL.Simple.Param.Param k, Database.MySQL.Simple.Param.Param l, Database.MySQL.Simple.Param.Param m, Database.MySQL.Simple.Param.Param n, Database.MySQL.Simple.Param.Param o, Database.MySQL.Simple.Param.Param p, Database.MySQL.Simple.Param.Param q) => Database.MySQL.Simple.QueryParams.QueryParams (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q)
instance (Database.MySQL.Simple.Param.Param a, Database.MySQL.Simple.Param.Param b, Database.MySQL.Simple.Param.Param c, Database.MySQL.Simple.Param.Param d, Database.MySQL.Simple.Param.Param e, Database.MySQL.Simple.Param.Param f, Database.MySQL.Simple.Param.Param g, Database.MySQL.Simple.Param.Param h, Database.MySQL.Simple.Param.Param i, Database.MySQL.Simple.Param.Param j, Database.MySQL.Simple.Param.Param k, Database.MySQL.Simple.Param.Param l, Database.MySQL.Simple.Param.Param m, Database.MySQL.Simple.Param.Param n, Database.MySQL.Simple.Param.Param o, Database.MySQL.Simple.Param.Param p, Database.MySQL.Simple.Param.Param q, Database.MySQL.Simple.Param.Param r) => Database.MySQL.Simple.QueryParams.QueryParams (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r)
instance (Database.MySQL.Simple.Param.Param a, Database.MySQL.Simple.Param.Param b, Database.MySQL.Simple.Param.Param c, Database.MySQL.Simple.Param.Param d, Database.MySQL.Simple.Param.Param e, Database.MySQL.Simple.Param.Param f, Database.MySQL.Simple.Param.Param g, Database.MySQL.Simple.Param.Param h, Database.MySQL.Simple.Param.Param i, Database.MySQL.Simple.Param.Param j, Database.MySQL.Simple.Param.Param k, Database.MySQL.Simple.Param.Param l, Database.MySQL.Simple.Param.Param m, Database.MySQL.Simple.Param.Param n, Database.MySQL.Simple.Param.Param o, Database.MySQL.Simple.Param.Param p, Database.MySQL.Simple.Param.Param q, Database.MySQL.Simple.Param.Param r, Database.MySQL.Simple.Param.Param s) => Database.MySQL.Simple.QueryParams.QueryParams (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s)
instance (Database.MySQL.Simple.Param.Param a, Database.MySQL.Simple.Param.Param b, Database.MySQL.Simple.Param.Param c, Database.MySQL.Simple.Param.Param d, Database.MySQL.Simple.Param.Param e, Database.MySQL.Simple.Param.Param f, Database.MySQL.Simple.Param.Param g, Database.MySQL.Simple.Param.Param h, Database.MySQL.Simple.Param.Param i, Database.MySQL.Simple.Param.Param j, Database.MySQL.Simple.Param.Param k, Database.MySQL.Simple.Param.Param l, Database.MySQL.Simple.Param.Param m, Database.MySQL.Simple.Param.Param n, Database.MySQL.Simple.Param.Param o, Database.MySQL.Simple.Param.Param p, Database.MySQL.Simple.Param.Param q, Database.MySQL.Simple.Param.Param r, Database.MySQL.Simple.Param.Param s, Database.MySQL.Simple.Param.Param t, Database.MySQL.Simple.Param.Param u, Database.MySQL.Simple.Param.Param v) => Database.MySQL.Simple.QueryParams.QueryParams (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v)
instance (Database.MySQL.Simple.Param.Param a, Database.MySQL.Simple.Param.Param b, Database.MySQL.Simple.Param.Param c, Database.MySQL.Simple.Param.Param d, Database.MySQL.Simple.Param.Param e, Database.MySQL.Simple.Param.Param f, Database.MySQL.Simple.Param.Param g, Database.MySQL.Simple.Param.Param h, Database.MySQL.Simple.Param.Param i, Database.MySQL.Simple.Param.Param j, Database.MySQL.Simple.Param.Param k, Database.MySQL.Simple.Param.Param l, Database.MySQL.Simple.Param.Param m, Database.MySQL.Simple.Param.Param n, Database.MySQL.Simple.Param.Param o, Database.MySQL.Simple.Param.Param p, Database.MySQL.Simple.Param.Param q, Database.MySQL.Simple.Param.Param r, Database.MySQL.Simple.Param.Param s, Database.MySQL.Simple.Param.Param t, Database.MySQL.Simple.Param.Param u, Database.MySQL.Simple.Param.Param v, Database.MySQL.Simple.Param.Param w) => Database.MySQL.Simple.QueryParams.QueryParams (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w)
instance (Database.MySQL.Simple.Param.Param a, Database.MySQL.Simple.Param.Param b, Database.MySQL.Simple.Param.Param c, Database.MySQL.Simple.Param.Param d, Database.MySQL.Simple.Param.Param e, Database.MySQL.Simple.Param.Param f, Database.MySQL.Simple.Param.Param g, Database.MySQL.Simple.Param.Param h, Database.MySQL.Simple.Param.Param i, Database.MySQL.Simple.Param.Param j, Database.MySQL.Simple.Param.Param k, Database.MySQL.Simple.Param.Param l, Database.MySQL.Simple.Param.Param m, Database.MySQL.Simple.Param.Param n, Database.MySQL.Simple.Param.Param o, Database.MySQL.Simple.Param.Param p, Database.MySQL.Simple.Param.Param q, Database.MySQL.Simple.Param.Param r, Database.MySQL.Simple.Param.Param s, Database.MySQL.Simple.Param.Param t, Database.MySQL.Simple.Param.Param u, Database.MySQL.Simple.Param.Param v, Database.MySQL.Simple.Param.Param w, Database.MySQL.Simple.Param.Param x) => Database.MySQL.Simple.QueryParams.QueryParams (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x)
instance Database.MySQL.Simple.Param.Param a => Database.MySQL.Simple.QueryParams.QueryParams [a]


-- | A mid-level client library for the MySQL database, aimed at ease of
--   use and high performance.
module Database.MySQL.Simple
data ConnectInfo
ConnectInfo :: String -> Word16 -> String -> String -> String -> [Option] -> FilePath -> Maybe SSLInfo -> ConnectInfo
[connectHost] :: ConnectInfo -> String
[connectPort] :: ConnectInfo -> Word16
[connectUser] :: ConnectInfo -> String
[connectPassword] :: ConnectInfo -> String
[connectDatabase] :: ConnectInfo -> String
[connectOptions] :: ConnectInfo -> [Option]
[connectPath] :: ConnectInfo -> FilePath
[connectSSL] :: ConnectInfo -> Maybe SSLInfo

-- | Connection to a MySQL database.
data Connection

-- | A query string. This type is intended to make it difficult to
--   construct a SQL query by concatenating string fragments, as that is an
--   extremely common way to accidentally introduce SQL injection
--   vulnerabilities into an application.
--   
--   This type is an instance of <a>IsString</a>, so the easiest way to
--   construct a query is to enable the <tt>OverloadedStrings</tt> language
--   extension and then simply write the query in double quotes.
--   
--   <pre>
--   {-# LANGUAGE OverloadedStrings #-}
--   
--   import Database.MySQL.Simple
--   
--   q :: Query
--   q = "select ?"
--   </pre>
--   
--   The underlying type is a <a>ByteString</a>, and literal Haskell
--   strings that contain Unicode characters will be correctly transformed
--   to UTF-8.
data Query

-- | Wrap a list of values for use in an <tt>IN</tt> clause. Replaces a
--   single "<tt>?</tt>" character with a parenthesized list of rendered
--   values.
--   
--   Example:
--   
--   <pre>
--   query c "select * from whatever where id in ?" (Only (In [3,4,5]))
--   </pre>
newtype In a
In :: a -> In a

-- | Wrap a list of values for use in a function with variable arguments.
--   Replaces a single "<tt>?</tt>" character with a non-parenthesized list
--   of rendered values.
--   
--   Example:
--   
--   <pre>
--   query conn
--     "SELECT * FROM example_table ORDER BY field(f,?)"
--     (Only (VaArgs [3,2,1]))
--   </pre>
newtype VaArgs a
VaArgs :: a -> VaArgs a

-- | Wrap a mostly-binary string to be escaped in hexadecimal.
newtype Binary a
Binary :: a -> Binary a

-- | A single-value "collection".
--   
--   This is useful if you need to supply a single parameter to a SQL
--   query, or extract a single column from a SQL result.
--   
--   Parameter example:
--   
--   <pre>
--   query c "select x from scores where x &gt; ?" (<a>Only</a> (42::Int))
--   </pre>
--   
--   Result example:
--   
--   <pre>
--   xs &lt;- query_ c "select id from users"
--   forM_ xs $ \(<a>Only</a> id) -&gt; {- ... -}
--   </pre>
newtype Only a
Only :: a -> Only a
[fromOnly] :: Only a -> a

-- | Exception thrown if a <a>Query</a> could not be formatted correctly.
--   This may occur if the number of '<tt>?</tt>' characters in the query
--   string does not match the number of parameters provided.
data FormatError

-- | Exception thrown if <a>query</a> is used to perform an
--   <tt>INSERT</tt>-like operation, or <a>execute</a> is used to perform a
--   <tt>SELECT</tt>-like operation.
data QueryError

-- | Exception thrown if conversion from a SQL value to a Haskell value
--   fails.
data ResultError

-- | Connect to a database.
connect :: ConnectInfo -> IO Connection

-- | Default information for setting up a connection.
--   
--   Defaults are as follows:
--   
--   <ul>
--   <li>Server on <tt>localhost</tt></li>
--   <li>User <tt>root</tt></li>
--   <li>No password</li>
--   <li>Database <tt>test</tt></li>
--   <li>Character set <tt>utf8</tt></li>
--   </ul>
--   
--   Use as in the following example:
--   
--   <pre>
--   connect defaultConnectInfo { connectHost = "db.example.com" }
--   </pre>
defaultConnectInfo :: ConnectInfo

-- | Close a connection, and mark any outstanding <a>Result</a> as invalid.
close :: Connection -> IO ()

-- | Perform a <tt>SELECT</tt> or other SQL query that is expected to
--   return results. All results are retrieved and converted before this
--   function returns.
--   
--   When processing large results, this function will consume a lot of
--   client-side memory. Consider using <a>fold</a> instead.
--   
--   Exceptions that may be thrown:
--   
--   <ul>
--   <li><a>FormatError</a>: the query string could not be formatted
--   correctly.</li>
--   <li><a>QueryError</a>: the result contains no columns (i.e. you should
--   be using <a>execute</a> instead of <a>query</a>).</li>
--   <li><a>ResultError</a>: result conversion failed.</li>
--   </ul>
query :: (QueryParams q, QueryResults r) => Connection -> Query -> q -> IO [r]

-- | A version of <a>query</a> that does not perform query substitution.
query_ :: QueryResults r => Connection -> Query -> IO [r]

-- | Perform a <tt>SELECT</tt> or other SQL query that is expected to
--   return results. Results are streamed incrementally from the server,
--   and consumed via a left fold.
--   
--   The result consumer must be carefully written to execute quickly. If
--   the consumer is slow, server resources will be tied up, and other
--   clients may not be able to update the tables from which the results
--   are being streamed.
--   
--   When dealing with small results, it may be simpler (and perhaps
--   faster) to use <a>query</a> instead.
--   
--   This fold is <i>not</i> strict. The stream consumer is responsible for
--   forcing the evaluation of its result to avoid space leaks.
--   
--   Exceptions that may be thrown:
--   
--   <ul>
--   <li><a>FormatError</a>: the query string could not be formatted
--   correctly.</li>
--   <li><a>QueryError</a>: the result contains no columns (i.e. you should
--   be using <a>execute</a> instead of <a>query</a>).</li>
--   <li><a>ResultError</a>: result conversion failed.</li>
--   </ul>
fold :: (QueryParams q, QueryResults r) => Connection -> Query -> q -> a -> (a -> r -> IO a) -> IO a

-- | A version of <a>fold</a> that does not perform query substitution.
fold_ :: QueryResults r => Connection -> Query -> a -> (a -> r -> IO a) -> IO a

-- | A version of <a>fold</a> that does not transform a state value.
forEach :: (QueryParams q, QueryResults r) => Connection -> Query -> q -> (r -> IO ()) -> IO ()

-- | A version of <a>forEach</a> that does not perform query substitution.
forEach_ :: QueryResults r => Connection -> Query -> (r -> IO ()) -> IO ()

-- | Execute an <tt>INSERT</tt>, <tt>UPDATE</tt>, or other SQL query that
--   is not expected to return results.
--   
--   Returns the number of rows affected.
--   
--   Throws <a>FormatError</a> if the query could not be formatted
--   correctly.
execute :: QueryParams q => Connection -> Query -> q -> IO Int64

-- | A version of <a>execute</a> that does not perform query substitution.
execute_ :: Connection -> Query -> IO Int64

-- | Execute a multi-row <tt>INSERT</tt>, <tt>UPDATE</tt>, or other SQL
--   query that is not expected to return results.
--   
--   Returns the number of rows affected.
--   
--   Throws <a>FormatError</a> if the query could not be formatted
--   correctly.
executeMany :: QueryParams q => Connection -> Query -> [q] -> IO Int64

-- | Return the value generated for an <tt>AUTO_INCREMENT</tt> column by
--   the previous <tt>INSERT</tt> or <tt>UPDATE</tt> statement.
--   
--   See <a>http://dev.mysql.com/doc/refman/5.5/en/mysql-insert-id.html</a>
insertID :: Connection -> IO Word64

-- | Execute an action inside a SQL transaction.
--   
--   This function initiates a transaction with a "<tt>begin
--   transaction</tt>" statement, then executes the supplied action. If the
--   action succeeds, the transaction will be completed with <a>commit</a>
--   before this function returns.
--   
--   If the action throws <i>any</i> kind of exception (not just a
--   MySQL-related exception), the transaction will be rolled back using
--   <a>rollback</a>, then the exception will be rethrown.
withTransaction :: Connection -> IO a -> IO a

-- | Turn autocommit on or off.
--   
--   By default, MySQL runs with autocommit mode enabled. In this mode, as
--   soon as you modify a table, MySQL stores your modification
--   permanently.
autocommit :: Connection -> Bool -> IO ()

-- | Commit the current transaction.
commit :: Connection -> IO ()

-- | Roll back the current transaction.
rollback :: Connection -> IO ()

-- | Format a query string with a variable number of rows.
--   
--   This function is exposed to help with debugging and logging. Do not
--   use it to prepare queries for execution.
--   
--   The query string must contain exactly one substitution group,
--   identified by the SQL keyword "<tt>VALUES</tt>" (case insensitive)
--   followed by an "<tt>(</tt>" character, a series of one or more
--   "<tt>?</tt>" characters separated by commas, and a "<tt>)</tt>"
--   character. White space in a substitution group is permitted.
--   
--   Throws <a>FormatError</a> if the query string could not be formatted
--   correctly.
formatMany :: QueryParams q => Connection -> Query -> [q] -> IO ByteString

-- | Format a query string.
--   
--   This function is exposed to help with debugging and logging. Do not
--   use it to prepare queries for execution.
--   
--   String parameters are escaped according to the character set in use on
--   the <a>Connection</a>.
--   
--   Throws <a>FormatError</a> if the query string could not be formatted
--   correctly.
formatQuery :: QueryParams q => Connection -> Query -> q -> IO ByteString
instance GHC.Show.Show Database.MySQL.Simple.QueryError
instance GHC.Classes.Eq Database.MySQL.Simple.QueryError
instance GHC.Show.Show Database.MySQL.Simple.FormatError
instance GHC.Classes.Eq Database.MySQL.Simple.FormatError
instance GHC.Exception.Type.Exception Database.MySQL.Simple.QueryError
instance GHC.Exception.Type.Exception Database.MySQL.Simple.FormatError
