398 lines
7.0 KiB
C++
398 lines
7.0 KiB
C++
// Version: 2021.6.18 15:19:24
|
|
|
|
#ifndef _T_PDO_CFG_H
|
|
#define _T_PDO_CFG_H
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
#ifdef _MSC_VER
|
|
#pragma warning(disable:4996)
|
|
#pragma warning(disable:4267)
|
|
#endif
|
|
#include "T_PDO_CFGDBAX.h"
|
|
class T_PDO_CFG{
|
|
friend class T_PDO_CFGDBAX;
|
|
private:
|
|
//aggregation to DB Class
|
|
T_PDO_CFGDBAX db;
|
|
public:
|
|
//
|
|
//A T T R I B U T E S
|
|
//===================
|
|
//
|
|
bool dbAccess;
|
|
char* dbMessage;// pointer for the return values of DBAX methodes
|
|
char messageBuffer[200];// temporary message buffer
|
|
friend class PapLib;
|
|
protected:
|
|
//
|
|
//A T T R I B U T E S
|
|
//===================
|
|
//
|
|
char c_item[100+1];
|
|
long l_type;
|
|
char c_chinese[100+1];
|
|
char c_unit[12+1];
|
|
short s_unitZi;
|
|
char c_table[40+1];
|
|
char c_column[40+1];
|
|
char c_remark[200+1];
|
|
short s_remarkZi;
|
|
char c_toc[27];
|
|
short s_tocZi;
|
|
char c_tom[27];
|
|
short s_tomZi;
|
|
char c_mop[121];
|
|
short s_mopZi;
|
|
char c_mou[31];
|
|
short s_mouZi;
|
|
// arguments for Primary key
|
|
char c_k_item[100+1];
|
|
long l_k_type;
|
|
public:
|
|
//
|
|
// LTA Structure
|
|
struct STR_T_PDO_CFG{
|
|
char item[100+1];
|
|
int type;
|
|
char chinese[100+1];
|
|
char unit[12+1];
|
|
char table[40+1];
|
|
char column[40+1];
|
|
char remark[200+1];
|
|
char toc[27];
|
|
char tom[27];
|
|
char mop[121];
|
|
char mou[31];
|
|
}structTable;
|
|
// LTA Structure Zi
|
|
struct STR_T_PDO_CFGZi{
|
|
short unitZi;
|
|
short remarkZi;
|
|
short tocZi;
|
|
short tomZi;
|
|
short mopZi;
|
|
short mouZi;
|
|
}structTableZi;
|
|
//
|
|
//C O N S T R U C T O R S
|
|
//=======================
|
|
//
|
|
public:
|
|
T_PDO_CFG();
|
|
//D E S T R U C T O R S
|
|
//=======================
|
|
//
|
|
virtual ~T_PDO_CFG();
|
|
//
|
|
//C O P Y - C O N S T R U C T O R
|
|
//=======================
|
|
T_PDO_CFG(const T_PDO_CFG &inst);
|
|
// For Constructors with parameters the flag dbAccess
|
|
// informs you if the access was successfully or not
|
|
T_PDO_CFG( const char* arg1,long arg2);
|
|
|
|
//methods
|
|
public:
|
|
char* getCreationTime() {return (char*)"2021.6.18 15:19:24";};
|
|
//initial data
|
|
void initial();
|
|
//read data
|
|
char* readDB();
|
|
//update data
|
|
char* updateDB();
|
|
//insert data
|
|
char* insertDB();
|
|
//this methode tries to update a DB record , when the update fails , the methode
|
|
//tries an insert of the failed record
|
|
char* storeDB();
|
|
//delete data
|
|
char* deleteDB();
|
|
//delete data
|
|
char* deleteDB(const char* where , long* count );
|
|
//openSetDB data
|
|
char* openSetDB(const char* where ,const char* order );
|
|
//getSetDB data
|
|
char* getSetDB();
|
|
//closeSetDB data
|
|
char* closeSetDB();
|
|
//countDB data
|
|
char* countDB(const char* where , long* count );
|
|
|
|
char* execute(const char* sql , long* count );
|
|
|
|
char* dbCommit();
|
|
|
|
char* dbRollback();
|
|
public:
|
|
//
|
|
// public methode setPrimKey
|
|
//
|
|
// this methode stores the unique key attributes
|
|
//
|
|
void setPrimKey(const char* arg1 , long arg2 );
|
|
|
|
|
|
// public methode initInsertKeys
|
|
//
|
|
// this methode stores the unique key attributes
|
|
//
|
|
void initInsertKeys( const char* arg1 , long arg2 );
|
|
|
|
|
|
public:
|
|
//
|
|
// public methode setKeysFromRecord
|
|
//
|
|
// this methode set the unique key attributes from the DB Record Attributes
|
|
//
|
|
void setKeysFromRecord();
|
|
|
|
//
|
|
//O P E R A T O R +
|
|
//===================
|
|
//
|
|
public:
|
|
T_PDO_CFG operator+(const T_PDO_CFG &inst) const;
|
|
|
|
//
|
|
//O P E R A T O R =
|
|
//===================
|
|
//
|
|
public:
|
|
const T_PDO_CFG& operator=(const T_PDO_CFG &inst);
|
|
char* item() const;//{
|
|
//return((char*)c_item );
|
|
//}
|
|
|
|
|
|
void set_item( const char* arg );//{
|
|
//strncpy((char*)c_item , arg , sizeof(c_item));
|
|
//c_item[sizeof(c_item)-1] = '\0';
|
|
//return;
|
|
//}
|
|
|
|
|
|
long type() const;//{
|
|
//return((long)l_type );
|
|
//}
|
|
|
|
|
|
void set_type( long arg );//{
|
|
//l_type = arg;
|
|
//return;
|
|
//}
|
|
|
|
|
|
char* chinese() const;//{
|
|
//return((char*)c_chinese );
|
|
//}
|
|
|
|
|
|
void set_chinese( const char* arg );//{
|
|
//strncpy((char*)c_chinese , arg , sizeof(c_chinese));
|
|
//c_chinese[sizeof(c_chinese)-1] = '\0';
|
|
//return;
|
|
//}
|
|
|
|
|
|
char* unit() const;//{
|
|
//return((char*)c_unit );
|
|
//}
|
|
|
|
short unitZi() const;//{
|
|
//return( s_unitZi);
|
|
//}
|
|
|
|
void set_unit( const char* arg );//{
|
|
//strncpy((char*)c_unit , arg , sizeof(c_unit));
|
|
//c_unit[sizeof(c_unit)-1] = '\0';
|
|
//s_unitZi= 0;
|
|
//return;
|
|
//}
|
|
|
|
void set_unitZi( short arg ) ;//{
|
|
//s_unitZi = arg;
|
|
//}
|
|
|
|
char* table() const;//{
|
|
//return((char*)c_table );
|
|
//}
|
|
|
|
|
|
void set_table( const char* arg );//{
|
|
//strncpy((char*)c_table , arg , sizeof(c_table));
|
|
//c_table[sizeof(c_table)-1] = '\0';
|
|
//return;
|
|
//}
|
|
|
|
|
|
char* column() const;//{
|
|
//return((char*)c_column );
|
|
//}
|
|
|
|
|
|
void set_column( const char* arg );//{
|
|
//strncpy((char*)c_column , arg , sizeof(c_column));
|
|
//c_column[sizeof(c_column)-1] = '\0';
|
|
//return;
|
|
//}
|
|
|
|
|
|
char* remark() const;//{
|
|
//return((char*)c_remark );
|
|
//}
|
|
|
|
short remarkZi() const;//{
|
|
//return( s_remarkZi);
|
|
//}
|
|
|
|
void set_remark( const char* arg );//{
|
|
//strncpy((char*)c_remark , arg , sizeof(c_remark));
|
|
//c_remark[sizeof(c_remark)-1] = '\0';
|
|
//s_remarkZi= 0;
|
|
//return;
|
|
//}
|
|
|
|
void set_remarkZi( short arg ) ;//{
|
|
//s_remarkZi = arg;
|
|
//}
|
|
|
|
public:
|
|
char* toc() const;//{
|
|
//return((char*)c_toc );
|
|
//}
|
|
|
|
short tocZi() const;//{
|
|
//return( s_tocZi);
|
|
//}
|
|
|
|
protected:
|
|
void set_toc( char* arg );//{
|
|
//strncpy((char*)c_toc , arg , sizeof(c_toc));
|
|
//c_toc[sizeof(c_toc)-1] = '\0';
|
|
//s_tocZi= 0;
|
|
//return;
|
|
//}
|
|
|
|
void set_tocZi( short arg );//{
|
|
//s_tocZi = arg;
|
|
//}
|
|
|
|
public:
|
|
char* tom() const;//{
|
|
//return((char*)c_tom );
|
|
//}
|
|
|
|
short tomZi() const;//{
|
|
//return( s_tomZi);
|
|
//}
|
|
|
|
protected:
|
|
void set_tom( char* arg );//{
|
|
//strncpy((char*)c_tom , arg , sizeof(c_tom));
|
|
//c_tom[sizeof(c_tom)-1] = '\0';
|
|
//s_tomZi= 0;
|
|
//return;
|
|
//}
|
|
|
|
void set_tomZi( short arg );//{
|
|
//s_tomZi = arg;
|
|
//}
|
|
|
|
public:
|
|
char* mop() const;//{
|
|
//return((char*)c_mop );
|
|
//}
|
|
|
|
short mopZi() const;//{
|
|
//return( s_mopZi);
|
|
//}
|
|
|
|
protected:
|
|
void set_mop( char* arg );//{
|
|
//strncpy((char*)c_mop , arg , sizeof(c_mop));
|
|
//c_mop[sizeof(c_mop)-1] = '\0';
|
|
//s_mopZi= 0;
|
|
//return;
|
|
//}
|
|
|
|
void set_mopZi( short arg );//{
|
|
//s_mopZi = arg;
|
|
//}
|
|
|
|
public:
|
|
char* mou() const;//{
|
|
//return((char*)c_mou );
|
|
//}
|
|
|
|
short mouZi() const;//{
|
|
//return( s_mouZi);
|
|
//}
|
|
|
|
protected:
|
|
void set_mou( char* arg );//{
|
|
//strncpy((char*)c_mou , arg , sizeof(c_mou));
|
|
//c_mou[sizeof(c_mou)-1] = '\0';
|
|
//s_mouZi= 0;
|
|
//return;
|
|
//}
|
|
|
|
void set_mouZi( short arg );//{
|
|
//s_mouZi = arg;
|
|
//}
|
|
|
|
public:
|
|
// methodes for Primary key
|
|
char* k_item();//{
|
|
//return((char*)c_k_item );
|
|
//}
|
|
|
|
void set_k_item( char* arg );//{
|
|
//strncpy((char*)c_k_item , arg , sizeof(c_k_item));
|
|
//c_k_item[sizeof(c_k_item)-1] = '\0';
|
|
//return;
|
|
//}
|
|
|
|
long k_type();//{
|
|
//return((long)l_k_type );
|
|
//}
|
|
|
|
void set_k_type( long arg );//{
|
|
//l_k_type = arg;
|
|
//return;
|
|
//}
|
|
|
|
public:
|
|
//
|
|
// public methode fillStructure
|
|
//
|
|
// this methode filles the classstructue with the private attributes
|
|
//
|
|
void fillStructure();//{
|
|
//}
|
|
///////////////////////////////////////////////////
|
|
void fillStructureZi();//{
|
|
//}
|
|
///////////////////////////////////////////////////
|
|
void setStructure();// {
|
|
//return;
|
|
//}
|
|
///////////////////////////////////////////////////
|
|
void setStructureZi() ;//{
|
|
//}
|
|
///////////////////////////////////////////////////
|
|
char* getName();//{
|
|
//return((char*)"T_PDO_CFG");
|
|
//}
|
|
///////////////////////////////////////////////////
|
|
int getSqlCode();//{
|
|
//return( db.dbSqlCode);
|
|
//}
|
|
///////////////////////////////////////////////////
|
|
int getRowsProcessed();//{
|
|
//return( db.dbRowsProcessed);
|
|
//}
|
|
};
|
|
#endif
|