summaryrefslogtreecommitdiff
path: root/src/core/xbxbase.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/xbxbase.cpp')
-rwxr-xr-xsrc/core/xbxbase.cpp53
1 files changed, 19 insertions, 34 deletions
diff --git a/src/core/xbxbase.cpp b/src/core/xbxbase.cpp
index 7dd3ac7..7443b26 100755
--- a/src/core/xbxbase.cpp
+++ b/src/core/xbxbase.cpp
@@ -51,12 +51,12 @@ xbInt16 xbXBase::CloseAllTables(){
d = (xbDbf *) GetDbfPtr( 1 );
if( d ){
if(( iRc = d->Close()) != XB_NO_ERROR ){
- iErrorStop = 10;
+ iErrorStop = 100;
throw iRc;
}
} else {
iRc = XB_INVALID_OBJECT;
- iErrorStop = 20;
+ iErrorStop = 110;
throw iRc;
}
}
@@ -130,7 +130,6 @@ void xbXBase::SetLogSize( size_t lSize ) {
xLog->LogSetLogSize( lSize );
}
-
//! @brief Write message to logfile.
/*!
\param sLogMessage - Message to write.
@@ -189,7 +188,7 @@ void xbXBase::SetLogDirectory( const xbString & sLogDirectory ){
xbBool xbXBase::GetLogStatus() const {
return xbFalse;
}
-xbInt16 xbXBase::WriteLogMessage( const xbString & sLogMessage ){
+xbInt16 xbXBase::WriteLogMessage( const xbString & sLogMessage, xbInt16 ){
return XB_NO_ERROR;
}
xbInt16 xbXBase::WriteLogBytes( xbUInt32 lCnt, const char *p ){
@@ -202,7 +201,7 @@ void xbXBase::DisableMsgLogging() {
return;
}
xbInt16 xbXBase::FlushLog() {
- return;
+ return XB_NO_ERROR;
}
void xbXBase::SetLogSize( size_t lSize ) {
return;
@@ -569,23 +568,22 @@ xbDbf* xbXBase::Open( const xbString &sTableName, const xbString &sAlias, xbInt1
try{
if( sTableName.Len() == 0 ){
- iErrorStop = 10;
+ iErrorStop = 100;
iRc = XB_FILE_NOT_FOUND;
throw iRc;
}
xbFile *f = new xbFile(this);
f->SetFileName( sTableName );
if(( iRc = f->FileExists( f->GetFqFileName())) != xbTrue ){
- iErrorStop = 20;
+ iErrorStop = 110;
iRc = XB_FILE_NOT_FOUND;
throw iRc;
}
unsigned char cFileTypeByte;
if(( iRc = f->GetXbaseFileTypeByte( f->GetFqFileName(), cFileTypeByte )) != XB_NO_ERROR ){
- iErrorStop = 30;
+ iErrorStop = 120;
throw iRc;
}
-
xbInt16 iTblVsn = f->DetermineXbaseTableVersion( cFileTypeByte );
f->xbFclose();
sFqFileName.Set( f->GetFqFileName() );
@@ -597,7 +595,7 @@ xbDbf* xbXBase::Open( const xbString &sTableName, const xbString &sAlias, xbInt1
iRc = pDbf->Open( sFqFileName, sAlias, iOpenMode, iShareMode );
#else
// std::cout << "Dbase IV file support not build into library. See XB_DBF4_SUPPORT" << std::endl;
- iErrorStop = 40;
+ iErrorStop = 130;
iRc = XB_FILE_TYPE_NOT_SUPPORTED;
throw iRc;
#endif
@@ -609,72 +607,64 @@ xbDbf* xbXBase::Open( const xbString &sTableName, const xbString &sAlias, xbInt1
iRc = pDbf->Open( sFqFileName, sAlias, iOpenMode, iShareMode );
#else
//std::cout << "Dbase III file support not build into library. See XB_DBF3_SUPPORT" << std::endl;
- iErrorStop = 50;
+ iErrorStop = 140;
iRc = XB_FILE_TYPE_NOT_SUPPORTED;
throw iRc;
#endif
} else {
- iErrorStop = 60;
+ iErrorStop = 150;
iRc = XB_FILE_TYPE_NOT_SUPPORTED;
throw iRc;
}
if( iRc != XB_NO_ERROR ){
- iErrorStop = 70;
+ iErrorStop = 160;
throw iRc;
}
}
catch (xbInt16 iRc ){
-
- std::cout << "Openerror\n";
-
xbString sMsg;
sMsg.Sprintf( "xbxbase::Open() Exception Caught. Error Stop = [%d] rc = [%d]", iErrorStop, iRc );
WriteLogMessage( sMsg.Str() );
WriteLogMessage( GetErrorMessage( iRc ));
-
}
return pDbf;
-
}
xbInt16 xbXBase::OpenHighestVersion( const xbString &sTableName, const xbString &sAlias,
xbDbf **dbf )
{
-
xbInt16 iRc = 0;
xbInt16 iErrorStop = 0;
-
- xbDbf * pwDbf;
-
+
try{
xbFile f(this);
if( sTableName.Len() == 0 ){
- iErrorStop = 10;
+ iErrorStop = 100;
iRc = XB_FILE_NOT_FOUND;
throw iRc;
}
f.SetFileName( sTableName );
if(( iRc = f.FileExists( f.GetFqFileName() )) != xbTrue ){
- iErrorStop = 20;
+ iErrorStop = 110;
iRc = XB_FILE_NOT_FOUND;
throw iRc;
}
unsigned char cFileTypeByte;
if(( iRc = f.GetXbaseFileTypeByte( f.GetFqFileName(), cFileTypeByte )) != XB_NO_ERROR ){
- iErrorStop = 30;
+ iErrorStop = 120;
return iRc;
}
if( f.DetermineXbaseTableVersion( cFileTypeByte ) == 4 ){
#ifdef XB_DBF4_SUPPORT
- pwDbf = new xbDbf4( this );
+ xbDbf *pwDbf = new xbDbf4( this );
pwDbf->Open( f.GetFqFileName(), sAlias );
*dbf = pwDbf;
pwDbf = 0;
#else
// std::cout << "Dbase IV file support not build into library. See XB_DBF4_SUPPORT" << std::endl;
- iErrorStop = 40;
+ iErrorStop = 130;
iRc = XB_FILE_TYPE_NOT_SUPPORTED;
throw iRc;
#endif
@@ -684,27 +674,22 @@ xbInt16 xbXBase::OpenHighestVersion( const xbString &sTableName, const xbString
*dbf = new xbDbf3( this );
#else
//std::cout << "Dbase III file support not build into library. See XB_DBF3_SUPPORT" << std::endl;
- iErrorStop = 50;
+ iErrorStop = 140;
iRc = XB_FILE_TYPE_NOT_SUPPORTED;
throw iRc;
#endif
} else {
- iErrorStop = 60;
+ iErrorStop = 150;
iRc = XB_FILE_TYPE_NOT_SUPPORTED;
throw iRc;
}
-
}
catch (xbInt16 iRc ){
-
- std::cout << "OpenHighestVersion error\n";
-
xbString sMsg;
sMsg.Sprintf( "xbxbase::OpenHighestVersion() Exception Caught. Error Stop = [%d] rc = [%d]", iErrorStop, iRc );
WriteLogMessage( sMsg.Str() );
WriteLogMessage( GetErrorMessage( iRc ));
-
}
return iRc;
}