diff options
Diffstat (limited to 'src/sql/xbdrpix.cpp')
-rwxr-xr-x | src/sql/xbdrpix.cpp | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/src/sql/xbdrpix.cpp b/src/sql/xbdrpix.cpp index 9e3bc3b..2815264 100755 --- a/src/sql/xbdrpix.cpp +++ b/src/sql/xbdrpix.cpp @@ -19,7 +19,7 @@ Email Contact: namespace xb{ - +#ifdef XB_INDEX_SUPPORT /***********************************************************************/ xbInt16 xbSql::SqlDropIndex( const xbString &sCmdLine ){ @@ -63,7 +63,7 @@ xbInt16 xbSql::SqlDropIndex( const xbString &sCmdLine ){ sNode.Trim(); sNode.ToUpperCase(); if( sNode != "EXISTS" ){ - iErrorStop = 10; + iErrorStop = 100; iRc = XB_SYNTAX_ERROR; throw iRc; } else { @@ -97,30 +97,42 @@ xbInt16 xbSql::SqlDropIndex( const xbString &sCmdLine ){ dbf = xbase->GetDbfPtr( fDbf.GetFqFileName()); if( !dbf ){ if(( iRc = xbase->OpenHighestVersion( sTableName, "", &dbf )) != XB_NO_ERROR ){ - iErrorStop = 20; + iErrorStop = 110; throw iRc; } } if( dbf == NULL ){ - iErrorStop = 40; + iErrorStop = 120; iRc = XB_FILE_NOT_FOUND; throw iRc; } #ifdef XB_LOCKING_SUPPORT if(( iRc = dbf->LockTable( XB_LOCK )) != XB_NO_ERROR ){ - iErrorStop = 50; + iErrorStop = 130; throw iRc; } #endif // XB_LOCKING_SUPPORT - iRc = dbf->DeleteTag( "NDX", sIxName ); - if( iRc == XB_FILE_NOT_FOUND && !bIfExists ){ - iErrorStop = 60; - throw( iRc ); - } else if( iRc != XB_NO_ERROR ){ - iErrorStop = 70; - throw iRc; + ulPos = sIxName.Pos( ".NDX" ); + if( ulPos > 0 ){ + iRc = dbf->DeleteTag( "NDX", sIxName ); + if( iRc == XB_FILE_NOT_FOUND && !bIfExists ){ + iErrorStop = 140; + throw( iRc ); + } else if( iRc != XB_NO_ERROR ){ + iErrorStop = 150; + throw iRc; + } + } else { // assuming MDX tag + iRc = dbf->DeleteTag( "MDX", sIxName ); + if( iRc == XB_FILE_NOT_FOUND && !bIfExists ){ + iErrorStop = 160; + throw( iRc ); + } else if( iRc != XB_NO_ERROR ){ + iErrorStop = 170; + throw iRc; + } } } catch (xbInt16 iRc ){ @@ -136,7 +148,7 @@ xbInt16 xbSql::SqlDropIndex( const xbString &sCmdLine ){ return iRc; } - +#endif // XB_INDEX_SUPPORT /***********************************************************************/ } /* namespace */ #endif /* XB_SQL_SUPPORT */ |