-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Bindings for SQL/CLI (ODBC) C API. -- -- See NEWS for the ChangeLog. Provides bindings to all the -- SQL/CLI C API standard. SQL/CLI C API is a subset of ODBC. You can use -- this package to access databases through ODBC. It is tested on -- Windows, Linux and Mac operating Systems whith Postgres, Oracle and -- SQLite. This package also contains Haskell wrapers to the foreign C -- calls and utilities to make using the SQL/CLI easier for the Haskell -- programmer. You can use this to acces any database through ODBC. @package sqlcli @version 0.2.2.0 module SQL.CLI type SQLCHAR = CUChar type SQLINTEGER = CLong type SQLSMALLINT = CShort type SQLDOUBLE = CDouble type SQLFLOAT = CDouble type SQLREAL = CFloat type SQLPOINTER = Ptr () type SQLDATE = CUChar type SQLTIME = CUChar type SQLTIMESTAMP = CUChar type SQLVARCHAR = CUChar type SQLDECIMAL = CUChar type SQLNUMERIC = CUChar type SQLRETURN = SQLSMALLINT type SQLHANDLE = SQLINTEGER type SQLHENV = SQLHANDLE type SQLHDBC = SQLHANDLE type SQLHSTMT = SQLHANDLE type SQLHDESC = SQLHANDLE type SQLLEN = CLong type SQLULEN = CULong sql_null_data :: Num a => a sql_data_at_exec :: Num a => a sql_success :: SQLRETURN sql_success_with_info :: SQLRETURN sql_no_data :: SQLRETURN sql_error :: SQLRETURN sql_invalid_handle :: SQLRETURN sql_need_data :: SQLRETURN -- | Test for sql_success or sql_success_with_info sql_succeeded :: SQLRETURN -> Bool sql_nts :: Num a => a sql_ntsl :: Num a => a -- | maximum message lenth Vendors may increase this constant but its value -- must be at lieast 512 sql_max_message_length :: Num a => a -- | maximum identifier length sql_max_id_length :: Num a => a sql_date_len :: Num a => a sql_time_len :: Num a => a sql_timestamp_len :: Num a => a sql_handle_env :: Num a => a sql_handle_dbc :: Num a => a sql_handle_stmt :: Num a => a sql_handle_desc :: Num a => a -- | environment attribute sql_attr_output_nts :: Num a => a -- | connection attribute sql_attr_auto_ipd :: Num a => a -- | connection and schema attributes sql_attr_metadata_id :: Num a => a sql_attr_app_row_desc :: Num a => a sql_attr_app_param_desc :: Num a => a sql_attr_imp_row_desc :: Num a => a sql_attr_imp_param_desc :: Num a => a sql_attr_cursor_scrollable :: Num a => a sql_attr_cursor_sensitivity :: Num a => a sql_desc_count :: Num a => a sql_desc_type :: Num a => a sql_desc_length :: Num a => a sql_desc_octet_length_ptr :: Num a => a sql_desc_precision :: Num a => a sql_desc_scale :: Num a => a sql_desc_datetime_interval_code :: Num a => a sql_desc_nullable :: Num a => a sql_desc_indicator_ptr :: Num a => a sql_desc_data_ptr :: Num a => a sql_desc_name :: Num a => a sql_desc_unnamed :: Num a => a sql_desc_octet_length :: Num a => a sql_desc_alloc_type :: Num a => a sql_diag_returncode :: Num a => a sql_diag_number :: Num a => a sql_diag_row_count :: Num a => a sql_diag_sqlstate :: Num a => a sql_diag_native :: Num a => a sql_diag_message_text :: Num a => a sql_diag_dynamic_function :: Num a => a sql_diag_class_origin :: Num a => a sql_diag_subclass_origin :: Num a => a sql_diag_connection_name :: Num a => a sql_diag_server_name :: Num a => a sql_diag_dynamic_function_code :: Num a => a sql_diag_alter_table :: Num a => a sql_diag_create_index :: Num a => a sql_diag_create_table :: Num a => a sql_diag_create_view :: Num a => a sql_diag_delete_where :: Num a => a sql_diag_drop_index :: Num a => a sql_diag_drop_table :: Num a => a sql_diag_drop_view :: Num a => a sql_diag_dynamic_delete_cursor :: Num a => a sql_diag_dynamic_update_cursor :: Num a => a sql_diag_grant :: Num a => a sql_diag_insert :: Num a => a sql_diag_revoke :: Num a => a sql_diag_select_cursor :: Num a => a sql_diag_unknown_statement :: Num a => a sql_diag_update_where :: Num a => a sql_char :: Num a => a sql_numeric :: Num a => a sql_decimal :: Num a => a sql_integer :: Num a => a sql_smallint :: Num a => a sql_float :: Num a => a sql_real :: Num a => a sql_double :: Num a => a sql_datetime :: Num a => a sql_varchar :: Num a => a sql_type_date :: Num a => a sql_type_time :: Num a => a sql_type_timestamp :: Num a => a sql_unspecified :: Num a => a sql_insensitive :: Num a => a sql_sensitive :: Num a => a sql_all_types :: Num a => a sql_default :: Num a => a sql_ard_type :: Num a => a sql_code_date :: Num a => a sql_code_time :: Num a => a sql_code_timestamp :: Num a => a sql_false :: Num a => a sql_true :: Num a => a sql_no_nulls :: Num a => a sql_nullable :: Num a => a sql_nullable_unknown :: Num a => a sql_pred_none :: Num a => a sql_pred_char :: Num a => a sql_pred_basic :: Num a => a sql_named :: Num a => a sql_unnamed :: Num a => a sql_desc_alloc_auto :: Num a => a sql_desc_alloc_user :: Num a => a sql_close :: Num a => a sql_drop :: Num a => a sql_unbind :: Num a => a sql_reset_params :: Num a => a sql_fetch_next :: Num a => a sql_fetch_first :: Num a => a sql_fetch_last :: Num a => a sql_fetch_prior :: Num a => a sql_fetch_absolute :: Num a => a sql_fetch_relative :: Num a => a sql_commit :: Num a => a sql_rollback :: Num a => a sql_null_henv :: SQLHANDLE sql_null_hdbc :: SQLHANDLE sql_null_hstmt :: SQLHANDLE sql_null_hdesc :: SQLHANDLE sql_null_handle :: SQLHANDLE sql_scope_currow :: Num a => a sql_scope_transaction :: Num a => a sql_scope_session :: Num a => a sql_pc_unknown :: Num a => a sql_pc_non_pseudo :: Num a => a sql_pc_pseudo :: Num a => a sql_row_identifier :: Num a => a sql_index_unique :: Num a => a sql_index_all :: Num a => a sql_index_clustered :: Num a => a sql_index_hashed :: Num a => a sql_index_other :: Num a => a sql_api_sqlallocconnect :: Num a => a sql_api_sqlallocenv :: Num a => a sql_api_sqlallochandle :: Num a => a sql_api_sqlallocstmt :: Num a => a sql_api_sqlbindcol :: Num a => a sql_api_sqlbindparam :: Num a => a sql_api_sqlcancel :: Num a => a sql_api_sqlclosecursor :: Num a => a sql_api_sqlcolattribute :: Num a => a sql_api_sqlcolumns :: Num a => a sql_api_sqlconnect :: Num a => a sql_api_sqlcopydesc :: Num a => a sql_api_sqldatasources :: Num a => a sql_api_sqldescribecol :: Num a => a sql_api_sqldisconnect :: Num a => a sql_api_sqlendtran :: Num a => a sql_api_sqlerror :: Num a => a sql_api_sqlexecdirect :: Num a => a sql_api_sqlexecute :: Num a => a sql_api_sqlfetch :: Num a => a sql_api_sqlfetchscroll :: Num a => a sql_api_sqlfreeconnect :: Num a => a sql_api_sqlfreeenv :: Num a => a sql_api_sqlfreehandle :: Num a => a sql_api_sqlfreestmt :: Num a => a sql_api_sqlgetconnectattr :: Num a => a sql_api_sqlgetconnectoption :: Num a => a sql_api_sqlgetcursorname :: Num a => a sql_api_sqlgetdata :: Num a => a sql_api_sqlgetdescfield :: Num a => a sql_api_sqlgetdescrec :: Num a => a sql_api_sqlgetdiagfield :: Num a => a sql_api_sqlgetdiagrec :: Num a => a sql_api_sqlgetenvattr :: Num a => a sql_api_sqlgetfunctions :: Num a => a sql_api_sqlgetinfo :: Num a => a sql_api_sqlgetstmtattr :: Num a => a sql_api_sqlgetstmtoption :: Num a => a sql_api_sqlgettypeinfo :: Num a => a sql_api_sqllanguages :: Num a => a sql_api_sqlnumresultcols :: Num a => a sql_api_sqlparamdata :: Num a => a sql_api_sqlprepare :: Num a => a sql_api_sqlputdata :: Num a => a sql_api_sqlreleaseenv :: Num a => a sql_api_sqlrowcount :: Num a => a sql_api_sqlserverinfo :: Num a => a sql_api_sqlsetconnectattr :: Num a => a sql_api_sqlsetconnectoption :: Num a => a sql_api_sqlsetcursorname :: Num a => a sql_api_sqlsetdescfield :: Num a => a sql_api_sqlsetdescrec :: Num a => a sql_api_sqlsetenvattr :: Num a => a sql_api_sqlsetparam :: Num a => a sql_api_sqlsetstmtattr :: Num a => a sql_api_sqlsetstmtoption :: Num a => a sql_api_sqlspecialcolumns :: Num a => a sql_api_sqlstatistics :: Num a => a sql_api_sqltables :: Num a => a sql_api_sqltransact :: Num a => a sql_max_driver_connections :: Num a => a sql_max_concurrent_activities :: Num a => a sql_data_source_name :: Num a => a sql_fetch_direction :: Num a => a sql_server_name :: Num a => a sql_search_pattern_escape :: Num a => a sql_dbms_name :: Num a => a sql_dbms_ver :: Num a => a sql_accessible_tables :: Num a => a sql_cursor_commit_behavior :: Num a => a sql_data_source_read_only :: Num a => a sql_default_txn_isolation :: Num a => a sql_identifier_case :: Num a => a sql_identifier_quote_char :: Num a => a sql_max_column_name_len :: Num a => a sql_max_cursor_name_len :: Num a => a sql_max_schema_name_len :: Num a => a sql_max_catalog_name_len :: Num a => a sql_max_table_name_len :: Num a => a sql_scroll_concurrency :: Num a => a sql_txn_capable :: Num a => a sql_user_name :: Num a => a sql_txn_isolation_option :: Num a => a sql_integrity :: Num a => a sql_getdata_extensions :: Num a => a sql_null_collation :: Num a => a sql_alter_table :: Num a => a sql_order_by_columns_in_select :: Num a => a sql_special_characters :: Num a => a sql_max_columns_in_group_by :: Num a => a sql_max_columns_in_index :: Num a => a sql_max_columns_in_order_by :: Num a => a sql_max_columns_in_select :: Num a => a sql_max_columns_in_table :: Num a => a sql_max_index_size :: Num a => a sql_max_row_size :: Num a => a sql_max_statement_len :: Num a => a sql_max_tables_in_select :: Num a => a sql_max_user_name_len :: Num a => a sql_oj_capabilities :: Num a => a sql_xopen_cli_year :: Num a => a sql_cursor_sensitivity :: Num a => a sql_describe_parameter :: Num a => a sql_catalog_name :: Num a => a sql_collation_seq :: Num a => a sql_max_identifier_len :: Num a => a sql_at_add_column :: CLong sql_at_drop_column :: CLong sql_at_alter_column :: CLong sql_at_add_constraint :: CLong sql_at_drop_constraint :: CLong sql_cb_delete :: Num a => a sql_cb_close :: Num a => a sql_cb_preserve :: Num a => a sql_fd_fetch_next :: CLong sql_fd_fetch_first :: CLong sql_fd_fetch_last :: CLong sql_fd_fetch_prior :: CLong sql_fd_fetch_absolute :: CLong sql_fd_fetch_relative :: CLong sql_gd_any_column :: CLong sql_gd_any_order :: CLong sql_ic_upper :: Num a => a sql_ic_lower :: Num a => a sql_ic_sensitive :: Num a => a sql_ic_mixed :: Num a => a sql_oj_left :: CLong sql_oj_right :: CLong sql_oj_full :: CLong sql_oj_nested :: CLong sql_oj_not_ordered :: CLong sql_oj_inner :: CLong sql_oj_all_comparison_ops :: CLong sql_scco_read_only :: CLong sql_scco_lock :: CLong sql_scco_opt_rowver :: CLong sql_scco_opt_values :: CLong sql_tc_none :: Num a => a sql_tc_dml :: Num a => a sql_tc_all :: Num a => a sql_tc_ddl_commit :: Num a => a sql_tc_ddl_ignore :: Num a => a sql_txn_read_uncommitted :: CLong sql_txn_read_committed :: CLong sql_txn_repeatable_read :: CLong sql_txn_serializable :: CLong sqlallocconnect :: SQLHENV -> Ptr SQLHDBC -> IO SQLRETURN sqlallocenv :: Ptr SQLHENV -> IO SQLRETURN sqlallochandle :: SQLSMALLINT -> SQLHANDLE -> Ptr SQLHANDLE -> IO SQLRETURN sqlallocstmt :: SQLHDBC -> Ptr SQLHSTMT -> IO SQLRETURN sqlbindcol :: SQLHSTMT -> SQLSMALLINT -> SQLSMALLINT -> SQLPOINTER -> SQLLEN -> Ptr SQLLEN -> IO SQLRETURN sqlbindparam :: SQLHSTMT -> SQLSMALLINT -> SQLSMALLINT -> SQLSMALLINT -> SQLULEN -> SQLSMALLINT -> SQLPOINTER -> Ptr SQLLEN -> IO SQLRETURN sqlcancel :: SQLHSTMT -> IO SQLRETURN sqlclosecursor :: SQLHSTMT -> IO SQLRETURN sqlcolattribute :: SQLHSTMT -> SQLSMALLINT -> SQLSMALLINT -> SQLPOINTER -> SQLSMALLINT -> Ptr SQLSMALLINT -> Ptr SQLLEN -> IO SQLRETURN sqlcolumns :: SQLHSTMT -> Ptr SQLCHAR -> SQLSMALLINT -> Ptr SQLCHAR -> SQLSMALLINT -> Ptr SQLCHAR -> SQLSMALLINT -> Ptr SQLCHAR -> SQLSMALLINT -> IO SQLRETURN sqlconnect :: SQLHDBC -> Ptr SQLCHAR -> SQLSMALLINT -> Ptr SQLCHAR -> SQLSMALLINT -> Ptr SQLCHAR -> SQLSMALLINT -> IO SQLRETURN sqlopydesc :: SQLHDESC -> SQLHDESC -> IO SQLRETURN sqldatasources :: SQLHENV -> SQLSMALLINT -> Ptr SQLCHAR -> SQLSMALLINT -> Ptr SQLSMALLINT -> Ptr SQLCHAR -> SQLSMALLINT -> Ptr SQLSMALLINT -> IO SQLRETURN sqldescribecol :: SQLHSTMT -> SQLSMALLINT -> Ptr SQLCHAR -> SQLSMALLINT -> Ptr SQLSMALLINT -> Ptr SQLSMALLINT -> Ptr SQLULEN -> Ptr SQLSMALLINT -> Ptr SQLSMALLINT -> IO SQLRETURN sqldisconnect :: SQLHDBC -> IO SQLRETURN sqlendtran :: SQLSMALLINT -> SQLHANDLE -> SQLSMALLINT -> IO SQLRETURN sqlerror :: SQLHENV -> SQLHDBC -> SQLHSTMT -> Ptr SQLCHAR -> Ptr SQLINTEGER -> Ptr SQLCHAR -> SQLSMALLINT -> Ptr SQLSMALLINT -> IO SQLRETURN sqlexecdirect :: SQLHSTMT -> Ptr SQLCHAR -> SQLINTEGER -> IO SQLRETURN sqlexecute :: SQLHSTMT -> IO SQLRETURN sqlfetch :: SQLHSTMT -> IO SQLRETURN sqlfetchscroll :: SQLHSTMT -> SQLSMALLINT -> SQLLEN -> IO SQLRETURN sqlfreeconnect :: SQLHDBC -> IO SQLRETURN sqlfreeenv :: SQLHENV -> IO SQLRETURN sqlfreehandle :: SQLSMALLINT -> SQLHANDLE -> IO SQLRETURN sqlfreestmt :: SQLHSTMT -> SQLSMALLINT -> IO SQLRETURN sqlgetconnectattr :: SQLHDBC -> SQLINTEGER -> SQLPOINTER -> SQLINTEGER -> Ptr SQLINTEGER -> IO SQLRETURN sqlgetconnectoption :: SQLHDBC -> SQLSMALLINT -> SQLPOINTER -> IO SQLRETURN sqlgetcursorname :: SQLHSTMT -> Ptr SQLCHAR -> SQLSMALLINT -> Ptr SQLSMALLINT -> IO SQLRETURN sqlgetdata :: SQLHSTMT -> SQLSMALLINT -> SQLSMALLINT -> SQLPOINTER -> SQLLEN -> Ptr SQLLEN -> IO SQLRETURN sqlgetdescfield :: SQLHDESC -> SQLSMALLINT -> SQLSMALLINT -> SQLPOINTER -> SQLINTEGER -> Ptr SQLINTEGER -> IO SQLRETURN sqlgetdescrec :: SQLHDESC -> SQLSMALLINT -> Ptr SQLCHAR -> SQLSMALLINT -> Ptr SQLSMALLINT -> Ptr SQLSMALLINT -> Ptr SQLSMALLINT -> Ptr SQLLEN -> Ptr SQLSMALLINT -> Ptr SQLSMALLINT -> Ptr SQLSMALLINT -> IO SQLRETURN sqlgetdiagfield :: SQLSMALLINT -> SQLHANDLE -> SQLSMALLINT -> SQLSMALLINT -> SQLPOINTER -> SQLSMALLINT -> Ptr SQLSMALLINT -> IO SQLRETURN sqlgetdiagrec :: SQLSMALLINT -> SQLHANDLE -> SQLSMALLINT -> Ptr SQLCHAR -> Ptr SQLINTEGER -> Ptr SQLCHAR -> SQLSMALLINT -> Ptr SQLSMALLINT -> IO SQLRETURN sqlgetenvattr :: SQLHENV -> SQLINTEGER -> SQLPOINTER -> SQLINTEGER -> Ptr SQLINTEGER -> IO SQLRETURN sqlgetfunctions :: SQLHDBC -> SQLSMALLINT -> Ptr SQLSMALLINT -> IO SQLRETURN sqlgetinfo :: SQLHDBC -> SQLSMALLINT -> SQLPOINTER -> SQLSMALLINT -> Ptr SQLSMALLINT -> IO SQLRETURN sqlgetstmtattr :: SQLHSTMT -> SQLINTEGER -> SQLPOINTER -> SQLINTEGER -> Ptr SQLINTEGER -> IO SQLRETURN sqlgetstmtoption :: SQLHSTMT -> SQLSMALLINT -> SQLPOINTER -> IO SQLRETURN sqlgettypeinfo :: SQLHSTMT -> SQLSMALLINT -> IO SQLRETURN sqlnumresultcols :: SQLHSTMT -> Ptr SQLSMALLINT -> IO SQLRETURN sqlparamdata :: SQLHSTMT -> Ptr SQLPOINTER -> IO SQLRETURN sqlprepare :: SQLHSTMT -> Ptr SQLCHAR -> SQLINTEGER -> IO SQLRETURN sqlputdata :: SQLHSTMT -> SQLPOINTER -> SQLLEN -> IO SQLRETURN sqlrowcount :: SQLHSTMT -> Ptr SQLLEN -> IO SQLRETURN sqlsetconnectattr :: SQLHDBC -> SQLINTEGER -> SQLPOINTER -> SQLINTEGER -> IO SQLRETURN sqlsetconnectoption :: SQLHDBC -> SQLSMALLINT -> SQLPOINTER -> IO SQLRETURN sqlsetcursorname :: SQLHSTMT -> Ptr SQLCHAR -> SQLSMALLINT -> IO SQLRETURN sqlsetdescfield :: SQLHDESC -> SQLSMALLINT -> SQLSMALLINT -> SQLPOINTER -> SQLINTEGER -> IO SQLRETURN sqlsetdescrec :: SQLHDESC -> SQLSMALLINT -> SQLSMALLINT -> SQLSMALLINT -> SQLINTEGER -> SQLSMALLINT -> SQLSMALLINT -> SQLPOINTER -> Ptr SQLLEN -> Ptr SQLLEN -> IO SQLRETURN sqlsetenvattr :: SQLHENV -> SQLINTEGER -> SQLPOINTER -> SQLINTEGER -> IO SQLRETURN sqlsetparam :: SQLHSTMT -> SQLSMALLINT -> SQLSMALLINT -> SQLSMALLINT -> SQLULEN -> SQLSMALLINT -> SQLPOINTER -> Ptr SQLLEN -> IO SQLRETURN sqlsetstmtattr :: SQLHSTMT -> SQLINTEGER -> SQLPOINTER -> SQLULEN -> IO SQLRETURN sqlsetstmtoption :: SQLHSTMT -> SQLSMALLINT -> SQLPOINTER -> IO SQLRETURN sqlspecialcolumns :: SQLHSTMT -> SQLSMALLINT -> Ptr SQLCHAR -> SQLSMALLINT -> Ptr SQLCHAR -> SQLSMALLINT -> Ptr SQLCHAR -> SQLSMALLINT -> SQLSMALLINT -> SQLSMALLINT -> IO SQLRETURN sqlstatistics :: SQLHSTMT -> Ptr SQLCHAR -> SQLSMALLINT -> Ptr SQLCHAR -> SQLSMALLINT -> Ptr SQLCHAR -> SQLSMALLINT -> SQLSMALLINT -> SQLSMALLINT -> IO SQLRETURN sqltables :: SQLHSTMT -> Ptr SQLCHAR -> SQLSMALLINT -> Ptr SQLCHAR -> SQLSMALLINT -> Ptr SQLCHAR -> SQLSMALLINT -> Ptr SQLCHAR -> SQLSMALLINT -> IO SQLRETURN sqltransact :: SQLHENV -> SQLHDBC -> SQLSMALLINT -> IO SQLRETURN module SQL.CLI.Utils logSrc :: Text -- | convert an implementation type to a SQL/CLI known type; checks if the -- type identifier is a SQL/CLI type; if not returns sql_varchar toCLIType :: SQLSMALLINT -> SQLSMALLINT -- | configuration values dependent on the actual CLI implementation data SQLConfig SQLConfig :: SQLSMALLINT -> SQLSMALLINT -> SQLSMALLINT -> SQLSMALLINT -> SQLSMALLINT -> SQLSMALLINT -> SQLSMALLINT -> SQLSMALLINT -> SQLSMALLINT -> SQLSMALLINT -> SQLSMALLINT -> SQLSMALLINT -> SQLSMALLINT -> SQLSMALLINT -> SQLSMALLINT -> SQLSMALLINT -> SQLSMALLINT -> SQLConfig -- | position of TABLE_CAT column in the resultset returned by Columns API -- call [sql_cli_flds_table_cat] :: SQLConfig -> SQLSMALLINT -- | position of TABLE_SCHEM column in the resultset returned by Columns -- API call [sql_cli_flds_table_schem] :: SQLConfig -> SQLSMALLINT -- | position of TABLE_NAME column in the resultset returned by Columns API -- call [sql_cli_flds_table_name] :: SQLConfig -> SQLSMALLINT -- | position of COLUMN_NAME column in the resultset returned by Columns -- API call [sql_cli_flds_column_name] :: SQLConfig -> SQLSMALLINT -- | position of DATA_TYPE column in the resultset returned by Columns API -- call [sql_cli_flds_data_type] :: SQLConfig -> SQLSMALLINT -- | position of TYPE_NAME column in the resultset returned by Columns API -- call [sql_cli_flds_type_name] :: SQLConfig -> SQLSMALLINT -- | position of COLUMN_SIZE column in the resultset returned by Columns -- API call [sql_cli_flds_column_size] :: SQLConfig -> SQLSMALLINT -- | position of BUFFER_LENGTH column in the resultset returned by Columns -- API call [sql_cli_flds_buffer_length] :: SQLConfig -> SQLSMALLINT -- | position of DECIMAL_DIGITS column in the resultset returned by Columns -- API call [sql_cli_flds_decimal_digits] :: SQLConfig -> SQLSMALLINT -- | position of NUM_PREC_RADIX column in the resultset returned by Columns -- API call [sql_cli_flds_num_prec_radix] :: SQLConfig -> SQLSMALLINT -- | position of NULLABLE column in the resultset returned by Columns API -- call [sql_cli_flds_nullable] :: SQLConfig -> SQLSMALLINT -- | position of REMARKS column in the resultset returned by Columns API -- call [sql_cli_flds_remarks] :: SQLConfig -> SQLSMALLINT -- | position of COLUMN_DEF column in the resultset returned by Columns API -- call [sql_cli_flds_column_def] :: SQLConfig -> SQLSMALLINT -- | position of DATETIME_CODE column in the resultset returned by Columns -- API call [sql_cli_flds_datetime_code] :: SQLConfig -> SQLSMALLINT -- | position of CHAR_OCTET_LENGTH column in the resultset returned by -- Columns API call [sql_cli_flds_char_octet_length] :: SQLConfig -> SQLSMALLINT -- | position of ORDINAL_POSITION column in the resultset returned by -- Columns API call [sql_cli_flds_ordinal_position] :: SQLConfig -> SQLSMALLINT -- | position of IS_NULLABLE column in the resultset returned by Columns -- API call [sql_cli_flds_is_nullable] :: SQLConfig -> SQLSMALLINT -- | information about column in the database; the meaning of fields is -- detailed in the SQL CLI specification in the documenation of Columns -- API call data ColumnInfo ColumnInfo :: Maybe String -> String -> String -> String -> SQLSMALLINT -> String -> Maybe SQLINTEGER -> Maybe SQLINTEGER -> Maybe SQLSMALLINT -> Maybe SQLSMALLINT -> SQLSMALLINT -> Maybe String -> Maybe String -> Maybe SQLINTEGER -> Maybe SQLINTEGER -> SQLINTEGER -> Maybe String -> ColumnInfo [ci_TableCat] :: ColumnInfo -> Maybe String [ci_TableSchem] :: ColumnInfo -> String [ci_TableName] :: ColumnInfo -> String [ci_ColumnName] :: ColumnInfo -> String [ci_DataType] :: ColumnInfo -> SQLSMALLINT [ci_TypeName] :: ColumnInfo -> String [ci_ColumnSize] :: ColumnInfo -> Maybe SQLINTEGER [ci_BufferLength] :: ColumnInfo -> Maybe SQLINTEGER [ci_DecimalDigits] :: ColumnInfo -> Maybe SQLSMALLINT [ci_NumPrecRadix] :: ColumnInfo -> Maybe SQLSMALLINT [ci_Nullable] :: ColumnInfo -> SQLSMALLINT [ci_Remarks] :: ColumnInfo -> Maybe String [ci_ColumnDef] :: ColumnInfo -> Maybe String [ci_DatetimeCode] :: ColumnInfo -> Maybe SQLINTEGER [ci_CharOctetLength] :: ColumnInfo -> Maybe SQLINTEGER [ci_OrdinalPosition] :: ColumnInfo -> SQLINTEGER [ci_IsNullable] :: ColumnInfo -> Maybe String -- | Read columns information for a given table on a database connection. -- It returns a ReaderT value that will get implementation -- dependent fieled numbers in the result set returned by Columns API -- call from a SQLConfig value. collectColumnsInfo :: (MonadIO m, MonadFail m) => SQLHDBC -> String -> String -> ReaderT SQLConfig m [ColumnInfo] -- | Implements the logic of collectColumnsInfo getting the handle -- to the statement that was used to call sqlcolumns on collectColumnsInfo' :: (MonadIO m, MonadFail m) => SQLHSTMT -> ReaderT SQLConfig m [ColumnInfo] -- | Checks if a table exists on the current connection. tableExists :: (MonadIO m, MonadFail m) => SQLHDBC -> String -> String -> m Bool -- | wrapper to SQL/CLI function EndTran; it creates a monadic action to -- call the foreign API function and to log diagnostics on the standard -- output; it fails if the API call fails endTran :: (MonadIO m, MonadFail m) => SQLSMALLINT -> SQLHANDLE -> SQLSMALLINT -> m () -- | wrapper for SQL/CLI function SetConnectAttr; it creates a monadic -- action that calls the foreign API function and logs diagnostics on -- standard error; it fails if the API call fails setConnectAttr :: (MonadIO m, MonadFail m) => SQLHDBC -> SQLINTEGER -> SQLPOINTER -> SQLINTEGER -> m () -- | wrapper for SQL/CLI function SetDescField; it creates a monadic action -- that calls the API function, logs diagnostic on standard output and -- fails if the API call fails setDescField :: (MonadIO m, MonadFail m) => SQLHDESC -> SQLSMALLINT -> SQLSMALLINT -> Ptr a -> SQLINTEGER -> m () -- | wrapper for SQL/CLI function GetDescField; it creates a monadic action -- that calls the API function, logs disgnostic on standard output and -- fails if the API call fails getDescField :: (MonadIO m, MonadFail m) => SQLHDESC -> SQLSMALLINT -> SQLSMALLINT -> Ptr a -> SQLINTEGER -> Ptr SQLINTEGER -> m () -- | wrapper for SQL/CLI function SetDescRec; it gets the same parameters -- as the function described in the API and creates a monadic action that -- fails if the API call fails and logs the diagnostics to standard error setDescRec :: (MonadIO m, MonadFail m) => SQLHDESC -> SQLSMALLINT -> SQLSMALLINT -> SQLSMALLINT -> SQLINTEGER -> SQLSMALLINT -> SQLSMALLINT -> Ptr a -> Ptr SQLLEN -> Ptr SQLLEN -> m () -- | wrapper for SQL/CLI function GetDescRec; it gets the same parameters -- as the function described in the API and creates a monadic action that -- fails if the API call fails and logs the diagnostics to standard error getDescRec :: (MonadIO m, MonadFail m) => SQLHDESC -> SQLSMALLINT -> Ptr SQLCHAR -> SQLSMALLINT -> Ptr SQLSMALLINT -> Ptr SQLSMALLINT -> Ptr SQLSMALLINT -> Ptr SQLLEN -> Ptr SQLSMALLINT -> Ptr SQLSMALLINT -> Ptr SQLSMALLINT -> m () -- | wrapper for SQL/CLI function NumResultCols; it fails if the API call -- fails and it displays diagnostic information on the standard error numResultCols :: (MonadIO m, MonadFail m) => SQLHSTMT -> m SQLSMALLINT -- | helper function to get the value of a Storable statement -- attribute getStorableStmtAttr :: (MonadIO m, MonadFail m, Storable a) => SQLHSTMT -> SQLINTEGER -> m a -- | wrapper for SQL/CLI function GetStmtAttr; it displays diagnostic info -- on the standard error and it fails if the call SQL/CLI call fails getStmtAttr :: (MonadIO m, MonadFail m) => SQLHSTMT -> SQLINTEGER -> Ptr a -> SQLINTEGER -> Ptr SQLINTEGER -> m () -- | wrapper for SQL/CLI function, BindParam; it displayes diagnostics on -- standard error bindParam :: (MonadIO m, MonadFail m) => SQLHSTMT -> SQLSMALLINT -> SQLSMALLINT -> SQLSMALLINT -> SQLULEN -> SQLSMALLINT -> Ptr a -> Ptr SQLLEN -> m () -- | wrapper for PutData SQL/CLI api call; it displays diagnostics on -- standard error putData :: (MonadIO m, MonadFail m) => SQLHSTMT -> Ptr a -> SQLLEN -> m () -- | wrapper for ParamData SQL/CLI API call; it gets a statement handle and -- a function that knows how to supply parameter data; this function gets -- the value DATA_PTR field of the record in the application parameter -- descriptor that relates to the dynamic parameter for which the -- implementation requires information. -- -- The successful return of this call means that all parameter data has -- been supplied and the sql statement has been executed. paramData :: (MonadIO m, MonadFail m) => SQLHSTMT -> (SQLPOINTER -> m ()) -> m () -- | wrapper for Prepare SQL/CLI API call prepare :: (MonadIO m, MonadFail m) => SQLHSTMT -> String -> m () -- | wrapper for Execute SQL/CLI API call; it receives ab handle to a -- prepared statement and a monadic action that should provide dynamic -- arguments data using calls to sqlputdata and -- sqlparamdata; this action will be used in the case -- sqlexecute returns sql_need_data, that is, if the -- prepared statement specifies some dynamic parameters that are not -- described in the application parameter descriptor (for example, by -- calling sqlbindparam for that parameter); the action must -- provide the data for parameters in the order the parameters appear in -- the sql statement and call sqlparamdata after each parameter -- data has been provided execute :: (MonadIO m, MonadFail m) => SQLHSTMT -> m () -> m () -- | concise information about a column of a result set, mapping the result -- of SQL CLI API call DescribeCol data ConciseColInfo ConciseColInfo :: String -> SQLSMALLINT -> SQLULEN -> SQLSMALLINT -> Bool -> ConciseColInfo [cci_ColumnName] :: ConciseColInfo -> String [cci_DataType] :: ConciseColInfo -> SQLSMALLINT [cci_ColumnSize] :: ConciseColInfo -> SQLULEN [cci_DecimalDigits] :: ConciseColInfo -> SQLSMALLINT [cci_Nullable] :: ConciseColInfo -> Bool -- | wrapper for DescribeCol SQL CLI API call describeCol :: (MonadIO m, MonadFail m) => SQLHSTMT -> SQLSMALLINT -> m ConciseColInfo -- | wrapper for SQL CLI Columns API call columns :: (MonadIO m, MonadFail m) => SQLHSTMT -> Maybe String -> Maybe String -> Maybe String -> Maybe String -> m () -- | wrapper for SQL CLI Tables API call tables :: (MonadIO m, MonadFail m) => SQLHSTMT -> Maybe String -> Maybe String -> Maybe String -> Maybe String -> m () -- | applies a function through all the records in a statment, passing an -- accumulator value and combining the actions returned by the function forAllRecords :: (MonadIO m, MonadFail m) => SQLHSTMT -> (a -> m a) -> a -> m a -- | applies a function through all the records in a statment, passing an -- accumulator value and combining the actions returned by the function; -- if all records have been successfully fetched, the second function is -- called; if an error occures, the third function is called, with the -- error message forAllRecordsWithEndAndFail :: (MonadIO m, MonadFail m) => SQLHSTMT -> (a -> m a) -> (a -> m a) -> (a -> String -> m a) -> a -> m a -- | exhaust all data of a column extracting all data chunks with GetData -- SQL/CLI call, and calling a function after extraction of each chunk -- passing it an accumulator value; the function should construct a -- monadic action that will deal with the extracted data chunk; in the -- end, these actions are combined in the monadic value returned by the -- forAllData forAllData :: (MonadIO m, MonadFail m) => SQLHSTMT -> SQLSMALLINT -> SQLSMALLINT -> SQLPOINTER -> SQLLEN -> Ptr SQLLEN -> (a -> m a) -> a -> m a -- | Read data from a column and checks the diagnostics, returning a -- True or False value inside a monadic action. It returns -- True if more data is available for read, and False -- otherwise. It fails in MaybeT IO monad if an error -- occured. It displays the diagnostics on the error on the standard -- error. getData :: (MonadIO m, MonadFail m) => SQLHSTMT -> SQLSMALLINT -> SQLSMALLINT -> SQLPOINTER -> SQLLEN -> Ptr SQLLEN -> m Bool -- | Read data available in a column of a fetched database record inside a -- monadic action. It fails if an error occurs, displaying the -- diagnostics on the standard error. It receives 2 monadic actions -- parameters: -- -- -- -- It executes the more action if there is more data available and it -- executes the end action if all data in the column has been read. getDataAndRun :: (MonadIO m, MonadFail m) => SQLHSTMT -> SQLSMALLINT -> SQLSMALLINT -> SQLPOINTER -> SQLLEN -> Ptr SQLLEN -> m a -> m a -> m a -- | Create a monadic action to fetch the next record in an executed -- statement producing True if there are more records available or -- False if all the records have been read. -- -- If an error occurs, the monadic action fails, displaying the error -- diagnostics on the standard error. fetch :: (MonadIO m, MonadFail m) => SQLHSTMT -> m Bool -- | Create a monadic action to fetch the next record in an excecuted -- statement. It, then, executes one of the 2 actions received as -- parameters. If sqlfetch returns a success code, it executes the -- first action, else, if sql_no_data is received as result (there -- were no more records to fetch), it executes the second action. -- -- If an error occrus, the monadic action fails, displaying error -- diagnostics on the standard error. fetchAndRun :: (MonadIO m, MonadFail m) => SQLHSTMT -> m a -> m a -> m a -- | Create a monadic action to fetch the next record in an excecuted -- statement. It, then, executes one of the 3 actions received as -- parameters depending on the result of calling sqlfetch -- function. -- -- If sqlfetch call returns a success code, then the first action -- is called, that should process the fetched record. -- -- If sqlfetch returns sql_no_data, meaning there are no -- more records to fetch, the second action is called that should -- terminate the data fetching on this statement. -- -- If sqlfetch returns an error, the third action is executed that -- should process the error condition, passing it the fail error message. -- -- If an error occrus, the monadic action fails, displaying error -- diagnostics on the standard error. fetchAndRunWithFail :: (MonadIO m, MonadFail m) => SQLHSTMT -> m a -> m a -> (String -> m a) -> m a -- | helper function to bind a SMALLINT column bindSmallIntCol :: (MonadIO m, MonadFail m) => SQLHSTMT -> SQLSMALLINT -> Ptr SQLSMALLINT -> Ptr SQLLEN -> m () -- | helper function to bind an INTEGER column bindIntegerCol :: (MonadIO m, MonadFail m) => SQLHSTMT -> SQLSMALLINT -> Ptr SQLINTEGER -> Ptr SQLLEN -> m () -- | helper function to bind a VARCHAR column. The buffer length parameter -- must include the NULL terminating character of the CString. bindVarcharCol :: (MonadIO m, MonadFail m) => SQLHSTMT -> SQLSMALLINT -> CString -> SQLLEN -> Ptr SQLLEN -> m () -- | wrapper for BindCol SQL CLI API call; if an error occurs the -- computation is stopped and diagnostics are displayed on the standard -- error bindCol :: (MonadIO m, MonadFail m) => SQLHSTMT -> SQLSMALLINT -> SQLSMALLINT -> SQLPOINTER -> SQLLEN -> Ptr SQLLEN -> m () -- | wrapper for SQL CLI ExecDirect API call; if an error occurs, the -- computation exits displaying diagnostics on the standard error. -- -- It gets 3 parameters: a handle statement, a sql string and a feed data -- action; if sqlexecdirect returns sql_need_data, it -- executes the feed data action. -- -- The feed data action is responsible with supplying the needed data for -- dynamic parameters by calling sqlputdata and -- sqlparamdata. See more details on SQL/CLI specification for -- ExecDirect, PutData and ParamData API calls. execDirect :: (MonadIO m, MonadFail m) => SQLHSTMT -> String -> m () -> m () -- | utility function that allocates a database connection handle and -- connects to the database. -- -- On success, the computation returns the handle to the database -- conncection. -- -- On error, the computation exits, displaying diagnostics on the -- standard error. connect :: (MonadIO m, MonadFail m) => SQLHENV -> String -> String -> String -> m SQLHDBC -- | wrapper for SQL CLI Disconnect API call; displays diagnostics on the -- standard error. disconnect :: SQLHDBC -> IO () -- | wrapper to SQL CLI AllocHandle API call; it displays diagnostics info -- on the standard error and fails if the handle could not be allocated allocHandle :: (MonadIO m, MonadFail m) => SQLSMALLINT -> SQLHANDLE -> m SQLHANDLE -- | wrapper for SQL CLI FreeHandle API call; it displays diagnostics on -- the standard error; it does not fail freeHandle :: SQLSMALLINT -> SQLHANDLE -> IO () -- | create an IO action that displays diagnostic records for a -- given handle on the standard error; this action will not fail displayDiagInfo :: SQLSMALLINT -> SQLHANDLE -> IO () -- | create a monadic action to display the diagnostic records for a given -- handle on the standard error; it fails if an error occurs while -- reading diagnostic records. displayDiagInfo' :: (MonadIO m, MonadFail m) => SQLSMALLINT -> SQLHANDLE -> m () -- | display a diagnostic record on standard error displayDiagRec :: DiagRecord -> IO () -- | create a monadic action to read the number of the diagnostic records -- for a given handle; it fails if an error occurs and it displays -- diagnostics on standard error getCountOfDiagRecs :: (MonadIO m, MonadFail m) => SQLSMALLINT -> SQLHANDLE -> m SQLINTEGER -- | information in a diagnostic record data DiagRecord DiagRecord :: SQLSMALLINT -> String -> SQLINTEGER -> String -> DiagRecord [diagrec_i] :: DiagRecord -> SQLSMALLINT [sqlstate] :: DiagRecord -> String [nativeError] :: DiagRecord -> SQLINTEGER [messageText] :: DiagRecord -> String -- | wrapper for SQL CLI GetDiagRec API call; the computation fails if an -- error occurs and it displays diagnostics on standard error getDiagRec :: (MonadIO m, MonadFail m) => SQLSMALLINT -> SQLHANDLE -> SQLSMALLINT -> m DiagRecord -- | helper function to allocate a CStringLen; it calls the function -- received as parameter with the address of the allocated string or with -- a null pointer if no string was received as input (i.e. -- Nothing) withMaybeCStringLen :: Maybe String -> (CStringLen -> IO a) -> IO a -- | helper function to read a nullable column; returns Nothing if the -- column is null peekMaybeCol :: Storable a => Ptr a -> Ptr SQLLEN -> IO (Maybe a) -- | helper function to read a nullable text column; returns Nothing if the -- column is null peekMaybeTextCol :: CString -> Ptr SQLLEN -> IO (Maybe String) instance GHC.Show.Show SQL.CLI.Utils.ColumnInfo instance GHC.Classes.Eq SQL.CLI.Utils.ColumnInfo instance GHC.Classes.Ord SQL.CLI.Utils.ColumnInfo