376 lines
9.0 KiB
C++
376 lines
9.0 KiB
C++
|
|
// Version: 2020.4.10 16:35:16
|
||
|
|
|
||
|
|
// File: T_TIME_SET.cpp
|
||
|
|
|
||
|
|
#include "T_TIME_SET.h"
|
||
|
|
|
||
|
|
T_TIME_SET::T_TIME_SET(){
|
||
|
|
// initialise all membervariables
|
||
|
|
initial();
|
||
|
|
}
|
||
|
|
T_TIME_SET::~T_TIME_SET(){
|
||
|
|
}
|
||
|
|
void T_TIME_SET::initial(){
|
||
|
|
// initialise all membervariables
|
||
|
|
set_code((char*)"");
|
||
|
|
set_chinese((char*)"");
|
||
|
|
set_chineseZi(-1);
|
||
|
|
set_warntop(0);
|
||
|
|
set_warntopZi(-1);
|
||
|
|
set_warnbot(0);
|
||
|
|
set_warnbotZi(-1);
|
||
|
|
set_errortop(0);
|
||
|
|
set_errortopZi(-1);
|
||
|
|
set_errorbot(0);
|
||
|
|
set_errorbotZi(-1);
|
||
|
|
// initialies Primary key members
|
||
|
|
set_k_code((char*)"");
|
||
|
|
}
|
||
|
|
T_TIME_SET::T_TIME_SET(const char* arg1)
|
||
|
|
{
|
||
|
|
initial();
|
||
|
|
setPrimKey (arg1);
|
||
|
|
//read DB record
|
||
|
|
dbAccess = true;
|
||
|
|
dbMessage = readDB();
|
||
|
|
if ( dbMessage != NULL ) {dbAccess = false;}
|
||
|
|
}
|
||
|
|
|
||
|
|
char* T_TIME_SET:: execute(const char* sql , long* count){
|
||
|
|
return( db.execute( sql , count ) );
|
||
|
|
}
|
||
|
|
|
||
|
|
char* T_TIME_SET:: dbCommit(){
|
||
|
|
return( db.dbCommit( ) );
|
||
|
|
}
|
||
|
|
|
||
|
|
char* T_TIME_SET:: dbRollback(){
|
||
|
|
return( db.dbRollback( ) );
|
||
|
|
}
|
||
|
|
|
||
|
|
char* T_TIME_SET::readDB(){
|
||
|
|
// DB Trace is off
|
||
|
|
return( db.readDB(*this) );
|
||
|
|
}
|
||
|
|
|
||
|
|
char* T_TIME_SET::updateDB(){
|
||
|
|
// DB Trace is off
|
||
|
|
return( db.updateDB(*this) );
|
||
|
|
}
|
||
|
|
|
||
|
|
char* T_TIME_SET::insertDB(){
|
||
|
|
// DB Trace is off
|
||
|
|
return( db.insertDB(*this) );
|
||
|
|
}
|
||
|
|
|
||
|
|
char* T_TIME_SET::deleteDB(){
|
||
|
|
// DB Trace is off
|
||
|
|
return( db.deleteDB(*this) );
|
||
|
|
}
|
||
|
|
|
||
|
|
char* T_TIME_SET::deleteDB(const char * where, long* count){
|
||
|
|
// DB Trace is off
|
||
|
|
return( db.deleteDB( where , count ) );
|
||
|
|
}
|
||
|
|
|
||
|
|
char* T_TIME_SET::openSetDB(const char * where,const char* order){
|
||
|
|
// DB Trace is off
|
||
|
|
return( db.openSetDB( where , order ) );
|
||
|
|
}
|
||
|
|
|
||
|
|
char* T_TIME_SET::countDB(const char * where, long* count){
|
||
|
|
// DB Trace is off
|
||
|
|
return( db.countDB( where , count ) );
|
||
|
|
}
|
||
|
|
|
||
|
|
char* T_TIME_SET::getSetDB(){
|
||
|
|
// DB Trace is off
|
||
|
|
return( db.getSetDB(*this) );
|
||
|
|
}
|
||
|
|
|
||
|
|
char* T_TIME_SET::closeSetDB(){
|
||
|
|
// DB Trace is off
|
||
|
|
return( db.closeSetDB() );
|
||
|
|
}
|
||
|
|
|
||
|
|
char* T_TIME_SET::storeDB(){
|
||
|
|
char* ret = NULL;
|
||
|
|
setKeysFromRecord();
|
||
|
|
ret=db.updateDB(*this);
|
||
|
|
if(ret != NULL){
|
||
|
|
ret=db.insertDB(*this);
|
||
|
|
if(ret != NULL){
|
||
|
|
dbAccess = false;
|
||
|
|
return(ret);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
return(ret);
|
||
|
|
}
|
||
|
|
|
||
|
|
// public methode setPrimKey T_TIME_SET
|
||
|
|
//
|
||
|
|
// this methode stores the unique key attributes
|
||
|
|
//
|
||
|
|
void T_TIME_SET::setPrimKey( const char* arg1 ){
|
||
|
|
strncpy( (char*)c_k_code , arg1 , sizeof(c_k_code) );
|
||
|
|
c_k_code[sizeof(c_k_code)-1] = '\0';
|
||
|
|
} // end of methode
|
||
|
|
|
||
|
|
void T_TIME_SET::initInsertKeys( const char* arg1 ){
|
||
|
|
setPrimKey ( arg1);
|
||
|
|
strncpy( (char*)c_code , arg1 , sizeof(c_code) );
|
||
|
|
c_code[sizeof(c_code)-1] = '\0';
|
||
|
|
} // end of methode
|
||
|
|
void T_TIME_SET::setKeysFromRecord(){
|
||
|
|
set_k_code( code() );
|
||
|
|
} // end of methode
|
||
|
|
//
|
||
|
|
//O P E R A T O R +
|
||
|
|
//===================
|
||
|
|
//
|
||
|
|
T_TIME_SET T_TIME_SET::operator+(const T_TIME_SET &inst) const{
|
||
|
|
T_TIME_SET ptrT_TIME_SET(*this);
|
||
|
|
//----------------------------------------------------------
|
||
|
|
ptrT_TIME_SET.set_code(inst.code());
|
||
|
|
//----------------------------------------------------------
|
||
|
|
if(inst.chineseZi() != -1){
|
||
|
|
ptrT_TIME_SET.set_chinese(inst.chinese());
|
||
|
|
ptrT_TIME_SET.set_chineseZi(inst.chineseZi());
|
||
|
|
}
|
||
|
|
//----------------------------------------------------------
|
||
|
|
if(inst.warntopZi() != -1){
|
||
|
|
ptrT_TIME_SET.set_warntop(inst.warntop());
|
||
|
|
ptrT_TIME_SET.set_warntopZi(inst.warntopZi());
|
||
|
|
}
|
||
|
|
//----------------------------------------------------------
|
||
|
|
if(inst.warnbotZi() != -1){
|
||
|
|
ptrT_TIME_SET.set_warnbot(inst.warnbot());
|
||
|
|
ptrT_TIME_SET.set_warnbotZi(inst.warnbotZi());
|
||
|
|
}
|
||
|
|
//----------------------------------------------------------
|
||
|
|
if(inst.errortopZi() != -1){
|
||
|
|
ptrT_TIME_SET.set_errortop(inst.errortop());
|
||
|
|
ptrT_TIME_SET.set_errortopZi(inst.errortopZi());
|
||
|
|
}
|
||
|
|
//----------------------------------------------------------
|
||
|
|
if(inst.errorbotZi() != -1){
|
||
|
|
ptrT_TIME_SET.set_errorbot(inst.errorbot());
|
||
|
|
ptrT_TIME_SET.set_errorbotZi(inst.errorbotZi());
|
||
|
|
}
|
||
|
|
return (ptrT_TIME_SET);
|
||
|
|
}
|
||
|
|
|
||
|
|
//
|
||
|
|
//O P E R A T O R =
|
||
|
|
//===================
|
||
|
|
//
|
||
|
|
const T_TIME_SET& T_TIME_SET::operator=(const T_TIME_SET &inst){
|
||
|
|
//----------------------------------------------------------
|
||
|
|
this->set_code(inst.code());
|
||
|
|
//----------------------------------------------------------
|
||
|
|
this->set_chinese(inst.chinese());
|
||
|
|
this->set_chineseZi(inst.chineseZi());
|
||
|
|
//----------------------------------------------------------
|
||
|
|
this->set_warntop(inst.warntop());
|
||
|
|
this->set_warntopZi(inst.warntopZi());
|
||
|
|
//----------------------------------------------------------
|
||
|
|
this->set_warnbot(inst.warnbot());
|
||
|
|
this->set_warnbotZi(inst.warnbotZi());
|
||
|
|
//----------------------------------------------------------
|
||
|
|
this->set_errortop(inst.errortop());
|
||
|
|
this->set_errortopZi(inst.errortopZi());
|
||
|
|
//----------------------------------------------------------
|
||
|
|
this->set_errorbot(inst.errorbot());
|
||
|
|
this->set_errorbotZi(inst.errorbotZi());
|
||
|
|
return (*this);
|
||
|
|
}
|
||
|
|
//
|
||
|
|
//C O P Y - C O N S T R U C T O R
|
||
|
|
//===================
|
||
|
|
//
|
||
|
|
T_TIME_SET::T_TIME_SET(const T_TIME_SET &inst){
|
||
|
|
//----------------------------------------------------------
|
||
|
|
this->set_code(inst.code());
|
||
|
|
//----------------------------------------------------------
|
||
|
|
this->set_chinese(inst.chinese());
|
||
|
|
this->set_chineseZi(inst.chineseZi());
|
||
|
|
//----------------------------------------------------------
|
||
|
|
this->set_warntop(inst.warntop());
|
||
|
|
this->set_warntopZi(inst.warntopZi());
|
||
|
|
//----------------------------------------------------------
|
||
|
|
this->set_warnbot(inst.warnbot());
|
||
|
|
this->set_warnbotZi(inst.warnbotZi());
|
||
|
|
//----------------------------------------------------------
|
||
|
|
this->set_errortop(inst.errortop());
|
||
|
|
this->set_errortopZi(inst.errortopZi());
|
||
|
|
//----------------------------------------------------------
|
||
|
|
this->set_errorbot(inst.errorbot());
|
||
|
|
this->set_errorbotZi(inst.errorbotZi());
|
||
|
|
}
|
||
|
|
char* T_TIME_SET::code() const{
|
||
|
|
return((char*)c_code );
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
void T_TIME_SET::set_code( const char* arg ){
|
||
|
|
strncpy((char*)c_code , arg , sizeof(c_code));
|
||
|
|
c_code[sizeof(c_code)-1] = '\0';
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
char* T_TIME_SET::chinese() const{
|
||
|
|
return((char*)c_chinese );
|
||
|
|
}
|
||
|
|
|
||
|
|
short T_TIME_SET::chineseZi() const{
|
||
|
|
return( s_chineseZi);
|
||
|
|
}
|
||
|
|
|
||
|
|
void T_TIME_SET::set_chinese( const char* arg ){
|
||
|
|
strncpy((char*)c_chinese , arg , sizeof(c_chinese));
|
||
|
|
c_chinese[sizeof(c_chinese)-1] = '\0';
|
||
|
|
s_chineseZi= 0;
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
void T_TIME_SET::set_chineseZi( short arg ) {
|
||
|
|
s_chineseZi = arg;
|
||
|
|
}
|
||
|
|
|
||
|
|
long T_TIME_SET::warntop() const{
|
||
|
|
return((long)l_warntop );
|
||
|
|
}
|
||
|
|
|
||
|
|
short T_TIME_SET::warntopZi() const{
|
||
|
|
return( s_warntopZi);
|
||
|
|
}
|
||
|
|
|
||
|
|
void T_TIME_SET::set_warntop( long arg ){
|
||
|
|
l_warntop = arg;
|
||
|
|
s_warntopZi= 0;
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
void T_TIME_SET::set_warntopZi( short arg ) {
|
||
|
|
s_warntopZi = arg;
|
||
|
|
}
|
||
|
|
|
||
|
|
long T_TIME_SET::warnbot() const{
|
||
|
|
return((long)l_warnbot );
|
||
|
|
}
|
||
|
|
|
||
|
|
short T_TIME_SET::warnbotZi() const{
|
||
|
|
return( s_warnbotZi);
|
||
|
|
}
|
||
|
|
|
||
|
|
void T_TIME_SET::set_warnbot( long arg ){
|
||
|
|
l_warnbot = arg;
|
||
|
|
s_warnbotZi= 0;
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
void T_TIME_SET::set_warnbotZi( short arg ) {
|
||
|
|
s_warnbotZi = arg;
|
||
|
|
}
|
||
|
|
|
||
|
|
long T_TIME_SET::errortop() const{
|
||
|
|
return((long)l_errortop );
|
||
|
|
}
|
||
|
|
|
||
|
|
short T_TIME_SET::errortopZi() const{
|
||
|
|
return( s_errortopZi);
|
||
|
|
}
|
||
|
|
|
||
|
|
void T_TIME_SET::set_errortop( long arg ){
|
||
|
|
l_errortop = arg;
|
||
|
|
s_errortopZi= 0;
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
void T_TIME_SET::set_errortopZi( short arg ) {
|
||
|
|
s_errortopZi = arg;
|
||
|
|
}
|
||
|
|
|
||
|
|
long T_TIME_SET::errorbot() const{
|
||
|
|
return((long)l_errorbot );
|
||
|
|
}
|
||
|
|
|
||
|
|
short T_TIME_SET::errorbotZi() const{
|
||
|
|
return( s_errorbotZi);
|
||
|
|
}
|
||
|
|
|
||
|
|
void T_TIME_SET::set_errorbot( long arg ){
|
||
|
|
l_errorbot = arg;
|
||
|
|
s_errorbotZi= 0;
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
void T_TIME_SET::set_errorbotZi( short arg ) {
|
||
|
|
s_errorbotZi = arg;
|
||
|
|
}
|
||
|
|
|
||
|
|
// methodes for Primary key
|
||
|
|
char* T_TIME_SET::k_code(){
|
||
|
|
return((char*)c_k_code );
|
||
|
|
}
|
||
|
|
|
||
|
|
void T_TIME_SET::set_k_code( char* arg ){
|
||
|
|
strncpy((char*)c_k_code , arg , sizeof(c_k_code));
|
||
|
|
c_k_code[sizeof(c_k_code)-1] = '\0';
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
//
|
||
|
|
// public methode fillStructure
|
||
|
|
//
|
||
|
|
// this methode filles the classstructue with the private attributes
|
||
|
|
//
|
||
|
|
void T_TIME_SET::fillStructure(){
|
||
|
|
strncpy ( structTable.code , code(),sizeof(structTable.code));
|
||
|
|
strncpy ( structTable.chinese , chinese(),sizeof(structTable.chinese));
|
||
|
|
structTable.warntop = warntop();
|
||
|
|
structTable.warnbot = warnbot();
|
||
|
|
structTable.errortop = errortop();
|
||
|
|
structTable.errorbot = errorbot();
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
///////////////////////////////////////////////////
|
||
|
|
void T_TIME_SET::fillStructureZi(){
|
||
|
|
structTableZi.chineseZi = chineseZi();
|
||
|
|
structTableZi.warntopZi = warntopZi();
|
||
|
|
structTableZi.warnbotZi = warnbotZi();
|
||
|
|
structTableZi.errortopZi = errortopZi();
|
||
|
|
structTableZi.errorbotZi = errorbotZi();
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
///////////////////////////////////////////////////
|
||
|
|
void T_TIME_SET::setStructure() {
|
||
|
|
set_chinese( structTable.chinese);
|
||
|
|
set_warntop( structTable.warntop);
|
||
|
|
set_warnbot( structTable.warnbot);
|
||
|
|
set_errortop( structTable.errortop);
|
||
|
|
set_errorbot( structTable.errorbot);
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
///////////////////////////////////////////////////
|
||
|
|
void T_TIME_SET::setStructureZi() {
|
||
|
|
set_chineseZi( structTableZi.chineseZi);
|
||
|
|
set_warntopZi( structTableZi.warntopZi);
|
||
|
|
set_warnbotZi( structTableZi.warnbotZi);
|
||
|
|
set_errortopZi( structTableZi.errortopZi);
|
||
|
|
set_errorbotZi( structTableZi.errorbotZi);
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
///////////////////////////////////////////////////
|
||
|
|
char* T_TIME_SET::getName(){
|
||
|
|
return((char*)"T_TIME_SET");
|
||
|
|
}
|
||
|
|
///////////////////////////////////////////////////
|
||
|
|
int T_TIME_SET::getSqlCode(){
|
||
|
|
return( db.dbSqlCode);
|
||
|
|
}
|
||
|
|
int T_TIME_SET::getRowsProcessed(){
|
||
|
|
return( db.dbRowsProcessed);
|
||
|
|
}
|