libdsproc3  2.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
Internal: DSDB

Functions

int dsproc_db_connect (void)
 Connect to the database.
void dsproc_db_disconnect (void)
 Disconnect from the database.
int dsproc_get_datastream_properties (int ds_id, DSProp ***dsprops)
 Get datastream properties.
int dsproc_get_datastream_property (int ds_id, const char *var_name, const char *prop_name, time_t data_time, const char **prop_value)
 Get a datastream property for a specified time.
int dsproc_get_input_ds_classes (DSClass ***ds_classes)
 Get input datastream classes.
int dsproc_get_output_ds_classes (DSClass ***ds_classes)
 Get output datastream classes.
int dsproc_get_location (ProcLoc **proc_loc)
 Get process location.
int dsproc_get_site_description (const char **site_desc)
 Get site description.
int dsproc_get_config_value (const char *config_key, char **config_value)
 Get process config value.

Detailed Description


Function Documentation

int dsproc_db_connect ( void  )

Connect to the database.

To insure the database connection is not held open longer than necessary it is important that every call to dsproc_db_connect() is followed by a call to dsproc_db_disconnect().

If an error occurs in this function it will be appended to the log and error mail messages, and the process status will be set appropriately.

Returns:
  • 1 if connected to the database
  • 0 if an error occurred
See also:
dsproc_db_disconnect()

Definition at line 256 of file dsproc_dsdb.c.

void dsproc_db_disconnect ( void  )

Disconnect from the database.

To insure the database connection is not held open longer than necessary it is important that every call to dsproc_db_connect() is followed by a call to dsproc_db_disconnect().

See also:
dsproc_db_connect()

Definition at line 295 of file dsproc_dsdb.c.

int dsproc_get_config_value ( const char *  config_key,
char **  config_value 
)

Get process config value.

The memory used by the output config_value is dynamically allocated. It is the responsibility of the calling process to free this memory when it is no longer needed.

If an error occurs in this function it will be appended to the log and error mail messages, and the process status will be set appropriately.

Parameters:
config_key- datastream class name
config_value- output: pointer to the config value
Returns:
  • 1 if successful
  • 0 if the database returned a NULL result
  • -1 if an error occurred

Definition at line 799 of file dsproc_dsdb.c.

int dsproc_get_datastream_properties ( int  ds_id,
DSProp ***  dsprops 
)

Get datastream properties.

If an error occurs in this function it will be appended to the log and error mail messages, and the process status will be set appropriately.

Parameters:
ds_id- datastream ID
dsprops- output: pointer to the NULL terminated array of DSProp structure pointers
Returns:
  • number of datastream properties
  • 0 if the database returned a NULL result
  • -1 if an error occurred

Definition at line 323 of file dsproc_dsdb.c.

int dsproc_get_datastream_property ( int  ds_id,
const char *  var_name,
const char *  prop_name,
time_t  data_time,
const char **  prop_value 
)

Get a datastream property for a specified time.

The memory used by the output value belongs to the internal data structures and must not be freed or altered by the calling processes.

If an error occurs in this function it will be appended to the log and error mail messages, and the process status will be set appropriately.

Parameters:
ds_id- datastream ID
var_name- variable name (NULL for global properties)
prop_name- datastream property name
data_time- data time to get the propery value for.
prop_value- output: pointer to the datastream property value
Returns:
  • 1 if successful
  • 0 if the property was not found
  • -1 if an error occurred

Definition at line 414 of file dsproc_dsdb.c.

int dsproc_get_input_ds_classes ( DSClass ***  ds_classes)

Get input datastream classes.

If an error occurs in this function it will be appended to the log and error mail messages, and the process status will be set appropriately.

Parameters:
ds_classes- output: pointer to the NULL terminated array of DSClass structure pointers
Returns:
  • number of input datastream classes
  • 0 if the database returned a NULL result
  • -1 if an error occurred

Definition at line 509 of file dsproc_dsdb.c.

int dsproc_get_location ( ProcLoc **  proc_loc)

Get process location.

The memory used by the output location structure belongs to the internal structures and must not be freed or modified by the calling process.

If an error occurs in this function it will be appended to the log and error mail messages, and the process status will be set appropriately.

Parameters:
proc_loc- output: pointer to the ProcLoc structure
Returns:
  • 1 if successful
  • 0 if the database returned a NULL result
  • -1 if an error occurred

Definition at line 651 of file dsproc_dsdb.c.

int dsproc_get_output_ds_classes ( DSClass ***  ds_classes)

Get output datastream classes.

If an error occurs in this function it will be appended to the log and error mail messages, and the process status will be set appropriately.

Parameters:
ds_classes- output: pointer to the NULL terminated array of DSClass structure pointers
Returns:
  • number of output datastream classes
  • 0 if the database returned a NULL result
  • -1 if an error occurred

Definition at line 579 of file dsproc_dsdb.c.

int dsproc_get_site_description ( const char **  site_desc)

Get site description.

The memory used by the output site description string belongs to the internal structures and must not be freed or modified by the calling process.

If an error occurs in this function it will be appended to the log and error mail messages, and the process status will be set appropriately.

Parameters:
site_desc- output: pointer to the site description
Returns:
  • 1 if successful
  • 0 if the database returned a NULL result
  • -1 if an error occurred

Definition at line 734 of file dsproc_dsdb.c.