eis/src/dbax/T_PDI_ZONE.cpp

446 lines
11 KiB
C++
Raw Normal View History

// Version: 2020.10.31 16:32:23
// File: T_PDI_ZONE.cpp
#include "T_PDI_ZONE.h"
T_PDI_ZONE::T_PDI_ZONE(){
// initialise all membervariables
initial();
}
T_PDI_ZONE::~T_PDI_ZONE(){
}
void T_PDI_ZONE::initial(){
// initialise all membervariables
set_entId((char*)"");
set_zone(0);
set_steelgrade((char*)"");
set_steelgradeZi(-1);
set_alloycode((char*)"");
set_alloycodeZi(-1);
set_thick(0.0);
set_thickZi(-1);
set_width(0.0);
set_widthZi(-1);
set_stime((char*)"");
set_stimeZi(-1);
set_etime((char*)"");
set_etimeZi(-1);
// initialies Primary key members
set_k_entId((char*)"");
set_k_zone(0);
}
T_PDI_ZONE::T_PDI_ZONE(const char* arg1,long arg2)
{
initial();
setPrimKey (arg1, arg2);
//read DB record
dbAccess = true;
dbMessage = readDB();
if ( dbMessage != NULL ) {dbAccess = false;}
}
char* T_PDI_ZONE:: execute(const char* sql , long* count){
return( db.execute( sql , count ) );
}
char* T_PDI_ZONE:: dbCommit(){
return( db.dbCommit( ) );
}
char* T_PDI_ZONE:: dbRollback(){
return( db.dbRollback( ) );
}
char* T_PDI_ZONE::readDB(){
// DB Trace is off
return( db.readDB(*this) );
}
char* T_PDI_ZONE::updateDB(){
// DB Trace is off
return( db.updateDB(*this) );
}
char* T_PDI_ZONE::insertDB(){
// DB Trace is off
return( db.insertDB(*this) );
}
char* T_PDI_ZONE::deleteDB(){
// DB Trace is off
return( db.deleteDB(*this) );
}
char* T_PDI_ZONE::deleteDB(const char * where, long* count){
// DB Trace is off
return( db.deleteDB( where , count ) );
}
char* T_PDI_ZONE::openSetDB(const char * where,const char* order){
// DB Trace is off
return( db.openSetDB( where , order ) );
}
char* T_PDI_ZONE::countDB(const char * where, long* count){
// DB Trace is off
return( db.countDB( where , count ) );
}
char* T_PDI_ZONE::getSetDB(){
// DB Trace is off
return( db.getSetDB(*this) );
}
char* T_PDI_ZONE::closeSetDB(){
// DB Trace is off
return( db.closeSetDB() );
}
char* T_PDI_ZONE::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_PDI_ZONE
//
// this methode stores the unique key attributes
//
void T_PDI_ZONE::setPrimKey( const char* arg1 , long arg2 ){
strncpy( (char*)c_k_entId , arg1 , sizeof(c_k_entId) );
c_k_entId[sizeof(c_k_entId)-1] = '\0';
l_k_zone = arg2;
} // end of methode
void T_PDI_ZONE::initInsertKeys( const char* arg1 , long arg2 ){
setPrimKey ( arg1 , arg2);
strncpy( (char*)c_entId , arg1 , sizeof(c_entId) );
c_entId[sizeof(c_entId)-1] = '\0';
l_zone = arg2;
} // end of methode
void T_PDI_ZONE::setKeysFromRecord(){
set_k_entId( entId() );
set_k_zone( zone() );
} // end of methode
//
//O P E R A T O R +
//===================
//
T_PDI_ZONE T_PDI_ZONE::operator+(const T_PDI_ZONE &inst) const{
T_PDI_ZONE ptrT_PDI_ZONE(*this);
//----------------------------------------------------------
ptrT_PDI_ZONE.set_entId(inst.entId());
//----------------------------------------------------------
ptrT_PDI_ZONE.set_zone(inst.zone());
//----------------------------------------------------------
if(inst.steelgradeZi() != -1){
ptrT_PDI_ZONE.set_steelgrade(inst.steelgrade());
ptrT_PDI_ZONE.set_steelgradeZi(inst.steelgradeZi());
}
//----------------------------------------------------------
if(inst.alloycodeZi() != -1){
ptrT_PDI_ZONE.set_alloycode(inst.alloycode());
ptrT_PDI_ZONE.set_alloycodeZi(inst.alloycodeZi());
}
//----------------------------------------------------------
if(inst.thickZi() != -1){
ptrT_PDI_ZONE.set_thick(inst.thick());
ptrT_PDI_ZONE.set_thickZi(inst.thickZi());
}
//----------------------------------------------------------
if(inst.widthZi() != -1){
ptrT_PDI_ZONE.set_width(inst.width());
ptrT_PDI_ZONE.set_widthZi(inst.widthZi());
}
//----------------------------------------------------------
if(inst.stimeZi() != -1){
ptrT_PDI_ZONE.set_stime(inst.stime());
ptrT_PDI_ZONE.set_stimeZi(inst.stimeZi());
}
//----------------------------------------------------------
if(inst.etimeZi() != -1){
ptrT_PDI_ZONE.set_etime(inst.etime());
ptrT_PDI_ZONE.set_etimeZi(inst.etimeZi());
}
return (ptrT_PDI_ZONE);
}
//
//O P E R A T O R =
//===================
//
const T_PDI_ZONE& T_PDI_ZONE::operator=(const T_PDI_ZONE &inst){
//----------------------------------------------------------
this->set_entId(inst.entId());
//----------------------------------------------------------
this->set_zone(inst.zone());
//----------------------------------------------------------
this->set_steelgrade(inst.steelgrade());
this->set_steelgradeZi(inst.steelgradeZi());
//----------------------------------------------------------
this->set_alloycode(inst.alloycode());
this->set_alloycodeZi(inst.alloycodeZi());
//----------------------------------------------------------
this->set_thick(inst.thick());
this->set_thickZi(inst.thickZi());
//----------------------------------------------------------
this->set_width(inst.width());
this->set_widthZi(inst.widthZi());
//----------------------------------------------------------
this->set_stime(inst.stime());
this->set_stimeZi(inst.stimeZi());
//----------------------------------------------------------
this->set_etime(inst.etime());
this->set_etimeZi(inst.etimeZi());
return (*this);
}
//
//C O P Y - C O N S T R U C T O R
//===================
//
T_PDI_ZONE::T_PDI_ZONE(const T_PDI_ZONE &inst){
//----------------------------------------------------------
this->set_entId(inst.entId());
//----------------------------------------------------------
this->set_zone(inst.zone());
//----------------------------------------------------------
this->set_steelgrade(inst.steelgrade());
this->set_steelgradeZi(inst.steelgradeZi());
//----------------------------------------------------------
this->set_alloycode(inst.alloycode());
this->set_alloycodeZi(inst.alloycodeZi());
//----------------------------------------------------------
this->set_thick(inst.thick());
this->set_thickZi(inst.thickZi());
//----------------------------------------------------------
this->set_width(inst.width());
this->set_widthZi(inst.widthZi());
//----------------------------------------------------------
this->set_stime(inst.stime());
this->set_stimeZi(inst.stimeZi());
//----------------------------------------------------------
this->set_etime(inst.etime());
this->set_etimeZi(inst.etimeZi());
}
char* T_PDI_ZONE::entId() const{
return((char*)c_entId );
}
void T_PDI_ZONE::set_entId( const char* arg ){
strncpy((char*)c_entId , arg , sizeof(c_entId));
c_entId[sizeof(c_entId)-1] = '\0';
return;
}
long T_PDI_ZONE::zone() const{
return((long)l_zone );
}
void T_PDI_ZONE::set_zone( long arg ){
l_zone = arg;
return;
}
char* T_PDI_ZONE::steelgrade() const{
return((char*)c_steelgrade );
}
short T_PDI_ZONE::steelgradeZi() const{
return( s_steelgradeZi);
}
void T_PDI_ZONE::set_steelgrade( const char* arg ){
strncpy((char*)c_steelgrade , arg , sizeof(c_steelgrade));
c_steelgrade[sizeof(c_steelgrade)-1] = '\0';
s_steelgradeZi= 0;
return;
}
void T_PDI_ZONE::set_steelgradeZi( short arg ) {
s_steelgradeZi = arg;
}
char* T_PDI_ZONE::alloycode() const{
return((char*)c_alloycode );
}
short T_PDI_ZONE::alloycodeZi() const{
return( s_alloycodeZi);
}
void T_PDI_ZONE::set_alloycode( const char* arg ){
strncpy((char*)c_alloycode , arg , sizeof(c_alloycode));
c_alloycode[sizeof(c_alloycode)-1] = '\0';
s_alloycodeZi= 0;
return;
}
void T_PDI_ZONE::set_alloycodeZi( short arg ) {
s_alloycodeZi = arg;
}
double T_PDI_ZONE::thick() const{
return((double)d_thick );
}
short T_PDI_ZONE::thickZi() const{
return( s_thickZi);
}
void T_PDI_ZONE::set_thick( double arg ){
d_thick = arg;
s_thickZi= 0;
return;
}
void T_PDI_ZONE::set_thickZi( short arg ) {
s_thickZi = arg;
}
double T_PDI_ZONE::width() const{
return((double)d_width );
}
short T_PDI_ZONE::widthZi() const{
return( s_widthZi);
}
void T_PDI_ZONE::set_width( double arg ){
d_width = arg;
s_widthZi= 0;
return;
}
void T_PDI_ZONE::set_widthZi( short arg ) {
s_widthZi = arg;
}
char* T_PDI_ZONE::stime() const{
return((char*)c_stime );
}
short T_PDI_ZONE::stimeZi() const{
return( s_stimeZi);
}
void T_PDI_ZONE::set_stime( char* arg ){
strncpy((char*)c_stime , arg , sizeof(c_stime));
c_stime[sizeof(c_stime)-1] = '\0';
s_stimeZi= 0;
return;
}
void T_PDI_ZONE::set_stimeZi( short arg ) {
s_stimeZi = arg;
}
char* T_PDI_ZONE::etime() const{
return((char*)c_etime );
}
short T_PDI_ZONE::etimeZi() const{
return( s_etimeZi);
}
void T_PDI_ZONE::set_etime( char* arg ){
strncpy((char*)c_etime , arg , sizeof(c_etime));
c_etime[sizeof(c_etime)-1] = '\0';
s_etimeZi= 0;
return;
}
void T_PDI_ZONE::set_etimeZi( short arg ) {
s_etimeZi = arg;
}
// methodes for Primary key
char* T_PDI_ZONE::k_entId(){
return((char*)c_k_entId );
}
void T_PDI_ZONE::set_k_entId( char* arg ){
strncpy((char*)c_k_entId , arg , sizeof(c_k_entId));
c_k_entId[sizeof(c_k_entId)-1] = '\0';
return;
}
long T_PDI_ZONE::k_zone(){
return((long)l_k_zone );
}
void T_PDI_ZONE::set_k_zone( long arg ){
l_k_zone = arg;
return;
}
//
// public methode fillStructure
//
// this methode filles the classstructue with the private attributes
//
void T_PDI_ZONE::fillStructure(){
strncpy ( structTable.entId , entId(),sizeof(structTable.entId));
structTable.zone = zone();
strncpy ( structTable.steelgrade , steelgrade(),sizeof(structTable.steelgrade));
strncpy ( structTable.alloycode , alloycode(),sizeof(structTable.alloycode));
structTable.thick = thick();
structTable.width = width();
strncpy ( structTable.stime , stime(),sizeof(structTable.stime));
strncpy ( structTable.etime , etime(),sizeof(structTable.etime));
return;
}
///////////////////////////////////////////////////
void T_PDI_ZONE::fillStructureZi(){
structTableZi.steelgradeZi = steelgradeZi();
structTableZi.alloycodeZi = alloycodeZi();
structTableZi.thickZi = thickZi();
structTableZi.widthZi = widthZi();
structTableZi.stimeZi = stimeZi();
structTableZi.etimeZi = etimeZi();
return;
}
///////////////////////////////////////////////////
void T_PDI_ZONE::setStructure() {
set_steelgrade( structTable.steelgrade);
set_alloycode( structTable.alloycode);
set_thick( structTable.thick);
set_width( structTable.width);
set_stime( structTable.stime);
set_etime( structTable.etime);
return;
}
///////////////////////////////////////////////////
void T_PDI_ZONE::setStructureZi() {
set_steelgradeZi( structTableZi.steelgradeZi);
set_alloycodeZi( structTableZi.alloycodeZi);
set_thickZi( structTableZi.thickZi);
set_widthZi( structTableZi.widthZi);
set_stimeZi( structTableZi.stimeZi);
set_etimeZi( structTableZi.etimeZi);
return;
}
///////////////////////////////////////////////////
char* T_PDI_ZONE::getName(){
return((char*)"T_PDI_ZONE");
}
///////////////////////////////////////////////////
int T_PDI_ZONE::getSqlCode(){
return( db.dbSqlCode);
}
int T_PDI_ZONE::getRowsProcessed(){
return( db.dbRowsProcessed);
}