diff options
Diffstat (limited to 'src/core/xbmemo3.cpp')
-rwxr-xr-x | src/core/xbmemo3.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/core/xbmemo3.cpp b/src/core/xbmemo3.cpp index 60c1d53..767e9d2 100755 --- a/src/core/xbmemo3.cpp +++ b/src/core/xbmemo3.cpp @@ -2,7 +2,7 @@ XBase64 Software Library -Copyright (c) 1997,2003,2014,2022 Gary A Kunkel +Copyright (c) 1997,2003,2014,2022,2023 Gary A Kunkel The xb64 software library is covered under the terms of the GPL Version 3, 2007 license. @@ -133,15 +133,18 @@ xbInt16 xbMemoDbt3::GetMemoField( xbInt16 iFieldNo, xbString & sMemoData ){ xbBool bDone = xbFalse; sMemoData = ""; try{ + if(( rc = dbf->GetULongField( iFieldNo, ulBlockNo )) < XB_NO_ERROR ){ iErrorStop = 100; throw rc; } + if( ulBlockNo == 0L ){ sMemoData = ""; return XB_NO_ERROR; } spp = NULL; + while( !bDone ){ if(( rc = ReadBlock( ulBlockNo++, GetBlockSize(), mbb )) != XB_NO_ERROR ){ iErrorStop = 120; @@ -256,6 +259,7 @@ xbInt16 xbMemoDbt3::PackMemo( void (*memoStatusFunc ) ( xbUInt32 ulItemNum, xbUI #endif try{ + #ifdef XB_LOCKING_SUPPORT if( dbf->GetAutoLock() && !dbf->GetTableLocked() ){ if(( iRc = dbf->LockTable( XB_LOCK )) != XB_NO_ERROR ){ @@ -275,7 +279,8 @@ xbInt16 xbMemoDbt3::PackMemo( void (*memoStatusFunc ) ( xbUInt32 ulItemNum, xbUI // create temp file xbString sTempMemoName; - if(( iRc = CreateUniqueFileName( GetDirectory(), "dbt", sTempMemoName )) != XB_NO_ERROR ){ + //if(( iRc = CreateUniqueFileName( GetDirectory(), "dbt", sTempMemoName )) != XB_NO_ERROR ){ + if(( iRc = CreateUniqueFileName( GetTempDirectory(), "DBT", sTempMemoName )) != XB_NO_ERROR ){ iErrorStop = 120; throw iRc; } @@ -297,7 +302,8 @@ xbInt16 xbMemoDbt3::PackMemo( void (*memoStatusFunc ) ( xbUInt32 ulItemNum, xbUI xbString sMemoFldData; for( xbUInt32 ulI = 1; ulI <= ulRecCnt; ulI++ ){ - if(( iRc = dbf->GetRecord( ulI )) != XB_NO_ERROR ){ + + if(( iRc = dbf->GetRecord( ulI )) != XB_NO_ERROR ){ iErrorStop = 150; throw iRc; } @@ -310,6 +316,8 @@ xbInt16 xbMemoDbt3::PackMemo( void (*memoStatusFunc ) ( xbUInt32 ulItemNum, xbUI iErrorStop = 160; throw iRc; } + + if( cFldType == 'M' ){ // copy it to work field if(( iRc = dbf->GetMemoField( lFc, sMemoFldData )) != XB_NO_ERROR ){ @@ -363,11 +371,13 @@ xbInt16 xbMemoDbt3::PackMemo( void (*memoStatusFunc ) ( xbUInt32 ulItemNum, xbUI throw iRc; } } + //close and delete target if(( iRc = pMemo->xbFclose()) != XB_NO_ERROR ){ iErrorStop = 250; throw iRc; } + if(( iRc = pMemo->xbRemove()) != XB_NO_ERROR ){ iErrorStop = 260; throw iRc; |