libdsdb3  3.0
 All Data Structures Files Functions Variables Typedefs Enumerations Macros Groups
Utility Functions

Functions

char * dsdb_bool_to_text (DSDB *dsdb, int bval, char *text)
 Convert a boolean value to a database specific text string.
int * dsdb_text_to_bool (DSDB *dsdb, const char *text, int *bval)
 Convert a database specific text string to a boolean value.
char * dsdb_time_to_text (DSDB *dsdb, time_t time, char *text)
 Convert seconds since 1970 to a database specific time string.
time_t * dsdb_text_to_time (DSDB *dsdb, const char *text, time_t *time)
 Convert a database specific time string to seconds since 1970.
char * dsdb_timeval_to_text (DSDB *dsdb, timeval_t *tval, char *text)
 Convert a timeval to a database specific time string.
timeval_tdsdb_text_to_timeval (DSDB *dsdb, const char *text, timeval_t *tval)
 Convert a database specific time string to a timeval.

Detailed Description


Function Documentation

char* dsdb_bool_to_text ( DSDB dsdb,
int  bval,
char *  text 
)

Convert a boolean value to a database specific text string.

This function will convert a boolean value into a string that can be used in database queries.

Parameters:
dsdb- pointer to the database connection
bval- boolean value (1 = TRUE, 0 = FALSE)
text- output: text string
Returns:
the text argument

Definition at line 263 of file dsdb.c.

int* dsdb_text_to_bool ( DSDB dsdb,
const char *  text,
int *  bval 
)

Convert a database specific text string to a boolean value.

This function will convert a boolean string returned by a database query into an integer (1 = TRUE, 0 = FALSE).

Error messages from this function are sent to the message handler (see msngr_init_log() and msngr_init_mail()).

Parameters:
dsdb- pointer to the database connection
text- text string
bval- output: boolean value (1 = TRUE, 0 = FALSE)
Returns:
  • the bval argument
  • NULL if the text string is not a valid boolean value

Definition at line 285 of file dsdb.c.

time_t* dsdb_text_to_time ( DSDB dsdb,
const char *  text,
time_t *  time 
)

Convert a database specific time string to seconds since 1970.

This function will convert a time string returned by a database query into seconds since 1970.

Error messages from this function are sent to the message handler (see msngr_init_log() and msngr_init_mail()).

Parameters:
dsdb- pointer to the database connection
text- time string
time- output: seconds since 1970
Returns:
  • the time argument
  • NULL if an error occurred

Definition at line 335 of file dsdb.c.

timeval_t* dsdb_text_to_timeval ( DSDB dsdb,
const char *  text,
timeval_t tval 
)

Convert a database specific time string to a timeval.

This function will convert a time string returned by a database query into a timeval.

Error messages from this function are sent to the message handler (see msngr_init_log() and msngr_init_mail()).

Parameters:
dsdb- pointer to the database connection
text- time string
tval- output: timeval (in seconds since 1970)
Returns:
  • the tval argument
  • NULL if an error occurred

Definition at line 388 of file dsdb.c.

char* dsdb_time_to_text ( DSDB dsdb,
time_t  time,
char *  text 
)

Convert seconds since 1970 to a database specific time string.

This function will convert seconds since 1970 into a time string that can be used in database queries.

The text argument must point to a string that can hold at least 32 characters.

Error messages from this function are sent to the message handler (see msngr_init_log() and msngr_init_mail()).

Parameters:
dsdb- pointer to the database connection
time- seconds since 1970
text- output: time string
Returns:
  • the text argument
  • NULL if an error occurred

Definition at line 310 of file dsdb.c.

char* dsdb_timeval_to_text ( DSDB dsdb,
timeval_t tval,
char *  text 
)

Convert a timeval to a database specific time string.

This function will convert a timeval into a time string that can be used in database queries.

The text argument must point to a string that can hold at least 32 characters.

Error messages from this function are sent to the message handler (see msngr_init_log() and msngr_init_mail()).

Parameters:
dsdb- pointer to the database connection
tval- pointer to the timeval (in seconds since 1970)
text- output: time string
Returns:
  • the text argument
  • NULL if an error occurred

Definition at line 363 of file dsdb.c.