eis/src/dbax/T_HMI_DISPSQL.cpp

380 lines
9.2 KiB
C++

// Version: 2014.7.30 16:47:28
// File: T_HMI_DISPSQL.cpp
#include "T_HMI_DISPSQL.h"
T_HMI_DISPSQL::T_HMI_DISPSQL(){
// initialise all membervariables
initial();
}
T_HMI_DISPSQL::~T_HMI_DISPSQL(){
}
void T_HMI_DISPSQL::initial(){
// initialise all membervariables
set_FormName("");
set_SQLText("");
set_toc("");
set_tocZi(-1);
set_tom("");
set_tomZi(-1);
set_mop("");
set_mopZi(-1);
set_mou("");
set_mouZi(-1);
// initialies Primary key members
set_k_FormName("");
set_k_SQLText("");
}
T_HMI_DISPSQL::T_HMI_DISPSQL(const char* arg1,const char* arg2)
{
initial();
setPrimKey (arg1, arg2);
//read DB record
dbAccess = true;
dbMessage = readDB();
if ( dbMessage != NULL ) {dbAccess = false;}
}
char* T_HMI_DISPSQL:: execute(const char* sql , long* count){
return( db.execute( sql , count ) );
}
char* T_HMI_DISPSQL:: dbCommit(){
return( db.dbCommit( ) );
}
char* T_HMI_DISPSQL:: dbRollback(){
return( db.dbRollback( ) );
}
char* T_HMI_DISPSQL::readDB(){
// DB Trace is off
return( db.readDB(*this) );
}
char* T_HMI_DISPSQL::updateDB(){
// DB Trace is off
return( db.updateDB(*this) );
}
char* T_HMI_DISPSQL::insertDB(){
// DB Trace is off
return( db.insertDB(*this) );
}
char* T_HMI_DISPSQL::deleteDB(){
// DB Trace is off
return( db.deleteDB(*this) );
}
char* T_HMI_DISPSQL::deleteDB(const char * where, long* count){
// DB Trace is off
return( db.deleteDB( where , count ) );
}
char* T_HMI_DISPSQL::openSetDB(const char * where,const char* order){
// DB Trace is off
return( db.openSetDB( where , order ) );
}
char* T_HMI_DISPSQL::countDB(const char * where, long* count){
// DB Trace is off
return( db.countDB( where , count ) );
}
char* T_HMI_DISPSQL::getSetDB(){
// DB Trace is off
return( db.getSetDB(*this) );
}
char* T_HMI_DISPSQL::closeSetDB(){
// DB Trace is off
return( db.closeSetDB() );
}
char* T_HMI_DISPSQL::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_HMI_DISPSQL
//
// this methode stores the unique key attributes
//
void T_HMI_DISPSQL::setPrimKey( const char* arg1 , const char* arg2 ){
strncpy( (char*)c_k_FormName , arg1 , sizeof(c_k_FormName) );
c_k_FormName[sizeof(c_k_FormName)-1] = '\0';
strncpy( (char*)c_k_SQLText , arg2 , sizeof(c_k_SQLText) );
c_k_SQLText[sizeof(c_k_SQLText)-1] = '\0';
} // end of methode
void T_HMI_DISPSQL::initInsertKeys( const char* arg1 , const char* arg2 ){
setPrimKey ( arg1 , arg2);
strncpy( (char*)c_FormName , arg1 , sizeof(c_FormName) );
c_FormName[sizeof(c_FormName)-1] = '\0';
strncpy( (char*)c_SQLText , arg2 , sizeof(c_SQLText) );
c_SQLText[sizeof(c_SQLText)-1] = '\0';
} // end of methode
void T_HMI_DISPSQL::setKeysFromRecord(){
set_k_FormName( FormName() );
set_k_SQLText( SQLText() );
} // end of methode
//
//O P E R A T O R +
//===================
//
T_HMI_DISPSQL T_HMI_DISPSQL::operator+(const T_HMI_DISPSQL &inst) const{
T_HMI_DISPSQL ptrT_HMI_DISPSQL(*this);
//----------------------------------------------------------
ptrT_HMI_DISPSQL.set_FormName(inst.FormName());
//----------------------------------------------------------
ptrT_HMI_DISPSQL.set_SQLText(inst.SQLText());
//----------------------------------------------------------
if(inst.tocZi() != -1){
ptrT_HMI_DISPSQL.set_toc(inst.toc());
ptrT_HMI_DISPSQL.set_tocZi(inst.tocZi());
}
//----------------------------------------------------------
if(inst.tomZi() != -1){
ptrT_HMI_DISPSQL.set_tom(inst.tom());
ptrT_HMI_DISPSQL.set_tomZi(inst.tomZi());
}
//----------------------------------------------------------
if(inst.mopZi() != -1){
ptrT_HMI_DISPSQL.set_mop(inst.mop());
ptrT_HMI_DISPSQL.set_mopZi(inst.mopZi());
}
//----------------------------------------------------------
if(inst.mouZi() != -1){
ptrT_HMI_DISPSQL.set_mou(inst.mou());
ptrT_HMI_DISPSQL.set_mouZi(inst.mouZi());
}
return (ptrT_HMI_DISPSQL);
}
//
//O P E R A T O R =
//===================
//
const T_HMI_DISPSQL& T_HMI_DISPSQL::operator=(const T_HMI_DISPSQL &inst){
//----------------------------------------------------------
this->set_FormName(inst.FormName());
//----------------------------------------------------------
this->set_SQLText(inst.SQLText());
//----------------------------------------------------------
this->set_toc(inst.toc());
this->set_tocZi(inst.tocZi());
//----------------------------------------------------------
this->set_tom(inst.tom());
this->set_tomZi(inst.tomZi());
//----------------------------------------------------------
this->set_mop(inst.mop());
this->set_mopZi(inst.mopZi());
//----------------------------------------------------------
this->set_mou(inst.mou());
this->set_mouZi(inst.mouZi());
return (*this);
}
//
//C O P Y - C O N S T R U C T O R
//===================
//
T_HMI_DISPSQL::T_HMI_DISPSQL(const T_HMI_DISPSQL &inst){
//----------------------------------------------------------
this->set_FormName(inst.FormName());
//----------------------------------------------------------
this->set_SQLText(inst.SQLText());
//----------------------------------------------------------
this->set_toc(inst.toc());
this->set_tocZi(inst.tocZi());
//----------------------------------------------------------
this->set_tom(inst.tom());
this->set_tomZi(inst.tomZi());
//----------------------------------------------------------
this->set_mop(inst.mop());
this->set_mopZi(inst.mopZi());
//----------------------------------------------------------
this->set_mou(inst.mou());
this->set_mouZi(inst.mouZi());
}
char* T_HMI_DISPSQL::FormName() const{
return((char*)c_FormName );
}
void T_HMI_DISPSQL::set_FormName( const char* arg ){
strncpy((char*)c_FormName , arg , sizeof(c_FormName));
c_FormName[sizeof(c_FormName)-1] = '\0';
return;
}
char* T_HMI_DISPSQL::SQLText() const{
return((char*)c_SQLText );
}
void T_HMI_DISPSQL::set_SQLText( const char* arg ){
strncpy((char*)c_SQLText , arg , sizeof(c_SQLText));
c_SQLText[sizeof(c_SQLText)-1] = '\0';
return;
}
char* T_HMI_DISPSQL::toc() const{
return((char*)c_toc );
}
short T_HMI_DISPSQL::tocZi() const{
return( s_tocZi);
}
void T_HMI_DISPSQL::set_toc( char* arg ){
strncpy((char*)c_toc , arg , sizeof(c_toc));
c_toc[sizeof(c_toc)-1] = '\0';
s_tocZi= 0;
return;
}
void T_HMI_DISPSQL::set_tocZi( short arg ){
s_tocZi = arg;
}
char* T_HMI_DISPSQL::tom() const{
return((char*)c_tom );
}
short T_HMI_DISPSQL::tomZi() const{
return( s_tomZi);
}
void T_HMI_DISPSQL::set_tom( char* arg ){
strncpy((char*)c_tom , arg , sizeof(c_tom));
c_tom[sizeof(c_tom)-1] = '\0';
s_tomZi= 0;
return;
}
void T_HMI_DISPSQL::set_tomZi( short arg ){
s_tomZi = arg;
}
char* T_HMI_DISPSQL::mop() const{
return((char*)c_mop );
}
short T_HMI_DISPSQL::mopZi() const{
return( s_mopZi);
}
void T_HMI_DISPSQL::set_mop( char* arg ){
strncpy((char*)c_mop , arg , sizeof(c_mop));
c_mop[sizeof(c_mop)-1] = '\0';
s_mopZi= 0;
return;
}
void T_HMI_DISPSQL::set_mopZi( short arg ){
s_mopZi = arg;
}
char* T_HMI_DISPSQL::mou() const{
return((char*)c_mou );
}
short T_HMI_DISPSQL::mouZi() const{
return( s_mouZi);
}
void T_HMI_DISPSQL::set_mou( char* arg ){
strncpy((char*)c_mou , arg , sizeof(c_mou));
c_mou[sizeof(c_mou)-1] = '\0';
s_mouZi= 0;
return;
}
void T_HMI_DISPSQL::set_mouZi( short arg ){
s_mouZi = arg;
}
// methodes for Primary key
char* T_HMI_DISPSQL::k_FormName(){
return((char*)c_k_FormName );
}
void T_HMI_DISPSQL::set_k_FormName( char* arg ){
strncpy((char*)c_k_FormName , arg , sizeof(c_k_FormName));
c_k_FormName[sizeof(c_k_FormName)-1] = '\0';
return;
}
char* T_HMI_DISPSQL::k_SQLText(){
return((char*)c_k_SQLText );
}
void T_HMI_DISPSQL::set_k_SQLText( char* arg ){
strncpy((char*)c_k_SQLText , arg , sizeof(c_k_SQLText));
c_k_SQLText[sizeof(c_k_SQLText)-1] = '\0';
return;
}
//
// public methode fillStructure
//
// this methode filles the classstructue with the private attributes
//
void T_HMI_DISPSQL::fillStructure(){
strncpy ( structTable.FormName , FormName(),sizeof(structTable.FormName));
strncpy ( structTable.SQLText , SQLText(),sizeof(structTable.SQLText));
strncpy ( structTable.toc , toc(),sizeof(structTable.toc));
strncpy ( structTable.tom , tom(),sizeof(structTable.tom));
strncpy ( structTable.mop , mop(),sizeof(structTable.mop));
strncpy ( structTable.mou , mou(),sizeof(structTable.mou));
return;
}
///////////////////////////////////////////////////
void T_HMI_DISPSQL::fillStructureZi(){
structTableZi.tocZi = tocZi();
structTableZi.tomZi = tomZi();
structTableZi.mopZi = mopZi();
structTableZi.mouZi = mouZi();
return;
}
///////////////////////////////////////////////////
void T_HMI_DISPSQL::setStructure() {
set_toc(structTable.toc);
set_tom(structTable.tom);
set_mop(structTable.mop);
set_mou(structTable.mou);
return;
}
///////////////////////////////////////////////////
void T_HMI_DISPSQL::setStructureZi() {
set_tocZi(structTableZi.tocZi);
set_tomZi(structTableZi.tomZi);
set_mopZi(structTableZi.mopZi);
set_mouZi(structTableZi.mouZi);
return;
}
///////////////////////////////////////////////////
char* T_HMI_DISPSQL::getName(){
return("T_HMI_DISPSQL");
}
///////////////////////////////////////////////////
int T_HMI_DISPSQL::getSqlCode(){
return( db.dbSqlCode);
}
int T_HMI_DISPSQL::getRowsProcessed(){
return( db.dbRowsProcessed);
}