File: tabfix.h

package info (click to toggle)
mariadb 1%3A11.8.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 772,520 kB
  • sloc: ansic: 2,414,714; cpp: 1,791,394; asm: 381,336; perl: 62,905; sh: 49,647; pascal: 40,897; java: 39,363; python: 20,791; yacc: 20,432; sql: 17,907; xml: 12,344; ruby: 8,544; cs: 6,542; makefile: 6,145; ada: 1,879; lex: 1,193; javascript: 996; objc: 80; tcl: 73; awk: 46; php: 22
file content (117 lines) | stat: -rw-r--r-- 4,337 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/*************** TabDos H Declares Source Code File (.H) ***************/
/*  Name: TABFIX.H    Version 2.4                                      */
/*                                                                     */
/*  (C) Copyright to the author Olivier BERTRAND          1999-2015    */
/*                                                                     */
/*  This file contains the TDBFIX and (FIX/BIN)COL classes declares.   */
/***********************************************************************/
#ifndef __TABFIX__
#define __TABFIX__
#include "tabdos.h"             /* Base class declares                 */
#include "filamdbf.h"

typedef class FIXCOL *PFIXCOL;
typedef class BINCOL *PBINCOL;
typedef class TXTFAM *PTXF;

/***********************************************************************/
/*  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
  AMT  GetAmType(void) override {return TYPE_AM_FIX;}
  void RestoreNrec(void) override;
  PTDB Duplicate(PGLOBAL g) override
                {return (PTDB)new(g) TDBFIX(g, this);}

  // Methods
  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();}

  // Database routines
  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;

 protected:
  bool PrepareWriting(PGLOBAL g) override {return false;}

  // Members
  char Teds;                  /* Binary table default endian setting   */
  }; // 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
  BINCOL(PGLOBAL g, PCOLDEF cdp, PTDB tp, PCOL cp, int i, PCSZ am = "BIN");
  BINCOL(BINCOL *colp, PTDB tdbp);  // Constructor used in copy process

  // Implementation
  int  GetAmType(void) override {return TYPE_AM_BIN;}
          int  GetDeplac(void) {return Deplac;}
          int  GetFileSize(void) 
               {return N ? N : GetTypeSize(Buf_Type, Long);}

  // Methods
  void ReadColumn(PGLOBAL g) override;
  void WriteColumn(PGLOBAL g) override;

  // Static
  static  void SetEndian(void); 

 protected:
  BINCOL(void) = default;    // Default constructor not to be used

  // Members
  static char Endian;         // The host endian setting (L or B)
  char *Buff;                 // Utility buffer
  char  Eds;                  // The file endian setting
  char  Fmt;                  // The converted value format
  int   N;                    // The number of bytes in the file
  int   M;                    // The buffer type size
  int   Lim;                  // Min(N,M)
  }; // end of class BINCOL

/***********************************************************************/
/*  This is the class declaration for the DBF columns catalog table.   */
/***********************************************************************/
class TDBDCL : public TDBCAT {
public:
	// Constructor
	TDBDCL(PDOSDEF tdp) : TDBCAT(tdp)
	  {Fn = tdp->GetFn(); Topt = tdp->GetTopt();}

protected:
	// Specific routines
	PQRYRES GetResult(PGLOBAL g) override
	  {return DBFColumns(g, ((PTABDEF)To_Def)->GetPath(), Fn, Topt, false);}

	// Members
	PCSZ Fn;                    // The DBF file (path) name
	PTOS Topt;
}; // end of class TDBOCL


#endif // __TABFIX__