manage/scdb.h File Reference

#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_cfgmake_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)

Detailed Description

Abstraction layer over the SCdb database.

Define Documentation

#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 Documentation

typedef unsigned long ulong


Function Documentation

struct SCdb_cfg* make_SCdb_cfg ( const char *  ini_path  ) 

Allocates a SCdb_cfg structure with entries from an ini file.

Parameters:
ini_path path of the ini file
Returns:
a pointer to the allocated SCdb_cfg structure if successful; NULL if couldn't open the file or if the file didn't have the required entries

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.

Parameters:
cfg database parameters
Returns:
0 if successful else -1

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.

Parameters:
query a string containing the query
Returns:
0 if successful else -1

int SCdb_reset_connection ( const struct SCdb_cfg cfg  ) 

Closes the connection and establishes a new one with the parameters from cfg.

Parameters:
cfg new connection parameters
Returns:
0 if successful else -1

SCDB_RES* SCdb_store_result (  ) 

Returns the results from last query


Generated on Wed Jan 23 16:21:21 2008 for Selection Check Librarys by  doxygen 1.5.1