-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Haskell binding to sqlite3 -- -- Haskell binding to sqlite3 http://sqlite.org/. @package sqlite @version 0.5.1 -- | Note: the quary part of this modules was imported (with modifications) -- from the lowest layer of abstraction of HaskellDB. module Database.SQL.Types type TableName = String type ColumnName = String type DatabaseName = String type OpName = String data SQLOrder SQLAsc :: SQLOrder SQLDesc :: SQLOrder -- | Data type for SQL SELECT statements. data SQLSelect SQLSelect :: [String] -> [(SQLExpr, String)] -> SelectSource -> [SQLExpr] -> [SQLExpr] -> [(SQLExpr, SQLOrder)] -> [String] -> SQLSelect -- | DISTINCT, ALL etc. | result, alias. Empty list means select -- all. options :: SQLSelect -> [String] attrs :: SQLSelect -> [(SQLExpr, String)] -- | FROM tables :: SQLSelect -> SelectSource -- | WHERE criteria :: SQLSelect -> [SQLExpr] -- | GROUP BY groupby :: SQLSelect -> [SQLExpr] -- | ORDER BY orderby :: SQLSelect -> [(SQLExpr, SQLOrder)] -- | TOP n, etc. extra :: SQLSelect -> [String] -- | UNION, etc SQLBin :: OpName -> SQLSelect -> SQLSelect -> SQLSelect select_all :: SelectSource -> SQLSelect data SelectSource From :: TableSource -> [Join] -> SelectSource -- | Join with another table. data Join Join :: OpName -> TableSource -> (Maybe (OpName, SQLExpr)) -> Join -- | Use empty string for no alias. data TableSource SrcTable :: TableName -> String -> TableSource SrcSelect :: SQLSelect -> String -> TableSource -- | Expressions in SQL statements. data SQLExpr ColumnSQLExpr :: ColumnName -> SQLExpr BinSQLExpr :: OpName -> SQLExpr -> SQLExpr -> SQLExpr PrefixSQLExpr :: OpName -> SQLExpr -> SQLExpr PostfixSQLExpr :: OpName -> SQLExpr -> SQLExpr FunSQLExpr :: OpName -> [SQLExpr] -> SQLExpr ConstSQLExpr :: String -> SQLExpr CaseSQLExpr :: [(SQLExpr, SQLExpr)] -> SQLExpr -> SQLExpr ListSQLExpr :: [SQLExpr] -> SQLExpr -- | Data type for SQL UPDATE statements. data SQLUpdate SQLUpdate :: TableName -> [(ColumnName, SQLExpr)] -> [SQLExpr] -> SQLUpdate -- | Data type for SQL DELETE statements. data SQLDelete SQLDelete :: TableName -> [SQLExpr] -> SQLDelete -- | Data type for SQL INSERT statements. data SQLInsert SQLInsert :: TableName -> [ColumnName] -> [SQLExpr] -> SQLInsert SQLInsertQuery :: TableName -> [ColumnName] -> SQLSelect -> SQLInsert -- | Data type for SQL CREATE statements. data SQLCreate a -- | Create a database SQLCreateDB :: DatabaseName -> SQLCreate a -- | Create a table SQLCreateTable :: (Table a) -> SQLCreate a -- | Data type representing the SQL DROP statement. data SQLDrop -- | Delete a database SQLDropDB :: DatabaseName -> SQLDrop -- | Delete a table named SQLTable SQLDropTable :: TableName -> SQLDrop data Clause IsNullable :: Bool -> Clause DefaultValue :: String -> Clause -- | Auto-increment? PrimaryKey :: Bool -> Clause ForeignKey :: TableName -> [ColumnName] -> [ForeignUpdateCondition] -> (Maybe Deferment) -> Clause Clustered :: Bool -> Clause Unique :: Clause data ForeignUpdateCondition OnDelete :: ForeignUpdateAction -> ForeignUpdateCondition OnUpdate :: ForeignUpdateAction -> ForeignUpdateCondition Match :: String -> ForeignUpdateCondition data ForeignUpdateAction SetNull :: ForeignUpdateAction SetDefault :: ForeignUpdateAction Cascade :: ForeignUpdateAction Restrict :: ForeignUpdateAction NoAction :: ForeignUpdateAction data Deferment Deferrable :: Deferment DeferrableInitiallyDeferred :: Deferment DeferrableInitiallyImmediate :: Deferment NotDeferrable :: Deferment NotDeferrableInitiallyDeferred :: Deferment NotDeferrableInitiallyImmediate :: Deferment data Constraint TablePrimaryKey :: [ColumnName] -> Constraint TableUnique :: [ColumnName] -> Constraint TableCheck :: SQLExpr -> Constraint data Table a Table :: String -> [Column a] -> [Constraint] -> Table a tabName :: Table a -> String tabColumns :: Table a -> [Column a] tabConstraints :: Table a -> [Constraint] VirtualTable :: String -> [Column a] -> [Constraint] -> String -> Table a tabName :: Table a -> String tabColumns :: Table a -> [Column a] tabConstraints :: Table a -> [Constraint] tabUsing :: Table a -> String -- | We parameterize over column type, since SQL engines do tend to provide -- their own set of supported datatypes (which may or may not map onto -- SQL99's set of types.) data Column a Column :: ColumnName -> a -> [Clause] -> Column a colName :: Column a -> ColumnName colType :: Column a -> a colClauses :: Column a -> [Clause] type SQLTable = Table SQLType -- | MySQL slanted, but also SQLite friendly if you don't get too fancy.. data SQLType SQLBoolean :: SQLType SQLChar :: (Maybe Int) -> SQLType SQLVarChar :: Int -> SQLType SQLBlob :: BlobType -> SQLType SQLDateTime :: DateTimeType -> SQLType SQLInt :: IntType -> Bool -> Bool -> SQLType SQLDecimal :: (Maybe Int) -> (Maybe Int) -> SQLType SQLFloat :: (Maybe Int) -> (Maybe Int) -> SQLType data IntType TINY :: IntType SMALL :: IntType MEDIUM :: IntType NORMAL :: IntType BIG :: IntType data DateTimeType DATE :: DateTimeType DATETIME :: DateTimeType TIMESTAMP :: DateTimeType TIME :: DateTimeType YEAR :: (Maybe Int) -> DateTimeType data BlobType TinyBlob :: BlobType NormalBlob :: (Maybe Int) -> BlobType MediumBlob :: BlobType LongBlob :: BlobType showType :: SQLType -> String showClause :: Clause -> String toSQLString :: String -> String export_sql :: PrettySQL t => t -> String class PrettySQL t pp_sql :: PrettySQL t => t -> Doc instance [incoherent] PrettySQL SQLType instance [incoherent] PrettySQL SQLDrop instance [incoherent] PrettySQL a => PrettySQL (SQLCreate a) instance [incoherent] PrettySQL SQLInsert instance [incoherent] PrettySQL SQLDelete instance [incoherent] PrettySQL SQLUpdate instance [incoherent] PrettySQL SQLSelect module Database.SQL sqlInsert :: TableName -> [(ColumnName, SQLExpr)] -> SQLInsert -- | Objects, types and constants used in the sqlite3 binding. module Database.SQLite.Types type SQLiteInt64 = Int64 type SQLiteWord64 = Word64 -- | An open SQLite database object. newtype SQLite SQLite :: (Ptr ()) -> SQLite -- | An instance of this object represent single SQL statements. This -- object is variously known as a prepared statement or a -- compiled SQL statement or simply as a statement. newtype SQLiteStmt SQLiteStmt :: (Ptr ()) -> SQLiteStmt -- | SQLite uses the sqlite3_value object to represent all values that are -- or can be stored in a database table. SQLite uses dynamic typing for -- the values it stores. Values stored in sqlite3_value objects can be be -- integers, floating point values, strings, BLOBs, or NULL. newtype SQLiteValue SQLiteValue :: (Ptr ()) -> SQLiteValue -- | The context in which an SQL function executes is stored in an -- sqlite3_context object. A pointer to an sqlite3_context object is -- always first parameter to application-defined SQL functions. newtype SQLiteContext SQLiteContext :: (Ptr ()) -> SQLiteContext -- | A BLOB handle newtype SQLiteBLOB SQLiteBLOB :: (Ptr ()) -> SQLiteBLOB newtype SQLiteUTF16 SQLiteUTF16 :: (Ptr ()) -> SQLiteUTF16 newtype SQLiteContextBuffer SQLiteContextBuffer :: (Ptr ()) -> SQLiteContextBuffer newtype SQLiteCallback a SQLiteCallback :: (FunPtr a) -> SQLiteCallback a type SQLiteCallbackUserData = Ptr () -- | SQLite types data SQLiteType SQLiteInt :: SQLiteType SQLiteFloat :: SQLiteType SQLiteText :: SQLiteType SQLiteBlob :: SQLiteType SQLiteNull :: SQLiteType type Status = Word32 -- | SQLite C status codes. -- -- sQLITE_OK :: Status sQLITE_ERROR :: Status sQLITE_INTERNAL :: Status sQLITE_PERM :: Status sQLITE_ABORT :: Status sQLITE_BUSY :: Status sQLITE_LOCKED :: Status sQLITE_NOMEM :: Status sQLITE_READONLY :: Status sQLITE_INTERRUPT :: Status sQLITE_IOERR :: Status sQLITE_CORRUPT :: Status sQLITE_NOTFOUND :: Status sQLITE_FULL :: Status sQLITE_CANTOPEN :: Status sQLITE_PROTOCOL :: Status sQLITE_EMPTY :: Status sQLITE_SCHEMA :: Status sQLITE_TOOBIG :: Status sQLITE_CONSTRAINT :: Status sQLITE_MISMATCH :: Status sQLITE_MISUSE :: Status sQLITE_NOLFS :: Status sQLITE_AUTH :: Status sQLITE_FORMAT :: Status sQLITE_RANGE :: Status sQLITE_NOTADB :: Status sQLITE_ROW :: Status sQLITE_DONE :: Status -- | SQLite extended result codes: -- -- sQLITE_IOERR_READ :: Status sQLITE_IOERR_SHORT_READ :: Status sQLITE_IOERR_WRITE :: Status sQLITE_IOERR_FSYNC :: Status sQLITE_IOERR_DIR_FSYNC :: Status sQLITE_IOERR_TRUNCATE :: Status sQLITE_IOERR_FSTAT :: Status sQLITE_IOERR_UNLOCK :: Status sQLITE_IOERR_RDLOCK :: Status sQLITE_IOERR_DELETE :: Status sQLITE_IOERR_BLOCKED :: Status sQLITE_IOERR_NOMEM :: Status type OpenFlags = Word32 -- | SQLite flags for open operations. -- -- sQLITE_OPEN_READONLY :: OpenFlags sQLITE_OPEN_READWRITE :: OpenFlags sQLITE_OPEN_CREATE :: OpenFlags sQLITE_OPEN_DELETEONCLOSE :: OpenFlags sQLITE_OPEN_EXCLUSIVE :: OpenFlags sQLITE_OPEN_MAIN_DB :: OpenFlags sQLITE_OPEN_TEMP_DB :: OpenFlags sQLITE_OPEN_TRANSIENT_DB :: OpenFlags sQLITE_OPEN_MAIN_JOURNAL :: OpenFlags sQLITE_OPEN_TEMP_JOURNAL :: OpenFlags sQLITE_OPEN_SUBJOURNAL :: OpenFlags sQLITE_OPEN_MASTER_JOURNAL :: OpenFlags type IOCap = Word32 -- | Device characteristics -- -- sQLITE_IOCAP_ATOMIC :: IOCap sQLITE_IOCAP_ATOMIC512 :: IOCap sQLITE_IOCAP_ATOMIC1K :: IOCap sQLITE_IOCAP_ATOMIC2K :: IOCap sQLITE_IOCAP_ATOMIC4K :: IOCap sQLITE_IOCAP_ATOMIC8K :: IOCap sQLITE_IOCAP_ATOMIC16K :: IOCap sQLITE_IOCAP_ATOMIC32K :: IOCap sQLITE_IOCAP_ATOMIC64K :: IOCap sQLITE_IOCAP_SAFE_APPEND :: IOCap sQLITE_IOCAP_SEQUENTIAL :: IOCap type LockFlag = Word32 -- | File locking levels -- -- sQLITE_LOCK_NONE :: LockFlag sQLITE_LOCK_SHARED :: LockFlag sQLITE_LOCK_RESERVED :: LockFlag sQLITE_LOCK_PENDING :: LockFlag sQLITE_LOCK_EXCLUSIVE :: LockFlag type SyncFlag = Word32 -- | Synchronization flags -- -- sQLITE_SYNC_NORMAL :: SyncFlag sQLITE_SYNC_FULL :: SyncFlag sQLITE_SYNC_DATAONLY :: SyncFlag type AccessFlag = Word32 -- | xAccess methods -- -- sQLITE_ACCESS_EXISTS :: AccessFlag sQLITE_ACCESS_READWRITE :: AccessFlag sQLITE_ACCESS_READ :: AccessFlag type AuthCode = Word32 -- | Authorizer Action Codes -- -- sQLITE_COPY :: AuthCode sQLITE_CREATE_INDEX :: AuthCode sQLITE_CREATE_TABLE :: AuthCode sQLITE_CREATE_TEMP_INDEX :: AuthCode sQLITE_CREATE_TEMP_TABLE :: AuthCode sQLITE_CREATE_TEMP_TRIGGER :: AuthCode sQLITE_CREATE_TEMP_VIEW :: AuthCode sQLITE_CREATE_TRIGGER :: AuthCode sQLITE_CREATE_VIEW :: AuthCode sQLITE_DELETE :: AuthCode sQLITE_DROP_INDEX :: AuthCode sQLITE_DROP_TABLE :: AuthCode sQLITE_DROP_TEMP_INDEX :: AuthCode sQLITE_DROP_TEMP_TABLE :: AuthCode sQLITE_DROP_TEMP_TRIGGER :: AuthCode sQLITE_DROP_TEMP_VIEW :: AuthCode sQLITE_DROP_TRIGGER :: AuthCode sQLITE_DROP_VIEW :: AuthCode sQLITE_INSERT :: AuthCode sQLITE_PRAGMA :: AuthCode sQLITE_READ :: AuthCode sQLITE_SELECT :: AuthCode sQLITE_TRANSACTION :: AuthCode sQLITE_UPDATE :: AuthCode sQLITE_ATTACH :: AuthCode sQLITE_DETACH :: AuthCode sQLITE_ALTER_TABLE :: AuthCode sQLITE_REINDEX :: AuthCode sQLITE_ANALYZE :: AuthCode sQLITE_CREATE_VTABLE :: AuthCode sQLITE_DROP_VTABLE :: AuthCode sQLITE_FUNCTION :: AuthCode type TextEncodeFlag = CInt -- | Text encodings -- -- sQLITE_UTF8 :: TextEncodeFlag sQLITE_UTF16LE :: TextEncodeFlag sQLITE_UTF16BE :: TextEncodeFlag sQLITE_UTF16 :: TextEncodeFlag sQLITE_ANY :: TextEncodeFlag sQLITE_UTF16_ALIGNED :: TextEncodeFlag type FundamentalDatatype = CInt -- | Fundamental datatypes -- -- sQLITE_INTEGER :: FundamentalDatatype sQLITE_FLOAT :: FundamentalDatatype sQLITE_BLOB :: FundamentalDatatype sQLITE_NULL :: FundamentalDatatype sQLITE_TEXT :: FundamentalDatatype isNullStmt :: SQLiteStmt -> Bool noCallback :: SQLiteCallback a freeCallback :: SQLiteCallback a -> IO () instance [incoherent] Eq SQLiteType instance [incoherent] Storable (SQLiteCallback a) instance [incoherent] Storable SQLiteContextBuffer instance [incoherent] Storable SQLiteUTF16 instance [incoherent] Storable SQLiteBLOB instance [incoherent] Storable SQLiteContext instance [incoherent] Storable SQLiteValue instance [incoherent] Storable SQLiteStmt instance [incoherent] Storable SQLite instance [incoherent] Enum SQLiteType -- | The documentation for these functions is at: -- -- module Database.SQLite.Base sqlite3_libversion :: IO CString sqlite3_libversion_number :: IO CString sqlite3_close :: SQLite -> IO Status sqlite3_exec :: SQLite -> CString -> SQLiteCallback ExecHandler -> SQLiteCallbackUserData -> Ptr CString -> IO Status sqlite3_extended_result_codes :: SQLite -> Bool -> IO Status sqlite3_last_insert_rowid :: SQLite -> IO SQLiteInt64 sqlite3_changes :: SQLite -> IO CInt sqlite3_total_changes :: SQLite -> IO CInt sqlite3_interrupt :: SQLite -> IO () sqlite3_complete :: CString -> IO Bool sqlite3_complete16 :: SQLiteUTF16 -> IO Bool sqlite3_busy_handler :: SQLite -> FunPtr (Ptr () -> CInt -> IO CInt) -> Ptr () -> IO Status sqlite3_busy_timeout :: SQLite -> CInt -> IO Status sqlite3_get_table :: SQLite -> CString -> Ptr (Ptr CString) -> Ptr CInt -> Ptr CInt -> Ptr (Ptr CString) -> IO Status sqlite3_free_table :: Ptr (Ptr CString) -> IO () sqlite3_malloc :: CInt -> IO (Ptr ()) sqlite3_realloc :: Ptr () -> CInt -> IO (Ptr ()) sqlite3_free :: Ptr () -> IO () sqlite3_set_authorizer :: SQLite -> FunPtr (Ptr () -> CInt -> CString -> CString -> CString -> CString -> IO Status) -> Ptr () -> IO Status sqlite3_trace :: SQLite -> FunPtr (Ptr () -> CString -> IO ()) -> Ptr () -> IO (Ptr ()) sqlite3_profile :: SQLite -> FunPtr (Ptr () -> CString -> SQLiteInt64 -> IO ()) -> Ptr () -> IO (Ptr ()) sqlite3_progress_handler :: SQLite -> CInt -> FunPtr (Ptr () -> IO CInt) -> Ptr () -> IO () sqlite3_open :: CString -> Ptr SQLite -> IO Status sqlite3_open16 :: SQLiteUTF16 -> Ptr SQLite -> IO Status sqlite3_open_v2 :: CString -> Ptr SQLite -> OpenFlags -> CString -> IO Status sqlite3_errcode :: SQLite -> IO Status sqlite3_errmsg :: SQLite -> IO CString sqlite3_prepare :: SQLite -> CString -> CInt -> Ptr SQLiteStmt -> Ptr CString -> IO Status sqlite3_bind_blob :: SQLiteStmt -> CInt -> Ptr () -> CInt -> FunPtr (Ptr () -> IO ()) -> IO Status sqlite3_bind_double :: SQLiteStmt -> CInt -> Double -> IO Status sqlite3_bind_int :: SQLiteStmt -> CInt -> CInt -> IO Status sqlite3_bind_int64 :: SQLiteStmt -> CInt -> SQLiteInt64 -> IO Status sqlite3_bind_null :: SQLiteStmt -> CInt -> IO Status sqlite3_bind_text :: SQLiteStmt -> CInt -> CString -> CInt -> FunPtr (Ptr () -> IO ()) -> IO Status sqlite3_bind_value :: SQLiteStmt -> CInt -> SQLiteValue -> IO Status sqlite3_bind_zeroblob :: SQLiteStmt -> CInt -> CInt -> IO Status sqlite3_bind_parameter_count :: SQLiteStmt -> IO CInt sqlite3_bind_parameter_name :: SQLiteStmt -> CInt -> IO CString sqlite3_bind_parameter_index :: SQLiteStmt -> CString -> IO CInt sqlite3_clear_bindings :: SQLiteStmt -> IO Status sqlite3_column_count :: SQLiteStmt -> IO CInt sqlite3_column_name :: SQLiteStmt -> CInt -> IO CString sqlite3_column_decltype :: SQLiteStmt -> CInt -> IO CString sqlite3_step :: SQLiteStmt -> IO Status sqlite3_data_count :: SQLiteStmt -> IO Status sqlite3_column_blob :: SQLiteStmt -> CInt -> IO (Ptr ()) sqlite3_column_bytes :: SQLiteStmt -> CInt -> IO CInt sqlite3_column_bytes16 :: SQLiteStmt -> CInt -> IO CInt sqlite3_column_double :: SQLiteStmt -> CInt -> IO Double sqlite3_column_int :: SQLiteStmt -> CInt -> IO CInt sqlite3_column_int64 :: SQLiteStmt -> CInt -> IO SQLiteInt64 sqlite3_column_text :: SQLiteStmt -> CInt -> IO CString sqlite3_column_text16 :: SQLiteStmt -> CInt -> IO SQLiteUTF16 sqlite3_column_type :: SQLiteStmt -> CInt -> IO CInt sqlite3_column_value :: SQLiteStmt -> CInt -> IO SQLiteValue sqlite3_finalize :: SQLiteStmt -> IO Status sqlite3_create_function :: SQLite -> CString -> CInt -> TextEncodeFlag -> SQLiteCallbackUserData -> SQLiteCallback StepHandler -> SQLiteCallback StepHandler -> SQLiteCallback FinalizeContextHandler -> IO CInt sqlite3_value_blob :: SQLiteValue -> IO SQLiteBLOB sqlite3_value_bytes :: SQLiteValue -> IO CInt sqlite3_value_bytes16 :: SQLiteValue -> IO CInt sqlite3_value_double :: SQLiteValue -> IO Double sqlite3_value_int :: SQLiteValue -> IO CInt sqlite3_value_int64 :: SQLiteValue -> IO SQLiteInt64 sqlite3_value_text :: SQLiteValue -> IO CString sqlite3_value_text16 :: SQLiteValue -> IO SQLiteUTF16 sqlite3_value_text16le :: SQLiteValue -> IO SQLiteUTF16 sqlite3_value_text16be :: SQLiteValue -> IO SQLiteUTF16 sqlite3_value_numeric_type :: SQLiteValue -> IO CInt sqlite3_value_type :: SQLiteValue -> IO FundamentalDatatype sqlite3_aggregate_context :: SQLiteContext -> CInt -> IO SQLiteContextBuffer sqlite3_user_data :: SQLiteContext -> IO (Ptr ()) sqlite3_get_auxdata :: SQLiteContext -> CInt -> IO (Ptr ()) sqlite3_set_auxdata :: SQLiteContext -> CInt -> Ptr () -> SQLiteCallback FreeHandler -> IO () sqlite3_static_destructor :: SQLiteCallback FreeHandler sqlite3_transient_destructor :: SQLiteCallback FreeHandler sqlite3_result_blob :: SQLiteContext -> Ptr () -> CInt -> SQLiteCallback FreeHandler -> IO () sqlite3_result_double :: SQLiteContext -> Double -> IO () sqlite3_result_error :: SQLiteContext -> CString -> CInt -> IO () sqlite3_result_error16 :: SQLiteContext -> SQLiteUTF16 -> CInt -> IO () sqlite3_result_error_toobig :: SQLiteContext -> IO () sqlite3_result_int :: SQLiteContext -> CInt -> IO () sqlite3_result_int64 :: SQLiteContext -> SQLiteInt64 -> IO () sqlite3_result_null :: SQLiteContext -> IO () sqlite3_result_text :: SQLiteContext -> CString -> CInt -> SQLiteCallback FreeHandler -> IO () sqlite3_result_text16 :: SQLiteContext -> SQLiteUTF16 -> CInt -> SQLiteCallback FreeHandler -> IO () sqlite3_result_text16le :: SQLiteContext -> SQLiteUTF16 -> CInt -> SQLiteCallback FreeHandler -> IO () sqlite3_result_text16be :: SQLiteContext -> SQLiteUTF16 -> CInt -> SQLiteCallback FreeHandler -> IO () sqlite3_result_value :: SQLiteContext -> SQLiteValue -> IO () sqlite3_result_zeroblob :: SQLiteContext -> CInt -> IO () sqlite3_create_collation :: SQLite -> CString -> TextEncodeFlag -> SQLiteCallbackUserData -> SQLiteCallback CompareHandler -> IO Status sqlite3_create_collation16 :: SQLite -> SQLiteUTF16 -> TextEncodeFlag -> SQLiteCallbackUserData -> SQLiteCallback CompareHandler -> IO Status sqlite3_create_collation_v2 :: SQLite -> CString -> TextEncodeFlag -> SQLiteCallbackUserData -> SQLiteCallback CompareHandler -> SQLiteCallback FreeHandler -> IO Status sqlite3_collation_needed :: SQLite -> SQLiteCallbackUserData -> SQLiteCallback CollationHandler -> IO Status sqlite3_collation_needed16 :: SQLite -> SQLiteCallbackUserData -> SQLiteCallback CollationHandler16 -> IO Status sqlite3_sleep :: CInt -> IO Status sqlite3_set_temp_directory :: CString -> IO () sqlite3_get_temp_directory :: IO CString sqlite3_get_autocommit :: SQLite -> IO Bool sqlite3_db_handle :: SQLiteStmt -> IO SQLite sqlite3_commit_hook :: SQLite -> SQLiteCallback FilterHandler -> SQLiteCallbackUserData -> IO (SQLiteCallback FilterHandler) sqlite3_rollback_hook :: SQLite -> SQLiteCallback FreeHandler -> SQLiteCallbackUserData -> IO (SQLiteCallback FreeHandler) sqlite3_update_hook :: SQLite -> SQLiteCallback UpdateHook -> SQLiteCallbackUserData -> IO (SQLiteCallback FreeHandler) sqlite3_enable_shared_cache :: CInt -> IO CInt sqlite3_blob_open :: SQLite -> CString -> CString -> CString -> SQLiteInt64 -> Bool -> Ptr SQLiteBLOB -> IO Status sqlite3_blob_close :: SQLiteBLOB -> IO Status sqlite3_blob_bytes :: SQLiteBLOB -> IO CInt sqlite3_blob_read :: SQLiteBLOB -> Ptr () -> CInt -> CInt -> IO Status sqlite3_blob_write :: SQLiteBLOB -> Ptr () -> CInt -> CInt -> IO Status type ExecHandler = SQLiteCallbackUserData -> CInt -> Ptr CString -> Ptr CString -> IO Status type FreeHandler = SQLiteCallbackUserData -> IO () type UpdateHook = SQLiteCallbackUserData -> CInt -> CString -> CString -> SQLiteInt64 -> IO () type FilterHandler = SQLiteCallbackUserData -> IO Status type StepHandler = SQLiteContext -> CInt -> Ptr SQLiteValue -> IO () type FinalizeContextHandler = SQLiteContext -> IO () type CompareHandler = SQLiteCallbackUserData -> CInt -> Ptr () -> CInt -> Ptr () -> IO CInt type CollationHandler = SQLiteCallbackUserData -> SQLite -> TextEncodeFlag -> CString -> IO () type CollationHandler16 = SQLiteCallbackUserData -> SQLite -> TextEncodeFlag -> SQLiteUTF16 -> IO () mkExecHandler :: ExecHandler -> IO (SQLiteCallback ExecHandler) mkFreeHandler :: FreeHandler -> IO (SQLiteCallback FreeHandler) mkUpdateHook :: UpdateHook -> IO (SQLiteCallback UpdateHook) mkFilterHandler :: FilterHandler -> IO (SQLiteCallback FilterHandler) mkStepHandler :: StepHandler -> IO (SQLiteCallback StepHandler) mkFinalizeContextHandler :: FinalizeContextHandler -> IO (SQLiteCallback FinalizeContextHandler) mkCompareHandler :: CompareHandler -> IO (SQLiteCallback CompareHandler) mkCollationHandler :: CollationHandler -> IO (SQLiteCallback CollationHandler) mkCollationHandler16 :: CollationHandler16 -> IO (SQLiteCallback CollationHandler16) -- | A Haskell binding to the sqlite3 database. See: -- -- -- -- for more information. -- -- The api is documented at: -- -- module Database.SQLite -- | Open a new database connection, whose name is given by the -- dbName argument. A sqlite3 handle is returned. -- -- An exception is thrown if the database could not be opened. openConnection :: String -> IO SQLiteHandle -- | Open a new database connection read-only, whose name is given by the -- dbName argument. A sqlite3 handle is returned. -- -- An exception is thrown if the database does not exist, or could not be -- opened. openReadonlyConnection :: String -> IO SQLiteHandle -- | Close a database connection. Destroys the SQLite value associated with -- a database, closes all open files relating to the database, and -- releases all resources. closeConnection :: SQLiteHandle -> IO () -- | Evaluate the SQL statement specified by sqlStmt execStatement :: SQLiteResult a => SQLiteHandle -> String -> IO (Either String [[Row a]]) -- | Returns an error, or Nothing if everything was OK. execStatement_ :: SQLiteHandle -> String -> IO (Maybe String) -- | Prepare and execute a parameterized statment. Statement parameter -- names start with a colon (for example, :col_id). Note that -- for the moment, column names should not contain 0 characters because -- that part of the column name will be ignored. execParamStatement :: SQLiteResult a => SQLiteHandle -> String -> [(String, Value)] -> IO (Either String [[Row a]]) -- | Prepare and execute a parameterized statment, ignoring the result. See -- also execParamStatement. execParamStatement_ :: SQLiteHandle -> String -> [(String, Value)] -> IO (Maybe String) -- | Insert a row into the table tab. insertRow :: SQLiteHandle -> TableName -> Row String -> IO (Maybe String) -- | Define a new table, populated from tab in the database. defineTable :: SQLiteHandle -> SQLTable -> IO (Maybe String) defineTableOpt :: SQLiteHandle -> Bool -> SQLTable -> IO (Maybe String) -- | Return the rowid (as an Integer) of the most recent successful INSERT -- into the database. getLastRowID :: SQLiteHandle -> IO Integer type Row a = [(ColumnName, a)] data Value Double :: Double -> Value Int :: Int64 -> Value Text :: String -> Value Blob :: ByteString -> Value Null :: Value -- | This function registers a RegexpHandler to be called when -- REGEXP(regexp,str) is used in an SQL query. addRegexpSupport :: SQLiteHandle -> RegexpHandler -> IO () -- | This is the type of the function supported by the -- addRegexpSupport function. The first argument is the regular -- expression to match with and the second argument is the string to -- match. The result shall be True for successful match and -- False otherwise. type RegexpHandler = ByteString -> ByteString -> IO Bool withPrim :: SQLiteHandle -> (SQLite -> IO a) -> IO a data SQLiteHandle newSQLiteHandle :: SQLite -> IO SQLiteHandle class IsValue a fromSQLiteValue :: IsValue a => SQLiteValue -> IO a returnSQLiteValue :: IsValue a => SQLiteContext -> a -> IO () class IsFunctionHandler a funcArity :: IsFunctionHandler a => a -> Arity funcHandler :: IsFunctionHandler a => a -> FunctionHandler createFunction :: IsFunctionHandler a => SQLiteHandle -> FunctionName -> a -> IO () createFunctionPrim :: SQLiteHandle -> FunctionName -> Arity -> FunctionHandler -> IO () createAggregatePrim :: (IsValue i, IsValue o) => SQLiteHandle -> FunctionName -> Arity -> (a -> [i] -> IO a) -> a -> (a -> IO o) -> IO () instance [incoherent] Show Value instance [incoherent] IsValue a => IsValue (Maybe a) instance [incoherent] IsValue () instance [incoherent] IsValue ByteString instance [incoherent] IsValue String instance [incoherent] IsValue CStringLen instance [incoherent] IsValue Int instance [incoherent] IsValue CInt instance [incoherent] IsValue Int64 instance [incoherent] IsValue Double instance [incoherent] IsValue Value instance [incoherent] IsValue SQLiteValue instance [incoherent] (IsValue a, IsValue r) => IsFunctionHandler ([a] -> IO r) instance [incoherent] (IsValue a, IsValue b, IsValue c, IsValue d, IsValue r) => IsFunctionHandler (a -> b -> c -> d -> IO r) instance [incoherent] (IsValue a, IsValue b, IsValue c, IsValue r) => IsFunctionHandler (a -> b -> c -> IO r) instance [incoherent] (IsValue a, IsValue b, IsValue r) => IsFunctionHandler (a -> b -> IO r) instance [incoherent] (IsValue a, IsValue r) => IsFunctionHandler (a -> IO r) instance [incoherent] IsValue r => IsFunctionHandler (String -> IO r) instance [incoherent] IsValue r => IsFunctionHandler (IO r) instance [incoherent] (IsValue a, IsValue r) => IsFunctionHandler ([a] -> r) instance [incoherent] (IsValue a, IsValue b, IsValue c, IsValue d, IsValue r) => IsFunctionHandler (a -> b -> c -> d -> r) instance [incoherent] (IsValue a, IsValue b, IsValue c, IsValue r) => IsFunctionHandler (a -> b -> c -> r) instance [incoherent] (IsValue a, IsValue b, IsValue r) => IsFunctionHandler (a -> b -> r) instance [incoherent] (IsValue a, IsValue r) => IsFunctionHandler (a -> r) instance [incoherent] IsValue r => IsFunctionHandler (String -> r) instance [incoherent] IsValue r => IsFunctionHandler r instance [incoherent] SQLiteResult Value instance [incoherent] SQLiteResult () instance [incoherent] SQLiteResult String