#include <stdio.h>
#include <mysql/mysql.h>
#include <string.h>
#include "wlcstdc.h"
#include "iniparser.h"
#include "scdata.h"
Include dependency graph for scdb.h:
Data Structures | |
struct | SCdb_cfg |
Defines | |
#define | SCDB_RES MYSQL_RES |
#define | SCDB_ROW MYSQL_ROW |
#define | SCdb_fetch_row mysql_fetch_row |
#define | SCdb_free_result mysql_free_result |
Typedefs | |
typedef unsigned long | ulong |
Functions | |
SCdb_cfg * | make_SCdb_cfg (const char *ini_path) |
int | SCdb_init (const struct SCdb_cfg *cfg) |
void | SCdb_free () |
int | SCdb_reset_connection (const struct SCdb_cfg *cfg) |
SCDB_RES * | SCdb_store_result () |
int | SCdb_query (const char *query) |
stored_proc SCdb stored procedures | |
Functions operating on SCdb stored procedures This is a set of stored procedures predefined in SCdb. See the "Selection Check Developers Manual" for a description of there parameters and about the results they give. All of these functions return 0 if the query was successful or -1 if otherwise. | |
int | SCdb_insert_wl (const char *date) |
int | SCdb_insert_SCs_data (int over, const char *date, const struct SCs_data *data) |
int | SCdb_get_wls (int year, int month) |
int | SCdb_get_planed_shift (int year, int month) |
int | SCdb_get_workers () |
int | SCdb_insert_worker (const char *first_name, const char *last_name) |
int | SCdb_delete_worker (const char *first_name, const char *last_name) |
int | SCdb_delete_alldata (const char *date) |
int | SCdb_delete_shift (const char *date) |
int | SCdb_insert_shift (const char *date, const char *first_name, const char *last_name, int station, int shift) |
int | SCdb_get_shift (const char *date) |
int | SCdb_get_work (const char *first_name, const char *last_name, const char *date) |
int | SCdb_get_input (const char *date, const char *tfrom, const char *tto, int ws) |
#define SCdb_fetch_row mysql_fetch_row |
#define SCdb_free_result mysql_free_result |
#define SCDB_RES MYSQL_RES |
Stores the resoults of a query
#define SCDB_ROW MYSQL_ROW |
Stores a row from the results
typedef unsigned long ulong |
struct SCdb_cfg* make_SCdb_cfg | ( | const char * | ini_path | ) |
int SCdb_delete_alldata | ( | const char * | date | ) |
Deletes worker. See "Selection Check Developer Manual for more information.
int SCdb_delete_shift | ( | const char * | date | ) |
Deletes a shift. See "Selection Check Developer Manual for more information.
int SCdb_delete_worker | ( | const char * | first_name, | |
const char * | last_name | |||
) |
Deletes worker. See "Selection Check Developer Manual for more information.
void SCdb_free | ( | ) |
Frees the database connection.
int SCdb_get_input | ( | const char * | date, | |
const char * | tfrom, | |||
const char * | tto, | |||
int | ws | |||
) |
Gets inputs from a SCslave generated in the specified time. See "Selection Check Developer Manual for more information.
int SCdb_get_planed_shift | ( | int | year, | |
int | month | |||
) |
Gets planed shift dates. See "Selection Check Developer Manual for more information.
int SCdb_get_shift | ( | const char * | date | ) |
Gets a shift. See "Selection Check Developer Manual for more information.
int SCdb_get_wls | ( | int | year, | |
int | month | |||
) |
Gets worklog dates. See "Selection Check Developer Manual for more information.
int SCdb_get_work | ( | const char * | first_name, | |
const char * | last_name, | |||
const char * | date | |||
) |
Gets work done by one worker in day 'date'. See "Selection Check Developer Manual for more information.
int SCdb_get_workers | ( | ) |
Gets worker names. See "Selection Check Developer Manual for more information.
int SCdb_init | ( | const struct SCdb_cfg * | cfg | ) |
Initializes a database connection with parameters from cfg.
cfg | database parameters |
int SCdb_insert_SCs_data | ( | int | over, | |
const char * | date, | |||
const struct SCs_data * | data | |||
) |
Inserts SCslaves data record. See "Selection Check Developer Manual for more information.
int SCdb_insert_shift | ( | const char * | date, | |
const char * | first_name, | |||
const char * | last_name, | |||
int | station, | |||
int | shift | |||
) |
Inserts a shift. See "Selection Check Developer Manual for more information.
int SCdb_insert_wl | ( | const char * | date | ) |
Inserts worklog date. See "Selection Check Developer Manual for more information.
int SCdb_insert_worker | ( | const char * | first_name, | |
const char * | last_name | |||
) |
Inserts worker. See "Selection Check Developer Manual for more information.
int SCdb_query | ( | const char * | query | ) |
Execute query from query.
query | a string containing the query |
int SCdb_reset_connection | ( | const struct SCdb_cfg * | cfg | ) |
Closes the connection and establishes a new one with the parameters from cfg.
cfg | new connection parameters |
SCDB_RES* SCdb_store_result | ( | ) |
Returns the results from last query