summaryrefslogtreecommitdiff
path: root/src/core/xbtblmgr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/xbtblmgr.cpp')
-rwxr-xr-xsrc/core/xbtblmgr.cpp31
1 files changed, 22 insertions, 9 deletions
diff --git a/src/core/xbtblmgr.cpp b/src/core/xbtblmgr.cpp
index e1bf496..f154dc6 100755
--- a/src/core/xbtblmgr.cpp
+++ b/src/core/xbtblmgr.cpp
@@ -61,7 +61,7 @@ xbInt16 xbTblMgr::AddTblToTblList( xbDbf *d, const xbString & sTblName, const xb
try{
if( sTblName.Len() == 0 ){
- iErrorStop = 10;
+ iErrorStop = 100;
iRc = XB_INVALID_TABLE_NAME;
throw iRc;
}
@@ -77,7 +77,7 @@ xbInt16 xbTblMgr::AddTblToTblList( xbDbf *d, const xbString & sTblName, const xb
}
if((i = (xbTblList *) calloc(1, sizeof(xbTblList))) == NULL){
- iErrorStop = 20;
+ iErrorStop = 110;
iRc = XB_NO_MEMORY;
throw iRc;
}
@@ -96,7 +96,7 @@ xbInt16 xbTblMgr::AddTblToTblList( xbDbf *d, const xbString & sTblName, const xb
}
if( t && (strcmp( t->psTblAlias->Str(), sAlias.Str()) == 0 )){
- iErrorStop = 30;
+ iErrorStop = 120;
delete i->psTblName;
delete i->psTblAlias;
free( i );
@@ -110,7 +110,7 @@ xbInt16 xbTblMgr::AddTblToTblList( xbDbf *d, const xbString & sTblName, const xb
s->pNext = i;
}
catch (xbInt16 iRc ){
- if( iErrorStop != 30 ){
+ if( iErrorStop != 120 ){
xbString sMsg;
sMsg.Sprintf( "xbTblMgr::AddTblToTblList() Exception Caught. Error Stop = [%d] iRc = [%d] Tbl Name = [%s] Alias = [%s]", iErrorStop, iRc, sTblName.Str(), sTblAlias.Str() );
std::cout << sMsg << std::endl;
@@ -137,7 +137,6 @@ xbInt16 xbTblMgr::DisplayTableList() const {
}
return iTblCnt;
}
-
/*************************************************************************/
/* Get pointer to named dbf.
Looks up an open DBF file by Name.
@@ -152,8 +151,15 @@ xbDbf *xbTblMgr::GetDbfPtr(const xbString& sTblAlias) const {
xbTblList *t;
t = TblList;
+ xbString s;
+ xbUInt32 ui = sTblAlias.Pos( ".DBF" );
+ if( ui > 0 )
+ s.Assign( sTblAlias.Str(), 1, ui - 1 );
+ else
+ s.Set( sTblAlias );
+
while( t ){
- if( sTblAlias == t->psTblAlias->Str())
+ if( s == t->psTblAlias->Str())
return t->pDbf;
t = t->pNext;
}
@@ -166,7 +172,6 @@ xbDbf *xbTblMgr::GetDbfPtr(const xbString& sTblAlias) const {
}
return NULL;
}
-
/*************************************************************************/
/* Get pointer to named dbf.
Looks up an open DBF file by Name.
@@ -192,12 +197,21 @@ xbDbf *xbTblMgr::GetDbfPtr(xbInt16 iItemNo ) const {
else
return NULL;
}
-
/*************************************************************************/
xbInt16 xbTblMgr::GetOpenTableCount() const {
return iOpenTableCount;
}
+/*************************************************************************/
+xbTblList * xbTblMgr::GetTblListEntry( xbDbf *pTbl ){
+ xbTblList * i = TblList;
+ while( i ){
+ if( i->pDbf == pTbl )
+ return i;
+ i = i->pNext;
+ }
+ return NULL;
+}
/*************************************************************************/
xbInt16 xbTblMgr::RemoveTblFromTblList( const xbString & sTblAlias ) {
xbTblList *i, *s;
@@ -252,6 +266,5 @@ xbInt16 xbTblMgr::RemoveTblFromTblList( xbDbf *pTbl ) {
}
return XB_NOT_FOUND;
}
-
/*************************************************************************/
} /* namespace */