Commit 089938cd authored by Alexander Barkov's avatar Alexander Barkov

Merge 10.0->10.0-connect

parents 82ce2a25 4d0587c3
......@@ -7,123 +7,120 @@
#ifdef __cplusplus
extern "C" {
#define MYSQL_DTRACE_DISABLED false
#else
#define MYSQL_DTRACE_DISABLED 0
#endif
#define MYSQL_CONNECTION_START(arg0, arg1, arg2)
#define MYSQL_CONNECTION_START_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_CONNECTION_START_ENABLED() (0)
#define MYSQL_CONNECTION_DONE(arg0, arg1)
#define MYSQL_CONNECTION_DONE_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_CONNECTION_DONE_ENABLED() (0)
#define MYSQL_COMMAND_START(arg0, arg1, arg2, arg3)
#define MYSQL_COMMAND_START_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_COMMAND_START_ENABLED() (0)
#define MYSQL_COMMAND_DONE(arg0)
#define MYSQL_COMMAND_DONE_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_COMMAND_DONE_ENABLED() (0)
#define MYSQL_QUERY_START(arg0, arg1, arg2, arg3, arg4)
#define MYSQL_QUERY_START_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_QUERY_START_ENABLED() (0)
#define MYSQL_QUERY_DONE(arg0)
#define MYSQL_QUERY_DONE_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_QUERY_DONE_ENABLED() (0)
#define MYSQL_QUERY_PARSE_START(arg0)
#define MYSQL_QUERY_PARSE_START_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_QUERY_PARSE_START_ENABLED() (0)
#define MYSQL_QUERY_PARSE_DONE(arg0)
#define MYSQL_QUERY_PARSE_DONE_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_QUERY_PARSE_DONE_ENABLED() (0)
#define MYSQL_QUERY_CACHE_HIT(arg0, arg1)
#define MYSQL_QUERY_CACHE_HIT_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_QUERY_CACHE_HIT_ENABLED() (0)
#define MYSQL_QUERY_CACHE_MISS(arg0)
#define MYSQL_QUERY_CACHE_MISS_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_QUERY_CACHE_MISS_ENABLED() (0)
#define MYSQL_QUERY_EXEC_START(arg0, arg1, arg2, arg3, arg4, arg5)
#define MYSQL_QUERY_EXEC_START_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_QUERY_EXEC_START_ENABLED() (0)
#define MYSQL_QUERY_EXEC_DONE(arg0)
#define MYSQL_QUERY_EXEC_DONE_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_QUERY_EXEC_DONE_ENABLED() (0)
#define MYSQL_INSERT_ROW_START(arg0, arg1)
#define MYSQL_INSERT_ROW_START_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_INSERT_ROW_START_ENABLED() (0)
#define MYSQL_INSERT_ROW_DONE(arg0)
#define MYSQL_INSERT_ROW_DONE_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_INSERT_ROW_DONE_ENABLED() (0)
#define MYSQL_UPDATE_ROW_START(arg0, arg1)
#define MYSQL_UPDATE_ROW_START_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_UPDATE_ROW_START_ENABLED() (0)
#define MYSQL_UPDATE_ROW_DONE(arg0)
#define MYSQL_UPDATE_ROW_DONE_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_UPDATE_ROW_DONE_ENABLED() (0)
#define MYSQL_DELETE_ROW_START(arg0, arg1)
#define MYSQL_DELETE_ROW_START_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_DELETE_ROW_START_ENABLED() (0)
#define MYSQL_DELETE_ROW_DONE(arg0)
#define MYSQL_DELETE_ROW_DONE_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_DELETE_ROW_DONE_ENABLED() (0)
#define MYSQL_READ_ROW_START(arg0, arg1, arg2)
#define MYSQL_READ_ROW_START_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_READ_ROW_START_ENABLED() (0)
#define MYSQL_READ_ROW_DONE(arg0)
#define MYSQL_READ_ROW_DONE_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_READ_ROW_DONE_ENABLED() (0)
#define MYSQL_INDEX_READ_ROW_START(arg0, arg1)
#define MYSQL_INDEX_READ_ROW_START_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_INDEX_READ_ROW_START_ENABLED() (0)
#define MYSQL_INDEX_READ_ROW_DONE(arg0)
#define MYSQL_INDEX_READ_ROW_DONE_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_INDEX_READ_ROW_DONE_ENABLED() (0)
#define MYSQL_HANDLER_RDLOCK_START(arg0, arg1)
#define MYSQL_HANDLER_RDLOCK_START_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_HANDLER_RDLOCK_START_ENABLED() (0)
#define MYSQL_HANDLER_WRLOCK_START(arg0, arg1)
#define MYSQL_HANDLER_WRLOCK_START_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_HANDLER_WRLOCK_START_ENABLED() (0)
#define MYSQL_HANDLER_UNLOCK_START(arg0, arg1)
#define MYSQL_HANDLER_UNLOCK_START_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_HANDLER_UNLOCK_START_ENABLED() (0)
#define MYSQL_HANDLER_RDLOCK_DONE(arg0)
#define MYSQL_HANDLER_RDLOCK_DONE_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_HANDLER_RDLOCK_DONE_ENABLED() (0)
#define MYSQL_HANDLER_WRLOCK_DONE(arg0)
#define MYSQL_HANDLER_WRLOCK_DONE_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_HANDLER_WRLOCK_DONE_ENABLED() (0)
#define MYSQL_HANDLER_UNLOCK_DONE(arg0)
#define MYSQL_HANDLER_UNLOCK_DONE_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_HANDLER_UNLOCK_DONE_ENABLED() (0)
#define MYSQL_FILESORT_START(arg0, arg1)
#define MYSQL_FILESORT_START_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_FILESORT_START_ENABLED() (0)
#define MYSQL_FILESORT_DONE(arg0, arg1)
#define MYSQL_FILESORT_DONE_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_FILESORT_DONE_ENABLED() (0)
#define MYSQL_SELECT_START(arg0)
#define MYSQL_SELECT_START_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_SELECT_START_ENABLED() (0)
#define MYSQL_SELECT_DONE(arg0, arg1)
#define MYSQL_SELECT_DONE_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_SELECT_DONE_ENABLED() (0)
#define MYSQL_INSERT_START(arg0)
#define MYSQL_INSERT_START_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_INSERT_START_ENABLED() (0)
#define MYSQL_INSERT_DONE(arg0, arg1)
#define MYSQL_INSERT_DONE_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_INSERT_DONE_ENABLED() (0)
#define MYSQL_INSERT_SELECT_START(arg0)
#define MYSQL_INSERT_SELECT_START_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_INSERT_SELECT_START_ENABLED() (0)
#define MYSQL_INSERT_SELECT_DONE(arg0, arg1)
#define MYSQL_INSERT_SELECT_DONE_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_INSERT_SELECT_DONE_ENABLED() (0)
#define MYSQL_UPDATE_START(arg0)
#define MYSQL_UPDATE_START_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_UPDATE_START_ENABLED() (0)
#define MYSQL_UPDATE_DONE(arg0, arg1, arg2)
#define MYSQL_UPDATE_DONE_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_UPDATE_DONE_ENABLED() (0)
#define MYSQL_MULTI_UPDATE_START(arg0)
#define MYSQL_MULTI_UPDATE_START_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_MULTI_UPDATE_START_ENABLED() (0)
#define MYSQL_MULTI_UPDATE_DONE(arg0, arg1, arg2)
#define MYSQL_MULTI_UPDATE_DONE_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_MULTI_UPDATE_DONE_ENABLED() (0)
#define MYSQL_DELETE_START(arg0)
#define MYSQL_DELETE_START_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_DELETE_START_ENABLED() (0)
#define MYSQL_DELETE_DONE(arg0, arg1)
#define MYSQL_DELETE_DONE_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_DELETE_DONE_ENABLED() (0)
#define MYSQL_MULTI_DELETE_START(arg0)
#define MYSQL_MULTI_DELETE_START_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_MULTI_DELETE_START_ENABLED() (0)
#define MYSQL_MULTI_DELETE_DONE(arg0, arg1)
#define MYSQL_MULTI_DELETE_DONE_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_MULTI_DELETE_DONE_ENABLED() (0)
#define MYSQL_NET_READ_START()
#define MYSQL_NET_READ_START_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_NET_READ_START_ENABLED() (0)
#define MYSQL_NET_READ_DONE(arg0, arg1)
#define MYSQL_NET_READ_DONE_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_NET_READ_DONE_ENABLED() (0)
#define MYSQL_NET_WRITE_START(arg0)
#define MYSQL_NET_WRITE_START_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_NET_WRITE_START_ENABLED() (0)
#define MYSQL_NET_WRITE_DONE(arg0)
#define MYSQL_NET_WRITE_DONE_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_NET_WRITE_DONE_ENABLED() (0)
#define MYSQL_KEYCACHE_READ_START(arg0, arg1, arg2, arg3)
#define MYSQL_KEYCACHE_READ_START_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_KEYCACHE_READ_START_ENABLED() (0)
#define MYSQL_KEYCACHE_READ_BLOCK(arg0)
#define MYSQL_KEYCACHE_READ_BLOCK_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_KEYCACHE_READ_BLOCK_ENABLED() (0)
#define MYSQL_KEYCACHE_READ_HIT()
#define MYSQL_KEYCACHE_READ_HIT_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_KEYCACHE_READ_HIT_ENABLED() (0)
#define MYSQL_KEYCACHE_READ_MISS()
#define MYSQL_KEYCACHE_READ_MISS_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_KEYCACHE_READ_MISS_ENABLED() (0)
#define MYSQL_KEYCACHE_READ_DONE(arg0, arg1)
#define MYSQL_KEYCACHE_READ_DONE_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_KEYCACHE_READ_DONE_ENABLED() (0)
#define MYSQL_KEYCACHE_WRITE_START(arg0, arg1, arg2, arg3)
#define MYSQL_KEYCACHE_WRITE_START_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_KEYCACHE_WRITE_START_ENABLED() (0)
#define MYSQL_KEYCACHE_WRITE_BLOCK(arg0)
#define MYSQL_KEYCACHE_WRITE_BLOCK_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_KEYCACHE_WRITE_BLOCK_ENABLED() (0)
#define MYSQL_KEYCACHE_WRITE_DONE(arg0, arg1)
#define MYSQL_KEYCACHE_WRITE_DONE_ENABLED() MYSQL_DTRACE_DISABLED
#define MYSQL_KEYCACHE_WRITE_DONE_ENABLED() (0)
#ifdef __cplusplus
}
......
......@@ -3195,13 +3195,26 @@ uint32 get_partition_id_cols_list_for_endpoint(partition_info *part_info,
(list_index - 1)*num_columns,
nparts, left_endpoint,
include_endpoint)));
#if 0
if (!left_endpoint)
{
/* Set the end after this list tuple if not already after the last. */
if (list_index < part_info->num_parts)
list_index++;
}
#else
if (!left_endpoint && list_index < part_info->num_list_values)
{
/*
Set the end after this list tuple if it is not already after the last
and it matches.
*/
int cmp = cmp_rec_and_tuple_prune(list_col_array + list_index*num_columns,
nparts, left_endpoint, include_endpoint);
if (cmp >= 0)
list_index++;
}
#endif
DBUG_RETURN(list_index);
}
......
......@@ -19,20 +19,20 @@ SET(CONNECT_PLUGIN_DYNAMIC "connect")
SET(CONNECT_SOURCES
ha_connect.cc connect.cc user_connect.cc mycat.cc
fmdlex.c osutil.c plugutil.c rcmsg.c rcmsg.h
csort.cpp maputil.cpp plgdbutl.cpp
colblk.cpp reldef.cpp tabcol.cpp table.cpp
filamap.cpp filamdbf.cpp filamfix.cpp filamtxt.cpp filamvct.cpp
tabdos.cpp tabfix.cpp tabfmt.cpp tabmul.cpp tabsys.cpp tabvct.cpp
array.cpp blkfil.cpp colblk.cpp csort.cpp
filamap.cpp filamdbf.cpp filamfix.cpp filamtxt.cpp filamvct.cpp filamzip.cpp
filter.cpp maputil.cpp myutil.cpp plgdbutl.cpp reldef.cpp tabcol.cpp
tabdos.cpp tabfix.cpp tabfmt.cpp table.cpp tabmul.cpp taboccur.cpp
tabpivot.cpp tabsys.cpp tabtbl.cpp tabutil.cpp tabvct.cpp tabxcl.cpp
valblk.cpp value.cpp xindex.cpp xobject.cpp
filamzip.cpp tabtbl.cpp myutil.cpp
tabutil.cpp tabxcl.cpp taboccur.cpp tabpivot.cpp
block.h catalog.h checklvl.h colblk.h connect.h csort.h engmsg.h
filamap.h filamdbf.h filamfix.h filamtxt.h filamvct.h filamzip.h
global.h ha_connect.h inihandl.h maputil.h msgid.h mycat.h myutil.h os.h
osutil.h plgcnx.h plgdbsem.h preparse.h reldef.h resource.h tabcol.h
tabdos.h tabfix.h tabfmt.h tabmul.h tabsys.h tabtbl.h tabvct.h
user_connect.h valblk.h value.h xindex.h xobject.h xtable.h
tabutil.h tabxcl.h taboccur.h tabpivot.h)
array.h blkfil.h block.h catalog.h checklvl.h colblk.h connect.h csort.h
engmsg.h filamap.h filamdbf.h filamfix.h filamtxt.h filamvct.h filamzip.h
filter.h global.h ha_connect.h inihandl.h maputil.h msgid.h mycat.h myutil.h
os.h osutil.h plgcnx.h plgdbsem.h preparse.h reldef.h resource.h tabcol.h
tabdos.h tabfix.h tabfmt.h tabmul.h taboccur.h tabpivot.h tabsys.h
tabtbl.h tabutil.h tabvct.h tabxcl.h user_connect.h valblk.h value.h
xindex.h xobject.h xtable.h)
#
# Definitions that are shared for all OSes
......
This diff is collapsed.
/**************** Array H Declares Source Code File (.H) ***************/
/* Name: ARRAY.H Version 3.1 */
/* */
/* (C) Copyright to the author Olivier BERTRAND 2005-2014 */
/* */
/* This file contains the ARRAY and VALBASE derived classes declares. */
/***********************************************************************/
/***********************************************************************/
/* Include required application header files */
/***********************************************************************/
#include "xobject.h"
#include "valblk.h"
#include "csort.h"
typedef class ARRAY *PARRAY;
/***********************************************************************/
/* Definition of class ARRAY with all its method functions. */
/* Note: This is not a general array class that could be defined as */
/* a template class, but rather a specific object containing a list */
/* of values to be processed by the filter IN operator. */
/* In addition it must act as a metaclass by being able to give back */
/* the type of values it contains. */
/* It must also be able to convert itself from some type to another. */
/***********************************************************************/
class DllExport ARRAY : public XOBJECT, public CSORT { // Array descblock
friend class MULAR;
//friend class VALLST;
//friend class SFROW;
public:
// Constructors
ARRAY(PGLOBAL g, int type, int size, int len = 1, int prec = 0);
//ARRAY(PGLOBAL g, PQUERY qryp);
//ARRAY(PGLOBAL g, PARRAY par, int k);
// Implementation
virtual int GetType(void) {return TYPE_ARRAY;}
virtual int GetResultType(void) {return Type;}
virtual int GetLength(void) {return Len;}
virtual int GetLengthEx(void) {return Len;}
virtual int GetScale() {return 0;}
int GetNval(void) {return Nval;}
int GetSize(void) {return Size;}
// PVAL GetValp(void) {return Valp;}
void SetType(int atype) {Type = atype;}
// void SetCorrel(bool b) {Correlated = b;}
// Methods
virtual void Reset(void) {Bot = -1;}
virtual int Qcompare(int *, int *);
virtual bool Compare(PXOB) {assert(FALSE); return FALSE;}
virtual bool SetFormat(PGLOBAL, FORMAT&) {assert(FALSE); return FALSE;}
//virtual int CheckSpcCol(PTDB, int) {return 0;}
virtual void Print(PGLOBAL g, FILE *f, uint n);
virtual void Print(PGLOBAL g, char *ps, uint z);
// void Empty(void);
void SetPrecision(PGLOBAL g, int p);
bool AddValue(PGLOBAL g, PSZ sp);
bool AddValue(PGLOBAL g, short n);
bool AddValue(PGLOBAL g, int n);
bool AddValue(PGLOBAL g, double f);
bool AddValue(PGLOBAL g, PXOB xp);
bool AddValue(PGLOBAL g, PVAL vp);
void GetNthValue(PVAL valp, int n);
char *GetStringValue(int n);
BYTE Vcompare(PVAL vp, int n);
void Save(int);
void Restore(int);
void Move(int, int);
bool Sort(PGLOBAL g);
bool Find(PVAL valp);
bool FilTest(PGLOBAL g, PVAL valp, OPVAL opc, int opm);
int Convert(PGLOBAL g, int k, PVAL vp = NULL);
int BlockTest(PGLOBAL g, int opc, int opm,
void *minp, void *maxp, bool s);
PSZ MakeArrayList(PGLOBAL g);
bool CanBeShort(void);
bool GetSubValue(PGLOBAL g, PVAL valp, int *kp);
protected:
// Members
PMBV Valblk; // To the MBVALS class
PVBLK Vblp; // To Valblock of the data array
//PVAL Valp; // The value used for Save and Restore is Value
int Size; // Size of value array
int Nval; // Total number of items in array
int Ndif; // Total number of distinct items in array
int Xsize; // Size of Index (used for correlated arrays)
int Type; // Type of individual values in the array
int Len; // Length of character string
int Bot; // Bottom of research index
int Top; // Top of research index
int X, Inf, Sup; // Used for block optimization
//bool Correlated; // -----------> Temporary
}; // end of class ARRAY
/***********************************************************************/
/* Definition of class MULAR with all its method functions. */
/* This class is used when constructing the arrays of constants used */
/* for indexing. Its only purpose is to provide a way to sort, reduce */
/* and reorder the arrays of multicolumn indexes as one block. Indeed */
/* sorting the arrays independantly would break the correspondance of */
/* column values. */
/***********************************************************************/
class MULAR : public CSORT, public BLOCK { // No need to be an XOBJECT
public:
// Constructor
MULAR(PGLOBAL g, int n);
// Implementation
void SetPars(PARRAY par, int i) {Pars[i] = par;}
// Methods
virtual int Qcompare(int *i1, int *i2); // Sort compare routine
bool Sort(PGLOBAL g);
protected:
// Members
int Narray; // The number of sub-arrays
PARRAY *Pars; // To the block of real arrays
}; // end of class ARRAY
This diff is collapsed.
This diff is collapsed.
......@@ -43,6 +43,8 @@ typedef struct _colinfo {
int Key;
int Precision;
int Scale;
int Opt;
int Freq;
char *Remark;
char *Datefmt;
char *Fieldfmt;
......@@ -82,7 +84,7 @@ class DllExport CATALOG {
virtual bool TestCond(PGLOBAL g, const char *name, const char *type)
{return true;}
virtual bool DropTable(PGLOBAL g, PSZ name, bool erase) {return true;}
virtual PTDB GetTable(PGLOBAL g, PTABLE tablep,
virtual PTDB GetTable(PGLOBAL g, PTABLE tablep,
MODE mode = MODE_READ, LPCSTR type = NULL)
{return NULL;}
virtual void TableNames(PGLOBAL g, char *buffer, int maxbuf, int info[]) {}
......
This diff is collapsed.
......@@ -36,10 +36,13 @@ class DllExport COLBLK : public XOBJECT {
virtual int GetAmType() {return TYPE_AM_ERROR;}
virtual void SetOk(void) {Status |= BUF_EMPTY;}
virtual PTDB GetTo_Tdb(void) {return To_Tdb;}
virtual int GetClustered(void) {return 0;}
virtual int IsClustered(void) {return FALSE;}
PCOL GetNext(void) {return Next;}
PSZ GetName(void) {return Name;}
int GetIndex(void) {return Index;}
ushort GetColUse(void) {return ColUse;}
int GetOpt(void) {return Opt;}
ushort GetColUse(ushort u) {return (ColUse & u);}
ushort GetStatus(void) {return Status;}
ushort GetStatus(ushort u) {return (Status & u);}
......@@ -48,17 +51,18 @@ class DllExport COLBLK : public XOBJECT {
void AddColUse(ushort u) {ColUse |= u;}
void AddStatus(ushort u) {Status |= u;}
void SetNext(PCOL cp) {Next = cp;}
PXCOL GetKcol(void) {return To_Kcol;}
void SetKcol(PXCOL kcp) {To_Kcol = kcp;}
PCOLDEF GetCdp(void) {return Cdp;}
PSZ GetDomain(void) {return (Cdp) ? Cdp->Decode : NULL;}
PSZ GetDesc(void) {return (Cdp) ? Cdp->Desc : NULL;}
PSZ GetFmt(void) {return (Cdp) ? Cdp->Fmt : NULL;}
bool IsUnsigned(void) {return Unsigned;}
bool IsNullable(void) {return Nullable;}
bool IsVirtual(void) {return Cdp->IsVirtual();}
bool IsNullable(void) {return Nullable;}
void SetNullable(bool b) {Nullable = b;}
// Methods
// Methods
virtual void Reset(void);
virtual bool Compare(PXOB xp);
virtual bool SetFormat(PGLOBAL, FORMAT&);
......@@ -70,6 +74,7 @@ class DllExport COLBLK : public XOBJECT {
virtual void WriteColumn(PGLOBAL g);
virtual void Print(PGLOBAL g, FILE *, uint);
virtual void Print(PGLOBAL g, char *, uint);
virtual bool VarSize(void) {return false;}
bool InitValue(PGLOBAL g);
protected:
......@@ -82,9 +87,11 @@ class DllExport COLBLK : public XOBJECT {
bool Nullable; // True if nullable
bool Unsigned; // True if unsigned
int Index; // Column number in table
int Opt; // Cluster/sort information
int Buf_Type; // Data type
int Long; // Internal length in table
int Precision; // Column length (as for ODBC)
int Freq; // Evaluated ceiling of distinct values
FORMAT Format; // Output format
ushort ColUse; // Column usage
ushort Status; // Column read status
......@@ -100,7 +107,7 @@ class DllExport SPCBLK : public COLBLK {
// Implementation
virtual int GetAmType(void) = 0;
virtual bool GetRnm(void) {return false;}
virtual bool GetRnm(void) {return false;}
// Methods
virtual bool IsSpecial(void) {return true;}
......@@ -122,7 +129,7 @@ class DllExport RIDBLK : public SPCBLK {
// Implementation
virtual int GetAmType(void) {return TYPE_AM_ROWID;}
virtual bool GetRnm(void) {return Rnm;}
virtual bool GetRnm(void) {return Rnm;}
// Methods
virtual void ReadColumn(PGLOBAL g);
......@@ -137,7 +144,7 @@ class DllExport RIDBLK : public SPCBLK {
class DllExport FIDBLK : public SPCBLK {
public:
// Constructor
FIDBLK(PCOLUMN cp);
FIDBLK(PCOLUMN cp, OPVAL op);
// Implementation
virtual int GetAmType(void) {return TYPE_AM_FILID;}
......@@ -147,7 +154,8 @@ class DllExport FIDBLK : public SPCBLK {
virtual void ReadColumn(PGLOBAL g);
protected:
PSZ Fn; // The current To_File of the table
PSZ Fn; // The current To_File of the table
OPVAL Op; // The file part operator
}; // end of class FIDBLK
/***********************************************************************/
......@@ -173,6 +181,29 @@ class DllExport TIDBLK : public SPCBLK {
PSZ Tname; // The current table name
}; // end of class TIDBLK
/***********************************************************************/
/* Class PRTBLK: PARTID special column descriptor. */
/***********************************************************************/
class DllExport PRTBLK : public SPCBLK {
public:
// Constructor
PRTBLK(PCOLUMN cp);
// Implementation
virtual int GetAmType(void) {return TYPE_AM_PRTID;}
// Methods
virtual void Reset(void) {} // This is a pseudo constant column
virtual void ReadColumn(PGLOBAL g);
protected:
// Default constructor not to be used
PRTBLK(void) {}
// Members
PSZ Pname; // The current partition name
}; // end of class PRTBLK
/***********************************************************************/
/* Class SIDBLK: SERVID special column descriptor. */
/***********************************************************************/
......
This diff is collapsed.
......@@ -33,10 +33,10 @@ bool CntCheckDB(PGLOBAL g, PHC handler, const char *pathname);
PTDB CntGetTDB(PGLOBAL g, const char *name, MODE xmod, PHC);
bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE, char *, char *, bool, PHC);
bool CntRewindTable(PGLOBAL g, PTDB tdbp);
int CntCloseTable(PGLOBAL g, PTDB tdbp);
int CntCloseTable(PGLOBAL g, PTDB tdbp, bool nox, bool abort);
int CntIndexInit(PGLOBAL g, PTDB tdbp, int id);
RCODE CntReadNext(PGLOBAL g, PTDB tdbp);
RCODE CntIndexRead(PGLOBAL g, PTDB, OPVAL op, const void *k, int n);
RCODE CntIndexRead(PGLOBAL g, PTDB, OPVAL op, const void *k, int n, bool mrr);
RCODE CntWriteRow(PGLOBAL g, PTDB tdbp);
RCODE CntUpdateRow(PGLOBAL g, PTDB tdbp);
RCODE CntDeleteRow(PGLOBAL g, PTDB tdbp, bool all);
......@@ -58,9 +58,9 @@ class DOXDEF: public DOSDEF {
/***********************************************************************/
class TDBDOX: public TDBDOS {
friend int MakeIndex(PGLOBAL, PTDB, PIXDEF);
friend int CntCloseTable(PGLOBAL, PTDB);
friend int CntCloseTable(PGLOBAL, PTDB, bool, bool);
friend int CntIndexInit(PGLOBAL, PTDB, int);
friend RCODE CntIndexRead(PGLOBAL, PTDB, OPVAL, const void*, int);
friend RCODE CntIndexRead(PGLOBAL, PTDB, OPVAL, const void*, int, bool);
friend RCODE CntDeleteRow(PGLOBAL, PTDB, bool);
friend int CntIndexRange(PGLOBAL, PTDB, const uchar**, uint*,
bool*, key_part_map*);
......
/*********** File AM Map C++ Program Source Code File (.CPP) ***********/
/* PROGRAM NAME: FILAMAP */
/* ------------- */
/* Version 1.4 */
/* Version 1.5 */
/* */
/* COPYRIGHT: */
/* ---------- */
/* (C) Copyright to the author Olivier BERTRAND 2005-2013 */
/* (C) Copyright to the author Olivier BERTRAND 2005-2014 */
/* */
/* WHAT THIS PROGRAM DOES: */
/* ----------------------- */
......@@ -129,9 +129,9 @@ bool MAPFAM::OpenTableFile(PGLOBAL g)
&& fp->Count && fp->Mode == mode)
break;
if (trace)
htrc("Mapping file, fp=%p\n", fp);
#ifdef DEBTRACE
htrc("Mapping file, fp=%p\n", fp);
#endif
} else
fp = NULL;
......@@ -322,8 +322,26 @@ int MAPFAM::ReadBuffer(PGLOBAL g)
/*******************************************************************/
/* Record file position in case of UPDATE or DELETE. */
/*******************************************************************/
Fpos = Mempos;
CurBlk = (int)Rows++;
int rc;
next:
Fpos = Mempos;
CurBlk = (int)Rows++;
/*******************************************************************/
/* Check whether optimization on ROWID */
/* can be done, as well as for join as for local filtering. */
/*******************************************************************/
switch (Tdbp->TestBlock(g)) {
case RC_EF:
return RC_EF;
case RC_NF:
// Skip this record
if ((rc = SkipRecord(g, FALSE)) != RC_OK)
return rc;
goto next;
} // endswitch rc
} else
Placed = false;
......@@ -382,7 +400,7 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc)
if (Tpos == Spos)
/*******************************************************************/
/* First line to delete. Move of eventual preceding lines is */
/* First line to delete. Move of eventual preceeding lines is */
/* not required here, just setting of future Spos and Tpos. */
/*******************************************************************/
Tpos = Fpos; // Spos is set below
......@@ -458,10 +476,10 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc)
/***********************************************************************/
/* Table file close routine for MAP access method. */
/***********************************************************************/
void MAPFAM::CloseTableFile(PGLOBAL g)
void MAPFAM::CloseTableFile(PGLOBAL g, bool abort)
{
PlugCloseFile(g, To_Fb);
To_Fb = NULL; // To get correct file size in Cardinality
To_Fb = NULL; // To get correct file size in Cardinality
if (trace)
htrc("MAP Close: closing %s count=%d\n",
......@@ -488,7 +506,7 @@ MBKFAM::MBKFAM(PDOSDEF tdp) : MAPFAM(tdp)
Block = tdp->GetBlock();
Last = tdp->GetLast();
Nrec = tdp->GetElemt();
BlkPos = NULL;
BlkPos = tdp->GetTo_Pos();
CurNum = Nrec;
} // end of MBKFAM standard constructor
......@@ -508,9 +526,7 @@ void MBKFAM::Reset(void)
/***********************************************************************/
int MBKFAM::Cardinality(PGLOBAL g)
{
// Should not be called in this version
return (g) ? -1 : 0;
//return (g) ? (int)((Block - 1) * Nrec + Last) : 1;
return (g) ? (int)((Block - 1) * Nrec + Last) : 1;
} // end of Cardinality
/***********************************************************************/
......@@ -534,8 +550,49 @@ int MBKFAM::GetRowID(void)
/***********************************************************************/
int MBKFAM::ReadBuffer(PGLOBAL g)
{
strcpy(g->Message, "This AM cannot be used in this version");
return RC_FX;
int len;
/*********************************************************************/
/* Sequential block reading when Placed is not true. */
/*********************************************************************/
if (Placed) {
Placed = false;
} else if (Mempos >= Top) { // Are we at the end of the memory
return RC_EF;
} else if (++CurNum < Nrec) {
Fpos = Mempos;
} else {
/*******************************************************************/
/* New block. */
/*******************************************************************/
CurNum = 0;
next:
if (++CurBlk >= Block)
return RC_EF;
/*******************************************************************/
/* Before reading a new block, check whether block optimization */
/* can be done, as well as for join as for local filtering. */
/*******************************************************************/
switch (Tdbp->TestBlock(g)) {
case RC_EF:
return RC_EF;
case RC_NF:
goto next;
} // endswitch rc
Fpos = Mempos = Memory + BlkPos[CurBlk];
} // endif's
// Immediately calculate next position (Used by DeleteDB)
while (*Mempos++ != '\n') ; // What about Unix ???
// Set caller line buffer
len = (Mempos - Fpos) - Ending;
memcpy(Tdbp->GetLine(), Fpos, len);
Tdbp->GetLine()[len] = '\0';
return RC_OK;
} // end of ReadBuffer
/***********************************************************************/
......@@ -618,17 +675,29 @@ int MPXFAM::ReadBuffer(PGLOBAL g)
Placed = false;
} else if (Mempos >= Top) { // Are we at the end of the memory
return RC_EF;
} else if (++CurNum < Nrec) {
} else if (++CurNum < Nrec) {
Fpos = Mempos;
} else {
} else {
/*******************************************************************/
/* New block. */
/*******************************************************************/
CurNum = 0;
CurNum = 0;
next:
if (++CurBlk >= Block)
return RC_EF;
/*******************************************************************/
/* Before reading a new block, check whether block optimization */
/* can be done, as well as for join as for local filtering. */
/*******************************************************************/
switch (Tdbp->TestBlock(g)) {
case RC_EF:
return RC_EF;
case RC_NF:
goto next;
} // endswitch rc
if (++CurBlk >= Block)
return RC_EF;
Fpos = Mempos = Headlen + Memory + CurBlk * Blksize;
} // endif's
......
/*************** FilAMap H Declares Source Code File (.H) **************/
/* Name: FILAMAP.H Version 1.2 */
/* */
/* (C) Copyright to the author Olivier BERTRAND 2005-2012 */
/* */
/* This file contains the MAP file access method classes declares. */
/***********************************************************************/
#ifndef __FILAMAP_H
#define __FILAMAP_H
#include "block.h"
#include "filamtxt.h"
typedef class MAPFAM *PMAPFAM;
/***********************************************************************/
/* This is the variable file access method using file mapping. */
/***********************************************************************/
class DllExport MAPFAM : public TXTFAM {
public:
// Constructor
MAPFAM(PDOSDEF tdp);
MAPFAM(PMAPFAM tmfp);
// Implementation
virtual AMT GetAmType(void) {return TYPE_AM_MAP;}
virtual int GetPos(void);
virtual int GetNextPos(void);
virtual PTXF Duplicate(PGLOBAL g)
{return (PTXF)new(g) MAPFAM(this);}
// Methods
virtual void Reset(void);
virtual int GetFileLength(PGLOBAL g);
virtual int Cardinality(PGLOBAL g) {return (g) ? -1 : 0;}
virtual int GetRowID(void);
virtual bool RecordPos(PGLOBAL g);
virtual bool SetPos(PGLOBAL g, int recpos);
virtual int SkipRecord(PGLOBAL g, bool header);
virtual bool OpenTableFile(PGLOBAL g);
virtual bool DeferReading(void) {return false;}
virtual int ReadBuffer(PGLOBAL g);
virtual int WriteBuffer(PGLOBAL g);
virtual int DeleteRecords(PGLOBAL g, int irc);
virtual void CloseTableFile(PGLOBAL g);
virtual void Rewind(void);
protected:
// Members
char *Memory; // Pointer on file mapping view.
char *Mempos; // Position of next data to read
char *Fpos; // Position of last read record
char *Tpos; // Target Position for delete move
char *Spos; // Start position for delete move
char *Top; // Mark end of file mapping view
}; // end of class MAPFAM
/***********************************************************************/
/* This is the blocked file access method using file mapping. */
/***********************************************************************/
class DllExport MBKFAM : public MAPFAM {
public:
// Constructor
MBKFAM(PDOSDEF tdp);
MBKFAM(PMAPFAM tmfp) : MAPFAM(tmfp) {}
// Implementation
virtual PTXF Duplicate(PGLOBAL g)
{return (PTXF)new(g) MBKFAM(this);}
// Methods
virtual void Reset(void);
virtual int Cardinality(PGLOBAL g);
virtual int GetRowID(void);
virtual int SkipRecord(PGLOBAL g, bool header);
virtual int ReadBuffer(PGLOBAL g);
virtual void Rewind(void);
protected:
// No additional members
}; // end of class MBKFAM
/***********************************************************************/
/* This is the fixed file access method using file mapping. */
/***********************************************************************/
class DllExport MPXFAM : public MBKFAM {
public:
// Constructor
MPXFAM(PDOSDEF tdp);
MPXFAM(PMAPFAM tmfp) : MBKFAM(tmfp) {}
// Implementation
virtual int GetPos(void);
virtual PTXF Duplicate(PGLOBAL g)
{return (PTXF)new(g) MPXFAM(this);}
// Methods
virtual int Cardinality(PGLOBAL g) {return TXTFAM::Cardinality(g);}
virtual bool SetPos(PGLOBAL g, int recpos);
virtual bool DeferReading(void) {return false;}
virtual int ReadBuffer(PGLOBAL g);
virtual int WriteBuffer(PGLOBAL g);
protected:
// No additional members
}; // end of class MPXFAM
#endif // __FILAMAP_H
/*************** FilAMap H Declares Source Code File (.H) **************/
/* Name: FILAMAP.H Version 1.2 */
/* */
/* (C) Copyright to the author Olivier BERTRAND 2005-2012 */
/* */
/* This file contains the MAP file access method classes declares. */
/***********************************************************************/
#ifndef __FILAMAP_H
#define __FILAMAP_H
#include "block.h"
#include "filamtxt.h"
typedef class MAPFAM *PMAPFAM;
/***********************************************************************/
/* This is the variable file access method using file mapping. */
/***********************************************************************/
class DllExport MAPFAM : public TXTFAM {
public:
// Constructor
MAPFAM(PDOSDEF tdp);
MAPFAM(PMAPFAM tmfp);
// Implementation
virtual AMT GetAmType(void) {return TYPE_AM_MAP;}
virtual int GetPos(void);
virtual int GetNextPos(void);
virtual PTXF Duplicate(PGLOBAL g)
{return (PTXF)new(g) MAPFAM(this);}
// Methods
virtual void Reset(void);
virtual int GetFileLength(PGLOBAL g);
virtual int Cardinality(PGLOBAL g) {return (g) ? -1 : 0;}
virtual int MaxBlkSize(PGLOBAL g, int s) {return s;}
virtual int GetRowID(void);
virtual bool RecordPos(PGLOBAL g);
virtual bool SetPos(PGLOBAL g, int recpos);
virtual int SkipRecord(PGLOBAL g, bool header);
virtual bool OpenTableFile(PGLOBAL g);
virtual bool DeferReading(void) {return false;}
virtual int ReadBuffer(PGLOBAL g);
virtual int WriteBuffer(PGLOBAL g);
virtual int DeleteRecords(PGLOBAL g, int irc);
virtual void CloseTableFile(PGLOBAL g, bool abort);
virtual void Rewind(void);
protected:
// Members
char *Memory; // Pointer on file mapping view.
char *Mempos; // Position of next data to read
char *Fpos; // Position of last read record
char *Tpos; // Target Position for delete move
char *Spos; // Start position for delete move
char *Top; // Mark end of file mapping view
}; // end of class MAPFAM
/***********************************************************************/
/* This is the blocked file access method using file mapping. */
/***********************************************************************/
class DllExport MBKFAM : public MAPFAM {
public:
// Constructor
MBKFAM(PDOSDEF tdp);
MBKFAM(PMAPFAM tmfp) : MAPFAM(tmfp) {}
// Implementation
virtual PTXF Duplicate(PGLOBAL g)
{return (PTXF)new(g) MBKFAM(this);}
// Methods
virtual void Reset(void);
virtual int Cardinality(PGLOBAL g);
virtual int MaxBlkSize(PGLOBAL g, int s)
{return TXTFAM::MaxBlkSize(g, s);}
virtual int GetRowID(void);
virtual int SkipRecord(PGLOBAL g, bool header);
virtual int ReadBuffer(PGLOBAL g);
virtual void Rewind(void);
protected:
// No additional members
}; // end of class MBKFAM
/***********************************************************************/
/* This is the fixed file access method using file mapping. */
/***********************************************************************/
class DllExport MPXFAM : public MBKFAM {
public:
// Constructor
MPXFAM(PDOSDEF tdp);
MPXFAM(PMAPFAM tmfp) : MBKFAM(tmfp) {}
// Implementation
virtual int GetPos(void);
virtual PTXF Duplicate(PGLOBAL g)
{return (PTXF)new(g) MPXFAM(this);}
// Methods
virtual int Cardinality(PGLOBAL g) {return TXTFAM::Cardinality(g);}
virtual int MaxBlkSize(PGLOBAL g, int s)
{return TXTFAM::MaxBlkSize(g, s);}
virtual bool SetPos(PGLOBAL g, int recpos);
virtual bool DeferReading(void) {return false;}
virtual int ReadBuffer(PGLOBAL g);
virtual int WriteBuffer(PGLOBAL g);
protected:
// No additional members
}; // end of class MPXFAM
#endif // __FILAMAP_H
......@@ -791,7 +791,7 @@ void DBFFAM::Rewind(void)
/***********************************************************************/
/* Table file close routine for DBF access method. */
/***********************************************************************/
void DBFFAM::CloseTableFile(PGLOBAL g)
void DBFFAM::CloseTableFile(PGLOBAL g, bool abort)
{
int rc = RC_OK, wrc = RC_OK;
MODE mode = Tdbp->GetMode();
......@@ -810,17 +810,17 @@ void DBFFAM::CloseTableFile(PGLOBAL g)
} // endif Modif
if (UseTemp && T_Stream && wrc == RC_OK) {
// Copy any remaining lines
bool b;
Fpos = Tdbp->Cardinality(g);
if ((rc = MoveIntermediateLines(g, &b)) == RC_OK) {
// Delete the old file and rename the new temp file.
RenameTempFile(g);
goto fin;
} // endif rc
if (!abort) {
// Copy any remaining lines
bool b;
Fpos = Tdbp->Cardinality(g);
abort = MoveIntermediateLines(g, &b) != RC_OK;
} // endif abort
// Delete the old file and rename the new temp file.
RenameTempFile(g, abort);
goto fin;
} // endif UseTemp
} // endif's mode
......
......@@ -67,7 +67,7 @@ class DllExport DBFFAM : public FIXFAM, public DBFBASE {
virtual void ResetBuffer(PGLOBAL g);
virtual int ReadBuffer(PGLOBAL g);
virtual int DeleteRecords(PGLOBAL g, int irc);
virtual void CloseTableFile(PGLOBAL g);
virtual void CloseTableFile(PGLOBAL g, bool abort);
virtual void Rewind(void);
protected:
......
......@@ -169,9 +169,20 @@ int FIXFAM::ReadBuffer(PGLOBAL g)
CurNum = 0;
Tdbp->SetLine(To_Buf);
next:
if (++CurBlk >= Block)
return RC_EF;
/*****************************************************************/
/* Before reading a new block, check whether block indexing */
/* can be done, as well as for join as for local filtering. */
/*****************************************************************/
switch (Tdbp->TestBlock(g)) {
case RC_EF:
return RC_EF;
case RC_NF:
goto next;
} // endswitch rc
} // endif's
if (OldBlk == CurBlk) {
......@@ -304,8 +315,7 @@ int FIXFAM::WriteBuffer(PGLOBAL g)
} else { // Mode == MODE_UPDATE
// T_Stream is the temporary stream or the table file stream itself
if (!T_Stream)
{
if (!T_Stream) {
if (UseTemp /*&& Tdbp->GetMode() == MODE_UPDATE*/) {
if (OpenTempFile(g))
return RC_FX;
......@@ -315,7 +325,9 @@ int FIXFAM::WriteBuffer(PGLOBAL g)
} else
T_Stream = Stream;
}
} // endif T_Stream
Modif++; // Modified line in Update mode
} // endif Mode
......@@ -409,7 +421,7 @@ int FIXFAM::DeleteRecords(PGLOBAL g, int irc)
/*****************************************************************/
/* Ok, now delete old file and rename new temp file. */
/*****************************************************************/
if (RenameTempFile(g))
if (RenameTempFile(g, false))
return RC_FX;
} else {
......@@ -516,7 +528,7 @@ bool FIXFAM::MoveIntermediateLines(PGLOBAL g, bool *b)
/***********************************************************************/
/* Table file close routine for FIX access method. */
/***********************************************************************/
void FIXFAM::CloseTableFile(PGLOBAL g)
void FIXFAM::CloseTableFile(PGLOBAL g, bool abort)
{
int rc = RC_OK, wrc = RC_OK;
MODE mode = Tdbp->GetMode();
......@@ -535,17 +547,17 @@ void FIXFAM::CloseTableFile(PGLOBAL g)
} // endif Modif
if (UseTemp && T_Stream && wrc == RC_OK) {
// Copy any remaining lines
bool b;
Fpos = Tdbp->Cardinality(g);
if ((rc = MoveIntermediateLines(g, &b)) == RC_OK) {
// Delete the old file and rename the new temp file.
RenameTempFile(g);
goto fin;
} // endif rc
if (!abort) {
// Copy any remaining lines
bool b;
Fpos = Tdbp->Cardinality(g);
abort = MoveIntermediateLines(g, &b) != RC_OK;
} // endif // abort
// Delete the old file and rename the new temp file.
RenameTempFile(g, abort);
goto fin;
} // endif UseTemp
} // endif's mode
......@@ -1013,9 +1025,21 @@ int BGXFAM::ReadBuffer(PGLOBAL g)
CurNum = 0;
Tdbp->SetLine(To_Buf);
next:
if (++CurBlk >= Block)
return RC_EF;
/*****************************************************************/
/* Before reading a new block, check whether block optimization */
/* can be done, as well as for join as for local filtering. */
/*****************************************************************/
switch (Tdbp->TestBlock(g)) {
case RC_EF:
return RC_EF;
case RC_NF:
goto next;
} // endswitch rc
} // endif's
if (OldBlk == CurBlk) {
......@@ -1222,7 +1246,7 @@ int BGXFAM::DeleteRecords(PGLOBAL g, int irc)
/*****************************************************************/
/* Ok, now delete old file and rename new temp file. */
/*****************************************************************/
if (RenameTempFile(g))
if (RenameTempFile(g, false))
return RC_FX;
} else {
......@@ -1352,7 +1376,7 @@ bool BGXFAM::MoveIntermediateLines(PGLOBAL g, bool *b)
/***********************************************************************/
/* Data Base close routine for BIGFIX access method. */
/***********************************************************************/
void BGXFAM::CloseTableFile(PGLOBAL g)
void BGXFAM::CloseTableFile(PGLOBAL g, bool abort)
{
int rc = RC_OK, wrc = RC_OK;
MODE mode = Tdbp->GetMode();
......@@ -1370,17 +1394,17 @@ void BGXFAM::CloseTableFile(PGLOBAL g)
} // endif Modif
if (UseTemp && Tfile && wrc == RC_OK) {
// Copy any remaining lines
bool b;
Fpos = Tdbp->Cardinality(g);
if ((rc = MoveIntermediateLines(g, &b)) == RC_OK) {
// Delete the old file and rename the new temp file.
RenameTempFile(g);
goto fin;
} // endif rc
if (!abort) {
// Copy any remaining lines
bool b;
Fpos = Tdbp->Cardinality(g);
abort = MoveIntermediateLines(g, &b) != RC_OK;
} // endif abort
// Delete the old file and rename the new temp file.
RenameTempFile(g, abort);
goto fin;
} // endif UseTemp
} // endif's mode
......
/************** FilAMFix H Declares Source Code File (.H) **************/
/* Name: FILAMFIX.H Version 1.2 */
/* */
/* (C) Copyright to the author Olivier BERTRAND 2005 - 2012 */
/* */
/* This file contains the FIX file access method classes declares. */
/***********************************************************************/
#ifndef __FILAMFIX_H
#define __FILAMFIX_H
#include "filamtxt.h"
typedef class FIXFAM *PFIXFAM;
typedef class BGXFAM *PBGXFAM;
/***********************************************************************/
/* This is the DOS/UNIX Access Method class declaration for standard */
/* files with fixed record format (FIX, BIN) */
/***********************************************************************/
class DllExport FIXFAM : public BLKFAM {
public:
// Constructor
FIXFAM(PDOSDEF tdp);
FIXFAM(PFIXFAM txfp);
// Implementation
virtual AMT GetAmType(void) {return TYPE_AM_FIX;}
virtual PTXF Duplicate(PGLOBAL g)
{return (PTXF)new(g) FIXFAM(this);}
// Methods
virtual int Cardinality(PGLOBAL g) {return TXTFAM::Cardinality(g);}
virtual bool AllocateBuffer(PGLOBAL g);
virtual void ResetBuffer(PGLOBAL g);
virtual int ReadBuffer(PGLOBAL g);
virtual int WriteBuffer(PGLOBAL g);
virtual int DeleteRecords(PGLOBAL g, int irc);
virtual void CloseTableFile(PGLOBAL g);
protected:
virtual bool CopyHeader(PGLOBAL g) {return false;}
virtual bool MoveIntermediateLines(PGLOBAL g, bool *b);
// No additional members
}; // end of class FIXFAM
/***********************************************************************/
/* 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 of more than 2 gigabytes. */
/***********************************************************************/
class BGXFAM : public FIXFAM {
public:
// Constructor
BGXFAM(PDOSDEF tdp);
BGXFAM(PBGXFAM txfp);
// Implementation
virtual PTXF Duplicate(PGLOBAL g)
{return (PTXF)new(g) BGXFAM(this);}
// Methods
virtual int Cardinality(PGLOBAL g);
virtual bool OpenTableFile(PGLOBAL g);
virtual int ReadBuffer(PGLOBAL g);
virtual int WriteBuffer(PGLOBAL g);
virtual int DeleteRecords(PGLOBAL g, int irc);
virtual void CloseTableFile(PGLOBAL g);
virtual void Rewind(void);
protected:
bool BigSeek(PGLOBAL g, HANDLE h, BIGINT pos
, int org = FILE_BEGIN);
int BigRead(PGLOBAL g, HANDLE h, void *inbuf, int req);
bool BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req);
virtual bool OpenTempFile(PGLOBAL g);
virtual bool MoveIntermediateLines(PGLOBAL g, bool *b = NULL);
// Members
HANDLE Hfile; // Handle(descriptor) to big file
HANDLE Tfile; // Handle(descriptor) to big temp file
}; // end of class BGXFAM
#endif // __FILAMFIX_H
/************** FilAMFix H Declares Source Code File (.H) **************/
/* Name: FILAMFIX.H Version 1.3 */
/* */
/* (C) Copyright to the author Olivier BERTRAND 2005 - 2014 */
/* */
/* This file contains the FIX file access method classes declares. */
/***********************************************************************/
#ifndef __FILAMFIX_H
#define __FILAMFIX_H
#include "filamtxt.h"
typedef class FIXFAM *PFIXFAM;
typedef class BGXFAM *PBGXFAM;
/***********************************************************************/
/* This is the DOS/UNIX Access Method class declaration for standard */
/* files with fixed record format (FIX, BIN) */
/***********************************************************************/
class DllExport FIXFAM : public BLKFAM {
public:
// Constructor
FIXFAM(PDOSDEF tdp);
FIXFAM(PFIXFAM txfp);
// Implementation
virtual AMT GetAmType(void) {return TYPE_AM_FIX;}
virtual PTXF Duplicate(PGLOBAL g)
{return (PTXF)new(g) FIXFAM(this);}
// Methods
virtual int Cardinality(PGLOBAL g) {return TXTFAM::Cardinality(g);}
virtual int MaxBlkSize(PGLOBAL g, int s)
{return TXTFAM::MaxBlkSize(g, s);}
virtual bool AllocateBuffer(PGLOBAL g);
virtual void ResetBuffer(PGLOBAL g);
virtual int ReadBuffer(PGLOBAL g);
virtual int WriteBuffer(PGLOBAL g);
virtual int DeleteRecords(PGLOBAL g, int irc);
virtual void CloseTableFile(PGLOBAL g, bool abort);
protected:
virtual bool CopyHeader(PGLOBAL g) {return false;}
virtual bool MoveIntermediateLines(PGLOBAL g, bool *b);
// No additional members
}; // end of class FIXFAM
/***********************************************************************/
/* 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 of more than 2 gigabytes. */
/***********************************************************************/
class BGXFAM : public FIXFAM {
public:
// Constructor
BGXFAM(PDOSDEF tdp);
BGXFAM(PBGXFAM txfp);
// Implementation
virtual PTXF Duplicate(PGLOBAL g)
{return (PTXF)new(g) BGXFAM(this);}
// Methods
virtual int Cardinality(PGLOBAL g);
virtual bool OpenTableFile(PGLOBAL g);
virtual int ReadBuffer(PGLOBAL g);
virtual int WriteBuffer(PGLOBAL g);
virtual int DeleteRecords(PGLOBAL g, int irc);
virtual void CloseTableFile(PGLOBAL g, bool abort);
virtual void Rewind(void);
protected:
bool BigSeek(PGLOBAL g, HANDLE h, BIGINT pos
, int org = FILE_BEGIN);
int BigRead(PGLOBAL g, HANDLE h, void *inbuf, int req);
bool BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req);
virtual bool OpenTempFile(PGLOBAL g);
virtual bool MoveIntermediateLines(PGLOBAL g, bool *b = NULL);
// Members
HANDLE Hfile; // Handle(descriptor) to big file
HANDLE Tfile; // Handle(descriptor) to big temp file
}; // end of class BGXFAM
#endif // __FILAMFIX_H
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/***********************************************************************/
/* GLOBAL.H: Declaration file used by all CONNECT implementations. */
/* (C) Copyright Olivier Bertrand 1993-2012 */
/* (C) Copyright Olivier Bertrand 1993-2014 */
/***********************************************************************/
/***********************************************************************/
......@@ -23,12 +23,12 @@
#define XML_SUPPORT 1
#endif
#if defined(XMSG)
#if defined(XMSG)
// Definition used to read messages from message file.
#include "msgid.h"
#define MSG(I) PlugReadMessage(NULL, MSG_##I, #I)
#define STEP(I) PlugReadMessage(g, MSG_##I, #I)
#elif defined(NEWMSG)
#elif defined(NEWMSG)
// Definition used to get messages from resource.
#include "msgid.h"
#define MSG(I) PlugGetMessage(NULL, MSG_##I)
......@@ -223,6 +223,7 @@ typedef struct _global { /* Global structure */
int Createas; /* To pass info to created table */
void *Xchk; /* indexes in create/alter */
short Alchecked; /* Checked for ALTER */
short Mrr; /* True when doing mrr */
short Trace;
int jump_level;
jmp_buf jumper[MAX_JUMP + 2];
......
This diff is collapsed.
This diff is collapsed.
......@@ -571,6 +571,7 @@ PTDB MYCAT::GetTable(PGLOBAL g, PTABLE tablep, MODE mode, LPCSTR type)
tdbp->GetAmType());
tablep->SetTo_Tdb(tdbp);
tdbp->SetTable(tablep);
tdbp->SetMode(mode);
} // endif tdbp
return (tdbp);
......
This diff is collapsed.
......@@ -64,6 +64,7 @@ class DllItem MYSQLC {
// Methods
int GetResultSize(PGLOBAL g, PSZ sql);
int GetTableSize(PGLOBAL g, PSZ query);
int Open(PGLOBAL g, const char *host, const char *db,
const char *user= "root", const char *pwd= "*",
int pt= 0);
......
......@@ -21,8 +21,8 @@ DROP INDEX xd ON t1;
ALTER TABLE t1 ADD INDEX xc (c), ADD INDEX xd (d);
SHOW INDEX FROM t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 1 xc 1 c A NULL NULL NULL XPLUG
t1 1 xd 1 d A NULL NULL NULL XPLUG
t1 1 xc 1 c A NULL NULL NULL XINDEX
t1 1 xd 1 d A NULL NULL NULL XINDEX
ALTER TABLE t1 DROP INDEX xc, DROP INDEX xd;
SHOW INDEX FROM t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
......@@ -111,8 +111,8 @@ t1 CREATE TABLE `t1` (
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=DBF
SHOW INDEX FROM t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 1 xc 1 c A NULL NULL NULL XPLUG
t1 1 xd 1 d A NULL NULL NULL XPLUG
t1 1 xc 1 c A NULL NULL NULL XINDEX
t1 1 xd 1 d A NULL NULL NULL XINDEX
SELECT * FROM t1;
c d
1 One
......@@ -143,8 +143,8 @@ line
ALTER TABLE t1 ADD INDEX xc (c), ADD INDEX xd (d);
SHOW INDEX FROM t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 1 xc 1 c A NULL NULL NULL XPLUG
t1 1 xd 1 d A NULL NULL NULL XPLUG
t1 1 xc 1 c A NULL NULL NULL XINDEX
t1 1 xd 1 d A NULL NULL NULL XINDEX
SELECT d FROM t1 WHERE c = 2;
d
Two
......@@ -249,7 +249,7 @@ line
# Sure enough, the data file was not deleted.
#
ALTER TABLE t1 ENGINE=CONNECT;
ERROR HY000: Operation denied. Table data would be lost.
ERROR HY000: Operation denied. Table data would be modified.
#
# But changing back to CONNECT succeed
# if the data file does not exist.
......
......@@ -35,7 +35,7 @@ Warning 1105 No table_type. Will be set to DOS
SELECT * FROM t2;
line
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created by CONNECT Version 1.02.0002 March 16, 2014 -->
<!-- Created by the MariaDB CONNECT Storage Engine-->
<t1>
<row>
<TH>c</TH>
......@@ -71,7 +71,7 @@ t1 CREATE TABLE `t1` (
SELECT * FROM t2;
line
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created by CONNECT Version 1.02.0002 March 16, 2014 -->
<!-- Created by the MariaDB CONNECT Storage Engine-->
<t1>
<row d="One">
<c>1</c>
......
......@@ -193,8 +193,6 @@ Kevin 8
Lisbeth 2
Mary 2
ALTER TABLE xpet MODIFY number INT NOT NULL;
Warnings:
Warning 1105 This is an outward table, table data were not modified.
SELECT * FROM xpet;
name race number
John dog 2
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*************** Tabxml H Declares Source Code File (.H) ***************/
/* Name: TABXML.H Version 1.6 */
/* */
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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