eis/src/dbax/T_DPI_DATADBAX.cpp

1345 lines
37 KiB
C++

// Version: 2019.6.19 13:7:3
// File: T_DPI_DATADBAX.cpp
#include <log4cplus/LOG.h>
#include "T_DPI_DATADBAX.h"
#include "T_DPI_DATA.h"
#define NORECORD 100
using namespace log4cplus;
extern iDA::Connection cn;
extern char sqlErrMsg[4000];
#define DB_EXECUTE() try{ cmd.Execute();}catch( iDA::Exception &e){ dbSqlCode=-1;strcpy( sqlErrMsg,e.ErrMsg().c_str());return sqlErrMsg;}
#define DB_UPDEXECUTE() try{ updatecmd.Execute();}catch( iDA::Exception &e){ dbSqlCode=-1;strcpy( sqlErrMsg,e.ErrMsg().c_str());return sqlErrMsg;}
#define DB_RDEXECUTE() try{ readcmd.Execute();}catch( iDA::Exception &e){ dbSqlCode=-1;strcpy( sqlErrMsg,e.ErrMsg().c_str());return sqlErrMsg;}
#define DB_INSEXECUTE() try{ insertcmd.Execute();}catch( iDA::Exception &e){ dbSqlCode=-1;strcpy( sqlErrMsg,e.ErrMsg().c_str());return sqlErrMsg;}
#define DB_FETCH() try{ if( !readcmd.FetchNext()){ dbSqlCode = NORECORD;strcpy( sqlErrMsg, "No record found");return sqlErrMsg;}}catch( iDA::Exception &e){ dbSqlCode=-1;strcpy( sqlErrMsg,e.ErrMsg().c_str());return sqlErrMsg;}
#define DB_UPDAFFECTED() if( updatecmd.RowsAffected() <= 0){ strcpy( sqlErrMsg, "No record affected");return sqlErrMsg;}
//
// Declare DB Hostvariables
//
#define OPENED 1
#define CLOSED 2
/* ****************************************************************************** */
/* */
/* define DB */
/* Hostvariables */
/* */
/* ****************************************************************************** */
static char db_OrderNo[10+1];
static char db_PlanNo[9+1];
static short db_PlanNoZi;
static char db_ProduceDate[27];
static short db_ProduceDateZi;
static char db_entId[20+1];
static char db_SteelGradeCode[3+1];
static short db_SteelGradeCodeZi;
static int db_Weight;
static short db_WeightZi;
static int db_Thickness;
static short db_ThicknessZi;
static int db_Width;
static short db_WidthZi;
static int db_Length;
static short db_LengthZi;
static short db_OutDiameter;
static short db_OutDiameterZi;
static char db_WorkingKindCode[2+1];
static short db_WorkingKindCodeZi;
static char db_PaperCode[2+1];
static short db_PaperCodeZi;
static char db_EntrySleeveUse[1+1];
static short db_EntrySleeveUseZi;
static char db_EntrySleeveType[1+1];
static short db_EntrySleeveTypeZi;
static short db_EntrySleeveDia;
static short db_EntrySleeveDiaZi;
static char db_EntrySleeveCode[4+1];
static short db_EntrySleeveCodeZi;
static char db_FinishingCode[2+1];
static short db_FinishingCodeZi;
static char db_BaseSurface[1+1];
static short db_BaseSurfaceZi;
static char db_APN[4+1];
static short db_APNZi;
static char db_SpecificationCode[6+1];
static short db_SpecificationCodeZi;
static char db_PreviousProcess[2+1];
static short db_PreviousProcessZi;
static char db_NextProcess[2+1];
static short db_NextProcessZi;
static char db_YardNr[10+1];
static short db_YardNrZi;
static char db_SpecialCommandCode[3+1];
static short db_SpecialCommandCodeZi;
static int db_DefectBeginPosition;
static short db_DefectBeginPositionZi;
static int db_DefectEndPosition;
static short db_DefectEndPositionZi;
static char db_DefectSurfacePosition[1+1];
static short db_DefectSurfacePositionZi;
static char db_DefectCode[4+1];
static short db_DefectCodeZi;
static long rowCnt;
// Host arguments for Primary key
static char k_db_entId[20+1];
//
// constructor
//
T_DPI_DATADBAX::T_DPI_DATADBAX()
{
}
//
// destructor
//
T_DPI_DATADBAX::~T_DPI_DATADBAX()
{
}
char* T_DPI_DATADBAX::execute(const char* sql , long* count ){
dbSqlCode = 0;
cmd.SetConnection( &cn);
cmd.SetCommandText( sql);
DB_EXECUTE();
if( count != NULL)
{
*count = cmd.RowsAffected();
}
return ( NULL );
}
char* T_DPI_DATADBAX::dbCommit(){
dbSqlCode = 0;
try{
cn.Commit();
}catch( iDA::Exception &e)
{
dbSqlCode = -1;
strcpy( sqlErrMsg,e.ErrMsg().c_str());
return sqlErrMsg;
}
return ( NULL );
}
char* T_DPI_DATADBAX::dbRollback(){
dbSqlCode = 0;
try{
cn.Rollback();
}catch( iDA::Exception &e)
{
dbSqlCode = -1;
strcpy( sqlErrMsg,e.ErrMsg().c_str());
return sqlErrMsg;
}
return ( NULL );
}
//
// private methode copyDB2Attribute
//
void T_DPI_DATADBAX::copyDB2Attribute( T_DPI_DATA &dbObj ){
dbObj.set_OrderNo((char*)db_OrderNo);
dbObj.set_PlanNo((char*)db_PlanNo);
dbObj.set_PlanNoZi((short)db_PlanNoZi);
dbObj.set_ProduceDate((char*)db_ProduceDate);
dbObj.set_ProduceDateZi((short)db_ProduceDateZi);
dbObj.set_entId((char*)db_entId);
dbObj.set_SteelGradeCode((char*)db_SteelGradeCode);
dbObj.set_SteelGradeCodeZi((short)db_SteelGradeCodeZi);
dbObj.set_Weight((long)db_Weight);
dbObj.set_WeightZi((short)db_WeightZi);
dbObj.set_Thickness((long)db_Thickness);
dbObj.set_ThicknessZi((short)db_ThicknessZi);
dbObj.set_Width((long)db_Width);
dbObj.set_WidthZi((short)db_WidthZi);
dbObj.set_Length((long)db_Length);
dbObj.set_LengthZi((short)db_LengthZi);
dbObj.set_OutDiameter((short)db_OutDiameter);
dbObj.set_OutDiameterZi((short)db_OutDiameterZi);
dbObj.set_WorkingKindCode((char*)db_WorkingKindCode);
dbObj.set_WorkingKindCodeZi((short)db_WorkingKindCodeZi);
dbObj.set_PaperCode((char*)db_PaperCode);
dbObj.set_PaperCodeZi((short)db_PaperCodeZi);
dbObj.set_EntrySleeveUse((char*)db_EntrySleeveUse);
dbObj.set_EntrySleeveUseZi((short)db_EntrySleeveUseZi);
dbObj.set_EntrySleeveType((char*)db_EntrySleeveType);
dbObj.set_EntrySleeveTypeZi((short)db_EntrySleeveTypeZi);
dbObj.set_EntrySleeveDia((short)db_EntrySleeveDia);
dbObj.set_EntrySleeveDiaZi((short)db_EntrySleeveDiaZi);
dbObj.set_EntrySleeveCode((char*)db_EntrySleeveCode);
dbObj.set_EntrySleeveCodeZi((short)db_EntrySleeveCodeZi);
dbObj.set_FinishingCode((char*)db_FinishingCode);
dbObj.set_FinishingCodeZi((short)db_FinishingCodeZi);
dbObj.set_BaseSurface((char*)db_BaseSurface);
dbObj.set_BaseSurfaceZi((short)db_BaseSurfaceZi);
dbObj.set_APN((char*)db_APN);
dbObj.set_APNZi((short)db_APNZi);
dbObj.set_SpecificationCode((char*)db_SpecificationCode);
dbObj.set_SpecificationCodeZi((short)db_SpecificationCodeZi);
dbObj.set_PreviousProcess((char*)db_PreviousProcess);
dbObj.set_PreviousProcessZi((short)db_PreviousProcessZi);
dbObj.set_NextProcess((char*)db_NextProcess);
dbObj.set_NextProcessZi((short)db_NextProcessZi);
dbObj.set_YardNr((char*)db_YardNr);
dbObj.set_YardNrZi((short)db_YardNrZi);
dbObj.set_SpecialCommandCode((char*)db_SpecialCommandCode);
dbObj.set_SpecialCommandCodeZi((short)db_SpecialCommandCodeZi);
dbObj.set_DefectBeginPosition((long)db_DefectBeginPosition);
dbObj.set_DefectBeginPositionZi((short)db_DefectBeginPositionZi);
dbObj.set_DefectEndPosition((long)db_DefectEndPosition);
dbObj.set_DefectEndPositionZi((short)db_DefectEndPositionZi);
dbObj.set_DefectSurfacePosition((char*)db_DefectSurfacePosition);
dbObj.set_DefectSurfacePositionZi((short)db_DefectSurfacePositionZi);
dbObj.set_DefectCode((char*)db_DefectCode);
dbObj.set_DefectCodeZi((short)db_DefectCodeZi);
} // end of methode
//
// private methode copyAttribute2DB
//
void T_DPI_DATADBAX::copyAttribute2DB( T_DPI_DATA &dbObj ){
if (strlen(dbObj.OrderNo()) < sizeof(db_OrderNo)){
strncpy ((char*)db_OrderNo, dbObj.OrderNo(), sizeof(db_OrderNo));
}
if (strlen(dbObj.PlanNo()) < sizeof(db_PlanNo)){
strncpy ((char*)db_PlanNo, dbObj.PlanNo(), sizeof(db_PlanNo));
}
db_PlanNoZi = dbObj.PlanNoZi();
if (strlen(dbObj.ProduceDate()) < sizeof(db_ProduceDate)){
strncpy ((char*)db_ProduceDate, dbObj.ProduceDate(), sizeof(db_ProduceDate));
}
db_ProduceDateZi = dbObj.ProduceDateZi();
if (strlen(dbObj.entId()) < sizeof(db_entId)){
strncpy ((char*)db_entId, dbObj.entId(), sizeof(db_entId));
}
if (strlen(dbObj.SteelGradeCode()) < sizeof(db_SteelGradeCode)){
strncpy ((char*)db_SteelGradeCode, dbObj.SteelGradeCode(), sizeof(db_SteelGradeCode));
}
db_SteelGradeCodeZi = dbObj.SteelGradeCodeZi();
db_Weight = dbObj.Weight();
db_WeightZi = dbObj.WeightZi();
db_Thickness = dbObj.Thickness();
db_ThicknessZi = dbObj.ThicknessZi();
db_Width = dbObj.Width();
db_WidthZi = dbObj.WidthZi();
db_Length = dbObj.Length();
db_LengthZi = dbObj.LengthZi();
db_OutDiameter = dbObj.OutDiameter();
db_OutDiameterZi = dbObj.OutDiameterZi();
if (strlen(dbObj.WorkingKindCode()) < sizeof(db_WorkingKindCode)){
strncpy ((char*)db_WorkingKindCode, dbObj.WorkingKindCode(), sizeof(db_WorkingKindCode));
}
db_WorkingKindCodeZi = dbObj.WorkingKindCodeZi();
if (strlen(dbObj.PaperCode()) < sizeof(db_PaperCode)){
strncpy ((char*)db_PaperCode, dbObj.PaperCode(), sizeof(db_PaperCode));
}
db_PaperCodeZi = dbObj.PaperCodeZi();
if (strlen(dbObj.EntrySleeveUse()) < sizeof(db_EntrySleeveUse)){
strncpy ((char*)db_EntrySleeveUse, dbObj.EntrySleeveUse(), sizeof(db_EntrySleeveUse));
}
db_EntrySleeveUseZi = dbObj.EntrySleeveUseZi();
if (strlen(dbObj.EntrySleeveType()) < sizeof(db_EntrySleeveType)){
strncpy ((char*)db_EntrySleeveType, dbObj.EntrySleeveType(), sizeof(db_EntrySleeveType));
}
db_EntrySleeveTypeZi = dbObj.EntrySleeveTypeZi();
db_EntrySleeveDia = dbObj.EntrySleeveDia();
db_EntrySleeveDiaZi = dbObj.EntrySleeveDiaZi();
if (strlen(dbObj.EntrySleeveCode()) < sizeof(db_EntrySleeveCode)){
strncpy ((char*)db_EntrySleeveCode, dbObj.EntrySleeveCode(), sizeof(db_EntrySleeveCode));
}
db_EntrySleeveCodeZi = dbObj.EntrySleeveCodeZi();
if (strlen(dbObj.FinishingCode()) < sizeof(db_FinishingCode)){
strncpy ((char*)db_FinishingCode, dbObj.FinishingCode(), sizeof(db_FinishingCode));
}
db_FinishingCodeZi = dbObj.FinishingCodeZi();
if (strlen(dbObj.BaseSurface()) < sizeof(db_BaseSurface)){
strncpy ((char*)db_BaseSurface, dbObj.BaseSurface(), sizeof(db_BaseSurface));
}
db_BaseSurfaceZi = dbObj.BaseSurfaceZi();
if (strlen(dbObj.APN()) < sizeof(db_APN)){
strncpy ((char*)db_APN, dbObj.APN(), sizeof(db_APN));
}
db_APNZi = dbObj.APNZi();
if (strlen(dbObj.SpecificationCode()) < sizeof(db_SpecificationCode)){
strncpy ((char*)db_SpecificationCode, dbObj.SpecificationCode(), sizeof(db_SpecificationCode));
}
db_SpecificationCodeZi = dbObj.SpecificationCodeZi();
if (strlen(dbObj.PreviousProcess()) < sizeof(db_PreviousProcess)){
strncpy ((char*)db_PreviousProcess, dbObj.PreviousProcess(), sizeof(db_PreviousProcess));
}
db_PreviousProcessZi = dbObj.PreviousProcessZi();
if (strlen(dbObj.NextProcess()) < sizeof(db_NextProcess)){
strncpy ((char*)db_NextProcess, dbObj.NextProcess(), sizeof(db_NextProcess));
}
db_NextProcessZi = dbObj.NextProcessZi();
if (strlen(dbObj.YardNr()) < sizeof(db_YardNr)){
strncpy ((char*)db_YardNr, dbObj.YardNr(), sizeof(db_YardNr));
}
db_YardNrZi = dbObj.YardNrZi();
if (strlen(dbObj.SpecialCommandCode()) < sizeof(db_SpecialCommandCode)){
strncpy ((char*)db_SpecialCommandCode, dbObj.SpecialCommandCode(), sizeof(db_SpecialCommandCode));
}
db_SpecialCommandCodeZi = dbObj.SpecialCommandCodeZi();
db_DefectBeginPosition = dbObj.DefectBeginPosition();
db_DefectBeginPositionZi = dbObj.DefectBeginPositionZi();
db_DefectEndPosition = dbObj.DefectEndPosition();
db_DefectEndPositionZi = dbObj.DefectEndPositionZi();
if (strlen(dbObj.DefectSurfacePosition()) < sizeof(db_DefectSurfacePosition)){
strncpy ((char*)db_DefectSurfacePosition, dbObj.DefectSurfacePosition(), sizeof(db_DefectSurfacePosition));
}
db_DefectSurfacePositionZi = dbObj.DefectSurfacePositionZi();
if (strlen(dbObj.DefectCode()) < sizeof(db_DefectCode)){
strncpy ((char*)db_DefectCode, dbObj.DefectCode(), sizeof(db_DefectCode));
}
db_DefectCodeZi = dbObj.DefectCodeZi();
} // end of methode
//
// private methode copyKey2Host
//
void T_DPI_DATADBAX::copyKey2Host( T_DPI_DATA &dbObj ){
if (strlen(dbObj.k_entId()) < sizeof(k_db_entId)){
strncpy ((char*)k_db_entId, dbObj.k_entId(), sizeof(k_db_entId));
}
} // end of methode
//
// private methode copyHost2Key
//
void T_DPI_DATADBAX::copyHost2Key( T_DPI_DATA &dbObj ){
dbObj.set_k_entId((char*)db_entId);
} // end of methode
//
// public methode readDB
//
char* T_DPI_DATADBAX::readDB(T_DPI_DATA &dbObj ){
copyKey2Host( dbObj );
ostringstream ostr;
dbSqlCode = 0;
ostr << "SELECT ";
// all columns
ostr << "OrderNo";
ostr << ",PlanNo";
ostr << ",TO_CHAR(ProduceDate, 'YYYYMMDDHH24MISS')";
ostr << ",entId";
ostr << ",SteelGradeCode";
ostr << ",Weight";
ostr << ",Thickness";
ostr << ",Width";
ostr << ",Length";
ostr << ",OutDiameter";
ostr << ",WorkingKindCode";
ostr << ",PaperCode";
ostr << ",EntrySleeveUse";
ostr << ",EntrySleeveType";
ostr << ",EntrySleeveDia";
ostr << ",EntrySleeveCode";
ostr << ",FinishingCode";
ostr << ",BaseSurface";
ostr << ",APN";
ostr << ",SpecificationCode";
ostr << ",PreviousProcess";
ostr << ",NextProcess";
ostr << ",YardNr";
ostr << ",SpecialCommandCode";
ostr << ",DefectBeginPosition";
ostr << ",DefectEndPosition";
ostr << ",DefectSurfacePosition";
ostr << ",DefectCode";
ostr << " FROM T_DPI_DATA WHERE ";
// where
ostr << "entId = '" << k_db_entId << "'";
readcmd.SetConnection(&cn);
readcmd.SetCommandText( ostr.str());
DB_RDEXECUTE();
DB_FETCH();
// Normal columns
// OrderNo
strncpy( db_OrderNo, readcmd.Field(1).AsString().c_str(), sizeof( db_OrderNo));
// Normal columns
// PlanNo
if( readcmd.Field(2).IsNull() == false)
{
db_PlanNoZi = 0;
strncpy( db_PlanNo, readcmd.Field(2).AsString().c_str(), sizeof( db_PlanNo));
}
else
{
db_PlanNoZi = -1;
memset( db_PlanNo, 0x00, sizeof( db_PlanNo));
}
// Normal columns
// ProduceDate
if( readcmd.Field(3).IsNull() == false)
{
db_ProduceDateZi = 0;
strncpy( db_ProduceDate, readcmd.Field(3).AsString().c_str(), sizeof( db_ProduceDate));
}
else
{
db_ProduceDateZi = -1;
memset( db_ProduceDate, 0x00, sizeof( db_ProduceDate));
}
// Primary Keys
strncpy( db_entId, readcmd.Field(4).AsString().c_str(), sizeof( db_entId));
// Normal columns
// SteelGradeCode
if( readcmd.Field(5).IsNull() == false)
{
db_SteelGradeCodeZi = 0;
strncpy( db_SteelGradeCode, readcmd.Field(5).AsString().c_str(), sizeof( db_SteelGradeCode));
}
else
{
db_SteelGradeCodeZi = -1;
memset( db_SteelGradeCode, 0x00, sizeof( db_SteelGradeCode));
}
// Normal columns
// Weight
if( readcmd.Field(6).IsNull() == false)
{
db_WeightZi = 0;
db_Weight = ( long)readcmd.Field(6).AsLong();
}
else
{
db_WeightZi = -1;
db_Weight = 0;
}
// Normal columns
// Thickness
if( readcmd.Field(7).IsNull() == false)
{
db_ThicknessZi = 0;
db_Thickness = ( long)readcmd.Field(7).AsLong();
}
else
{
db_ThicknessZi = -1;
db_Thickness = 0;
}
// Normal columns
// Width
if( readcmd.Field(8).IsNull() == false)
{
db_WidthZi = 0;
db_Width = ( long)readcmd.Field(8).AsLong();
}
else
{
db_WidthZi = -1;
db_Width = 0;
}
// Normal columns
// Length
if( readcmd.Field(9).IsNull() == false)
{
db_LengthZi = 0;
db_Length = ( long)readcmd.Field(9).AsLong();
}
else
{
db_LengthZi = -1;
db_Length = 0;
}
// Normal columns
// OutDiameter
if( readcmd.Field(10).IsNull() == false)
{
db_OutDiameterZi = 0;
db_OutDiameter = ( short)readcmd.Field(10).AsLong();
}
else
{
db_OutDiameterZi = -1;
db_OutDiameter = 0;
}
// Normal columns
// WorkingKindCode
if( readcmd.Field(11).IsNull() == false)
{
db_WorkingKindCodeZi = 0;
strncpy( db_WorkingKindCode, readcmd.Field(11).AsString().c_str(), sizeof( db_WorkingKindCode));
}
else
{
db_WorkingKindCodeZi = -1;
memset( db_WorkingKindCode, 0x00, sizeof( db_WorkingKindCode));
}
// Normal columns
// PaperCode
if( readcmd.Field(12).IsNull() == false)
{
db_PaperCodeZi = 0;
strncpy( db_PaperCode, readcmd.Field(12).AsString().c_str(), sizeof( db_PaperCode));
}
else
{
db_PaperCodeZi = -1;
memset( db_PaperCode, 0x00, sizeof( db_PaperCode));
}
// Normal columns
// EntrySleeveUse
if( readcmd.Field(13).IsNull() == false)
{
db_EntrySleeveUseZi = 0;
strncpy( db_EntrySleeveUse, readcmd.Field(13).AsString().c_str(), sizeof( db_EntrySleeveUse));
}
else
{
db_EntrySleeveUseZi = -1;
memset( db_EntrySleeveUse, 0x00, sizeof( db_EntrySleeveUse));
}
// Normal columns
// EntrySleeveType
if( readcmd.Field(14).IsNull() == false)
{
db_EntrySleeveTypeZi = 0;
strncpy( db_EntrySleeveType, readcmd.Field(14).AsString().c_str(), sizeof( db_EntrySleeveType));
}
else
{
db_EntrySleeveTypeZi = -1;
memset( db_EntrySleeveType, 0x00, sizeof( db_EntrySleeveType));
}
// Normal columns
// EntrySleeveDia
if( readcmd.Field(15).IsNull() == false)
{
db_EntrySleeveDiaZi = 0;
db_EntrySleeveDia = ( short)readcmd.Field(15).AsLong();
}
else
{
db_EntrySleeveDiaZi = -1;
db_EntrySleeveDia = 0;
}
// Normal columns
// EntrySleeveCode
if( readcmd.Field(16).IsNull() == false)
{
db_EntrySleeveCodeZi = 0;
strncpy( db_EntrySleeveCode, readcmd.Field(16).AsString().c_str(), sizeof( db_EntrySleeveCode));
}
else
{
db_EntrySleeveCodeZi = -1;
memset( db_EntrySleeveCode, 0x00, sizeof( db_EntrySleeveCode));
}
// Normal columns
// FinishingCode
if( readcmd.Field(17).IsNull() == false)
{
db_FinishingCodeZi = 0;
strncpy( db_FinishingCode, readcmd.Field(17).AsString().c_str(), sizeof( db_FinishingCode));
}
else
{
db_FinishingCodeZi = -1;
memset( db_FinishingCode, 0x00, sizeof( db_FinishingCode));
}
// Normal columns
// BaseSurface
if( readcmd.Field(18).IsNull() == false)
{
db_BaseSurfaceZi = 0;
strncpy( db_BaseSurface, readcmd.Field(18).AsString().c_str(), sizeof( db_BaseSurface));
}
else
{
db_BaseSurfaceZi = -1;
memset( db_BaseSurface, 0x00, sizeof( db_BaseSurface));
}
// Normal columns
// APN
if( readcmd.Field(19).IsNull() == false)
{
db_APNZi = 0;
strncpy( db_APN, readcmd.Field(19).AsString().c_str(), sizeof( db_APN));
}
else
{
db_APNZi = -1;
memset( db_APN, 0x00, sizeof( db_APN));
}
// Normal columns
// SpecificationCode
if( readcmd.Field(20).IsNull() == false)
{
db_SpecificationCodeZi = 0;
strncpy( db_SpecificationCode, readcmd.Field(20).AsString().c_str(), sizeof( db_SpecificationCode));
}
else
{
db_SpecificationCodeZi = -1;
memset( db_SpecificationCode, 0x00, sizeof( db_SpecificationCode));
}
// Normal columns
// PreviousProcess
if( readcmd.Field(21).IsNull() == false)
{
db_PreviousProcessZi = 0;
strncpy( db_PreviousProcess, readcmd.Field(21).AsString().c_str(), sizeof( db_PreviousProcess));
}
else
{
db_PreviousProcessZi = -1;
memset( db_PreviousProcess, 0x00, sizeof( db_PreviousProcess));
}
// Normal columns
// NextProcess
if( readcmd.Field(22).IsNull() == false)
{
db_NextProcessZi = 0;
strncpy( db_NextProcess, readcmd.Field(22).AsString().c_str(), sizeof( db_NextProcess));
}
else
{
db_NextProcessZi = -1;
memset( db_NextProcess, 0x00, sizeof( db_NextProcess));
}
// Normal columns
// YardNr
if( readcmd.Field(23).IsNull() == false)
{
db_YardNrZi = 0;
strncpy( db_YardNr, readcmd.Field(23).AsString().c_str(), sizeof( db_YardNr));
}
else
{
db_YardNrZi = -1;
memset( db_YardNr, 0x00, sizeof( db_YardNr));
}
// Normal columns
// SpecialCommandCode
if( readcmd.Field(24).IsNull() == false)
{
db_SpecialCommandCodeZi = 0;
strncpy( db_SpecialCommandCode, readcmd.Field(24).AsString().c_str(), sizeof( db_SpecialCommandCode));
}
else
{
db_SpecialCommandCodeZi = -1;
memset( db_SpecialCommandCode, 0x00, sizeof( db_SpecialCommandCode));
}
// Normal columns
// DefectBeginPosition
if( readcmd.Field(25).IsNull() == false)
{
db_DefectBeginPositionZi = 0;
db_DefectBeginPosition = ( long)readcmd.Field(25).AsLong();
}
else
{
db_DefectBeginPositionZi = -1;
db_DefectBeginPosition = 0;
}
// Normal columns
// DefectEndPosition
if( readcmd.Field(26).IsNull() == false)
{
db_DefectEndPositionZi = 0;
db_DefectEndPosition = ( long)readcmd.Field(26).AsLong();
}
else
{
db_DefectEndPositionZi = -1;
db_DefectEndPosition = 0;
}
// Normal columns
// DefectSurfacePosition
if( readcmd.Field(27).IsNull() == false)
{
db_DefectSurfacePositionZi = 0;
strncpy( db_DefectSurfacePosition, readcmd.Field(27).AsString().c_str(), sizeof( db_DefectSurfacePosition));
}
else
{
db_DefectSurfacePositionZi = -1;
memset( db_DefectSurfacePosition, 0x00, sizeof( db_DefectSurfacePosition));
}
// Normal columns
// DefectCode
if( readcmd.Field(28).IsNull() == false)
{
db_DefectCodeZi = 0;
strncpy( db_DefectCode, readcmd.Field(28).AsString().c_str(), sizeof( db_DefectCode));
}
else
{
db_DefectCodeZi = -1;
memset( db_DefectCode, 0x00, sizeof( db_DefectCode));
}
// copy host variables into Class attributes
copyDB2Attribute( dbObj );
return ( NULL );
} // end of methode
//
// public methode updateDB
//
char* T_DPI_DATADBAX::updateDB(T_DPI_DATA &dbObj ){
copyKey2Host( dbObj );
copyAttribute2DB( dbObj );
dbSqlCode = 0;
ostringstream ostr;
ostr << "UPDATE T_DPI_DATA SET ";
// Material Keys & Primary Keys
ostr << "entId='" << db_entId << "'";
// Normal column
ostr << ", OrderNo = '" << db_OrderNo << "'";
if( db_PlanNoZi != -1) ostr << ", PlanNo = '" << db_PlanNo << "'"; else ostr<<",PlanNo = NULL";
if( db_ProduceDateZi != -1) ostr << ", ProduceDate = TO_DATE('" << db_ProduceDate << "','YYYYMMDDHH24MISS')"; else ostr<<",ProduceDate = NULL";
if( db_SteelGradeCodeZi != -1) ostr << ", SteelGradeCode = '" << db_SteelGradeCode << "'"; else ostr<<",SteelGradeCode = NULL";
if( db_WeightZi != -1) ostr << ", Weight = " << db_Weight; else ostr<<",Weight = NULL";
if( db_ThicknessZi != -1) ostr << ", Thickness = " << db_Thickness; else ostr<<",Thickness = NULL";
if( db_WidthZi != -1) ostr << ", Width = " << db_Width; else ostr<<",Width = NULL";
if( db_LengthZi != -1) ostr << ", Length = " << db_Length; else ostr<<",Length = NULL";
if( db_OutDiameterZi != -1) ostr << ", OutDiameter = " << db_OutDiameter; else ostr<<",OutDiameter = NULL";
if( db_WorkingKindCodeZi != -1) ostr << ", WorkingKindCode = '" << db_WorkingKindCode << "'"; else ostr<<",WorkingKindCode = NULL";
if( db_PaperCodeZi != -1) ostr << ", PaperCode = '" << db_PaperCode << "'"; else ostr<<",PaperCode = NULL";
if( db_EntrySleeveUseZi != -1) ostr << ", EntrySleeveUse = '" << db_EntrySleeveUse << "'"; else ostr<<",EntrySleeveUse = NULL";
if( db_EntrySleeveTypeZi != -1) ostr << ", EntrySleeveType = '" << db_EntrySleeveType << "'"; else ostr<<",EntrySleeveType = NULL";
if( db_EntrySleeveDiaZi != -1) ostr << ", EntrySleeveDia = " << db_EntrySleeveDia; else ostr<<",EntrySleeveDia = NULL";
if( db_EntrySleeveCodeZi != -1) ostr << ", EntrySleeveCode = '" << db_EntrySleeveCode << "'"; else ostr<<",EntrySleeveCode = NULL";
if( db_FinishingCodeZi != -1) ostr << ", FinishingCode = '" << db_FinishingCode << "'"; else ostr<<",FinishingCode = NULL";
if( db_BaseSurfaceZi != -1) ostr << ", BaseSurface = '" << db_BaseSurface << "'"; else ostr<<",BaseSurface = NULL";
if( db_APNZi != -1) ostr << ", APN = '" << db_APN << "'"; else ostr<<",APN = NULL";
if( db_SpecificationCodeZi != -1) ostr << ", SpecificationCode = '" << db_SpecificationCode << "'"; else ostr<<",SpecificationCode = NULL";
if( db_PreviousProcessZi != -1) ostr << ", PreviousProcess = '" << db_PreviousProcess << "'"; else ostr<<",PreviousProcess = NULL";
if( db_NextProcessZi != -1) ostr << ", NextProcess = '" << db_NextProcess << "'"; else ostr<<",NextProcess = NULL";
if( db_YardNrZi != -1) ostr << ", YardNr = '" << db_YardNr << "'"; else ostr<<",YardNr = NULL";
if( db_SpecialCommandCodeZi != -1) ostr << ", SpecialCommandCode = '" << db_SpecialCommandCode << "'"; else ostr<<",SpecialCommandCode = NULL";
if( db_DefectBeginPositionZi != -1) ostr << ", DefectBeginPosition = " << db_DefectBeginPosition; else ostr<<",DefectBeginPosition = NULL";
if( db_DefectEndPositionZi != -1) ostr << ", DefectEndPosition = " << db_DefectEndPosition; else ostr<<",DefectEndPosition = NULL";
if( db_DefectSurfacePositionZi != -1) ostr << ", DefectSurfacePosition = '" << db_DefectSurfacePosition << "'"; else ostr<<",DefectSurfacePosition = NULL";
if( db_DefectCodeZi != -1) ostr << ", DefectCode = '" << db_DefectCode << "'"; else ostr<<",DefectCode = NULL";
// where
ostr << " WHERE ";
ostr << "entId = '" << db_entId << "'";
updatecmd.SetConnection(&cn);
updatecmd.SetCommandText( ostr.str());
DB_UPDEXECUTE();
DB_UPDAFFECTED();
return ( NULL );
} // end of methode
//
// public methode insertDB
//
char* T_DPI_DATADBAX::insertDB(T_DPI_DATA &dbObj ){
copyAttribute2DB( dbObj );
dbSqlCode = 0;
m_sql = "INSERT INTO T_DPI_DATA VALUES( :1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14, :15, :16, :17, :18, :19, :20, :21, :22, :23, :24, :25, :26, :27, :28)";
insertcmd.SetConnection(&cn);
insertcmd.SetCommandText( m_sql);
// Normal columns
insertcmd.Param(1) = ( char *)db_OrderNo;
// Normal columns
if( db_PlanNoZi != -1) insertcmd.Param(2) = ( char *)db_PlanNo; else insertcmd.Param(2).SetAsNull();
// Normal columns
if( db_ProduceDateZi != -1) insertcmd.Param(3) = DateTime( db_ProduceDate); else insertcmd.Param(3).SetAsNull();
// Primary columns
insertcmd.Param(4) = ( char *)db_entId;
// Normal columns
if( db_SteelGradeCodeZi != -1) insertcmd.Param(5) = ( char *)db_SteelGradeCode; else insertcmd.Param(5).SetAsNull();
// Normal columns
if( db_WeightZi != -1) insertcmd.Param(6) = ( long)db_Weight; else insertcmd.Param(6).SetAsNull();
// Normal columns
if( db_ThicknessZi != -1) insertcmd.Param(7) = ( long)db_Thickness; else insertcmd.Param(7).SetAsNull();
// Normal columns
if( db_WidthZi != -1) insertcmd.Param(8) = ( long)db_Width; else insertcmd.Param(8).SetAsNull();
// Normal columns
if( db_LengthZi != -1) insertcmd.Param(9) = ( long)db_Length; else insertcmd.Param(9).SetAsNull();
// Normal columns
if( db_OutDiameterZi != -1) insertcmd.Param(10) = ( long)db_OutDiameter; else insertcmd.Param(10).SetAsNull();
// Normal columns
if( db_WorkingKindCodeZi != -1) insertcmd.Param(11) = ( char *)db_WorkingKindCode; else insertcmd.Param(11).SetAsNull();
// Normal columns
if( db_PaperCodeZi != -1) insertcmd.Param(12) = ( char *)db_PaperCode; else insertcmd.Param(12).SetAsNull();
// Normal columns
if( db_EntrySleeveUseZi != -1) insertcmd.Param(13) = ( char *)db_EntrySleeveUse; else insertcmd.Param(13).SetAsNull();
// Normal columns
if( db_EntrySleeveTypeZi != -1) insertcmd.Param(14) = ( char *)db_EntrySleeveType; else insertcmd.Param(14).SetAsNull();
// Normal columns
if( db_EntrySleeveDiaZi != -1) insertcmd.Param(15) = ( long)db_EntrySleeveDia; else insertcmd.Param(15).SetAsNull();
// Normal columns
if( db_EntrySleeveCodeZi != -1) insertcmd.Param(16) = ( char *)db_EntrySleeveCode; else insertcmd.Param(16).SetAsNull();
// Normal columns
if( db_FinishingCodeZi != -1) insertcmd.Param(17) = ( char *)db_FinishingCode; else insertcmd.Param(17).SetAsNull();
// Normal columns
if( db_BaseSurfaceZi != -1) insertcmd.Param(18) = ( char *)db_BaseSurface; else insertcmd.Param(18).SetAsNull();
// Normal columns
if( db_APNZi != -1) insertcmd.Param(19) = ( char *)db_APN; else insertcmd.Param(19).SetAsNull();
// Normal columns
if( db_SpecificationCodeZi != -1) insertcmd.Param(20) = ( char *)db_SpecificationCode; else insertcmd.Param(20).SetAsNull();
// Normal columns
if( db_PreviousProcessZi != -1) insertcmd.Param(21) = ( char *)db_PreviousProcess; else insertcmd.Param(21).SetAsNull();
// Normal columns
if( db_NextProcessZi != -1) insertcmd.Param(22) = ( char *)db_NextProcess; else insertcmd.Param(22).SetAsNull();
// Normal columns
if( db_YardNrZi != -1) insertcmd.Param(23) = ( char *)db_YardNr; else insertcmd.Param(23).SetAsNull();
// Normal columns
if( db_SpecialCommandCodeZi != -1) insertcmd.Param(24) = ( char *)db_SpecialCommandCode; else insertcmd.Param(24).SetAsNull();
// Normal columns
if( db_DefectBeginPositionZi != -1) insertcmd.Param(25) = ( long)db_DefectBeginPosition; else insertcmd.Param(25).SetAsNull();
// Normal columns
if( db_DefectEndPositionZi != -1) insertcmd.Param(26) = ( long)db_DefectEndPosition; else insertcmd.Param(26).SetAsNull();
// Normal columns
if( db_DefectSurfacePositionZi != -1) insertcmd.Param(27) = ( char *)db_DefectSurfacePosition; else insertcmd.Param(27).SetAsNull();
// Normal columns
if( db_DefectCodeZi != -1) insertcmd.Param(28) = ( char *)db_DefectCode; else insertcmd.Param(28).SetAsNull();
DB_INSEXECUTE();
return ( NULL );
} // end of methode
//
// public methode deleteDB
//
char* T_DPI_DATADBAX::deleteDB(T_DPI_DATA &dbObj ){
ostringstream ostr;
dbSqlCode = 0;
copyKey2Host( dbObj );
ostr << "DELETE FROM T_DPI_DATA WHERE ";
ostr << "entId = '" << db_entId << "'";
cmd.SetConnection( &cn);
cmd.SetCommandText( ostr.str());
DB_EXECUTE();
return ( NULL );
} // end of methode
//
// public methode deleteDB delete in case of a where clause
//
char* T_DPI_DATADBAX::deleteDB(const char* where , long* count){
dbSqlCode = 0;
*(count) = -1L;
m_sql = "DELETE FROM T_DPI_DATA ";
if ( where != (char*)NULL ) {
m_sql.append( where );
}
cmd.SetConnection( &cn);
cmd.SetCommandText( m_sql);
DB_EXECUTE();
if( count != NULL){
*count = cmd.RowsAffected();
}
return ( NULL );
} // end of methode
//
// public methode openSetDB
//
char* T_DPI_DATADBAX::openSetDB(const char* where , const char* order){
dbSqlCode = 0;
m_sql = "SELECT OrderNo, PlanNo, TO_CHAR(ProduceDate, 'YYYYMMDDHH24MISS'), entId, SteelGradeCode, Weight, Thickness, Width, Length, OutDiameter, WorkingKindCode, PaperCode, EntrySleeveUse, EntrySleeveType, EntrySleeveDia, EntrySleeveCode, FinishingCode, BaseSurface, APN, SpecificationCode, PreviousProcess, NextProcess, YardNr, SpecialCommandCode, DefectBeginPosition, DefectEndPosition, DefectSurfacePosition, DefectCode FROM T_DPI_DATA ";
if ( where != (char*)NULL ) {
m_sql.append( where);
m_sql.append( " ");
}
if (order != (char*)NULL){
m_sql.append( order);
}
readcmd.SetConnection(&cn);
readcmd.SetCommandText( m_sql);
DB_RDEXECUTE();
return ( NULL );
} // end of methode
//
// public methode getSetDB
//
char* T_DPI_DATADBAX::getSetDB( T_DPI_DATA &dbObj ){
dbSqlCode = 0;
DB_FETCH();
// Normal columns
// OrderNo
strncpy( db_OrderNo, readcmd.Field(1).AsString().c_str(), sizeof( db_OrderNo));
// Normal columns
// PlanNo
if( readcmd.Field(2).IsNull() == false)
{
db_PlanNoZi = 0;
strncpy( db_PlanNo, readcmd.Field(2).AsString().c_str(), sizeof( db_PlanNo));
}
else
{
db_PlanNoZi = -1;
memset( db_PlanNo, 0x00, sizeof( db_PlanNo));
}
// Normal columns
// ProduceDate
if( readcmd.Field(3).IsNull() == false)
{
db_ProduceDateZi = 0;
strncpy( db_ProduceDate, readcmd.Field(3).AsString().c_str(), sizeof( db_ProduceDate));
}
else
{
db_ProduceDateZi = -1;
memset( db_ProduceDate, 0x00, sizeof( db_ProduceDate));
}
// Primary columns
strncpy( db_entId, readcmd.Field(4).AsString().c_str(), sizeof( db_entId));
// Normal columns
// SteelGradeCode
if( readcmd.Field(5).IsNull() == false)
{
db_SteelGradeCodeZi = 0;
strncpy( db_SteelGradeCode, readcmd.Field(5).AsString().c_str(), sizeof( db_SteelGradeCode));
}
else
{
db_SteelGradeCodeZi = -1;
memset( db_SteelGradeCode, 0x00, sizeof( db_SteelGradeCode));
}
// Normal columns
// Weight
if( readcmd.Field(6).IsNull() == false)
{
db_WeightZi = 0;
db_Weight = ( long)readcmd.Field(6).AsLong();
}
else
{
db_WeightZi = -1;
db_Weight = 0;
}
// Normal columns
// Thickness
if( readcmd.Field(7).IsNull() == false)
{
db_ThicknessZi = 0;
db_Thickness = ( long)readcmd.Field(7).AsLong();
}
else
{
db_ThicknessZi = -1;
db_Thickness = 0;
}
// Normal columns
// Width
if( readcmd.Field(8).IsNull() == false)
{
db_WidthZi = 0;
db_Width = ( long)readcmd.Field(8).AsLong();
}
else
{
db_WidthZi = -1;
db_Width = 0;
}
// Normal columns
// Length
if( readcmd.Field(9).IsNull() == false)
{
db_LengthZi = 0;
db_Length = ( long)readcmd.Field(9).AsLong();
}
else
{
db_LengthZi = -1;
db_Length = 0;
}
// Normal columns
// OutDiameter
if( readcmd.Field(10).IsNull() == false)
{
db_OutDiameterZi = 0;
db_OutDiameter = ( short)readcmd.Field(10).AsLong();
}
else
{
db_OutDiameterZi = -1;
db_OutDiameter = 0;
}
// Normal columns
// WorkingKindCode
if( readcmd.Field(11).IsNull() == false)
{
db_WorkingKindCodeZi = 0;
strncpy( db_WorkingKindCode, readcmd.Field(11).AsString().c_str(), sizeof( db_WorkingKindCode));
}
else
{
db_WorkingKindCodeZi = -1;
memset( db_WorkingKindCode, 0x00, sizeof( db_WorkingKindCode));
}
// Normal columns
// PaperCode
if( readcmd.Field(12).IsNull() == false)
{
db_PaperCodeZi = 0;
strncpy( db_PaperCode, readcmd.Field(12).AsString().c_str(), sizeof( db_PaperCode));
}
else
{
db_PaperCodeZi = -1;
memset( db_PaperCode, 0x00, sizeof( db_PaperCode));
}
// Normal columns
// EntrySleeveUse
if( readcmd.Field(13).IsNull() == false)
{
db_EntrySleeveUseZi = 0;
strncpy( db_EntrySleeveUse, readcmd.Field(13).AsString().c_str(), sizeof( db_EntrySleeveUse));
}
else
{
db_EntrySleeveUseZi = -1;
memset( db_EntrySleeveUse, 0x00, sizeof( db_EntrySleeveUse));
}
// Normal columns
// EntrySleeveType
if( readcmd.Field(14).IsNull() == false)
{
db_EntrySleeveTypeZi = 0;
strncpy( db_EntrySleeveType, readcmd.Field(14).AsString().c_str(), sizeof( db_EntrySleeveType));
}
else
{
db_EntrySleeveTypeZi = -1;
memset( db_EntrySleeveType, 0x00, sizeof( db_EntrySleeveType));
}
// Normal columns
// EntrySleeveDia
if( readcmd.Field(15).IsNull() == false)
{
db_EntrySleeveDiaZi = 0;
db_EntrySleeveDia = ( short)readcmd.Field(15).AsLong();
}
else
{
db_EntrySleeveDiaZi = -1;
db_EntrySleeveDia = 0;
}
// Normal columns
// EntrySleeveCode
if( readcmd.Field(16).IsNull() == false)
{
db_EntrySleeveCodeZi = 0;
strncpy( db_EntrySleeveCode, readcmd.Field(16).AsString().c_str(), sizeof( db_EntrySleeveCode));
}
else
{
db_EntrySleeveCodeZi = -1;
memset( db_EntrySleeveCode, 0x00, sizeof( db_EntrySleeveCode));
}
// Normal columns
// FinishingCode
if( readcmd.Field(17).IsNull() == false)
{
db_FinishingCodeZi = 0;
strncpy( db_FinishingCode, readcmd.Field(17).AsString().c_str(), sizeof( db_FinishingCode));
}
else
{
db_FinishingCodeZi = -1;
memset( db_FinishingCode, 0x00, sizeof( db_FinishingCode));
}
// Normal columns
// BaseSurface
if( readcmd.Field(18).IsNull() == false)
{
db_BaseSurfaceZi = 0;
strncpy( db_BaseSurface, readcmd.Field(18).AsString().c_str(), sizeof( db_BaseSurface));
}
else
{
db_BaseSurfaceZi = -1;
memset( db_BaseSurface, 0x00, sizeof( db_BaseSurface));
}
// Normal columns
// APN
if( readcmd.Field(19).IsNull() == false)
{
db_APNZi = 0;
strncpy( db_APN, readcmd.Field(19).AsString().c_str(), sizeof( db_APN));
}
else
{
db_APNZi = -1;
memset( db_APN, 0x00, sizeof( db_APN));
}
// Normal columns
// SpecificationCode
if( readcmd.Field(20).IsNull() == false)
{
db_SpecificationCodeZi = 0;
strncpy( db_SpecificationCode, readcmd.Field(20).AsString().c_str(), sizeof( db_SpecificationCode));
}
else
{
db_SpecificationCodeZi = -1;
memset( db_SpecificationCode, 0x00, sizeof( db_SpecificationCode));
}
// Normal columns
// PreviousProcess
if( readcmd.Field(21).IsNull() == false)
{
db_PreviousProcessZi = 0;
strncpy( db_PreviousProcess, readcmd.Field(21).AsString().c_str(), sizeof( db_PreviousProcess));
}
else
{
db_PreviousProcessZi = -1;
memset( db_PreviousProcess, 0x00, sizeof( db_PreviousProcess));
}
// Normal columns
// NextProcess
if( readcmd.Field(22).IsNull() == false)
{
db_NextProcessZi = 0;
strncpy( db_NextProcess, readcmd.Field(22).AsString().c_str(), sizeof( db_NextProcess));
}
else
{
db_NextProcessZi = -1;
memset( db_NextProcess, 0x00, sizeof( db_NextProcess));
}
// Normal columns
// YardNr
if( readcmd.Field(23).IsNull() == false)
{
db_YardNrZi = 0;
strncpy( db_YardNr, readcmd.Field(23).AsString().c_str(), sizeof( db_YardNr));
}
else
{
db_YardNrZi = -1;
memset( db_YardNr, 0x00, sizeof( db_YardNr));
}
// Normal columns
// SpecialCommandCode
if( readcmd.Field(24).IsNull() == false)
{
db_SpecialCommandCodeZi = 0;
strncpy( db_SpecialCommandCode, readcmd.Field(24).AsString().c_str(), sizeof( db_SpecialCommandCode));
}
else
{
db_SpecialCommandCodeZi = -1;
memset( db_SpecialCommandCode, 0x00, sizeof( db_SpecialCommandCode));
}
// Normal columns
// DefectBeginPosition
if( readcmd.Field(25).IsNull() == false)
{
db_DefectBeginPositionZi = 0;
db_DefectBeginPosition = ( long)readcmd.Field(25).AsLong();
}
else
{
db_DefectBeginPositionZi = -1;
db_DefectBeginPosition = 0;
}
// Normal columns
// DefectEndPosition
if( readcmd.Field(26).IsNull() == false)
{
db_DefectEndPositionZi = 0;
db_DefectEndPosition = ( long)readcmd.Field(26).AsLong();
}
else
{
db_DefectEndPositionZi = -1;
db_DefectEndPosition = 0;
}
// Normal columns
// DefectSurfacePosition
if( readcmd.Field(27).IsNull() == false)
{
db_DefectSurfacePositionZi = 0;
strncpy( db_DefectSurfacePosition, readcmd.Field(27).AsString().c_str(), sizeof( db_DefectSurfacePosition));
}
else
{
db_DefectSurfacePositionZi = -1;
memset( db_DefectSurfacePosition, 0x00, sizeof( db_DefectSurfacePosition));
}
// Normal columns
// DefectCode
if( readcmd.Field(28).IsNull() == false)
{
db_DefectCodeZi = 0;
strncpy( db_DefectCode, readcmd.Field(28).AsString().c_str(), sizeof( db_DefectCode));
}
else
{
db_DefectCodeZi = -1;
memset( db_DefectCode, 0x00, sizeof( db_DefectCode));
}
copyDB2Attribute( dbObj );
copyHost2Key( dbObj );
return ( NULL );
} // end of methode
//
// public methode closeSetDB
//
char* T_DPI_DATADBAX::closeSetDB(){
dbSqlCode = 0;
return ( NULL );
} // end of methode
//
// public methode countDB
//
char* T_DPI_DATADBAX::countDB(const char* where , long* count){
dbSqlCode = 0;
*(count) = -1L;
m_sql = "SELECT count(*) FROM T_DPI_DATA ";
if ( where != (char*)NULL ) {
m_sql.append( where);
}
readcmd.SetConnection(&cn);
readcmd.SetCommandText( m_sql);
DB_RDEXECUTE();
DB_FETCH();
*count = ( long)readcmd.Field(1).AsLong();
return ( NULL );
} // end of methode