2013-02-07 13:34:27 +04:00
|
|
|
/*************** TabDos H Declares Source Code File (.H) ***************/
|
2015-05-15 11:56:29 +02:00
|
|
|
/* Name: TABFIX.H Version 2.4 */
|
2013-02-07 13:34:27 +04:00
|
|
|
/* */
|
2015-05-15 11:56:29 +02:00
|
|
|
/* (C) Copyright to the author Olivier BERTRAND 1999-2015 */
|
2013-02-07 13:34:27 +04:00
|
|
|
/* */
|
|
|
|
/* This file contains the TDBFIX and (FIX/BIN)COL classes declares. */
|
|
|
|
/***********************************************************************/
|
|
|
|
#ifndef __TABFIX__
|
|
|
|
#define __TABFIX__
|
|
|
|
#include "tabdos.h" /* Base class declares */
|
2013-02-11 00:31:03 +01:00
|
|
|
#include "filamdbf.h"
|
2013-02-07 13:34:27 +04:00
|
|
|
|
|
|
|
typedef class FIXCOL *PFIXCOL;
|
|
|
|
typedef class BINCOL *PBINCOL;
|
2015-05-15 11:56:29 +02:00
|
|
|
typedef class TXTFAM *PTXF;
|
2013-02-07 13:34:27 +04:00
|
|
|
|
|
|
|
/***********************************************************************/
|
|
|
|
/* This is the DOS/UNIX Access Method class declaration for files */
|
|
|
|
/* that are standard files with columns starting at fixed offset. */
|
|
|
|
/* This class is for fixed formatted files. */
|
|
|
|
/***********************************************************************/
|
|
|
|
class DllExport TDBFIX : public TDBDOS {
|
|
|
|
friend class FIXCOL;
|
|
|
|
friend class BINCOL;
|
|
|
|
public:
|
|
|
|
// Constructor
|
|
|
|
TDBFIX(PDOSDEF tdp, PTXF txfp);
|
|
|
|
TDBFIX(PGLOBAL g, PTDBFIX tdbp);
|
|
|
|
|
|
|
|
// Implementation
|
2024-06-12 09:46:26 -04:00
|
|
|
AMT GetAmType(void) override {return TYPE_AM_FIX;}
|
|
|
|
void RestoreNrec(void) override;
|
|
|
|
PTDB Duplicate(PGLOBAL g) override
|
2013-02-07 13:34:27 +04:00
|
|
|
{return (PTDB)new(g) TDBFIX(g, this);}
|
|
|
|
|
|
|
|
// Methods
|
2024-06-12 09:46:26 -04:00
|
|
|
PTDB Clone(PTABS t) override;
|
|
|
|
void ResetDB(void) override;
|
|
|
|
bool IsUsingTemp(PGLOBAL g) override;
|
|
|
|
int RowNumber(PGLOBAL g, bool b = false) override;
|
|
|
|
int ResetTableOpt(PGLOBAL g, bool dop, bool dox) override;
|
|
|
|
void ResetSize(void) override;
|
|
|
|
int GetBadLines(void) override {return Txfp->GetNerr();}
|
2013-02-07 13:34:27 +04:00
|
|
|
|
|
|
|
// Database routines
|
2024-06-12 09:46:26 -04:00
|
|
|
PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n) override;
|
|
|
|
int GetProgMax(PGLOBAL g) override;
|
|
|
|
int Cardinality(PGLOBAL g) override;
|
|
|
|
int GetMaxSize(PGLOBAL g) override;
|
|
|
|
bool OpenDB(PGLOBAL g) override;
|
|
|
|
int WriteDB(PGLOBAL g) override;
|
2013-02-07 13:34:27 +04:00
|
|
|
|
|
|
|
protected:
|
2024-06-12 09:46:26 -04:00
|
|
|
bool PrepareWriting(PGLOBAL g) override {return false;}
|
2014-08-16 16:46:35 +02:00
|
|
|
|
2015-05-26 01:02:33 +02:00
|
|
|
// Members
|
|
|
|
char Teds; /* Binary table default endian setting */
|
2013-02-07 13:34:27 +04:00
|
|
|
}; // end of class TDBFIX
|
|
|
|
|
|
|
|
/***********************************************************************/
|
|
|
|
/* Class BINCOL: BIN access method column descriptor. */
|
|
|
|
/* This A.M. is used for file processed by blocks. */
|
|
|
|
/***********************************************************************/
|
|
|
|
class DllExport BINCOL : public DOSCOL {
|
|
|
|
friend class TDBFIX;
|
|
|
|
public:
|
|
|
|
// Constructors
|
2017-05-11 21:57:21 +02:00
|
|
|
BINCOL(PGLOBAL g, PCOLDEF cdp, PTDB tp, PCOL cp, int i, PCSZ am = "BIN");
|
2013-02-07 13:34:27 +04:00
|
|
|
BINCOL(BINCOL *colp, PTDB tdbp); // Constructor used in copy process
|
|
|
|
|
|
|
|
// Implementation
|
2024-06-12 09:46:26 -04:00
|
|
|
int GetAmType(void) override {return TYPE_AM_BIN;}
|
2015-05-15 11:56:29 +02:00
|
|
|
int GetDeplac(void) {return Deplac;}
|
|
|
|
int GetFileSize(void)
|
|
|
|
{return N ? N : GetTypeSize(Buf_Type, Long);}
|
2013-02-07 13:34:27 +04:00
|
|
|
|
|
|
|
// Methods
|
2024-06-12 09:46:26 -04:00
|
|
|
void ReadColumn(PGLOBAL g) override;
|
|
|
|
void WriteColumn(PGLOBAL g) override;
|
2013-02-07 13:34:27 +04:00
|
|
|
|
2015-05-13 19:58:21 +02:00
|
|
|
// Static
|
2015-05-15 11:56:29 +02:00
|
|
|
static void SetEndian(void);
|
2015-05-13 19:58:21 +02:00
|
|
|
|
2013-02-07 13:34:27 +04:00
|
|
|
protected:
|
2023-02-07 13:57:20 +02:00
|
|
|
BINCOL(void) = default; // Default constructor not to be used
|
2013-02-07 13:34:27 +04:00
|
|
|
|
|
|
|
// Members
|
2015-05-13 19:58:21 +02:00
|
|
|
static char Endian; // The host endian setting (L or B)
|
|
|
|
char *Buff; // Utility buffer
|
2015-05-26 01:02:33 +02:00
|
|
|
char Eds; // The file endian setting
|
|
|
|
char Fmt; // The converted value format
|
2015-05-13 19:58:21 +02:00
|
|
|
int N; // The number of bytes in the file
|
2015-05-15 11:56:29 +02:00
|
|
|
int M; // The buffer type size
|
|
|
|
int Lim; // Min(N,M)
|
2013-02-07 13:34:27 +04:00
|
|
|
}; // end of class BINCOL
|
2013-02-11 00:31:03 +01:00
|
|
|
|
|
|
|
/***********************************************************************/
|
|
|
|
/* This is the class declaration for the DBF columns catalog table. */
|
|
|
|
/***********************************************************************/
|
|
|
|
class TDBDCL : public TDBCAT {
|
2020-07-13 16:30:57 +02:00
|
|
|
public:
|
|
|
|
// Constructor
|
|
|
|
TDBDCL(PDOSDEF tdp) : TDBCAT(tdp)
|
|
|
|
{Fn = tdp->GetFn(); Topt = tdp->GetTopt();}
|
2013-02-11 00:31:03 +01:00
|
|
|
|
2020-07-13 16:30:57 +02:00
|
|
|
protected:
|
2013-02-11 00:31:03 +01:00
|
|
|
// Specific routines
|
2024-06-12 09:46:26 -04:00
|
|
|
PQRYRES GetResult(PGLOBAL g) override
|
2020-07-13 16:30:57 +02:00
|
|
|
{return DBFColumns(g, ((PTABDEF)To_Def)->GetPath(), Fn, Topt, false);}
|
2013-02-11 00:31:03 +01:00
|
|
|
|
2020-07-13 16:30:57 +02:00
|
|
|
// Members
|
2017-05-11 21:57:21 +02:00
|
|
|
PCSZ Fn; // The DBF file (path) name
|
2020-07-13 16:30:57 +02:00
|
|
|
PTOS Topt;
|
|
|
|
}; // end of class TDBOCL
|
2013-02-11 00:31:03 +01:00
|
|
|
|
|
|
|
|
2013-02-07 13:34:27 +04:00
|
|
|
#endif // __TABFIX__
|