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

Functions

int dsproc_dqrdb_connect (void)
 Connect to the DQR database.
void dsproc_dqrdb_disconnect (void)
 Disconnect from the DQR database.
void dsproc_free_dqrs (DQR **dqrs)
 Free all memory used by an array of pointers to DQR structures.
int dsproc_get_dqrs (const char *site, const char *facility, const char *dsc_name, const char *dsc_level, const char *var_name, time_t start_time, time_t end_time, DQR ***dqrs)
 Get the DQRs for a datastream variable.

Detailed Description


Function Documentation

int dsproc_dqrdb_connect ( void  )

Connect to the DQR database.

To insure the database connection is not held open longer than necessary it is important that every call to dsproc_dqrdb_connect() is followed by a call to dsproc_dqrdb_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_dqrdb_disconnect()

Definition at line 396 of file dsproc_dqrdb.c.

void dsproc_dqrdb_disconnect ( void  )

Disconnect from the DQR database.

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

See also:
dsproc_dqrdb_connect()

Definition at line 442 of file dsproc_dqrdb.c.

void dsproc_free_dqrs ( DQR **  dqrs)

Free all memory used by an array of pointers to DQR structures.

Parameters:
dqrs- pointer to the array of pointers to DQR structures

Definition at line 460 of file dsproc_dqrdb.c.

int dsproc_get_dqrs ( const char *  site,
const char *  facility,
const char *  dsc_name,
const char *  dsc_level,
const char *  var_name,
time_t  start_time,
time_t  end_time,
DQR ***  dqrs 
)

Get the DQRs for a datastream variable.

The memory used by the output array is dynamically allocated. It is the responsibility of the calling process to free this memory when it is no longer needed (see dsproc_free_dqrs()).

Null results from the database are not reported as errors. It is the responsibility of the calling process to report these as errors if necessary.

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- site name
facility- facility name
dsc_name- datastream class name
dsc_level- datastream class level
var_name- variable name or NULL for all variables
start_time- start time in seconds since 1970
end_time- end time in seconds since 1970
dqrs- output: pointer to the array of pointers to the DQR structures.
Returns:
  • number of DQRs returned
  • 0 if no DQRs were found
  • -1 if an error occurred

Definition at line 494 of file dsproc_dqrdb.c.