ChangeLogTag:19990827-18:46 GMT+1 Bruno Cantero <bruno@issnet.net>
This commit is contained in:
@@ -1,3 +1,13 @@
|
||||
19990827-18:46 GMT+1 Bruno Cantero <bruno@issnet.net>
|
||||
* source/rtl/filesys.c
|
||||
* Now hb_fsCommit() work with MSVC
|
||||
|
||||
* funclist.txt
|
||||
include/rddapi.h
|
||||
source/rdd/dbcmd.c
|
||||
source/rdd/dbf1.c
|
||||
* Added dbCommit() and dbCommitAll() functions
|
||||
|
||||
19990827-14:19 GMT+1 Bruno Cantero <bruno@issnet.net>
|
||||
* include/rddapi.h
|
||||
source/vm/hvm.c
|
||||
|
||||
@@ -55,8 +55,8 @@ DBCLEARINDEX ;S;
|
||||
DBCLEARRELATION ;S;
|
||||
DBCLOSEALL ;R;
|
||||
DBCLOSEAREA ;R;
|
||||
DBCOMMIT ;S;
|
||||
DBCOMMITALL ;S;
|
||||
DBCOMMIT ;R;
|
||||
DBCOMMITALL ;R;
|
||||
DBCREATE ;R;
|
||||
DBCREATEIND ;S;
|
||||
DBDELETE ;R;
|
||||
|
||||
@@ -608,8 +608,10 @@ typedef struct _RDDFUNCS
|
||||
DBENTRYP_SI getValue;
|
||||
#if 0
|
||||
DBENTRYP_SVP getVarLen;
|
||||
#endif
|
||||
DBENTRYP_V goCold;
|
||||
DBENTRYP_V goHot;
|
||||
#if 0
|
||||
DBENTRYP_VP putRec;
|
||||
#endif
|
||||
DBENTRYP_SI putValue;
|
||||
|
||||
@@ -69,6 +69,7 @@ HARBOUR HB_DBAPPEND( void );
|
||||
HARBOUR HB_DBCLOSEALL( void );
|
||||
HARBOUR HB_DBCLOSEAREA( void );
|
||||
HARBOUR HB_DBCOMMIT( void );
|
||||
HARBOUR HB_DBCOMMITALL( void );
|
||||
HARBOUR HB_DBCREATE( void );
|
||||
HARBOUR HB_DBDELETE( void );
|
||||
HARBOUR HB_DBGOBOTTOM( void );
|
||||
@@ -264,27 +265,34 @@ static ERRCODE FieldName( AREAP pArea, USHORT uiIndex, void * szName )
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
static ERRCODE Flush( AREAP pArea )
|
||||
{
|
||||
HB_SYMBOL_UNUSED( pArea );
|
||||
|
||||
printf( "Calling default: Flush()\n" );
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
static ERRCODE Found( AREAP pArea, BOOL * pFound )
|
||||
{
|
||||
* pFound = pArea->fFound;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
static ERRCODE Info( AREAP pArea, USHORT uiIndex, PHB_ITEM pItem )
|
||||
static ERRCODE GoCold( AREAP pArea )
|
||||
{
|
||||
HB_SYMBOL_UNUSED( pArea );
|
||||
HB_SYMBOL_UNUSED( uiIndex );
|
||||
HB_SYMBOL_UNUSED( pItem );
|
||||
PHB_ITEM pError;
|
||||
|
||||
printf( "Calling default: Info()\n" );
|
||||
if( pArea->lpExtendInfo->fReadOnly )
|
||||
{
|
||||
pError = hb_errNew();
|
||||
hb_errPutGenCode( pError, EG_READONLY );
|
||||
hb_errPutDescription( pError, hb_langDGetErrorDesc( EG_READONLY ) );
|
||||
hb_errPutSubCode( pError, 1025 );
|
||||
SELF_ERROR( ( AREAP ) pCurrArea->pArea, pError );
|
||||
hb_errRelease( pError );
|
||||
return FAILURE;
|
||||
}
|
||||
else
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
static ERRCODE GoHot( AREAP pArea )
|
||||
{
|
||||
pArea->lpExtendInfo->fRecordChanged = FALSE;
|
||||
pArea->lpFileInfo->fAppend = FALSE;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@@ -354,15 +362,6 @@ static ERRCODE Skip( AREAP pArea, LONG lToSkip )
|
||||
return SELF_SKIPRAW( pArea, lToSkip );
|
||||
}
|
||||
|
||||
static ERRCODE SkipFilter( AREAP pArea, LONG lToSkip )
|
||||
{
|
||||
HB_SYMBOL_UNUSED( pArea );
|
||||
HB_SYMBOL_UNUSED( lToSkip );
|
||||
|
||||
printf( "Calling default: SkipFilter()\n" );
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
static ERRCODE StructSize( AREAP pArea, USHORT * uiSize )
|
||||
{
|
||||
HB_SYMBOL_UNUSED( pArea );
|
||||
@@ -405,7 +404,7 @@ static RDDFUNCS defTable = { Bof,
|
||||
( DBENTRYP_I ) UnSupported,
|
||||
UnSupported,
|
||||
Skip,
|
||||
SkipFilter,
|
||||
( DBENTRYP_L ) UnSupported,
|
||||
( DBENTRYP_L ) UnSupported,
|
||||
AddField,
|
||||
( DBENTRYP_B ) UnSupported,
|
||||
@@ -415,8 +414,10 @@ static RDDFUNCS defTable = { Bof,
|
||||
FieldCount,
|
||||
FieldInfo,
|
||||
FieldName,
|
||||
Flush,
|
||||
UnSupported,
|
||||
( DBENTRYP_SI ) UnSupported,
|
||||
GoCold,
|
||||
GoHot,
|
||||
( DBENTRYP_SI ) UnSupported,
|
||||
UnSupported,
|
||||
( DBENTRYP_ULP ) UnSupported,
|
||||
@@ -425,7 +426,7 @@ static RDDFUNCS defTable = { Bof,
|
||||
Alias,
|
||||
Close,
|
||||
( DBENTRYP_VP ) UnSupported,
|
||||
Info,
|
||||
( DBENTRYP_SI ) UnSupported,
|
||||
NewArea,
|
||||
Open,
|
||||
Release,
|
||||
@@ -831,21 +832,12 @@ HARBOUR HB_BOF( void )
|
||||
HARBOUR HB_DBAPPEND( void )
|
||||
{
|
||||
BOOL bUnLockAll = TRUE;
|
||||
PHB_ITEM pError;
|
||||
|
||||
if( pCurrArea )
|
||||
{
|
||||
bNetError = FALSE;
|
||||
if( ( ( AREAP ) pCurrArea->pArea )->lpExtendInfo->fReadOnly )
|
||||
{
|
||||
pError = hb_errNew();
|
||||
hb_errPutGenCode( pError, EG_READONLY );
|
||||
hb_errPutDescription( pError, hb_langDGetErrorDesc( EG_READONLY ) );
|
||||
hb_errPutSubCode( pError, 1025 );
|
||||
SELF_ERROR( ( AREAP ) pCurrArea->pArea, pError );
|
||||
hb_errRelease( pError );
|
||||
if( SELF_GOCOLD( ( AREAP ) pCurrArea->pArea ) == FAILURE )
|
||||
return;
|
||||
}
|
||||
if( ISLOG( 1 ) )
|
||||
bUnLockAll = hb_parl( 1 );
|
||||
bNetError = ( SELF_APPEND( ( AREAP ) pCurrArea->pArea, bUnLockAll ) == FAILURE );
|
||||
@@ -890,6 +882,18 @@ HARBOUR HB_DBCOMMIT( void )
|
||||
hb_errRT_DBCMD( EG_NOTABLE, 2001, 0, "DBCOMMIT" );
|
||||
}
|
||||
|
||||
HARBOUR HB_DBCOMMITALL( void )
|
||||
{
|
||||
LPAREANODE pAreaNode;
|
||||
|
||||
pAreaNode = pWorkAreas;
|
||||
while( pAreaNode )
|
||||
{
|
||||
SELF_FLUSH( ( AREAP ) pAreaNode->pArea );
|
||||
pAreaNode = pAreaNode->pNext;
|
||||
}
|
||||
}
|
||||
|
||||
HARBOUR HB_DBCREATE( void )
|
||||
{
|
||||
char * szFileName, * szDriver;
|
||||
|
||||
@@ -200,8 +200,7 @@ static BOOL hb_dbfUpdateRecord( AREAP pArea, ULONG lRecNo )
|
||||
!hb_dbfUpdateHeader( pArea, lRecCount ) )
|
||||
return FALSE;
|
||||
}
|
||||
pArea->lpExtendInfo->fRecordChanged = FALSE;
|
||||
pArea->lpFileInfo->fAppend = FALSE;
|
||||
SELF_GOHOT( pArea );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -334,12 +333,9 @@ static BOOL hb_dbfUnLockAllRecords( AREAP pArea )
|
||||
|
||||
pFileInfo = pArea->lpFileInfo;
|
||||
for( lPosLocked = 0; lPosLocked < pFileInfo->lNumLocksPos; lPosLocked++ )
|
||||
{
|
||||
printf("UnLock record %ld\n",pFileInfo->pLocksPos[ lPosLocked ]);
|
||||
if( !hb_fsLock( pArea->lpFileInfo->hFile, LOCK_START +
|
||||
pFileInfo->pLocksPos[ lPosLocked ], 1, FL_UNLOCK ) )
|
||||
bUnLocked = FALSE;
|
||||
}
|
||||
|
||||
if( pFileInfo->lNumLocksPos > 1 )
|
||||
hb_xfree( pFileInfo->pLocksPos );
|
||||
@@ -443,6 +439,7 @@ static ERRCODE Close( AREAP pArea )
|
||||
{
|
||||
if( pArea->lpFileInfo->hFile != FS_ERROR )
|
||||
{
|
||||
SELF_FLUSH( pArea );
|
||||
SELF_RAWLOCK( pArea, FILE_UNLOCK, 0 );
|
||||
hb_fsClose( pArea->lpFileInfo->hFile );
|
||||
pArea->lpFileInfo->hFile = FS_ERROR;
|
||||
@@ -480,6 +477,9 @@ static ERRCODE DeleteRec( AREAP pArea )
|
||||
{
|
||||
PHB_ITEM pError;
|
||||
|
||||
if( SELF_GOCOLD( pArea ) == FAILURE )
|
||||
return FAILURE;
|
||||
|
||||
if( pArea->lpExtendInfo->bRecord[ 0 ] == '*' )
|
||||
return SUCCESS;
|
||||
|
||||
@@ -500,6 +500,17 @@ static ERRCODE DeleteRec( AREAP pArea )
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
static ERRCODE Flush( AREAP pArea )
|
||||
{
|
||||
if( pArea->lpFileInfo->hFile != FS_ERROR )
|
||||
{
|
||||
hb_fsCommit( pArea->lpFileInfo->hFile );
|
||||
return SUCCESS;
|
||||
}
|
||||
else
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
static ERRCODE GetValue( AREAP pArea, USHORT uiIndex, PHB_ITEM pItem )
|
||||
{
|
||||
LPFIELD pField;
|
||||
@@ -720,6 +731,9 @@ static ERRCODE PutValue( AREAP pArea, USHORT uiIndex, PHB_ITEM pItem )
|
||||
if( uiIndex > pArea->uiFieldCount )
|
||||
return FAILURE;
|
||||
|
||||
if( SELF_GOCOLD( pArea ) == FAILURE )
|
||||
return FAILURE;
|
||||
|
||||
if( !pArea->lpExtendInfo->fExclusive && !pArea->lpFileInfo->fFileLocked &&
|
||||
!hb_dbfIsLocked( pArea, pArea->lpExtendInfo->lRecNo ) )
|
||||
{
|
||||
@@ -732,17 +746,6 @@ static ERRCODE PutValue( AREAP pArea, USHORT uiIndex, PHB_ITEM pItem )
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if( pArea->lpExtendInfo->fReadOnly )
|
||||
{
|
||||
pError = hb_errNew();
|
||||
hb_errPutGenCode( pError, EG_READONLY );
|
||||
hb_errPutDescription( pError, hb_langDGetErrorDesc( EG_READONLY ) );
|
||||
hb_errPutSubCode( pError, 1025 );
|
||||
SELF_ERROR( pArea, pError );
|
||||
hb_errRelease( pError );
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
pField = pArea->lpFields;
|
||||
uiOffset = 1;
|
||||
for( uiCount = 1; uiCount < uiIndex; uiCount++ )
|
||||
@@ -941,6 +944,9 @@ static ERRCODE RecAll( AREAP pArea )
|
||||
{
|
||||
PHB_ITEM pError;
|
||||
|
||||
if( SELF_GOCOLD( pArea ) == FAILURE )
|
||||
return FAILURE;
|
||||
|
||||
if( pArea->lpExtendInfo->bRecord[ 0 ] != '*' )
|
||||
return SUCCESS;
|
||||
|
||||
@@ -1105,8 +1111,10 @@ static RDDFUNCS dbfTable = { 0, /* Super Bof */
|
||||
0, /* Super FieldCount */
|
||||
0, /* Super FieldInfo */
|
||||
0, /* Super FieldName */
|
||||
0, /* Super Flush */
|
||||
Flush, /* Super Flush */
|
||||
GetValue,
|
||||
0, /* Super GoCold */
|
||||
0, /* Super GoHot */
|
||||
PutValue,
|
||||
RecAll,
|
||||
RecCount,
|
||||
|
||||
@@ -548,8 +548,25 @@ void hb_fsCommit ( FHANDLE hFileHandle )
|
||||
}
|
||||
|
||||
#else
|
||||
#if defined(_MSC_VER)
|
||||
|
||||
s_uiErrorLast = FS_ERROR;
|
||||
int dup_handle;
|
||||
|
||||
errno = 0;
|
||||
dup_handle = _dup( hFileHandle );
|
||||
s_uiErrorLast = errno;
|
||||
|
||||
if( dup_handle != -1 )
|
||||
{
|
||||
_close( dup_handle );
|
||||
s_uiErrorLast = errno;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
s_uiErrorLast = FS_ERROR;
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user