dsdb.h File Reference

Header File For The DSDB C Library. More...

#include <time.h>
#include "armdb.h"

Go to the source code of this file.

Classes

struct  DSClass
 Datastream Class Structure. More...

struct  DSDB
 DSDB Structure. More...

struct  DSTimes
 Datastream Times Structure. More...

struct  FamProc
 Family Process Structure. More...

struct  ProcLoc
 Process Location Structure. More...

struct  ProcState
 Process State Structure. More...

struct  ProcStatus
 Process Status Structure. More...

struct  TDBKey
 TDB Key Structure. More...


Functions

char * dsdb_get_version (void)
char * dsdb_get_error (DSDB *dsdb)
 Get Last Error Message.

int dsdb_get_status (DSDB *dsdb)
 Get Status of Last Function Call.

void dsdb_set_error (DSDB *dsdb, int status, const char *error)
 Set Function Status and Error Message.

DSDBdsdb_new (DB_TYPE db_type)
 Create New DSDB Structure.

void dsdb_free (DSDB *dsdb)
 Free DSDB Structure.

int dsdb_connect (DSDB *dsdb, const char *db_alias)
 Make Initial Database Connection.

void dsdb_disconnect (DSDB *dsdb)
 Disconnect From Database.

int dsdb_reconnect (DSDB *dsdb)
 Reconnect To Database.

int dsdb_is_connected (DSDB *dsdb)
 Check If Database Connection Has Been Established.

int dsdb_init_process_methods (DSDB *dsdb, const char *site, const char *facility, const char *proc_type, const char *proc_name)
time_t dsdb_text_to_tm (DSDB *dsdb, const char *text, struct tm *tm_time)
char * dsdb_tm_to_text (DSDB *dsdb, const struct tm *tm_time, char *text)
int * dsdb_text_to_bool (DSDB *dsdb, const char *text, int *bool_val)
char * dsdb_bool_to_text (DSDB *dsdb, int bool_val, char *text)
char * dsdb_string_copy (DSDB *dsdb, const char *str_in)
tm * dsdb_tm_copy (DSDB *dsdb, const struct tm *tm_in)
tm * dsdb_tm_create (DSDB *dsdb, const char *time_string)
void dsdb_free_family_process (FamProc *fam_proc)
FamProcdsdb_get_family_process (DSDB *dsdb)
void dsdb_free_family_processes (FamProc **fam_procs)
FamProc ** dsdb_inquire_family_processes (DSDB *dsdb, const char *category, const char *class)
void dsdb_free_process_location (ProcLoc *proc_loc)
ProcLocdsdb_get_process_location (DSDB *dsdb)
int dsdb_delete_process_state (DSDB *dsdb)
void dsdb_free_process_state (ProcState *proc_state)
ProcStatedsdb_get_process_state (DSDB *dsdb)
int dsdb_is_process_enabled (DSDB *dsdb)
int dsdb_update_process_state (DSDB *dsdb, const char *state, const char *desc, const struct tm *state_tm)
int dsdb_delete_process_status (DSDB *dsdb)
void dsdb_free_process_status (ProcStatus *proc_status)
ProcStatusdsdb_get_process_status (DSDB *dsdb)
int dsdb_update_process_started (DSDB *dsdb, const struct tm *started_tm)
int dsdb_update_process_completed (DSDB *dsdb, const struct tm *completed_tm)
int dsdb_update_process_status (DSDB *dsdb, const char *status, const char *desc, const struct tm *status_tm)
void dsdb_free_ds_classes (DSClass **ds_classes)
DSClass ** dsdb_get_process_inputs (DSDB *dsdb)
DSClass ** dsdb_get_process_outputs (DSDB *dsdb)
int dsdb_delete_datastream_times (DSDB *dsdb, const char *dsc_name, const char *dsc_level)
void dsdb_free_ds_times (DSTimes *ds_times)
DSTimesdsdb_get_datastream_times (DSDB *dsdb, const char *dsc_name, const char *dsc_level)
int dsdb_update_datastream_times (DSDB *dsdb, const char *dsc_name, const char *dsc_level, const struct tm *first, const struct tm *last)
int dsdb_delete_tdb_key (DSDB *dsdb, const char *tdb_name, const char *tdb_key)
char * dsdb_get_tdb_key (DSDB *dsdb, const char *tdb_name, const char *tdb_key)
void dsdb_free_tdb_keys (TDBKey **tdb_keys)
TDBKey ** dsdb_inquire_tdb_keys (DSDB *dsdb, const char *tdb_name, const char *tdb_key)
int dsdb_update_tdb_key (DSDB *dsdb, const char *tdb_name, const char *tdb_key, const char *tdb_value)
int dsdb_delete_timed_tdb_key (DSDB *dsdb, const char *tdb_name, const char *tdb_key, time_t key_time)
char * dsdb_get_timed_tdb_key (DSDB *dsdb, const char *tdb_name, const char *tdb_key, time_t key_time)
int dsdb_update_timed_tdb_key (DSDB *dsdb, const char *tdb_name, const char *tdb_key, time_t key_time, const char *tdb_value)


Detailed Description

Header File For The DSDB C Library.

The DSDB C Library is the base library that applications should use to access the stored procedures in the Data System Database.

Definition in file dsdb.h.


Function Documentation

int dsdb_connect DSDB dsdb,
const char *  db_alias
 

Make Initial Database Connection.

This function must be called to make the initial connection to the database. It will parse the user's .db_connect file looking for the specified db_alias.

Parameters:
dsdb Pointer to the DSDB structure.
db_alias The database alias defined in the user's .db_connect file.
Returns:
  • 0 => Failure
  • 1 => Success
See also:
dsdb_disconnect, dsdb_reconnect

Definition at line 182 of file dsdb.c.

References DSDB::armdb.

void dsdb_disconnect DSDB dsdb  ) 
 

Disconnect From Database.

This function will close the database connection but preserve the settings of the current session. The dsdb_reconnect function can then be called to reconnect to the database.

Parameters:
dsdb Pointer to the DSDB structure.
See also:
dsdb_reconnect

Definition at line 195 of file dsdb.c.

References DSDB::armdb.

void dsdb_free DSDB dsdb  ) 
 

Free DSDB Structure.

This function will close the database connection and free all memory used by the DSDB structure.

Parameters:
dsdb Pointer to the DSDB structure.

Definition at line 120 of file dsdb.c.

References DSDB::armdb, DSDB::facility, DSDB::proc_name, DSDB::proc_type, and DSDB::site.

char* dsdb_get_error DSDB dsdb  ) 
 

Get Last Error Message.

Parameters:
dsdb Pointer to the DSDB structure.
Returns:
The last DSDB error message.

Definition at line 56 of file dsdb.c.

References DSDB::armdb.

int dsdb_get_status DSDB dsdb  ) 
 

Get Status of Last Function Call.

Parameters:
dsdb Pointer to the DSDB structure.
Returns:
The status of the last DSDB function call:
  • DB_NO_ERROR => No error was generated.
  • DB_ERROR => An internal database error was generated.
  • DB_FILE_ERROR => Error reading the user's .db_connect file.
  • DB_MEM_ERROR => Memory allocation error.
  • DB_NULL_RESULT => A NULL result was received from the database query.
  • DB_BAD_RESULT => An invalid result was received from the database query.
  • DB_BAD_INPUT => A bad input value was detected.
See also:
dsdb_get_error

Definition at line 79 of file dsdb.c.

References DSDB::armdb.

int dsdb_is_connected DSDB dsdb  ) 
 

Check If Database Connection Has Been Established.

Parameters:
dsdb Pointer to the DSDB structure.
Returns:
  • 0 => Disconnected
  • 1 => Connected

Definition at line 222 of file dsdb.c.

References DSDB::armdb.

DSDB* dsdb_new DB_TYPE  db_type  ) 
 

Create New DSDB Structure.

Parameters:
db_type The type of the database to connect to. Currently the the underlying ARMDB library only supports PGSQL_DB.
Returns:
The new DSDB structure or NULL if it could not be created.
See also:
dsdb_connect, dsdb_disconnect, dsdb_free, dsdb_reconnect

Definition at line 142 of file dsdb.c.

References DSDB::armdb, and dsdb_set_error().

int dsdb_reconnect DSDB dsdb  ) 
 

Reconnect To Database.

This function will reconnect to the database using the setings defined by the previous database connection.

Parameters:
dsdb Pointer to the DSDB structure.
Returns:
  • 0 => Failure
  • 1 => Success
See also:
dsdb_disconnect

Definition at line 210 of file dsdb.c.

References DSDB::armdb.

void dsdb_set_error DSDB dsdb,
int  status,
const char *  error
 

Set Function Status and Error Message.

This function can be used to set the status and error message of a DSDB function call.

Parameters:
dsdb Pointer to the DSDB structure.
status The status code.
error The error message.

Definition at line 97 of file dsdb.c.

References DSDB::armdb.

Referenced by dsdb_new().


Generated on Fri Aug 25 13:33:58 2006 for DSDB-C_LIB by doxygen 1.3.5