summaryrefslogtreecommitdiff
path: root/src/core/xbfields.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/xbfields.cpp')
-rwxr-xr-xsrc/core/xbfields.cpp56
1 files changed, 32 insertions, 24 deletions
diff --git a/src/core/xbfields.cpp b/src/core/xbfields.cpp
index 8cfb4e6..e683d9c 100755
--- a/src/core/xbfields.cpp
+++ b/src/core/xbfields.cpp
@@ -492,43 +492,50 @@ xbInt16 xbDbf::GetLogicalField( const xbString &sFieldName, xbBool &bFieldValue
*/
xbInt16 xbDbf::GetLongField( xbInt16 iFieldNo, xbInt32 & lFieldValue ) const {
- xbInt16 rc = 0;
- xbInt16 iErrorStop = 0;
- char cFieldType;
+ xbInt16 iRc = 0;
+ xbInt16 iErrorStop = 0;
+ char cFieldType;
+ xbString sTemp;
try{
- if(( rc = GetFieldType( iFieldNo, cFieldType )) != XB_NO_ERROR ){
- iErrorStop = 10;
- throw rc;
+ if(( iRc = GetFieldType( iFieldNo, cFieldType )) != XB_NO_ERROR ){
+ iErrorStop = 100;
+ throw iRc;
}
if( cFieldType != 'N' && cFieldType != 'F' && cFieldType != 'M' ){
- iErrorStop = 20;
- rc = XB_INVALID_FIELD_TYPE;
- throw rc;
+ iErrorStop = 110;
+ iRc = XB_INVALID_FIELD_TYPE;
+ throw iRc;
}
- xbString sTemp;
- if(( rc = GetField( iFieldNo, sTemp, 0 )) < 0 ){
- iErrorStop = 30;
- throw rc;
+ if(( iRc = GetField( iFieldNo, sTemp, 0 )) < 0 ){
+ iErrorStop = 120;
+ throw iRc;
}
+ sTemp.Trim();
- if( !sTemp.ValidNumericValue() || ((int) sTemp.Pos( '.' ) > 0)){
- iErrorStop = 40;
- rc = XB_INVALID_DATA;
- throw rc;
+ if( !sTemp.ValidNumericValue() ){
+ iErrorStop = 130;
+ iRc = XB_INVALID_DATA;
+ throw iRc;
+ }
+
+ if( sTemp.Pos( '.' ) > 0){
+ iErrorStop = 140;
+ iRc = XB_INVALID_DATA;
+ throw iRc;
}
lFieldValue = atol( sTemp.Str());
}
- catch (xbInt16 rc ){
+ catch (xbInt16 iRc ){
xbString sMsg;
- sMsg.Sprintf( "xbDbf::GetLongField() Exception Caught. Error Stop = [%d] rc = [%d]", iErrorStop, rc );
+ sMsg.Sprintf( "xbDbf::GetLongField() Exception Caught. Error Stop = [%d] rc = [%d] [%s]", iErrorStop, iRc, sTemp.Str() );
xbase->WriteLogMessage( sMsg.Str() );
- xbase->WriteLogMessage( GetErrorMessage( rc ));
+ xbase->WriteLogMessage( GetErrorMessage( iRc ));
}
return XB_NO_ERROR;
@@ -615,24 +622,24 @@ xbInt16 xbDbf::GetULongField( xbInt16 iFieldNo, xbUInt32 & ulFieldValue ) const
try{
if(( rc = GetFieldType( iFieldNo, cFieldType )) != XB_NO_ERROR ){
- iErrorStop = 10;
+ iErrorStop = 100;
throw rc;
}
if( cFieldType != 'N' && cFieldType != 'F' && cFieldType != 'M' ){
- iErrorStop = 20;
+ iErrorStop = 110;
rc = XB_INVALID_FIELD_TYPE;
throw rc;
}
xbString sTemp;
if(( rc = GetField( iFieldNo, sTemp, 0 )) != XB_NO_ERROR ){
- iErrorStop = 30;
+ iErrorStop = 120;
throw rc;
}
sTemp.Trim();
if( !sTemp.ValidNumericValue() || ((int) sTemp.Pos( '.' ) > 0)){
- iErrorStop = 40;
+ iErrorStop = 130;
rc = XB_INVALID_DATA;
throw rc;
}
@@ -1118,5 +1125,6 @@ xbBool xbDbf::MemoFieldExists( xbInt16 iFieldNo ) const{
}
#endif
+
} /* namespace */