00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00032 #ifndef __ALP_ATTN_DML_H__
00033 #define __ALP_ATTN_DML_H__
00034
00035 #include <time.h>
00036
00037 #include <hiker/types.h>
00038 #include <hiker/sysclass.h>
00039 #include <hiker/attnmgr_common.h>
00040 #include <hiker/sal.h>
00041
00050
00051
00056 #define ALP_STATUS_ATTN_DML_BAD_PARAM (ALP_STATUS_ATTN_DML | 0x00000100)
00057 #define ALP_STATUS_ATTN_DML_NO_MEMORY (ALP_STATUS_ATTN_DML | 0x00000200)
00058 #define ALP_STATUS_ATTN_DML_INTERNAL_ERROR (ALP_STATUS_ATTN_DML | 0x00000300)
00059 #define ALP_STATUS_ATTN_DML_NO_RECORDS (ALP_STATUS_ATTN_DML | 0x00000400)
00060 #define ALP_STATUS_ATTN_DML_INVALID_LUID (ALP_STATUS_ATTN_DML | 0x00000500)
00061 #define ALP_STATUS_ATTN_DML_DATABASE_ERROR (ALP_STATUS_ATTN_DML | 0x00000600)
00062 #define ALP_STATUS_ATTN_DML_DUPLICATE (ALP_STATUS_ATTN_DML | 0x00000700)
00063 #define ALP_STATUS_ATTN_DML_CORRUPT (ALP_STATUS_ATTN_DML | 0x00000800)
00064 #define ALP_STATUS_ATTN_DML_EXISTS (ALP_STATUS_ATTN_DML | 0x00000900)
00065
00066
00068 typedef enum {
00069 InvalidItem = 0,
00070 AlertItem = 1,
00071 PropertyItem = 2,
00072 PropertyListItem = 3,
00073 } AlpAttnDmlItemType;
00074
00080 typedef enum {
00081 Source = 1,
00082 Name = 2,
00083 Handle = 3,
00084 Interface = 4,
00085 Priority = 5,
00086 Duration = 6,
00087 Pending = 7,
00088 Attributes = 8,
00089 AlertLuid = 9,
00090 Value = 10,
00091 Property = 11,
00092 PropLuid = 12,
00093 UserId = 13,
00094 GroupId = 14,
00095 Created = 15,
00096 Updated = 16,
00097 PropType = 17,
00098 } AlpAttnDmlColumnType;
00099
00101 typedef enum {
00102 OrderByNone,
00103 OrderByPriority,
00104 OrderByTimestamp,
00105 NumOrderByAttnTypes
00106 } AlpAttnDmlOrderByType;
00107
00108 #ifdef __cplusplus
00109 extern "C" {
00110 #endif
00111
00116
00117 alp_status_t alp_attn_dml_open (AlpDmlH *dmlH);
00118 alp_status_t alp_attn_dml_close (AlpDmlH dmlH);
00119
00120 alp_status_t alp_attn_dml_set_filename (const char *directory,
00121 const char *filename);
00128 const char *alp_attn_dml_get_filename (void);
00129
00137 alp_status_t alp_attn_dml_check_database (AlpDmlH dmlH);
00144 alp_status_t alp_attn_dml_item_create (AlpAttnDmlItemType itemType,
00145 AlpDmlItemH *itemH);
00146
00147 alp_status_t alp_attn_dml_item_destroy (AlpDmlItemH itemH);
00148
00149 alp_status_t alp_attn_dml_item_set_int32 (AlpDmlItemH itemH,
00150 AlpAttnDmlColumnType column,
00151 int32_t *value);
00152
00153 alp_status_t alp_attn_dml_item_set_uint32 (AlpDmlItemH itemH,
00154 AlpAttnDmlColumnType column,
00155 uint32_t *value);
00156
00157 alp_status_t alp_attn_dml_item_set_bool (AlpDmlItemH itemH,
00158 AlpAttnDmlColumnType column,
00159 bool *value);
00160
00161 alp_status_t alp_attn_dml_item_set_string (AlpDmlItemH itemH,
00162 AlpAttnDmlColumnType column,
00163 const char *value);
00164
00165 alp_status_t alp_attn_dml_item_set_blob (AlpDmlItemH itemH,
00166 AlpAttnDmlColumnType column,
00167 void *data,
00168 uint32_t size);
00169
00170 const char *alp_attn_dml_item_get_string (AlpDmlItemH itemH,
00171 AlpAttnDmlColumnType column);
00172
00173 int32_t alp_attn_dml_item_get_int32 (AlpDmlItemH itemH,
00174 AlpAttnDmlColumnType column);
00175
00176 uint32_t alp_attn_dml_item_get_uint32 (AlpDmlItemH itemH,
00177 AlpAttnDmlColumnType column);
00178
00185 alp_status_t alp_attn_dml_item_set_property_list (AlpDmlItemH itemH,
00186 AlpDmlItemH propListH);
00187 alp_status_t alp_attn_dml_item_add_property (AlpDmlItemH itemH,
00188 AlpDmlItemH propH);
00195 extern alp_status_t alp_attn_dml_insert (AlpDmlH dmlH,
00196 AlpDmlItemH itemH,
00197 AlpLuid *itemLuid);
00198
00199 extern alp_status_t alp_attn_dml_replace (AlpDmlH dmlH,
00200 AlpDmlItemH itemH);
00201
00202 extern alp_status_t alp_attn_dml_update (AlpDmlH dmlH,
00203 AlpDmlItemH itemH);
00204
00205 extern alp_status_t alp_attn_dml_delete (AlpDmlH dmlH,
00206 AlpDmlItemH itemH);
00207
00208 extern alp_status_t alp_attn_dml_find (AlpDmlH dmlH,
00209 AlpDmlItemH itemH,
00210 AlpLuid *itemLuid);
00211
00219 alp_status_t alp_attn_dml_alert_statement_begin (AlpDmlH dmlH,
00220 AlpDmlStatementH *stmtH,
00221 char *source,
00222 char *name,
00223 char *handle,
00224 AlpLuid alertLuid,
00225 AlpAttnDmlOrderByType orderBy,
00226 uint32_t *numResults);
00227
00228 alp_status_t alp_attn_dml_prop_statement_begin (AlpDmlH dmlH,
00229 AlpDmlStatementH *stmtH,
00230
00231 AlpLuid alertLuid,
00232 AlpLuid propLuid,
00233 char *property,
00234 uint32_t *numResults);
00235
00236 alp_status_t alp_attn_dml_statement_next (AlpDmlStatementH stmtH);
00237
00238 alp_status_t alp_attn_dml_statement_end (AlpDmlStatementH stmtH);
00239
00240 alp_status_t alp_attn_dml_statement_get_int32 (AlpDmlStatementH stmtH,
00241 AlpAttnDmlColumnType column,
00242 int32_t *value);
00243
00244 alp_status_t alp_attn_dml_statement_get_uint32 (AlpDmlStatementH stmtH,
00245 AlpAttnDmlColumnType column,
00246 uint32_t *value);
00247
00248 alp_status_t alp_attn_dml_statement_get_int64 (AlpDmlStatementH stmtH,
00249 AlpAttnDmlColumnType column,
00250 int64_t *value);
00251
00252 alp_status_t alp_attn_dml_statement_get_string (AlpDmlStatementH stmtH,
00253 AlpAttnDmlColumnType column,
00254 char **value);
00255
00256 alp_status_t alp_attn_dml_statement_get_bool (AlpDmlStatementH stmtH,
00257 AlpAttnDmlColumnType column,
00258 bool *value);
00259
00260 alp_status_t alp_attn_dml_statement_get_timestamp(AlpDmlStatementH stmtH,
00261 AlpAttnDmlColumnType column,
00262 time_t *value);
00263
00264 alp_status_t alp_attn_dml_statement_get_luid (AlpDmlStatementH stmtH,
00265 AlpLuid *itemLuid);
00266
00293 alp_status_t alp_attn_dml_statement_get_blob (AlpDmlStatementH stmtH,
00294 AlpAttnDmlColumnType column,
00295 bool copy,
00296 void **value,
00297 uint32_t *size);
00298
00303
00304 extern alp_status_t alp_attn_dml_transaction_begin (AlpDmlH dmlH,
00305 bool exclusive);
00306 extern alp_status_t alp_attn_dml_transaction_end (AlpDmlH dmlH);
00307 extern alp_status_t alp_attn_dml_transaction_rollback(AlpDmlH dmlH);
00308
00309
00310
00311
00312 #ifdef __cplusplus
00313 }
00314 #endif
00315
00316 #endif