Main Page | Modules | Namespace List | Class Hierarchy | Data Structures | Directories | File List | Namespace Members | Data Fields | Globals

attnmgr_dml.h File Reference


Detailed Description

Contains the SDK & PDK API for the ALP Attention DML.

#include <time.h>
#include <hiker/types.h>
#include <hiker/sysclass.h>
#include <hiker/attnmgr_common.h>
#include <hiker/sal.h>

Go to the source code of this file.

Error code definitions for attention data model

#define ALP_STATUS_ATTN_DML_BAD_PARAM   (ALP_STATUS_ATTN_DML | 0x00000100)
#define ALP_STATUS_ATTN_DML_NO_MEMORY   (ALP_STATUS_ATTN_DML | 0x00000200)
#define ALP_STATUS_ATTN_DML_INTERNAL_ERROR   (ALP_STATUS_ATTN_DML | 0x00000300)
#define ALP_STATUS_ATTN_DML_NO_RECORDS   (ALP_STATUS_ATTN_DML | 0x00000400)
#define ALP_STATUS_ATTN_DML_INVALID_LUID   (ALP_STATUS_ATTN_DML | 0x00000500)
#define ALP_STATUS_ATTN_DML_DATABASE_ERROR   (ALP_STATUS_ATTN_DML | 0x00000600)
#define ALP_STATUS_ATTN_DML_DUPLICATE   (ALP_STATUS_ATTN_DML | 0x00000700)
#define ALP_STATUS_ATTN_DML_CORRUPT   (ALP_STATUS_ATTN_DML | 0x00000800)
#define ALP_STATUS_ATTN_DML_EXISTS   (ALP_STATUS_ATTN_DML | 0x00000900)

Attention DML DataModel API

alp_status_t alp_attn_dml_open (AlpDmlH *dmlH)
alp_status_t alp_attn_dml_close (AlpDmlH dmlH)
alp_status_t alp_attn_dml_set_filename (const char *directory, const char *filename)
const char * alp_attn_dml_get_filename (void)
 Return db pathname.
alp_status_t alp_attn_dml_check_database (AlpDmlH dmlH)
 Check database integrity.

Attention DML Item API

alp_status_t alp_attn_dml_item_create (AlpAttnDmlItemType itemType, AlpDmlItemH *itemH)
alp_status_t alp_attn_dml_item_destroy (AlpDmlItemH itemH)
alp_status_t alp_attn_dml_item_set_int32 (AlpDmlItemH itemH, AlpAttnDmlColumnType column, int32_t *value)
alp_status_t alp_attn_dml_item_set_uint32 (AlpDmlItemH itemH, AlpAttnDmlColumnType column, uint32_t *value)
alp_status_t alp_attn_dml_item_set_bool (AlpDmlItemH itemH, AlpAttnDmlColumnType column, bool *value)
alp_status_t alp_attn_dml_item_set_string (AlpDmlItemH itemH, AlpAttnDmlColumnType column, const char *value)
alp_status_t alp_attn_dml_item_set_blob (AlpDmlItemH itemH, AlpAttnDmlColumnType column, void *data, uint32_t size)
const char * alp_attn_dml_item_get_string (AlpDmlItemH itemH, AlpAttnDmlColumnType column)
int32_t alp_attn_dml_item_get_int32 (AlpDmlItemH itemH, AlpAttnDmlColumnType column)
uint32_t alp_attn_dml_item_get_uint32 (AlpDmlItemH itemH, AlpAttnDmlColumnType column)
alp_status_t alp_attn_dml_item_set_property_list (AlpDmlItemH itemH, AlpDmlItemH propListH)
 miscellaneous setter / getter functions These are for adding / getting properties associated with an alert.
alp_status_t alp_attn_dml_item_add_property (AlpDmlItemH itemH, AlpDmlItemH propH)

Attention DML Write API

alp_status_t alp_attn_dml_insert (AlpDmlH dmlH, AlpDmlItemH itemH, AlpLuid *itemLuid)
alp_status_t alp_attn_dml_replace (AlpDmlH dmlH, AlpDmlItemH itemH)
alp_status_t alp_attn_dml_update (AlpDmlH dmlH, AlpDmlItemH itemH)
alp_status_t alp_attn_dml_delete (AlpDmlH dmlH, AlpDmlItemH itemH)
alp_status_t alp_attn_dml_find (AlpDmlH dmlH, AlpDmlItemH itemH, AlpLuid *itemLuid)

Attention DML Read API

alp_status_t alp_attn_dml_alert_statement_begin (AlpDmlH dmlH, AlpDmlStatementH *stmtH, char *source, char *name, char *handle, AlpLuid alertLuid, AlpAttnDmlOrderByType orderBy, uint32_t *numResults)
 Creates and initializes a new AlpDmlStatementH that can be used to iterate over a set of AlertItem's in the Attention data model.
alp_status_t alp_attn_dml_prop_statement_begin (AlpDmlH dmlH, AlpDmlStatementH *stmtH, AlpLuid alertLuid, AlpLuid propLuid, char *property, uint32_t *numResults)
 Creates and initializes a new AlpDmlStatementH that can be used to iterate over a set of PropertyItem's in the Attention data model.
alp_status_t alp_attn_dml_statement_next (AlpDmlStatementH stmtH)
 Given a statement handle initialized with alp_attn_dml_*_statement_init() API, this routine will step the statement forward to point to the next item in the sequence.
alp_status_t alp_attn_dml_statement_end (AlpDmlStatementH stmtH)
 Close/end the selection statement.
alp_status_t alp_attn_dml_statement_get_int32 (AlpDmlStatementH stmtH, AlpAttnDmlColumnType column, int32_t *value)
 Get a int32_t from the current statement record statementH must be from a previous call to begin.
alp_status_t alp_attn_dml_statement_get_uint32 (AlpDmlStatementH stmtH, AlpAttnDmlColumnType column, uint32_t *value)
 Get a uint32_t from the current statement record statementH must be from a previous call to begin.
alp_status_t alp_attn_dml_statement_get_int64 (AlpDmlStatementH stmtH, AlpAttnDmlColumnType column, int64_t *value)
 Get a int64_t from the current statement record statementH must be from a previous call to begin.
alp_status_t alp_attn_dml_statement_get_string (AlpDmlStatementH stmtH, AlpAttnDmlColumnType column, char **value)
 @ brief Get a text string from the current statement record statementH must be from a previous call to begin
alp_status_t alp_attn_dml_statement_get_bool (AlpDmlStatementH stmtH, AlpAttnDmlColumnType column, bool *value)
 Get a bool from the current statement record statementH must be from a previous call to begin.
alp_status_t alp_attn_dml_statement_get_timestamp (AlpDmlStatementH stmtH, AlpAttnDmlColumnType column, time_t *value)
 Get the timestamp from the current statement record statementH must be from a previous call to begin.
alp_status_t alp_attn_dml_statement_get_luid (AlpDmlStatementH stmtH, AlpLuid *itemLuid)
 Get the luid from the current statement record.
alp_status_t alp_attn_dml_statement_get_blob (AlpDmlStatementH stmtH, AlpAttnDmlColumnType column, bool copy, void **value, uint32_t *size)
 Given a statement handle that has been initialized and stepped using alp_attn_dml_statement_next() where an item has been found, this function can be used to retrieve any integer field from the item located at the current statement position.

Attention DML Transaction API

alp_status_t alp_attn_dml_transaction_begin (AlpDmlH dmlH, bool exclusive)
alp_status_t alp_attn_dml_transaction_end (AlpDmlH dmlH)
alp_status_t alp_attn_dml_transaction_rollback (AlpDmlH dmlH)

Enumerations

enum  AlpAttnDmlItemType { InvalidItem = 0, AlertItem = 1, PropertyItem = 2, PropertyListItem = 3 }
enum  AlpAttnDmlColumnType {
  Source = 1, Name = 2, Handle = 3, Interface = 4,
  Priority = 5, Duration = 6, Pending = 7, Attributes = 8,
  AlertLuid = 9, Value = 10, Property = 11, PropLuid = 12,
  UserId = 13, GroupId = 14, Created = 15, Updated = 16,
  PropType = 17
}
 The enum below lists all the fields that can be get and set in any of the AlpContactsDmlItemType's above. More...
enum  AlpAttnDmlOrderByType { OrderByNone, OrderByPriority, OrderByTimestamp, NumOrderByAttnTypes }
 Used by alp_attn_dml_alerts_statement_begin(). More...


Define Documentation

#define ALP_STATUS_ATTN_DML_BAD_PARAM   (ALP_STATUS_ATTN_DML | 0x00000100)
 

#define ALP_STATUS_ATTN_DML_CORRUPT   (ALP_STATUS_ATTN_DML | 0x00000800)
 

#define ALP_STATUS_ATTN_DML_DATABASE_ERROR   (ALP_STATUS_ATTN_DML | 0x00000600)
 

#define ALP_STATUS_ATTN_DML_DUPLICATE   (ALP_STATUS_ATTN_DML | 0x00000700)
 

#define ALP_STATUS_ATTN_DML_EXISTS   (ALP_STATUS_ATTN_DML | 0x00000900)
 

#define ALP_STATUS_ATTN_DML_INTERNAL_ERROR   (ALP_STATUS_ATTN_DML | 0x00000300)
 

#define ALP_STATUS_ATTN_DML_INVALID_LUID   (ALP_STATUS_ATTN_DML | 0x00000500)
 

#define ALP_STATUS_ATTN_DML_NO_MEMORY   (ALP_STATUS_ATTN_DML | 0x00000200)
 

#define ALP_STATUS_ATTN_DML_NO_RECORDS   (ALP_STATUS_ATTN_DML | 0x00000400)
 


Enumeration Type Documentation

enum AlpAttnDmlColumnType
 

The enum below lists all the fields that can be get and set in any of the AlpContactsDmlItemType's above.

Note the enum value is used in the names of the edit dialog items (quasi data-driven programming with no meta info avail)

Enumerator:
Source  String - Used in: Alerts - Cannot be NULL.
Name  String - Used in: Alerts, Properties - Cannot be NULL.
Handle  String - Used in: Alerts - Cannot be NULL.
Interface  String - Used in: Alerts.
Priority  Int32 - Used in: Alerts.
Duration  Int32 - Used in: Alerts.
Pending  Bool - Used in: Alerts.
Attributes  Bool - Used in: Alerts.
AlertLuid  Uint32 - Used in: Alerts, Properties.
Value  String - Used in: Properties.
Property  PropertyItem - Used in: Alerts (pseudo).
PropLuid  Uint32 - Used in: Properties.
UserId  Int32 - Used in: Alerts.
GroupId  Int32 - Used in: Alerts.
Created  Int32 - Used in: Alerts.
Updated  Int32 - Used in: Alerts.
PropType  Uint32 - Used in: Props.

enum AlpAttnDmlItemType
 

Used for alp_attn_dml_item_create()

Enumerator:
InvalidItem 
AlertItem 
PropertyItem 
PropertyListItem 

enum AlpAttnDmlOrderByType
 

Used by alp_attn_dml_alerts_statement_begin().

Enumerator:
OrderByNone  Do not specify a sort order.
OrderByPriority  Order query by priority, highest first.
OrderByTimestamp  Order query by time, oldest first.
NumOrderByAttnTypes  Order query by alert type.


Function Documentation

alp_status_t alp_attn_dml_alert_statement_begin AlpDmlH  dmlH,
AlpDmlStatementH stmtH,
char *  source,
char *  name,
char *  handle,
AlpLuid  alertLuid,
AlpAttnDmlOrderByType  orderBy,
uint32_t *  numResults
 

Creates and initializes a new AlpDmlStatementH that can be used to iterate over a set of AlertItem's in the Attention data model.

After calling this routine, you must call alp_attn_dml_statement_next() to advance the statement to the first object in the result set before you can call any of the alp_attn_dml_statement_get_* API to retrieve information from an object.

It is important to keep track of which alp_attn_dml_*_statement_begin function you use to initialize which AlpDmlStatementH, because that will dictate which objects are included in the statement's result set, and what AlpAttnDmlColumnType's you can use to fetch values from items in the statement.

If there are no records found that match the search critereon, numResults, if it was supplied will be set to 0, ALP_STATUS_ATTN_DML_NO_RECORDS will be returned, and the stmtH parameter will not be initialized (so the caller should not call alp_attn_dml_statement_next (or end) on it.

The AlpDmlH handle must have been initialized by a previously opened.

Parameters:
[in] an AlpDmlH structure which is an AlpSALHandle
[out] a pointer to an AlpDmlStatementH, which is an AlpSALStatement
[in] result order specification
[out] an integer indicating the number of items found
See also:
alp_attn_dml_statement_next

alp_attn_dml_statement_end

Returns:
alp_status_t

alp_status_t alp_attn_dml_check_database AlpDmlH  dmlH  ) 
 

Check database integrity.

Parameters:
[in] dmlH Database DML handle
Returns:
ALP_STATUS_OK integrity check succeeded

ALP_STATUS_ATTN_DML_CORRUPT integrity check failed

alp_status_t alp_attn_dml_close AlpDmlH  dmlH  ) 
 

alp_status_t alp_attn_dml_delete AlpDmlH  dmlH,
AlpDmlItemH  itemH
 

alp_status_t alp_attn_dml_find AlpDmlH  dmlH,
AlpDmlItemH  itemH,
AlpLuid itemLuid
 

const char* alp_attn_dml_get_filename void   ) 
 

Return db pathname.

Returns:
char * containing pointing to the database pathname. Do not free() this string.

alp_status_t alp_attn_dml_insert AlpDmlH  dmlH,
AlpDmlItemH  itemH,
AlpLuid itemLuid
 

alp_status_t alp_attn_dml_item_add_property AlpDmlItemH  itemH,
AlpDmlItemH  propH
 

alp_status_t alp_attn_dml_item_create AlpAttnDmlItemType  itemType,
AlpDmlItemH itemH
 

alp_status_t alp_attn_dml_item_destroy AlpDmlItemH  itemH  ) 
 

int32_t alp_attn_dml_item_get_int32 AlpDmlItemH  itemH,
AlpAttnDmlColumnType  column
 

const char* alp_attn_dml_item_get_string AlpDmlItemH  itemH,
AlpAttnDmlColumnType  column
 

uint32_t alp_attn_dml_item_get_uint32 AlpDmlItemH  itemH,
AlpAttnDmlColumnType  column
 

alp_status_t alp_attn_dml_item_set_blob AlpDmlItemH  itemH,
AlpAttnDmlColumnType  column,
void *  data,
uint32_t  size
 

alp_status_t alp_attn_dml_item_set_bool AlpDmlItemH  itemH,
AlpAttnDmlColumnType  column,
bool *  value
 

alp_status_t alp_attn_dml_item_set_int32 AlpDmlItemH  itemH,
AlpAttnDmlColumnType  column,
int32_t *  value
 

alp_status_t alp_attn_dml_item_set_property_list AlpDmlItemH  itemH,
AlpDmlItemH  propListH
 

miscellaneous setter / getter functions These are for adding / getting properties associated with an alert.

Parameters:
[in] itemH an alert item
[in] propListH a property list item containing a linked list of

alp_status_t alp_attn_dml_item_set_string AlpDmlItemH  itemH,
AlpAttnDmlColumnType  column,
const char *  value
 

alp_status_t alp_attn_dml_item_set_uint32 AlpDmlItemH  itemH,
AlpAttnDmlColumnType  column,
uint32_t *  value
 

alp_status_t alp_attn_dml_open AlpDmlH dmlH  ) 
 

alp_status_t alp_attn_dml_prop_statement_begin AlpDmlH  dmlH,
AlpDmlStatementH stmtH,
AlpLuid  alertLuid,
AlpLuid  propLuid,
char *  property,
uint32_t *  numResults
 

Creates and initializes a new AlpDmlStatementH that can be used to iterate over a set of PropertyItem's in the Attention data model.

After calling this routine, you must call alp_attn_dml_statement_next() to advance the statement to the first object in the result set before you can call any of the alp_attn_dml_statement_get_* API to retrieve information from an object.

It is important to keep track of which alp_attn_dml_*_statement_begin function you use to initialize which AlpDmlStatementH, because that will dictate which objects are included in the statement's result set, and what AlpAttnDmlColumnType's you can use to fetch values from items in the statement.

If there are no records found that match the search critereon, numResults, if it was supplied will be set to 0, ALP_STATUS_ATTN_DML_NO_RECORDS will be returned, and the stmtH parameter will not be initialized (so the caller should not call alp_attn_dml_statement_next (or end) on it.

The AlpDmlH handle must have been initialized by a previously opened.

Parameters:
[in] an AlpDmlH structure which is an AlpSALHandle
[out] a pointer to an AlpDmlStatementH, which is an AlpSALStatement
[in] an optional alertLuid to limit the result set.
[in] an optional propLuid to limit the result set.
[in] an optional property spec to limit the result set.
[out] an integer indicating the number of items found
See also:
alp_attn_dml_statement_next

alp_attn_dml_statement_end

Returns:
alp_status_t

alp_status_t alp_attn_dml_replace AlpDmlH  dmlH,
AlpDmlItemH  itemH
 

alp_status_t alp_attn_dml_set_filename const char *  directory,
const char *  filename
 

alp_status_t alp_attn_dml_statement_end AlpDmlStatementH  stmtH  ) 
 

Close/end the selection statement.

stmtH must be from a previous call to begin

Parameters:
[in] a pointer to an AlpDmlStatementH, which is an AlpSALStatement
Returns:
alp_status_t
See also:
alp_attn_dml_statement_begin

alp_attn_dml_statement_next

alp_status_t alp_attn_dml_statement_get_blob AlpDmlStatementH  stmtH,
AlpAttnDmlColumnType  column,
bool  copy,
void **  value,
uint32_t *  size
 

Given a statement handle that has been initialized and stepped using alp_attn_dml_statement_next() where an item has been found, this function can be used to retrieve any integer field from the item located at the current statement position.

Parameters:
[in] stmtH an AlpDmlStatementH, which is an AlpSALStatement
[in] column an AlpAttnColumnType to specify the field to get the value from
[out] value the char* (string) value of the field
Returns:
alp_status_t

alp_status_t alp_attn_dml_statement_get_bool AlpDmlStatementH  stmtH,
AlpAttnDmlColumnType  column,
bool *  value
 

Get a bool from the current statement record statementH must be from a previous call to begin.

Parameters:
[in] an AlpDmlStatementH, which is an AlpSALStatement
[in] an AlpAttnColumnType to specify the field to get the value from
[out] the bool value of the field
Returns:
alp_status_t

alp_status_t alp_attn_dml_statement_get_int32 AlpDmlStatementH  stmtH,
AlpAttnDmlColumnType  column,
int32_t *  value
 

Get a int32_t from the current statement record statementH must be from a previous call to begin.

Parameters:
[in] an AlpDmlStatementH, which is an AlpSALStatement
[in] an AlpAttnColumnType to specify the field to get the value from
[out] the int32_t value of the field
Returns:
alp_status_t

alp_status_t alp_attn_dml_statement_get_int64 AlpDmlStatementH  stmtH,
AlpAttnDmlColumnType  column,
int64_t *  value
 

Get a int64_t from the current statement record statementH must be from a previous call to begin.

Parameters:
[in] an AlpDmlStatementH, which is an AlpSALStatement
[in] an AlpAttnColumnType to specify the field to get the value from
[out] the int64_t value of the field
Returns:
alp_status_t

alp_status_t alp_attn_dml_statement_get_luid AlpDmlStatementH  stmtH,
AlpLuid itemLuid
 

Get the luid from the current statement record.

stmtH must be from a previous call to begin

Parameters:
[in] an AlpDmlStatementH, which is an AlpSALStatement
[out] the item luid value from the record
Returns:
alp_status_t

alp_status_t alp_attn_dml_statement_get_string AlpDmlStatementH  stmtH,
AlpAttnDmlColumnType  column,
char **  value
 

@ brief Get a text string from the current statement record statementH must be from a previous call to begin

Parameters:
[in] an AlpDmlStatementH, which is an AlpSALStatement
[in] an AlpAttnColumnType to specify the field to get the value from
[out] the char* (string) value of the field
Returns:
alp_status_t

alp_status_t alp_attn_dml_statement_get_timestamp AlpDmlStatementH  stmtH,
AlpAttnDmlColumnType  column,
time_t *  value
 

Get the timestamp from the current statement record statementH must be from a previous call to begin.

Parameters:
[in] an AlpDmlStatementH, which is an AlpSALStatement
[in] an AlpAttnColumnType to specify the field to get the value from
[out] the timestamp value from the record
Returns:
alp_status_t

alp_status_t alp_attn_dml_statement_get_uint32 AlpDmlStatementH  stmtH,
AlpAttnDmlColumnType  column,
uint32_t *  value
 

Get a uint32_t from the current statement record statementH must be from a previous call to begin.

Parameters:
[in] stmtH an AlpDmlStatementH, which is an AlpSALStatement
[in] column an AlpAttnColumnType to specify the field to get the value from
[out] value the uint32_t value of the field
Returns:
alp_status_t

alp_status_t alp_attn_dml_statement_next AlpDmlStatementH  stmtH  ) 
 

Given a statement handle initialized with alp_attn_dml_*_statement_init() API, this routine will step the statement forward to point to the next item in the sequence.

Note that you must call this API in order to get to the first element in the list.

Parameters:
[in] stmtH Statement handle that has been initialized with alp_attn_dml_*_statement_init() API
Returns:
alp_status_t
See also:
alp_attn_dml_statement_begin

alp_attn_dml_statement_end

alp_status_t alp_attn_dml_transaction_begin AlpDmlH  dmlH,
bool  exclusive
 

alp_status_t alp_attn_dml_transaction_end AlpDmlH  dmlH  ) 
 

alp_status_t alp_attn_dml_transaction_rollback AlpDmlH  dmlH  ) 
 

alp_status_t alp_attn_dml_update AlpDmlH  dmlH,
AlpDmlItemH  itemH
 


Generated on Sat Dec 16 20:29:48 2006 for hiker-0.9 by  doxygen 1.4.4