Commit b3b02104 authored by Olivier Bertrand's avatar Olivier Bertrand

- Prepar using indexes in MAP mode (not used yet)

modified:
  storage/connect/tabdos.cpp
  storage/connect/xindex.cpp
  storage/connect/xindex.h
parent f60b5672
...@@ -554,9 +554,7 @@ int TDBDOS::MakeIndex(PGLOBAL g, PIXDEF pxdf, bool add) ...@@ -554,9 +554,7 @@ int TDBDOS::MakeIndex(PGLOBAL g, PIXDEF pxdf, bool add)
if (!x->Make(g, sxp)) { if (!x->Make(g, sxp)) {
// Retreive define values from the index // Retreive define values from the index
xdp->SetMaxSame(x->GetMaxSame()); xdp->SetMaxSame(x->GetMaxSame());
// xdp->SetOffset(x->GetDefoff()); // xdp->SetSize(x->GetSize());
// xdp->SetOffhigh(x->GetDefhigh());
xdp->SetSize(x->GetSize());
// store KXYCOL Mxs in KPARTDEF Mxsame // store KXYCOL Mxs in KPARTDEF Mxsame
xdp->SetMxsame(x); xdp->SetMxsame(x);
...@@ -565,7 +563,7 @@ int TDBDOS::MakeIndex(PGLOBAL g, PIXDEF pxdf, bool add) ...@@ -565,7 +563,7 @@ int TDBDOS::MakeIndex(PGLOBAL g, PIXDEF pxdf, bool add)
printf("Make done...\n"); printf("Make done...\n");
#endif // TRACE #endif // TRACE
if (x->GetSize() > 0) // if (x->GetSize() > 0)
sxp = xdp; sxp = xdp;
xdp->SetInvalid(false); xdp->SetInvalid(false);
......
This diff is collapsed.
/*************** Xindex H Declares Source Code File (.H) ***************/ /*************** Xindex H Declares Source Code File (.H) ***************/
/* Name: XINDEX.H Version 3.4 */ /* Name: XINDEX.H Version 3.5 */
/* */ /* */
/* (C) Copyright to the author Olivier BERTRAND 2004 - 2012 */ /* (C) Copyright to the author Olivier BERTRAND 2004 - 2013 */
/* */ /* */
/* This file contains the XINDEX class declares. */ /* This file contains the XINDEX class declares. */
/***********************************************************************/ /***********************************************************************/
...@@ -11,12 +11,17 @@ ...@@ -11,12 +11,17 @@
#include "csort.h" /* Base class declares */ #include "csort.h" /* Base class declares */
#include "xtable.h" #include "xtable.h"
#include "valblk.h" #include "valblk.h"
#if defined(XMAP)
#include "maputil.h"
#endif // XMAP
enum IDT {TYPE_IDX_ERROR = 0, /* Type not defined */ enum IDT {TYPE_IDX_ERROR = 0, /* Type not defined */
TYPE_IDX_INDX = 4, /* Permanent standard index */ TYPE_IDX_INDX = 4, /* Permanent standard index */
TYPE_IDX_XROW = 5}; /* Permanent row index */ TYPE_IDX_XROW = 5}; /* Permanent row index */
typedef struct mem_map *MMP; #if defined(XMAP)
typedef MEMMAP *MMP;
#endif // XMAP
typedef class INDEXDEF *PIXDEF; typedef class INDEXDEF *PIXDEF;
typedef class KPARTDEF *PKPDEF; typedef class KPARTDEF *PKPDEF;
typedef class XINDEX *PXINDEX; typedef class XINDEX *PXINDEX;
...@@ -96,8 +101,8 @@ class DllExport INDEXDEF : public BLOCK { /* Index description block */ ...@@ -96,8 +101,8 @@ class DllExport INDEXDEF : public BLOCK { /* Index description block */
//void SetOffset(int off) {Offset = off;} //void SetOffset(int off) {Offset = off;}
//int GetOffhigh(void) {return Offhigh;} //int GetOffhigh(void) {return Offhigh;}
//void SetOffhigh(int hof) {Offhigh = hof;} //void SetOffhigh(int hof) {Offhigh = hof;}
int GetSize(void) {return Size;} //int GetSize(void) {return Size;}
void SetSize(int size) {Size = size;} //void SetSize(int size) {Size = size;}
int GetMaxSame(void) {return MaxSame;} int GetMaxSame(void) {return MaxSame;}
bool Define(PGLOBAL g, void *memp, PTABDEF dfp, LPCSTR p); bool Define(PGLOBAL g, void *memp, PTABDEF dfp, LPCSTR p);
PIXDEF GetIndexOf(PCOL colp, bool hd = false); PIXDEF GetIndexOf(PCOL colp, bool hd = false);
...@@ -119,7 +124,7 @@ class DllExport INDEXDEF : public BLOCK { /* Index description block */ ...@@ -119,7 +124,7 @@ class DllExport INDEXDEF : public BLOCK { /* Index description block */
int ID; /* Index ID number */ int ID; /* Index ID number */
//int Offset; /* Offset in index file */ //int Offset; /* Offset in index file */
//int Offhigh; /* Offset high in big index file */ //int Offhigh; /* Offset high in big index file */
int Size; /* Size of index file */ //int Size; /* Size of index file */
int MaxSame; /* Max number of same values */ int MaxSame; /* Max number of same values */
}; // end of INDEXDEF }; // end of INDEXDEF
...@@ -246,9 +251,9 @@ class DllExport XINDEX : public XXBASE { ...@@ -246,9 +251,9 @@ class DllExport XINDEX : public XXBASE {
virtual int GetCurPos(void) {return (Pex) ? Pex[Cur_K] : Cur_K;} virtual int GetCurPos(void) {return (Pex) ? Pex[Cur_K] : Cur_K;}
virtual void SetNval(int n) {Nval = n;} virtual void SetNval(int n) {Nval = n;}
int GetMaxSame(void) {return MaxSame;} int GetMaxSame(void) {return MaxSame;}
int GetDefoff(void) {return Defoff;} // int GetDefoff(void) {return Defoff;}
int GetDefhigh(void) {return Defhigh;} // int GetDefhigh(void) {return Defhigh;}
int GetSize(void) {return Size;} // int GetSize(void) {return Size;}
// Methods // Methods
virtual void Reset(void); virtual void Reset(void);
...@@ -281,9 +286,9 @@ class DllExport XINDEX : public XXBASE { ...@@ -281,9 +286,9 @@ class DllExport XINDEX : public XXBASE {
int Nk; // The number of indexed columns int Nk; // The number of indexed columns
int Nval; // The number of used columns int Nval; // The number of used columns
int Incr; // Increment of record position int Incr; // Increment of record position
int Defoff; // Offset of definition in index file //int Defoff; // Offset of definition in index file
int Defhigh; // High order of offset big value //int Defhigh; // High order of offset big value
int Size; // Size of definition in index file //int Size; // Size of definition in index file
int MaxSame; // Max number of same values int MaxSame; // Max number of same values
}; // end of class XINDEX }; // end of class XINDEX
...@@ -324,7 +329,6 @@ class DllExport XLOAD : public BLOCK { ...@@ -324,7 +329,6 @@ class DllExport XLOAD : public BLOCK {
// Methods // Methods
virtual bool Open(PGLOBAL g, char *filename, int id, MODE mode) = 0; virtual bool Open(PGLOBAL g, char *filename, int id, MODE mode) = 0;
//virtual bool GetOff(int& low, int& high, PIXDEF sxp) = 0;
virtual bool Seek(PGLOBAL g, int low, int high, int origin) = 0; virtual bool Seek(PGLOBAL g, int low, int high, int origin) = 0;
virtual bool Read(PGLOBAL g, void *buf, int n, int size) = 0; virtual bool Read(PGLOBAL g, void *buf, int n, int size) = 0;
virtual int Write(PGLOBAL g, void *buf, int n, virtual int Write(PGLOBAL g, void *buf, int n,
...@@ -332,8 +336,7 @@ class DllExport XLOAD : public BLOCK { ...@@ -332,8 +336,7 @@ class DllExport XLOAD : public BLOCK {
virtual void Close(char *fn, int id) = 0; virtual void Close(char *fn, int id) = 0;
virtual void Close(void); virtual void Close(void);
#if defined(XMAP) #if defined(XMAP)
virtual void *FileView(PGLOBAL g, char *fn, int loff, virtual void *FileView(PGLOBAL g, char *fn) = 0;
int hoff, int size) = 0;
#endif // XMAP #endif // XMAP
protected: protected:
...@@ -359,22 +362,20 @@ class DllExport XFILE : public XLOAD { ...@@ -359,22 +362,20 @@ class DllExport XFILE : public XLOAD {
// Methods // Methods
virtual bool Open(PGLOBAL g, char *filename, int id, MODE mode); virtual bool Open(PGLOBAL g, char *filename, int id, MODE mode);
//virtual bool GetOff(int& low, int& high, PIXDEF sxp);
virtual bool Seek(PGLOBAL g, int low, int high, int origin); virtual bool Seek(PGLOBAL g, int low, int high, int origin);
virtual bool Read(PGLOBAL g, void *buf, int n, int size); virtual bool Read(PGLOBAL g, void *buf, int n, int size);
virtual int Write(PGLOBAL g, void *buf, int n, int size, bool& rc); virtual int Write(PGLOBAL g, void *buf, int n, int size, bool& rc);
virtual void Close(char *fn, int id); virtual void Close(char *fn, int id);
virtual void Close(void); virtual void Close(void);
#if defined(XMAP) #if defined(XMAP)
virtual void *FileView(PGLOBAL g, char *fn, int loff, virtual void *FileView(PGLOBAL g, char *fn);
int hoff, int size);
#endif // XMAP #endif // XMAP
protected: protected:
// Members // Members
FILE *Xfile; // Index stream file FILE *Xfile; // Index stream file
#if defined(XMAP) && !defined(WIN32) #if defined(XMAP)
MMP Mmp; // To UNIX mapped index file MMP Mmp; // To mapped index file
#endif // XMAP #endif // XMAP
}; // end of class XFILE }; // end of class XFILE
...@@ -388,14 +389,12 @@ class DllExport XHUGE : public XLOAD { ...@@ -388,14 +389,12 @@ class DllExport XHUGE : public XLOAD {
// Methods // Methods
virtual bool Open(PGLOBAL g, char *filename, int id, MODE mode); virtual bool Open(PGLOBAL g, char *filename, int id, MODE mode);
//virtual bool GetOff(int& low, int& high, PIXDEF sxp);
virtual bool Seek(PGLOBAL g, int low, int high, int origin); virtual bool Seek(PGLOBAL g, int low, int high, int origin);
virtual bool Read(PGLOBAL g, void *buf, int n, int size); virtual bool Read(PGLOBAL g, void *buf, int n, int size);
virtual int Write(PGLOBAL g, void *buf, int n, int size, bool& rc); virtual int Write(PGLOBAL g, void *buf, int n, int size, bool& rc);
virtual void Close(char *fn, int id); virtual void Close(char *fn, int id);
#if defined(XMAP) #if defined(XMAP)
virtual void *FileView(PGLOBAL g, char *fn, int loff, virtual void *FileView(PGLOBAL g, char *fn);
int hoff, int size);
#endif // XMAP #endif // XMAP
protected: protected:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment