GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> FMX / V4-0-14 > fmxshr / rhel5-32


Interface   Data Structures   File List   Data Fields   Globals  

Defines | Functions
FMX_user.c File Reference

Connection and user management functions. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
#include <mysql.h>
#include <FMX/FMX_msgs.h>
#include <FMX/FMX_pubdefs.h>
#include <MDB/MDB_pubdefs.h>
#include <FMX_diction.h>
#include <FMX_prvdefs.h>

Defines

#define FMX_L_BUFFER   ( 2048 )
 Maximum length of a general purpose string buffer.
#define FMX_K_PORT   ( 8206 )
 Standard port on which to contact an fmx database.

Functions

unsigned int FMX_connect (FMX_Connection **con, const char *host, const char *user, const char *pass, int port)
 Create a connection to the database.
unsigned int FMX_disconnect (FMX_Connection *ucb)
 Break a connection to the database.

Detailed Description

Connection and user management functions.

CVS $Id: FMX_user.c,v 1.3 2011/03/25 20:42:51 apw Exp $
Author:
A.P.Waite

Function Documentation

unsigned int FMX_connect ( FMX_Connection **  con,
const char *  host,
const char *  user,
const char *  pass,
int  port 
)

Create a connection to the database.

Parameters:
con(out) Connection handle
host(in) Host name (NULL: take from $FMX_C_FDB)
user(in) User name (NULL: take from .my.cnf)
pass(in) Password (NULL: take from .my.cnf)
port(in) Connection handle
Return values:
FMX_ALLOCBUFLocal (stack) buffer too small
FMX_ALLOCMEMCannot allocate sufficient memory (dynamic)
FMX_EVMISSExpected environment variable not found
FMX_MYSQLCONCannot select database status from global table
FMX_LINKMISTExpected file system link not found
FMX_MYCNFBADUser's .my.cnf file insufficiently protected
FMX_MYCNFMISCannot find user's .my.cnf file
FMX_MYSQLINTCannot initialize a MySQL handle
FMX_MYSQLCONCannot connect to MySQL database
FMX_SUCCESSSuccess
FMX_USERACCCannot determine access privileges for user
FMX_USERIDCannot identify user from database tables
FMX_USERNOTUser has no privileges on this database

References _FMX_Connection::access, FMX_fcb, FMX_K_PORT, FMX_L_BUFFER, FMX_USR_LOGICIAN, FMX_USR_OPTICIAN, FMX_USR_PHYSICIAN, FMX_USR_TECHNICIAN, _FMX_Connection::host, _FMX_Connection::mysql, _FMX_Connection::next, _FMX_Connection::role, _FMX_Control::root, _FMX_Connection::root, s__my_cnf, s_fmx, s_FMX_C_FDB, s_FMX_HOST, s_HOME, s_production, s_Y, _FMX_Connection::self, and _FMX_Connection::user.

unsigned int FMX_disconnect ( FMX_Connection ucb)

Break a connection to the database.

Parameters:
ucb(in) User connection block
Return values:
FMX_UCBMISSConnection block not found in list
FMX_UCBNOTInvalid connection block
FMX_SUCCESSSuccess

References FMX_fcb, FMX_freeEnumTable(), FMX_L_ENUM_TABLES, _FMX_Connection::host, _FMX_Connection::mysql, _FMX_Connection::next, _FMX_Connection::root, _FMX_Control::root, _FMX_Connection::self, and _FMX_Connection::user.

Referenced by FMX_shutdown().