29#define XB_CHAR_FLD 'C'
30#define XB_LOGICAL_FLD 'L'
31#define XB_NUMERIC_FLD 'N'
32#define XB_DATE_FLD 'D'
33#define XB_MEMO_FLD 'M'
34#define XB_FLOAT_FLD 'F'
62#define XB_ACTIVE_RECS 1
63#define XB_DELETED_RECS 2
70#define XB_DONTOVERLAY 0
71#define XB_CHAREOF '\x1A'
72#define XB_CHARHDR '\x0D'
103struct XBDLLEXPORT xbSchemaRec {
107 unsigned char cFieldLen;
108 unsigned char cNoOfDecs;
110 xbInt16 iLongFieldLen;
111 unsigned char cIxFlag;
118#ifdef XB_INDEX_SUPPORT
119class XBDLLEXPORT xbIx;
121struct XBDLLEXPORT xbIxList {
156 virtual xbInt16 Abort();
157 virtual xbInt16 AppendRecord();
158 virtual xbInt16 BlankRecord();
159 virtual xbInt16 Commit();
160 virtual xbInt16 Close();
161 virtual xbInt16 CopyDbfStructure(
xbDbf *dNewTable,
const xbString &sTableName,
const xbString &sTableAlias, xbInt16 iOverlay, xbInt16 iShareMode );
163 virtual xbInt16 DeleteTable ();
164 virtual xbInt16 DeleteAll ( xbInt16 iOption );
165 virtual xbInt16 DeleteAllRecords ();
166 virtual xbInt16 DeleteRecord ();
168 virtual xbInt16
DumpRecord ( xbUInt32 ulRecNo, xbInt16 iOutputDest = 0, xbInt16 iOutputFmt = 0 );
169 virtual xbInt16 GetAutoCommit ()
const;
170 virtual xbInt16 GetAutoCommit ( xbInt16 iOption )
const;
171 virtual xbUInt32 GetCurRecNo ()
const;
172 virtual xbInt16 GetDbfStatus ()
const;
173 virtual xbInt32 GetFieldCnt ()
const;
174 virtual xbInt16 GetFirstRecord ();
175 virtual xbInt16 GetFirstRecord ( xbInt16 iOption );
176 virtual xbInt16 GetLastRecord ();
177 virtual xbInt16 GetLastRecord ( xbInt16 iOption );
179 virtual xbInt16 GetNextRecord ();
180 virtual xbInt16 GetNextRecord ( xbInt16 iOption );
181 virtual xbInt16 GetNextRecord ( xbInt16 iOption, xbUInt32 ulStartRec );
183 virtual xbInt16 GetPrevRecord ();
184 virtual xbInt16 GetPrevRecord ( xbInt16 iOption );
185 virtual xbInt16 GetRecord ( xbUInt32 ulRecNo );
186 virtual xbInt16 GetRecordCnt ( xbUInt32 & ulRecCnt );
187 virtual char * GetRecordBuf ( xbInt16 iOpt = 0 )
const;
188 virtual xbUInt16 GetRecordLen ()
const;
189 virtual const xbString &GetTblAlias()
const;
191 virtual xbXBase *GetXbasePtr ()
const;
197 virtual xbInt16
Open (
const xbString &sTableName,
const xbString &sAlias, xbInt16 iOpenMode, xbInt16 iShareMode ) = 0;
198 virtual xbInt16 Pack ();
199 virtual xbInt16 Pack ( xbUInt32 &ulDeletedRecCnt );
202 virtual xbInt16 PutRecord ();
203 virtual xbInt16 PutRecord ( xbUInt32 ulRecNo );
204 virtual xbInt16 ReadHeader ( xbInt16 iFilePositionOption, xbInt16 iReadOption );
205 virtual xbInt16 RecordDeleted ( xbInt16 iOpt = 0 )
const;
207 virtual xbInt16 SetAutoCommit ( xbInt16 iAutoCommit );
209 virtual xbInt16 UndeleteAllRecords();
210 virtual xbInt16 UndeleteRecord ();
211 virtual xbInt16 Zap ();
216 virtual xbInt16 GetField(xbInt16 iFieldNo,
xbString &sFieldValue, xbInt16 iRecBufSw )
const;
217 virtual xbInt16 GetField(xbInt16 iFieldNo,
xbString &sFieldValue)
const;
218 virtual xbInt16 GetField(
const xbString &sFieldName,
xbString &sFieldValue)
const;
219 virtual xbInt16 GetFieldDecimal( xbInt16 iFieldNo, xbInt16 &iFieldDecimal )
const;
220 virtual xbInt16 GetFieldDecimal(
const xbString &sFieldName, xbInt16 &iFieldDecimal )
const;
221 virtual xbInt16 GetFieldLen( xbInt16 iFieldNo, xbInt16 &iFieldLen )
const;
222 virtual xbInt16 GetFieldLen(
const xbString &sFieldName, xbInt16 &iFieldLen )
const;
223 virtual xbInt16 GetFieldName( xbInt16 iFieldNo,
xbString &sFieldName )
const;
225 virtual xbInt16 GetFieldNo(
const xbString &sFieldName, xbInt16 &iFieldNo )
const;
226 virtual xbInt16 GetFieldNo(
const xbString &sFieldName )
const;
228 virtual xbInt16 GetFieldType( xbInt16 iFieldNo,
char &cFieldType )
const;
229 virtual xbInt16 GetFieldType(
const xbString &sFieldName,
char &cFieldType )
const;
230 virtual xbInt16 PutField(
const xbString &sFieldName,
const xbString &sFieldData );
231 virtual xbInt16 PutField( xbInt16 iFieldNo,
const xbString &sFieldData );
233 virtual xbInt16 PutLogicalField( xbInt16 iFieldNo,
const xbString &sFieldData );
234 virtual xbInt16 PutLogicalField(
const xbString &sFieldName,
const xbString &sFieldData );
235 virtual xbInt16 GetLogicalField( xbInt16 iFieldNo,
xbString &sFieldData )
const;
236 virtual xbInt16 GetLogicalField(
const xbString &sFieldName,
xbString &sFieldData)
const;
238 virtual xbInt16 PutLogicalField( xbInt16 iFieldNo,
xbBool bFieldData );
239 virtual xbInt16 PutLogicalField(
const xbString &sFieldName,
xbBool bFieldData );
240 virtual xbInt16 GetLogicalField( xbInt16 iFieldNo,
xbBool &bFieldData )
const;
241 virtual xbInt16 GetLogicalField( xbInt16 iFieldNo,
xbBool &bFieldData, xbInt16 iRecBufSw )
const;
242 virtual xbInt16 GetLogicalField(
const xbString &sFieldName,
xbBool &bFieldData)
const;
244 virtual xbInt16 GetLongField( xbInt16 iFieldNo, xbInt32 &lFieldValue )
const;
245 virtual xbInt16 GetLongField(
const xbString &sFieldName, xbInt32 &lFieldValue )
const;
246 virtual xbInt16 PutLongField( xbInt16 iFieldNo, xbInt32 lFieldValue );
247 virtual xbInt16 PutLongField(
const xbString &sFieldNo, xbInt32 lFieldValue );
249 virtual xbInt16 GetULongField( xbInt16 iFieldNo, xbUInt32 &lFieldValue )
const;
250 virtual xbInt16 GetULongField(
const xbString &sFieldName, xbUInt32 &lFieldValue )
const;
251 virtual xbInt16 PutULongField( xbInt16 iFieldNo, xbUInt32 lFieldValue );
252 virtual xbInt16 PutULongField(
const xbString &sFieldNo, xbUInt32 lFieldValue );
254 virtual xbInt16 GetDoubleField( xbInt16 FieldNo,
xbDouble &dFieldValue )
const;
255 virtual xbInt16 GetDoubleField( xbInt16 FieldNo,
xbDouble &dFieldValue, xbInt16 iRecBufSw )
const;
256 virtual xbInt16 GetDoubleField(
const xbString &sFieldName,
xbDouble &dFieldValue )
const;
257 virtual xbInt16 PutDoubleField( xbInt16 FieldNo,
xbDouble dFieldValue );
258 virtual xbInt16 PutDoubleField(
const xbString &FieldName,
xbDouble dFieldValue );
260 virtual xbInt16 GetFloatField( xbInt16 iFieldNo,
xbFloat &fFieldValue )
const;
261 virtual xbInt16 GetFloatField(
const xbString &sFieldName,
xbFloat &fFieldValue )
const;
262 virtual xbInt16 PutFloatField( xbInt16 iFieldNo,
xbFloat fFieldValue );
263 virtual xbInt16 PutFloatField(
const xbString &sFieldName,
xbFloat fFieldValue );
265 virtual xbInt16 GetDateField( xbInt16 iFieldNo,
xbDate &dt )
const;
266 virtual xbInt16 GetDateField(
const xbString &sFieldName,
xbDate &dt )
const;
267 virtual xbInt16 PutDateField( xbInt16 iFieldNo,
const xbDate &dt );
268 virtual xbInt16 PutDateField(
const xbString &sFieldName,
const xbDate &dt );
272 #ifdef XB_MEMO_SUPPORT
273 virtual xbInt16 GetMemoFieldCnt ()
const;
274 virtual xbMemo *GetMemoPtr ();
275 virtual xbUInt32 GetCreateMemoBlockSize()
const;
276 virtual xbInt16 GetMemoField ( xbInt16 iFldNo,
xbString &sMemoData );
277 virtual xbInt16 GetMemoField (
const xbString & sFldName,
xbString &sMemoData );
278 virtual xbInt16 GetMemoFieldLen ( xbInt16 iFldNo, xbUInt32 &ullMemoFieldLen );
279 virtual xbInt16 GetMemoFieldLen (
const xbString & sFldName, xbUInt32 &ulMemoFieldLen );
280 virtual xbBool MemoFieldExists ( xbInt16 iFieldNo )
const;
281 virtual xbBool MemoFieldExists (
const xbString &sFieldName )
const;
282 virtual xbInt16 SetCreateMemoBlockSize( xbUInt32 ulBlockSize ) = 0;
283 virtual xbInt16 UpdateMemoField ( xbInt16 iFldNo,
const xbString &sMemoData );
284 virtual xbInt16 UpdateMemoField (
const xbString & sFldName,
const xbString &sMemoData );
288 #ifdef XB_LOCKING_SUPPORT
289 virtual xbInt16 LockTable ( xbInt16 iLockFunction );
290 virtual xbInt16 LockRecord ( xbInt16 iLockFunction, xbUInt32 ulRecNo );
291 virtual xbInt16 LockAppend ( xbInt16 iLockFunction );
292 virtual xbInt16 LockHeader ( xbInt16 iLockFunction );
294 #ifdef XB_MEMO_SUPPORT
295 virtual xbInt16 LockMemo ( xbInt16 iLockFunction );
296 virtual xbBool GetMemoLocked ()
const;
299 #ifdef XB_INDEX_SUPPORT
300 virtual xbInt16 LockIndices ( xbInt16 iLockFunction );
303 xbInt16 GetAutoLock ()
const;
304 void SetAutoLock ( xbInt16 iAutoLock );
305 xbInt16 GetLockFlavor ()
const;
306 void SetLockFlavor ( xbInt16 iLockFlavor );
307 xbBool GetTableLocked ()
const;
308 xbBool GetHeaderLocked ()
const;
309 xbUInt32 GetAppendLocked ()
const;
310 xbLinkListNode<xbUInt32> * GetFirstRecLock ()
const;
312 #ifdef XB_DEBUG_SUPPORT
313 void DumpTableLockStatus()
const;
318 #ifdef XB_INDEX_SUPPORT
319 virtual xbInt16 CloseIndexFile( xbIx *pIx );
321 xbInt16 iDescending, xbInt16 iUnique, xbInt16 iOverLay, xbIx **xbIxOut,
void **vpTagOut );
322 virtual xbInt16 DeleteTag(
const xbString &sIxType,
const xbString &sName );
323 virtual xbInt16 DeleteAllIndexFiles();
324 virtual xbInt16 Find(
xbString &sKey );
325 virtual xbInt16 Find(
xbDate &dtKey );
326 virtual xbInt16 Find(
xbDouble &dKey );
327 virtual xbIx *GetCurIx()
const;
328 virtual void *GetCurTag()
const;
330 virtual xbInt16 GetFirstKey();
331 virtual xbInt16 GetNextKey();
332 virtual xbInt16 GetPrevKey();
333 virtual xbInt16 GetLastKey();
335 virtual const xbString &GetCurIxType()
const;
336 virtual const xbString &GetCurTagName()
const;
337 virtual xbIxList *GetIxList()
const;
338 xbLinkListNode<xbTag *> *GetTagList ()
const;
339 virtual xbInt16 OpenIndex(
const xbString &sIxType,
const xbString &sIndexName );
340 virtual xbInt16 SetCurTag(
const xbString &sTagName );
341 virtual void SetCurTag(
const xbString &sIxType, xbIx *pIx,
void *vpTag );
343 #ifdef XB_DEBUG_SUPPORT
344 virtual xbInt16 CheckTagIntegrity( xbInt16 iTagOpt, xbInt16 iOutputOpt );
345 virtual xbInt16 Reindex( xbInt16 iTagOpt );
349 #ifdef XB_NDXINF_SUPPORT
350 virtual xbInt16 AssociateIndex(
const xbString &sType,
const xbString &sName, xbInt16 iOption );
351 xbLinkListNode<xbString> *GetNdxInfList()
const;
362 #ifdef XB_INDEX_SUPPORT
364 friend class xbIxMdx;
366 xbInt16 AddIndex( xbIx *ix,
const xbString &sFmt );
368 virtual xbInt16 GetNdxInfFileName(
xbString &sNdxIdxFileName );
369 xbInt16 RemoveIndex( xbIx * ix );
370 void UpdateSchemaIxFlag( xbInt16 iFldNo,
unsigned char cVal );
371 virtual xbInt16 UpdateTagList ();
376 #ifdef XB_LOCKING_SUPPORT
377 void SetHeaderLocked (
xbBool bTableLocked );
378 void SetTableLocked (
xbBool bTableLocked );
381 #ifdef XB_MEMO_SUPPORT
382 xbInt16 iMemoFieldCnt;
384 xbUInt32 ulCreateMemoBlockSize;
387 #ifdef XB_NDXINF_SUPPORT
388 virtual xbInt16 DeleteNdxInfData();
389 virtual xbInt16 LoadNdxInfData();
390 virtual xbInt16 SaveNdxInfData();
399 virtual xbInt16 GetRawField( xbInt16 iFieldNo,
char *Buf, xbUInt32 BufSize, xbInt16 iRecBufSw )
const;
400 virtual void InitVars();
401 virtual xbInt16 SetVersion() = 0;
402 virtual xbInt16 ValidateSchema(
xbSchema * s ) = 0;
403 xbInt16 WriteHeader( xbInt16 iPositionOption, xbInt16 iWriteOption );
412 xbInt16 iFileVersion;
421 xbSchemaRec *SchemaPtr;
427 unsigned char cVersion;
432 xbUInt16 uiHeaderLen;
433 xbUInt16 uiRecordLen;
434 char cTransactionFlag;
435 char cEncryptionFlag;
442 void ResetNoOfRecords();
445#ifdef XB_LOCKING_SUPPORT
450 xbUInt32 ulAppendLocked;
451 xbLinkListOrd<xbUInt32> lloRecLocks;
455#ifdef XB_INDEX_SUPPORT
463 xbLinkList<xbTag *> llTags;
467#ifdef XB_NDXINF_SUPPORT
468 xbLinkList<xbString> llNdxInfData;
475#ifdef XB_DBF3_SUPPORT
483class XBDLLEXPORT xbDbf3 :
public xbDbf {
487 virtual xbInt16 CreateTable (
const xbString &sTableName,
const xbString &sAlias,
xbSchema *, xbInt16 iOverlay, xbInt16 iShareMode );
488 virtual xbInt16 GetVersion ()
const;
489 virtual xbInt16 Open (
const xbString &sTableName,
const xbString &sAlias, xbInt16 iOpenMode, xbInt16 iShareMode );
491 #ifdef XB_MEMO_SUPPORT
492 virtual xbInt16 SetCreateMemoBlockSize( xbUInt32 iBlockSize );
496 xbInt16 SetVersion ();
497 virtual xbInt16 ValidateSchema(
xbSchema *s );
505#ifdef XB_DBF4_SUPPORT
512class XBDLLEXPORT xbDbf4 :
public xbDbf {
518 virtual xbInt16 CreateTable (
const xbString &sTableName,
const xbString &sAlias, xbSchema *, xbInt16 iOverlay, xbInt16 iShareMode );
519 virtual xbInt16 GetVersion ()
const;
520 virtual xbInt16 Open (
const xbString &sTableName,
const xbString &sAlias, xbInt16 iOpenMode, xbInt16 iShareMode );
522 #ifdef XB_MEMO_SUPPORT
523 virtual xbInt16 SetCreateMemoBlockSize( xbUInt32 iBlockSize );
528 xbInt16 SetVersion();
529 virtual xbInt16 ValidateSchema ( xbSchema *s );
xbDate class.
Definition: xbdate.h:62
Base class for handling dbf files/tables.
Definition: xbdbf.h:150
virtual xbInt32 GetPhysicalIxCnt() const
virtual xbInt16 DumpRecord(xbUInt32 ulRecNo, xbInt16 iOutputDest=0, xbInt16 iOutputFmt=0)
virtual xbInt16 GetVersion() const =0
virtual xbInt16 Open(const xbString &sTableName, const xbString &sAlias, xbInt16 iOpenMode, xbInt16 iShareMode)=0
virtual xbInt16 CreateTable(const xbString &sTableName, const xbString &sAlias, xbSchema *pSchema, xbInt16 iOverlay, xbInt16 iShareMode)=0
virtual xbInt16 Open(const xbString &sTableName)
virtual xbInt16 DumpHeader(xbInt16 iOption) const
virtual xbInt16 Open(const xbString &sTableName, const xbString &sAlias)
virtual xbBool MemoFieldsExist() const
Class for handling low level file I/O.
Definition: xbfile.h:56
Class for handling string data.
Definition: xbstring.h:50
xbXbase class.
Definition: xbxbase.h:123
Definition: xbdate.cpp:19
double xbDouble
Definition: xbtypes.h:23
float xbFloat
Definition: xbtypes.h:22
class XBDLLEXPORT xbXBase
Definition: xbssv.h:27
short int xbBool
Definition: xbtypes.h:24
class XBDLLEXPORT xbDbf
Definition: xbtblmgr.h:28
Schema used for defining tables with CreateTable methods.
Definition: xbdbf.h:95
char cType
Definition: xbdbf.h:97
xbInt16 iFieldLen
Definition: xbdbf.h:98
xbInt16 iNoOfDecs
Definition: xbdbf.h:99