-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A low-level MySQL client library. -- -- A low-level client library for the MySQL database, implemented as -- bindings to the C mysqlclient API. -- -- Important licensing note: This library is BSD-licensed under -- the terms of the MySQL FOSS License Exception -- http://www.mysql.com/about/legal/licensing/foss-exception/. -- -- Since this library links against the GPL-licensed mysqlclient -- library, a non-open-source application that uses it may be -- subject to the terms of the GPL. @package mysql @version 0.1.2 -- | Types for working with the direct bindings to the C -- mysqlclient API. module Database.MySQL.Base.Types -- | Column types supported by MySQL. data Type Decimal :: Type Tiny :: Type Short :: Type Long :: Type Float :: Type Double :: Type Null :: Type Timestamp :: Type LongLong :: Type Int24 :: Type Date :: Type Time :: Type DateTime :: Type Year :: Type NewDate :: Type VarChar :: Type Bit :: Type NewDecimal :: Type Enum :: Type Set :: Type TinyBlob :: Type MediumBlob :: Type LongBlob :: Type Blob :: Type VarString :: Type String :: Type Geometry :: Type type Seconds = Word data Protocol TCP :: Protocol Socket :: Protocol Pipe :: Protocol Memory :: Protocol data Option ConnectTimeout :: Seconds -> Option Compress :: Option NamedPipe :: Option InitCommand :: ByteString -> Option ReadDefaultFile :: FilePath -> Option ReadDefaultGroup :: ByteString -> Option CharsetDir :: FilePath -> Option CharsetName :: String -> Option LocalInFile :: Bool -> Option Protocol :: Protocol -> Option SharedMemoryBaseName :: ByteString -> Option ReadTimeout :: Seconds -> Option WriteTimeout :: Seconds -> Option UseRemoteConnection :: Option UseEmbeddedConnection :: Option GuessConnection :: Option ClientIP :: ByteString -> Option SecureAuth :: Bool -> Option ReportDataTruncation :: Bool -> Option Reconnect :: Bool -> Option SSLVerifyServerCert :: Bool -> Option FoundRows :: Option IgnoreSIGPIPE :: Option IgnoreSpace :: Option Interactive :: Option LocalFiles :: Option MultiResults :: Option MultiStatements :: Option NoSchema :: Option -- | A description of a field (column) of a table. data Field Field :: ByteString -> ByteString -> ByteString -> ByteString -> ByteString -> ByteString -> Maybe ByteString -> Word -> Word -> FieldFlags -> Word -> Word -> Type -> Field -- | Name of column. [fieldName] :: Field -> ByteString -- | Original column name, if an alias. [fieldOrigName] :: Field -> ByteString -- | Table of column, if column was a field. [fieldTable] :: Field -> ByteString -- | Original table name, if table was an alias. [fieldOrigTable] :: Field -> ByteString -- | Database for table. [fieldDB] :: Field -> ByteString -- | Catalog for table. [fieldCatalog] :: Field -> ByteString -- | Default value. [fieldDefault] :: Field -> Maybe ByteString -- | Width of column (create length). [fieldLength] :: Field -> Word -- | Maximum width for selected set. [fieldMaxLength] :: Field -> Word -- | Div flags. [fieldFlags] :: Field -> FieldFlags -- | Number of decimals in field. [fieldDecimals] :: Field -> Word -- | Character set number. [fieldCharSet] :: Field -> Word [fieldType] :: Field -> Type type FieldFlag = FieldFlags data FieldFlags data MYSQL data MYSQL_RES type MYSQL_ROW = Ptr (Ptr CChar) data MYSQL_ROWS type MYSQL_ROW_OFFSET = Ptr MYSQL_ROWS type MyBool = CChar hasAllFlags :: FieldFlags -> FieldFlags -> Bool flagNotNull :: FieldFlag flagPrimaryKey :: FieldFlag flagUniqueKey :: FieldFlag flagMultipleKey :: FieldFlag flagUnsigned :: FieldFlag flagZeroFill :: FieldFlag flagBinary :: FieldFlag flagAutoIncrement :: FieldFlag flagNumeric :: FieldFlag flagNoDefaultValue :: FieldFlag toConnectFlag :: Option -> CULong instance GHC.Show.Show Database.MySQL.Base.Types.Option instance GHC.Read.Read Database.MySQL.Base.Types.Option instance GHC.Classes.Eq Database.MySQL.Base.Types.Option instance GHC.Enum.Enum Database.MySQL.Base.Types.Protocol instance GHC.Show.Show Database.MySQL.Base.Types.Protocol instance GHC.Read.Read Database.MySQL.Base.Types.Protocol instance GHC.Classes.Eq Database.MySQL.Base.Types.Protocol instance GHC.Show.Show Database.MySQL.Base.Types.Field instance GHC.Classes.Eq Database.MySQL.Base.Types.Field instance GHC.Classes.Eq Database.MySQL.Base.Types.FieldFlags instance GHC.Show.Show Database.MySQL.Base.Types.Type instance GHC.Classes.Eq Database.MySQL.Base.Types.Type instance GHC.Enum.Enum Database.MySQL.Base.Types.Type instance GHC.Show.Show Database.MySQL.Base.Types.FieldFlags instance GHC.Base.Monoid Database.MySQL.Base.Types.FieldFlags instance Foreign.Storable.Storable Database.MySQL.Base.Types.Field -- | Direct bindings to the C mysqlclient API. module Database.MySQL.Base.C mysql_init :: Ptr MYSQL -> IO (Ptr MYSQL) mysql_options :: Ptr MYSQL -> Option -> IO CInt mysql_ssl_set :: Ptr MYSQL -> CString -> CString -> CString -> CString -> CString -> IO MyBool mysql_real_connect :: Ptr MYSQL -> CString -> CString -> CString -> CString -> CInt -> CString -> CULong -> IO (Ptr MYSQL) mysql_close :: Ptr MYSQL -> IO () mysql_ping :: Ptr MYSQL -> IO CInt mysql_autocommit :: Ptr MYSQL -> MyBool -> IO MyBool mysql_change_user :: Ptr MYSQL -> CString -> CString -> CString -> IO MyBool mysql_select_db :: Ptr MYSQL -> CString -> IO CInt mysql_set_character_set :: Ptr MYSQL -> CString -> IO CInt mysql_thread_id :: Ptr MYSQL -> IO CULong mysql_get_server_info :: Ptr MYSQL -> IO CString mysql_get_host_info :: Ptr MYSQL -> IO CString mysql_get_proto_info :: Ptr MYSQL -> IO CUInt mysql_character_set_name :: Ptr MYSQL -> IO CString mysql_get_ssl_cipher :: Ptr MYSQL -> IO CString mysql_stat :: Ptr MYSQL -> IO CString mysql_real_query :: Ptr MYSQL -> CString -> CULong -> IO CInt mysql_insert_id :: Ptr MYSQL -> IO CULLong mysql_real_escape_string :: Ptr MYSQL -> CString -> CString -> CULong -> IO CULong mysql_field_count :: Ptr MYSQL -> IO CUInt mysql_affected_rows :: Ptr MYSQL -> IO CULLong mysql_store_result :: Ptr MYSQL -> IO (Ptr MYSQL_RES) mysql_use_result :: Ptr MYSQL -> IO (Ptr MYSQL_RES) mysql_fetch_lengths :: Ptr MYSQL_RES -> IO (Ptr CULong) mysql_fetch_lengths_nonblock :: Ptr MYSQL_RES -> IO (Ptr CULong) mysql_fetch_row :: Ptr MYSQL_RES -> IO MYSQL_ROW mysql_fetch_row_nonblock :: Ptr MYSQL_RES -> IO MYSQL_ROW mysql_free_result :: Ptr MYSQL_RES -> IO () mysql_free_result_nonblock :: Ptr MYSQL_RES -> IO () mysql_fetch_fields :: Ptr MYSQL_RES -> IO (Ptr Field) mysql_fetch_fields_nonblock :: Ptr MYSQL_RES -> IO (Ptr Field) mysql_data_seek :: Ptr MYSQL_RES -> CULLong -> IO () mysql_row_seek :: Ptr MYSQL_RES -> MYSQL_ROW_OFFSET -> IO MYSQL_ROW_OFFSET mysql_row_tell :: Ptr MYSQL_RES -> IO MYSQL_ROW_OFFSET mysql_next_result :: Ptr MYSQL -> IO CInt mysql_commit :: Ptr MYSQL -> IO MyBool mysql_rollback :: Ptr MYSQL -> IO MyBool mysql_get_client_info :: CString mysql_get_client_version :: CULong mysql_errno :: Ptr MYSQL -> IO CInt mysql_error :: Ptr MYSQL -> IO CString -- | A low-level client library for the MySQL database, implemented as -- bindings to the C mysqlclient API. module Database.MySQL.Base 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 data SSLInfo SSLInfo :: FilePath -> FilePath -> FilePath -> FilePath -> String -> SSLInfo [sslKey] :: SSLInfo -> FilePath [sslCert] :: SSLInfo -> FilePath [sslCA] :: SSLInfo -> FilePath [sslCAPath] :: SSLInfo -> FilePath -- | Comma-separated list of cipher names. [sslCiphers] :: SSLInfo -> String type Seconds = Word data Protocol TCP :: Protocol Socket :: Protocol Pipe :: Protocol Memory :: Protocol data Option ConnectTimeout :: Seconds -> Option Compress :: Option NamedPipe :: Option InitCommand :: ByteString -> Option ReadDefaultFile :: FilePath -> Option ReadDefaultGroup :: ByteString -> Option CharsetDir :: FilePath -> Option CharsetName :: String -> Option LocalInFile :: Bool -> Option Protocol :: Protocol -> Option SharedMemoryBaseName :: ByteString -> Option ReadTimeout :: Seconds -> Option WriteTimeout :: Seconds -> Option UseRemoteConnection :: Option UseEmbeddedConnection :: Option GuessConnection :: Option ClientIP :: ByteString -> Option SecureAuth :: Bool -> Option ReportDataTruncation :: Bool -> Option Reconnect :: Bool -> Option SSLVerifyServerCert :: Bool -> Option FoundRows :: Option IgnoreSIGPIPE :: Option IgnoreSpace :: Option Interactive :: Option LocalFiles :: Option MultiResults :: Option MultiStatements :: Option NoSchema :: Option -- | Default information for setting up a connection. -- -- Defaults are as follows: -- -- -- -- Use as in the following example: -- --
--   connect defaultConnectInfo { connectHost = "db.example.com" }
--   
defaultConnectInfo :: ConnectInfo -- | Default (empty) information for setting up an SSL connection. defaultSSLInfo :: SSLInfo -- | Connection to a MySQL database. data Connection -- | Result of a database query. data Result -- | Column types supported by MySQL. data Type Decimal :: Type Tiny :: Type Short :: Type Long :: Type Float :: Type Double :: Type Null :: Type Timestamp :: Type LongLong :: Type Int24 :: Type Date :: Type Time :: Type DateTime :: Type Year :: Type NewDate :: Type VarChar :: Type Bit :: Type NewDecimal :: Type Enum :: Type Set :: Type TinyBlob :: Type MediumBlob :: Type LongBlob :: Type Blob :: Type VarString :: Type String :: Type Geometry :: Type -- | A row cursor, used by rowSeek and rowTell. data Row data MySQLError -- | Connect to a database. connect :: ConnectInfo -> IO Connection -- | Close a connection, and mark any outstanding Result as invalid. close :: Connection -> IO () -- | 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 () ping :: Connection -> IO () changeUser :: Connection -> String -> String -> Maybe String -> IO () selectDB :: Connection -> String -> IO () setCharacterSet :: Connection -> String -> IO () threadId :: Connection -> IO Word serverInfo :: Connection -> IO String hostInfo :: Connection -> IO String protocolInfo :: Connection -> IO Word characterSet :: Connection -> IO String sslCipher :: Connection -> IO (Maybe String) serverStatus :: Connection -> IO String query :: Connection -> ByteString -> IO () -- | Return the value generated for an AUTO_INCREMENT column by -- the previous INSERT or UPDATE statement. -- -- See http://dev.mysql.com/doc/refman/5.5/en/mysql-insert-id.html insertID :: Connection -> IO Word64 escape :: Connection -> ByteString -> IO ByteString -- | Return the number of fields (columns) in a result. -- -- -- -- The number of columns may legitimately be zero. fieldCount :: Either Connection Result -> IO Int affectedRows :: Connection -> IO Int64 -- | Check whether a Result is still valid, i.e. backed by a live -- MYSQL_RES value. isResultValid :: Result -> IO Bool -- | Immediately free the MYSQL_RES value associated with this -- Result, and mark the Result as invalid. freeResult :: Result -> IO () -- | Retrieve a complete result. -- -- Any previous outstanding Result is first marked as invalid. storeResult :: Connection -> IO Result -- | Initiate a row-by-row retrieval of a result. -- -- Any previous outstanding Result is first marked as invalid. useResult :: Connection -> IO Result fetchRow :: Result -> IO [Maybe ByteString] fetchFields :: Result -> IO [Field] dataSeek :: Result -> Int64 -> IO () rowSeek :: Result -> Row -> IO Row rowTell :: Result -> IO Row -- | Read the next statement result. Returns True if another result -- is available, False otherwise. -- -- This function marks the current Result as invalid, if one -- exists. nextResult :: Connection -> IO Bool -- | Commit the current transaction. commit :: Connection -> IO () -- | Roll back the current transaction. rollback :: Connection -> IO () clientInfo :: String clientVersion :: Word instance GHC.Show.Show Database.MySQL.Base.MySQLError instance GHC.Classes.Eq Database.MySQL.Base.MySQLError instance GHC.Show.Show Database.MySQL.Base.ConnectInfo instance GHC.Read.Read Database.MySQL.Base.ConnectInfo instance GHC.Classes.Eq Database.MySQL.Base.ConnectInfo instance GHC.Show.Show Database.MySQL.Base.SSLInfo instance GHC.Read.Read Database.MySQL.Base.SSLInfo instance GHC.Classes.Eq Database.MySQL.Base.SSLInfo instance GHC.Exception.Exception Database.MySQL.Base.MySQLError