2000-09-02 00:08 GMT+1 Bruno Cantero <bruno@issnet.net>
This commit is contained in:
@@ -1,3 +1,26 @@
|
||||
2000-09-02 00:08 GMT+1 Bruno Cantero <bruno@issnet.net>
|
||||
+ include/hbdbf.h
|
||||
+ include/hbrddcdx.h
|
||||
* makefile.bc
|
||||
* makefile.vc
|
||||
* source/rdd/dbfcdx/Makefile
|
||||
* source/rdd/dbfcdx/dbfcdx1.c
|
||||
* source/rdd/rddsys.prg
|
||||
+ Added DBFCDX files to makefiles and reactivate it.
|
||||
By now is the default driver (rddsys.prg).
|
||||
|
||||
* include/hbrdddbf.h
|
||||
* source/rdd/dbcmd.c
|
||||
* source/rdd/workarea.c
|
||||
* source/rdd/hbdbsort.c
|
||||
* Fixed some warnings.
|
||||
|
||||
* tests/newrdd.prg
|
||||
+ Added CVS header Id.
|
||||
|
||||
* tests/testcdx.prg
|
||||
* Test FPT memos.
|
||||
|
||||
2000-09-01 13:55 GMT+2 Maurilio Longo <maurilio.longo@libero.it>
|
||||
* source/rtl/tbrowse.prg
|
||||
! fixed hilighting and dehilighting of cells if field is logical; that is logical cells value
|
||||
|
||||
84
harbour/include/hbdbf.h
Normal file
84
harbour/include/hbdbf.h
Normal file
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
* DBF structures
|
||||
*
|
||||
* Copyright 1999 Bruno Cantero <bruno@issnet.net>
|
||||
* www - http://www.harbour-project.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version, with one exception:
|
||||
*
|
||||
* The exception is that if you link the Harbour Runtime Library (HRL)
|
||||
* and/or the Harbour Virtual Machine (HVM) with other files to produce
|
||||
* an executable, this does not by itself cause the resulting executable
|
||||
* to be covered by the GNU General Public License. Your use of that
|
||||
* executable is in no way restricted on account of linking the HRL
|
||||
* and/or HVM code into it.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
|
||||
* their web site at http://www.gnu.org/).
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef HB_DBF_H_
|
||||
#define HB_DBF_H_
|
||||
|
||||
#include "hbapirdd.h"
|
||||
|
||||
#if defined(HB_EXTERN_C)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* DBF header */
|
||||
|
||||
typedef struct _DBFHEADER
|
||||
{
|
||||
BYTE bVersion;
|
||||
BYTE bYear;
|
||||
BYTE bMonth;
|
||||
BYTE bDay;
|
||||
ULONG ulRecCount;
|
||||
USHORT uiHeaderLen;
|
||||
USHORT uiRecordLen;
|
||||
BYTE bReserved1[ 16 ];
|
||||
BYTE bHasTags;
|
||||
BYTE bReserved2[ 3 ];
|
||||
} DBFHEADER;
|
||||
|
||||
typedef DBFHEADER * LPDBFHEADER;
|
||||
|
||||
|
||||
|
||||
/* DBF fields */
|
||||
|
||||
typedef struct _DBFFIELD
|
||||
{
|
||||
BYTE bName[ 11 ];
|
||||
BYTE bType;
|
||||
BYTE bReserved1[ 4 ];
|
||||
BYTE bLen;
|
||||
BYTE bDec;
|
||||
BYTE bReserved2[ 13 ];
|
||||
BYTE bHasTag;
|
||||
} DBFFIELD;
|
||||
|
||||
typedef DBFFIELD * LPDBFFIELD;
|
||||
|
||||
#if defined(HB_EXTERN_C)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* HB_DBF_H_ */
|
||||
319
harbour/include/hbrddcdx.h
Normal file
319
harbour/include/hbrddcdx.h
Normal file
@@ -0,0 +1,319 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
* DBFCDX RDD
|
||||
*
|
||||
* Copyright 1999 Bruno Cantero <bruno@issnet.net>
|
||||
* www - http://www.harbour-project.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version, with one exception:
|
||||
*
|
||||
* The exception is that if you link the Harbour Runtime Library (HRL)
|
||||
* and/or the Harbour Virtual Machine (HVM) with other files to produce
|
||||
* an executable, this does not by itself cause the resulting executable
|
||||
* to be covered by the GNU General Public License. Your use of that
|
||||
* executable is in no way restricted on account of linking the HRL
|
||||
* and/or HVM code into it.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
|
||||
* their web site at http://www.gnu.org/).
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef HB_RDDCDX_H_
|
||||
#define HB_RDDCDX_H_
|
||||
|
||||
#include "hbapirdd.h"
|
||||
|
||||
#if defined(HB_EXTERN_C)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* DBFCDX errors */
|
||||
|
||||
#define EDBF_OPEN_DBF 1001
|
||||
#define EDBF_CREATE_DBF 1004
|
||||
#define EDBF_READ 1010
|
||||
#define EDBF_WRITE 1011
|
||||
#define EDBF_CORRUPT 1012
|
||||
#define EDBF_DATATYPE 1020
|
||||
#define EDBF_DATAWIDTH 1021
|
||||
#define EDBF_UNLOCKED 1022
|
||||
#define EDBF_SHARED 1023
|
||||
#define EDBF_APPENDLOCK 1024
|
||||
#define EDBF_READONLY 1025
|
||||
|
||||
|
||||
|
||||
/* DBFCDX default memo extension */
|
||||
#define CDX_MEMOEXT ".fpt"
|
||||
|
||||
|
||||
|
||||
/* FPT's */
|
||||
|
||||
#define FPT_DEFBLOCKSIZE 64
|
||||
#define SIZEOFMEMOFREEBLOCK 6
|
||||
#define MAXFREEBLOCKS 82
|
||||
|
||||
typedef struct _MEMOHEADER
|
||||
{
|
||||
ULONG ulNextBlock; /* Next memo entry */
|
||||
ULONG ulBlockSize; /* Size of block */
|
||||
} MEMOHEADER;
|
||||
|
||||
typedef MEMOHEADER * LPMEMOHEADER;
|
||||
|
||||
|
||||
|
||||
typedef struct _MEMOBLOCK
|
||||
{
|
||||
ULONG ulType; /* 0 = binary, 1 = text */
|
||||
ULONG ulSize; /* length of data */
|
||||
} MEMOBLOCK;
|
||||
|
||||
typedef MEMOBLOCK * LPMEMOBLOCK;
|
||||
|
||||
|
||||
|
||||
typedef struct _MEMOFREEBLOCK
|
||||
{
|
||||
USHORT uiBlocks; /* Number of blocks */
|
||||
ULONG ulBlock; /* Block number */
|
||||
} MEMOFREEBLOCK;
|
||||
|
||||
typedef MEMOFREEBLOCK * LPMEMOFREEBLOCK;
|
||||
|
||||
|
||||
|
||||
typedef struct _MEMOROOT
|
||||
{
|
||||
ULONG ulNextBlock; /* Next block in the list */
|
||||
ULONG ulBlockSize; /* Size of block */
|
||||
BYTE szSignature[ 8 ]; /* Signature */
|
||||
BYTE fChanged; /* TRUE if root block is changed */
|
||||
USHORT uiListLen; /* Length of list */
|
||||
BYTE pFreeList[ 492 ]; /* Array of free memo blocks (82 MEMOFREEBLOCK's) */
|
||||
} MEMOROOT;
|
||||
|
||||
typedef MEMOROOT * LPMEMOROOT;
|
||||
|
||||
|
||||
|
||||
/* CDX's */
|
||||
|
||||
typedef struct _TAG
|
||||
{
|
||||
BYTE * pKeyBuffer; /* Buffer of keys */
|
||||
} TAG;
|
||||
|
||||
typedef TAG * LPTAG;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* DBF WORKAREA
|
||||
* ------------
|
||||
* The Workarea Structure of DBFCDX RDD
|
||||
*
|
||||
*/
|
||||
|
||||
typedef struct _CDXAREA
|
||||
{
|
||||
struct _RDDFUNCS * lprfsHost; /* Virtual method table for this workarea */
|
||||
USHORT uiArea; /* The number assigned to this workarea */
|
||||
void * atomAlias; /* Pointer to the alias symbol for this workarea */
|
||||
USHORT uiFieldExtent; /* Total number of fields allocated */
|
||||
USHORT uiFieldCount; /* Total number of fields used */
|
||||
LPFIELD lpFields; /* Pointer to an array of fields */
|
||||
void * lpFieldExtents; /* Void ptr for additional field properties */
|
||||
PHB_ITEM valResult; /* All purpose result holder */
|
||||
BOOL fTop; /* TRUE if "top" */
|
||||
BOOL fBottom; /* TRUE if "bottom" */
|
||||
BOOL fBof; /* TRUE if "bof" */
|
||||
BOOL fEof; /* TRUE if "eof" */
|
||||
BOOL fFound; /* TRUE if "found" */
|
||||
DBSCOPEINFO dbsi; /* Info regarding last LOCATE */
|
||||
DBFILTERINFO dbfi; /* Filter in effect */
|
||||
LPDBORDERCONDINFO lpdbOrdCondInfo;
|
||||
LPDBRELINFO lpdbRelations; /* Parent/Child relationships used */
|
||||
USHORT uiParents; /* Number of parents for this area */
|
||||
USHORT heap;
|
||||
USHORT heapSize;
|
||||
USHORT rddID;
|
||||
|
||||
/*
|
||||
* DBFS's additions to the workarea structure
|
||||
*
|
||||
* Warning: The above section MUST match WORKAREA exactly! Any
|
||||
* additions to the structure MUST be added below, as in this
|
||||
* example.
|
||||
*/
|
||||
|
||||
FHANDLE hDataFile; /* Data file handle */
|
||||
FHANDLE hMemoFile; /* Memo file handle */
|
||||
USHORT uiHeaderLen; /* Size of header */
|
||||
USHORT uiRecordLen; /* Size of record */
|
||||
ULONG ulRecCount; /* Total records */
|
||||
char * szDataFileName; /* Name of data file */
|
||||
char * szMemoFileName; /* Name of memo file */
|
||||
BOOL fHasMemo; /* WorkArea with Memo fields */
|
||||
BOOL fHasTags; /* WorkArea with MDX or CDX index */
|
||||
BOOL fShared; /* Shared file */
|
||||
BOOL fReadOnly; /* Read only file */
|
||||
USHORT * pFieldOffset; /* Pointer to field offset array */
|
||||
BYTE * pRecord; /* Buffer of record data */
|
||||
BOOL fValidBuffer; /* State of buffer */
|
||||
BOOL fPositioned; /* Positioned record */
|
||||
ULONG ulRecNo; /* Current record */
|
||||
BOOL fRecordChanged; /* Record changed */
|
||||
BOOL fAppend; /* TRUE if new record is added */
|
||||
BOOL fDeleted; /* TRUE if record is deleted */
|
||||
BOOL fUpdateHeader; /* Update header of file */
|
||||
BOOL fFLocked; /* TRUE if file is locked */
|
||||
LPDBRELINFO lpdbPendingRel; /* Pointer to parent rel struct */
|
||||
BYTE bYear; /* Last update */
|
||||
BYTE bMonth;
|
||||
BYTE bDay;
|
||||
ULONG * pLocksPos; /* List of records locked */
|
||||
ULONG ulNumLocksPos; /* Number of records locked */
|
||||
|
||||
/*
|
||||
* CDX's additions to the workarea structure
|
||||
*
|
||||
* Warning: The above section MUST match WORKAREA exactly! Any
|
||||
* additions to the structure MUST be added below, as in this
|
||||
* example.
|
||||
*/
|
||||
|
||||
USHORT uiMemoBlockSize; /* Size of memo block */
|
||||
LPMEMOROOT pMemoRoot; /* Array of free memo blocks */
|
||||
LPTAG * lpIndexes; /* Pointer to indexes array */
|
||||
|
||||
} CDXAREA;
|
||||
|
||||
typedef CDXAREA * LPCDXAREA;
|
||||
|
||||
#ifndef CDXAREAP
|
||||
#define CDXAREAP LPCDXAREA
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* -- DBFCDX METHODS --
|
||||
*/
|
||||
|
||||
#define SUPERTABLE ( &cdxSuper )
|
||||
|
||||
#define hb_cdxBof NULL
|
||||
#define hb_cdxEof NULL
|
||||
#define hb_cdxFound NULL
|
||||
#define hb_cdxGoBottom NULL
|
||||
#define hb_cdxGoTo NULL
|
||||
#define hb_cdxGoToId NULL
|
||||
#define hb_cdxGoTop NULL
|
||||
#define hb_cdxSeek NULL
|
||||
#define hb_cdxSkip NULL
|
||||
#define hb_cdxSkipFilter NULL
|
||||
#define hb_cdxSkipRaw NULL
|
||||
#define hb_cdxAddField NULL
|
||||
#define hb_cdxAppend NULL
|
||||
#define hb_cdxCreateFields NULL
|
||||
#define hb_cdxDeleteRec NULL
|
||||
#define hb_cdxDeleted NULL
|
||||
#define hb_cdxFieldCount NULL
|
||||
#define hb_cdxFieldDisplay NULL
|
||||
#define hb_cdxFieldInfo NULL
|
||||
#define hb_cdxFieldName NULL
|
||||
#define hb_cdxFlush NULL
|
||||
#define hb_cdxGetRec NULL
|
||||
extern ERRCODE hb_cdxGetValue( CDXAREAP pArea, USHORT uiIndex, PHB_ITEM pItem );
|
||||
extern ERRCODE hb_cdxGetVarLen( CDXAREAP pArea, USHORT uiIndex, ULONG * pLength );
|
||||
#define hb_cdxGoCold NULL
|
||||
#define hb_cdxGoHot NULL
|
||||
#define hb_cdxPutRec NULL
|
||||
extern ERRCODE hb_cdxPutValue( CDXAREAP pArea, USHORT uiIndex, PHB_ITEM pItem );
|
||||
#define hb_cdxRecAll NULL
|
||||
#define hb_cdxRecCount NULL
|
||||
#define hb_cdxRecInfo NULL
|
||||
#define hb_cdxRecNo NULL
|
||||
#define hb_cdxSetFieldExtent NULL
|
||||
#define hb_cdxAlias NULL
|
||||
extern ERRCODE hb_cdxClose( CDXAREAP pArea );
|
||||
#define hb_cdxCreate NULL
|
||||
extern ERRCODE hb_cdxInfo( CDXAREAP pArea, USHORT uiIndex, PHB_ITEM pItem );
|
||||
#define hb_cdxNewArea NULL
|
||||
extern ERRCODE hb_cdxOpen( CDXAREAP pArea, LPDBOPENINFO pOpenInfo );
|
||||
#define hb_cdxRelease NULL
|
||||
extern ERRCODE hb_cdxStructSize( CDXAREAP pArea, USHORT * uiSize );
|
||||
extern ERRCODE hb_cdxSysName( CDXAREAP pArea, BYTE * pBuffer );
|
||||
#define hb_cdxEval NULL
|
||||
#define hb_cdxPack NULL
|
||||
#define hb_cdxPackRec NULL
|
||||
#define hb_cdxSort NULL
|
||||
#define hb_cdxTrans NULL
|
||||
#define hb_cdxTransRec NULL
|
||||
#define hb_cdxZap NULL
|
||||
#define hb_cdxChildEnd NULL
|
||||
#define hb_cdxChildStart NULL
|
||||
#define hb_cdxChildSync NULL
|
||||
#define hb_cdxSyncChildren NULL
|
||||
#define hb_cdxClearRel NULL
|
||||
#define hb_cdxForceRel NULL
|
||||
#define hb_cdxRelArea NULL
|
||||
#define hb_cdxRelEval NULL
|
||||
#define hb_cdxRelText NULL
|
||||
#define hb_cdxSetRel NULL
|
||||
#define hb_cdxOrderListAdd NULL
|
||||
#define hb_cdxOrderListClear NULL
|
||||
#define hb_cdxOrderListDelete NULL
|
||||
#define hb_cdxOrderListFocus NULL
|
||||
#define hb_cdxOrderListRebuild NULL
|
||||
#define hb_cdxOrderCondition NULL
|
||||
#define hb_cdxOrderCreate NULL
|
||||
#define hb_cdxOrderDestroy NULL
|
||||
#define hb_cdxOrderInfo NULL
|
||||
#define hb_cdxClearFilter NULL
|
||||
#define hb_cdxClearLocate NULL
|
||||
#define hb_cdxClearScope NULL
|
||||
#define hb_cdxCountScope NULL
|
||||
#define hb_cdxFilterText NULL
|
||||
#define hb_cdxScopeInfo NULL
|
||||
#define hb_cdxSetFilter NULL
|
||||
#define hb_cdxSetLocate NULL
|
||||
#define hb_cdxSetScope NULL
|
||||
#define hb_cdxSkipScope NULL
|
||||
#define hb_cdxCompile NULL
|
||||
#define hb_cdxError NULL
|
||||
#define hb_cdxEvalBlock NULL
|
||||
#define hb_cdxRawLock NULL
|
||||
#define hb_cdxLock NULL
|
||||
#define hb_cdxUnLock NULL
|
||||
#define hb_cdxCloseMemFile NULL
|
||||
extern ERRCODE hb_cdxCreateMemFile( CDXAREAP pArea, LPDBOPENINFO pCreateInfo );
|
||||
#define hb_cdxGetValueFile NULL
|
||||
extern ERRCODE hb_cdxOpenMemFile( CDXAREAP pArea, LPDBOPENINFO pOpenInfo );
|
||||
#define hb_cdxPutValueFile NULL
|
||||
extern ERRCODE hb_cdxReadDBHeader( CDXAREAP pArea );
|
||||
extern ERRCODE hb_cdxWriteDBHeader( CDXAREAP pArea );
|
||||
#define hb_cdxWhoCares NULL
|
||||
|
||||
#if defined(HB_EXTERN_C)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* HB_RDDCDX_H_ */
|
||||
@@ -42,41 +42,6 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* DBF header */
|
||||
|
||||
typedef struct _DBFHEADER
|
||||
{
|
||||
BYTE bVersion;
|
||||
BYTE bYear;
|
||||
BYTE bMonth;
|
||||
BYTE bDay;
|
||||
ULONG ulRecCount;
|
||||
USHORT uiHeaderLen;
|
||||
USHORT uiRecordLen;
|
||||
BYTE bReserved1[ 16 ];
|
||||
BYTE bHasTags;
|
||||
BYTE bReserved2[ 3 ];
|
||||
} DBFHEADER;
|
||||
|
||||
typedef DBFHEADER * LPDBFHEADER;
|
||||
|
||||
|
||||
|
||||
typedef struct _DBFFIELD
|
||||
{
|
||||
BYTE bName[ 11 ];
|
||||
BYTE bType;
|
||||
BYTE bReserved1[ 4 ];
|
||||
BYTE bLen;
|
||||
BYTE bDec;
|
||||
BYTE bReserved2[ 13 ];
|
||||
BYTE bHasTag;
|
||||
} DBFFIELD;
|
||||
|
||||
typedef DBFFIELD * LPDBFFIELD;
|
||||
|
||||
|
||||
|
||||
/* DBF errors */
|
||||
|
||||
#define EDBF_OPEN_DBF 1001
|
||||
@@ -105,11 +70,13 @@ typedef DBFFIELD * LPDBFFIELD;
|
||||
#define DBF_LOCKPOS 1000000000L
|
||||
|
||||
|
||||
|
||||
/* DBT's */
|
||||
|
||||
#define DBT_BLOCKSIZE 512
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* DBF WORKAREA
|
||||
* ------------
|
||||
|
||||
@@ -397,12 +397,9 @@ NULSYS_LIB_OBJS = \
|
||||
DBFNTX_LIB_OBJS = \
|
||||
$(OBJ_DIR)\dbfntx0.obj
|
||||
|
||||
#DBFCDX_LIB_OBJS = \
|
||||
# $(OBJ_DIR)\dbfcdx1.obj \
|
||||
# \
|
||||
# $(OBJ_DIR)\dbfcdx0.obj
|
||||
|
||||
DBFCDX_LIB_OBJS = \
|
||||
$(OBJ_DIR)\dbfcdx1.obj \
|
||||
\
|
||||
$(OBJ_DIR)\dbfcdx0.obj
|
||||
|
||||
#
|
||||
@@ -1916,9 +1913,9 @@ $(OBJ_DIR)\dbfcdx0.obj : $(OBJ_DIR)\dbfcdx0.c
|
||||
$(CC) $(CLIBFLAGS) -o$@ $**
|
||||
tlib $(DBFCDX_LIB) $(ARFLAGS) -+$@,,
|
||||
|
||||
#$(OBJ_DIR)\dbfcdx1.obj : $(RDD_DIR)\dbfcdx\dbfcdx1.c
|
||||
# $(CC) $(CLIBFLAGS) -o$@ $**
|
||||
# tlib $(DBFCDX_LIB) $(ARFLAGS) -+$@,,
|
||||
$(OBJ_DIR)\dbfcdx1.obj : $(RDD_DIR)\dbfcdx\dbfcdx1.c
|
||||
$(CC) $(CLIBFLAGS) -o$@ $**
|
||||
tlib $(DBFCDX_LIB) $(ARFLAGS) -+$@,,
|
||||
|
||||
#
|
||||
# DEBUG.LIB dependencies
|
||||
|
||||
@@ -465,11 +465,9 @@ DBFNTX_LIB_OBJS = \
|
||||
$(HARBOUR_EXE) $(HARBOURFLAGS) -o$(OBJ_DIR)\ $<
|
||||
$(MAKE) -nologo /$(MK_FLAGS) /f$(MK_FILE) $(DBFCDX_LIB)2
|
||||
|
||||
#DBFCDX_LIB_OBJS = \
|
||||
# $(OBJ_DIR)\dbfcdx1.obj \
|
||||
# \
|
||||
# $(OBJ_DIR)\dbfcdx0.obj
|
||||
DBFCDX_LIB_OBJS = \
|
||||
$(OBJ_DIR)\dbfcdx1.obj \
|
||||
\
|
||||
$(OBJ_DIR)\dbfcdx0.obj
|
||||
|
||||
#
|
||||
|
||||
@@ -661,6 +661,16 @@ ERRCODE hb_rddSelectWorkAreaAlias( char * szName )
|
||||
return bResult;
|
||||
}
|
||||
|
||||
/*
|
||||
* Function for getting current workarea pointer
|
||||
*/
|
||||
void * hb_rddGetCurrentWorkAreaPointer( void )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_rddGetCurrentWorkAreaPointer()"));
|
||||
|
||||
return s_pCurrArea->pArea;
|
||||
}
|
||||
|
||||
/*
|
||||
* Obtain the current value of a field.
|
||||
*/
|
||||
@@ -1102,6 +1112,8 @@ HB_FUNC( DBCREATE )
|
||||
pStruct = hb_param( 2 , HB_IT_ARRAY );
|
||||
if( pStruct )
|
||||
uiLen = ( USHORT ) hb_arrayLen( pStruct );
|
||||
else
|
||||
uiLen = 0;
|
||||
|
||||
if( ( strlen( szFileName ) == 0 ) || !pStruct || uiLen == 0 )
|
||||
{
|
||||
@@ -1129,10 +1141,10 @@ HB_FUNC( DBCREATE )
|
||||
}
|
||||
}
|
||||
|
||||
uiPrevArea = s_uiCurrArea;
|
||||
if( !ISLOG( 4 ) )
|
||||
{
|
||||
bOpen = FALSE;
|
||||
uiPrevArea = s_uiCurrArea;
|
||||
hb_rddSelectFirstAvailable();
|
||||
}
|
||||
else
|
||||
@@ -2834,14 +2846,16 @@ HB_FUNC( __DBARRANGE )
|
||||
dbSortInfo.lpdbsItem = ( LPDBSORTITEM ) hb_xgrab( dbSortInfo.uiItemCount * sizeof( DBSORTITEM ) );
|
||||
ulSize = 0;
|
||||
for( uiCount = 1; uiCount <= dbSortInfo.uiItemCount; uiCount++ )
|
||||
{
|
||||
if( hb_arrayGetCLen( pFields, uiCount ) > ulSize )
|
||||
ulSize = hb_arrayGetCLen( pFields, uiCount );
|
||||
}
|
||||
szFieldLine = ( char * ) hb_xgrab( ulSize + 1 );
|
||||
for( uiCount = 0; uiCount < dbSortInfo.uiItemCount; uiCount++ )
|
||||
{
|
||||
dbSortInfo.lpdbsItem[ uiCount ].uiFlags = 0;
|
||||
ulSize = hb_arrayGetCLen( pFields, uiCount + 1 );
|
||||
hb_strncpyUpper( szFieldLine, hb_arrayGetCPtr( pFields, uiCount + 1 ), ulSize );
|
||||
hb_strncpyUpper( szFieldLine, hb_arrayGetCPtr( pFields, uiCount + 1 ),
|
||||
hb_arrayGetCLen( pFields, uiCount + 1 ) );
|
||||
szPos = strchr( szFieldLine, '/' );
|
||||
if( szPos )
|
||||
{
|
||||
@@ -2858,7 +2872,6 @@ HB_FUNC( __DBARRANGE )
|
||||
( * ( szPos + 2 ) != 0 && * ( szPos + 3 ) == 'C' ) ) )
|
||||
dbSortInfo.lpdbsItem[ uiCount ].uiFlags |= SF_CASE;
|
||||
* szPos = 0;
|
||||
ulSize = szFieldLine - szPos;
|
||||
}
|
||||
else
|
||||
dbSortInfo.lpdbsItem[ uiCount ].uiFlags |= SF_ASCEND;
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include "hbvm.h"
|
||||
#include "hbapiitm.h"
|
||||
#include "hbrdddbf.h"
|
||||
#include "hbdbf.h"
|
||||
#include "hbapierr.h"
|
||||
#include "hbapilng.h"
|
||||
#include "hbset.h"
|
||||
@@ -570,6 +571,7 @@ static BOOL hb_dbfPutMemo( DBFAREAP pArea, USHORT uiIndex, PHB_ITEM pItem )
|
||||
ULONG ulLen, ulBlock;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_dbfPutMemo(%p, %hu, %p)", pArea, uiIndex, pItem));
|
||||
|
||||
ulLen = hb_itemGetCLen( pItem );
|
||||
if( ulLen > 0 )
|
||||
{
|
||||
@@ -969,7 +971,7 @@ ERRCODE hb_dbfGetValue( DBFAREAP pArea, USHORT uiIndex, PHB_ITEM pItem )
|
||||
return FAILURE;
|
||||
|
||||
bError = FALSE;
|
||||
uiIndex --;
|
||||
uiIndex--;
|
||||
pField = pArea->lpFields + uiIndex;
|
||||
switch( pField->uiType )
|
||||
{
|
||||
@@ -1037,7 +1039,6 @@ ERRCODE hb_dbfGetValue( DBFAREAP pArea, USHORT uiIndex, PHB_ITEM pItem )
|
||||
ERRCODE hb_dbfGetVarLen( DBFAREAP pArea, USHORT uiIndex, ULONG * pLength )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_dbfGetVarLen(%p, %hu, %p)", pArea, uiIndex, pLength));
|
||||
HB_SYMBOL_UNUSED( uiIndex );
|
||||
|
||||
if( pArea->lpdbPendingRel )
|
||||
SELF_FORCEREL( ( AREAP ) pArea );
|
||||
@@ -1047,7 +1048,7 @@ ERRCODE hb_dbfGetVarLen( DBFAREAP pArea, USHORT uiIndex, ULONG * pLength )
|
||||
return FAILURE;
|
||||
|
||||
if( pArea->fHasMemo )
|
||||
* pLength = hb_dbfGetMemoLen( pArea, uiIndex );
|
||||
* pLength = hb_dbfGetMemoLen( pArea, uiIndex - 1 );
|
||||
else
|
||||
* pLength = 0;
|
||||
|
||||
@@ -1160,7 +1161,7 @@ ERRCODE hb_dbfPutValue( DBFAREAP pArea, USHORT uiIndex, PHB_ITEM pItem )
|
||||
return FAILURE;
|
||||
|
||||
uiError = SUCCESS;
|
||||
uiIndex --;
|
||||
uiIndex--;
|
||||
pField = pArea->lpFields + uiIndex;
|
||||
if( pField->uiType == HB_IT_MEMO )
|
||||
{
|
||||
@@ -1513,7 +1514,7 @@ ERRCODE hb_dbfCreate( DBFAREAP pArea, LPDBOPENINFO pCreateInfo )
|
||||
pArea->fHasMemo = bHasMemo;
|
||||
|
||||
/* Write header */
|
||||
if( hb_dbfWriteDBHeader( pArea ) == FAILURE )
|
||||
if( SELF_WRITEDBHEADER( ( AREAP ) pArea ) == FAILURE )
|
||||
{
|
||||
hb_fsClose( pArea->hDataFile );
|
||||
pArea->hDataFile = FS_ERROR;
|
||||
@@ -1546,12 +1547,12 @@ ERRCODE hb_dbfCreate( DBFAREAP pArea, LPDBOPENINFO pCreateInfo )
|
||||
strcat( pArea->szMemoFileName, pFileName->szName );
|
||||
hb_xfree( pFileName );
|
||||
pFileExt = hb_itemPutC( NULL, "" );
|
||||
hb_dbfInfo( pArea, DBI_MEMOEXT, pFileExt );
|
||||
SELF_INFO( ( AREAP ) pArea, DBI_MEMOEXT, pFileExt );
|
||||
strncat( pArea->szMemoFileName, hb_itemGetCPtr( pFileExt ),
|
||||
_POSIX_PATH_MAX - strlen( pArea->szMemoFileName ) );
|
||||
hb_itemRelease( pFileExt );
|
||||
pCreateInfo->abName = ( BYTE * ) pArea->szMemoFileName;
|
||||
return hb_dbfCreateMemFile( pArea, pCreateInfo );
|
||||
return SELF_CREATEMEMFILE( ( AREAP ) pArea, pCreateInfo );
|
||||
}
|
||||
else
|
||||
return SUCCESS;
|
||||
@@ -1682,7 +1683,7 @@ ERRCODE hb_dbfOpen( DBFAREAP pArea, LPDBOPENINFO pOpenInfo )
|
||||
return FAILURE;
|
||||
|
||||
/* Read file header and exit if error */
|
||||
if( hb_dbfReadDBHeader( pArea ) == FAILURE )
|
||||
if( SELF_READDBHEADER( ( AREAP ) pArea ) == FAILURE )
|
||||
{
|
||||
SELF_CLOSE( ( AREAP ) pArea );
|
||||
return FAILURE;
|
||||
@@ -1710,7 +1711,7 @@ ERRCODE hb_dbfOpen( DBFAREAP pArea, LPDBOPENINFO pOpenInfo )
|
||||
pArea->szMemoFileName = szFileName;
|
||||
|
||||
/* Open memo file and exit if error */
|
||||
if( hb_dbfOpenMemFile( pArea, pOpenInfo ) == FAILURE )
|
||||
if( SELF_OPENMEMFILE( ( AREAP ) pArea, pOpenInfo ) == FAILURE )
|
||||
{
|
||||
SELF_CLOSE( ( AREAP ) pArea );
|
||||
return FAILURE;
|
||||
@@ -1894,7 +1895,10 @@ ERRCODE hb_dbfPack( DBFAREAP pArea )
|
||||
ulUserEvery = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
pBlock = NULL;
|
||||
ulUserEvery = 1;
|
||||
}
|
||||
|
||||
/* Force write new header */
|
||||
pArea->fUpdateHeader = TRUE;
|
||||
@@ -1964,10 +1968,10 @@ ERRCODE hb_dbfSort( DBFAREAP pArea, LPDBSORTINFO pSortInfo )
|
||||
uiError = SUCCESS;
|
||||
uiCount = 0;
|
||||
pBuffer = dbQuickSort.pBuffer;
|
||||
ulRecNo = 1;
|
||||
if( pSortInfo->dbtri.dbsci.itmRecID )
|
||||
{
|
||||
uiError = hb_dbfGoTo( pArea, hb_itemGetNL( pSortInfo->dbtri.dbsci.itmRecID ) );
|
||||
ulRecNo = 1;
|
||||
bMoreRecords = bLimited = TRUE;
|
||||
}
|
||||
else if( pSortInfo->dbtri.dbsci.lNext )
|
||||
@@ -2102,7 +2106,6 @@ ERRCODE hb_dbfTransRec( DBFAREAP pArea, LPDBTRANSINFO pTransInfo )
|
||||
*/
|
||||
ERRCODE hb_dbfZap( DBFAREAP pArea )
|
||||
{
|
||||
BYTE pBlock[ DBT_BLOCKSIZE ];
|
||||
PHB_ITEM pError;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_dbfZap(%p)", pArea));
|
||||
@@ -2125,14 +2128,10 @@ ERRCODE hb_dbfZap( DBFAREAP pArea )
|
||||
pArea->fUpdateHeader = TRUE;
|
||||
pArea->ulRecCount = 0;
|
||||
|
||||
/* Create memo file */
|
||||
/* Zap memo file */
|
||||
if( pArea->fHasMemo )
|
||||
{
|
||||
memset( pBlock, 0, DBT_BLOCKSIZE );
|
||||
* ( ( LONG * ) pBlock ) = 1;
|
||||
hb_fsSeek( pArea->hMemoFile, 0, FS_SET );
|
||||
if( hb_fsWrite( pArea->hMemoFile, pBlock, DBT_BLOCKSIZE ) != DBT_BLOCKSIZE )
|
||||
return FAILURE;
|
||||
SELF_CREATEMEMFILE( ( AREAP ) pArea, NULL );
|
||||
hb_fsWrite( pArea->hMemoFile, NULL, 0 );
|
||||
}
|
||||
return SUCCESS;
|
||||
@@ -2295,34 +2294,39 @@ ERRCODE hb_dbfCreateMemFile( DBFAREAP pArea, LPDBOPENINFO pCreateInfo )
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_dbfCreateMemFile(%p, %p)", pArea, pCreateInfo));
|
||||
|
||||
memset( pBlock, 0, DBT_BLOCKSIZE );
|
||||
pError = NULL;
|
||||
/* Try create */
|
||||
do
|
||||
if( pCreateInfo )
|
||||
{
|
||||
pArea->hMemoFile = hb_fsCreate( pCreateInfo->abName, FC_NORMAL );
|
||||
if( pArea->hMemoFile == FS_ERROR )
|
||||
pError = NULL;
|
||||
/* Try create */
|
||||
do
|
||||
{
|
||||
if( !pError )
|
||||
pArea->hMemoFile = hb_fsCreate( pCreateInfo->abName, FC_NORMAL );
|
||||
if( pArea->hMemoFile == FS_ERROR )
|
||||
{
|
||||
pError = hb_errNew();
|
||||
hb_errPutGenCode( pError, EG_CREATE );
|
||||
hb_errPutSubCode( pError, EDBF_CREATE_DBF );
|
||||
hb_errPutDescription( pError, hb_langDGetErrorDesc( EG_CREATE ) );
|
||||
hb_errPutFileName( pError, ( char * ) pCreateInfo->abName );
|
||||
hb_errPutFlags( pError, EF_CANRETRY );
|
||||
if( !pError )
|
||||
{
|
||||
pError = hb_errNew();
|
||||
hb_errPutGenCode( pError, EG_CREATE );
|
||||
hb_errPutSubCode( pError, EDBF_CREATE_DBF );
|
||||
hb_errPutDescription( pError, hb_langDGetErrorDesc( EG_CREATE ) );
|
||||
hb_errPutFileName( pError, ( char * ) pCreateInfo->abName );
|
||||
hb_errPutFlags( pError, EF_CANRETRY );
|
||||
}
|
||||
bRetry = ( SELF_ERROR( ( AREAP ) pArea, pError ) == E_RETRY );
|
||||
}
|
||||
bRetry = ( SELF_ERROR( ( AREAP ) pArea, pError ) == E_RETRY );
|
||||
}
|
||||
else
|
||||
bRetry = FALSE;
|
||||
} while( bRetry );
|
||||
if( pError )
|
||||
hb_errRelease( pError );
|
||||
else
|
||||
bRetry = FALSE;
|
||||
} while( bRetry );
|
||||
if( pError )
|
||||
hb_errRelease( pError );
|
||||
|
||||
if( pArea->hMemoFile == FS_ERROR )
|
||||
return FAILURE;
|
||||
if( pArea->hMemoFile == FS_ERROR )
|
||||
return FAILURE;
|
||||
}
|
||||
else /* For zap file */
|
||||
hb_fsSeek( pArea->hMemoFile, 0, FS_SET );
|
||||
|
||||
memset( pBlock, 0, DBT_BLOCKSIZE );
|
||||
* ( ( LONG * ) pBlock ) = 1;
|
||||
if( hb_fsWrite( pArea->hMemoFile, pBlock, DBT_BLOCKSIZE ) != DBT_BLOCKSIZE )
|
||||
return FAILURE;
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
ROOT = ../../../
|
||||
|
||||
#C_SOURCES=\
|
||||
# dbfcdx1.c \
|
||||
C_SOURCES=\
|
||||
dbfcdx1.c \
|
||||
|
||||
PRG_SOURCES=\
|
||||
dbfcdx0.prg \
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -136,8 +136,8 @@ static BOOL hb_dbQSortIsLess( LPDBQUICKSORT pQuickSort, ULONG ulRecNo1, ULONG ul
|
||||
|
||||
/* Compare buffers */
|
||||
if( bIgnoreCase )
|
||||
iResult = stricmp( ( const char * ) pQuickSort->pCmpBufferA,
|
||||
( const char * ) pQuickSort->pCmpBufferB );
|
||||
iResult = hb_stricmp( ( const char * ) pQuickSort->pCmpBufferA,
|
||||
( const char * ) pQuickSort->pCmpBufferB );
|
||||
else
|
||||
iResult = strcmp( ( const char * ) pQuickSort->pCmpBufferA,
|
||||
( const char * ) pQuickSort->pCmpBufferB );
|
||||
|
||||
@@ -39,13 +39,13 @@ ANNOUNCE RDDSYS
|
||||
|
||||
init procedure RddInit
|
||||
|
||||
REQUEST DBFNTX
|
||||
REQUEST DBFCDX
|
||||
|
||||
/* NOTE: Using this internal version of this functions, since at this
|
||||
point the DBFNTX RDD may not be registered, depending on the
|
||||
point the DBFCDX RDD may not be registered, depending on the
|
||||
execution order of INIT procedures. */
|
||||
|
||||
__rddSetDefault( "DBFNTX" )
|
||||
__rddSetDefault( "DBFCDX" )
|
||||
|
||||
return
|
||||
|
||||
|
||||
@@ -688,6 +688,7 @@ ERRCODE hb_waRelText( AREAP pArea, USHORT uiRelNo, void * pExpr )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_waRelText(%p, %hu, %p)", pArea, uiRelNo, pExpr));
|
||||
HB_SYMBOL_UNUSED( pArea );
|
||||
HB_SYMBOL_UNUSED( uiRelNo );
|
||||
HB_SYMBOL_UNUSED( pExpr );
|
||||
|
||||
printf( "\nTODO: hb_waRelText()\n" );
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
|
||||
function Main()
|
||||
|
||||
local nI, aArray
|
||||
|
||||
@@ -8,18 +8,38 @@ function Main()
|
||||
{ "NUMERIC", "N", 8, 0 }, ;
|
||||
{ "DOUBLE", "N", 8, 2 }, ;
|
||||
{ "DATE", "D", 8, 0 }, ;
|
||||
{ "MEMO", "M", 10, 0 }, ;
|
||||
{ "LOGICAL", "L", 1, 0 } }
|
||||
|
||||
REQUEST DBFCDX
|
||||
CLS
|
||||
dbUseArea( .T., "DBFCDX", "test", "TESTDBF", .T., .F. )
|
||||
dbCreate( "testcdx", aStruct, "DBFCDX", .T., "TESTCDX" )
|
||||
|
||||
rddSetDefault( "DBFCDX" )
|
||||
? "RddName:", RddName()
|
||||
? "Press any key to continue..."
|
||||
InKey( 0 )
|
||||
Select( "TESTDBF" )
|
||||
SET FILTER TO TESTDBF->SALARY > 140000
|
||||
TESTDBF->( dbGoTop() )
|
||||
while !TESTDBF->( Eof() )
|
||||
TESTCDX->( dbAppend() )
|
||||
TESTCDX->NUMERIC = TESTDBF->SALARY
|
||||
TESTCDX->MEMO := TESTDBF->FIRST + Chr( 13 ) + Chr( 10 ) + ;
|
||||
TESTDBF->LAST + Chr( 13 ) + Chr( 10 ) + ;
|
||||
TESTDBF->STREET
|
||||
TESTDBF->( dbSkip() )
|
||||
end
|
||||
|
||||
FErase( "testcdx.cdx" )
|
||||
dbCreate( "testcdx", aStruct, "DBFCDX" )
|
||||
dbUseArea( ,, "testcdx", "MYALIAS" )
|
||||
ordCreate( "testcdx", "1Tag ", "FIELD->Character", { || FIELD->Character }, .F. )
|
||||
ordCreate( "testcdx", "2Tag ", "FIELD->Character", { || FIELD->Character }, .F. )
|
||||
? MYALIAS->CHARACTER
|
||||
? TESTCDX->( RecCount() )
|
||||
TESTCDX->( dbGoTop() )
|
||||
? TESTCDX->( Eof() )
|
||||
while !TESTCDX->( Eof() )
|
||||
? TESTCDX->( RecNo() ), TESTCDX->NUMERIC
|
||||
? TESTCDX->MEMO
|
||||
TESTCDX->( dbSkip() )
|
||||
? "Press any key to continue..."
|
||||
InKey( 0 )
|
||||
end
|
||||
|
||||
return nil
|
||||
|
||||
return nil
|
||||
Reference in New Issue
Block a user