Created
December 24, 2013 12:20
-
-
Save adolgarev/8112518 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* MySQL specific routines */ | |
#ifndef EXTERN_MYSQL_H | |
#define EXTERN_MYSQL_H | |
#include <mysql/mysql.h> | |
extern char *DBHOST; | |
extern char *DBUSER; | |
extern char *DBPASSWD; | |
extern char *DBDB; | |
extern int DBPORT; | |
extern char *DBUNIXSOCKET; | |
typedef MYSQL_TIME mb_time_t; | |
/* prepared requests numbers */ | |
typedef enum { | |
mb_db_schedule_stmt, | |
... | |
} mb_db_stmt_e; | |
int mb_db_init(); | |
int mb_db_del(); | |
/* execute prepared request, what is a request number from mb_db_stmt_e enum | |
count points to variable where rows number will be stored, | |
returns pointer to array of rows, you need to free() allocated memory, | |
returns NULL in case of empty set or error, sets count to -1 if error occured */ | |
void *mb_db_exec(int what, size_t *count); | |
#define MB_DB_CONFIG_VALUE_LEN 256 | |
#define MB_DB_SETTINGS_VALUE_LEN 4096 | |
/* below are the structs to hold results from db */ | |
typedef struct { | |
int schedule_id; | |
char name[128]; | |
int schedule_type; | |
char enabled; | |
short int starthour; | |
short int startminute; | |
short int endhour; | |
short int endminute; | |
short int everyhours; | |
short int day; | |
char sunday; | |
char monday; | |
char tuesday; | |
char wednesday; | |
char thursday; | |
char friday; | |
char saturday; | |
int status; | |
short int retentionmethod; | |
short int retentionlength; | |
char username[64]; | |
char machine_username[128]; | |
char machine_address[128]; | |
int machine_os_type; | |
} mb_db_schedule_t; | |
... | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment