mariadb/storage/connect/tabtbl.h
Vicențiu Ciorbaru 1e88e85503 Squashed commit of connect/10.0:
Main additions:

commit 543c2006a70983c2ce75024bce3679b0c20f9ae6
Author: Olivier Bertrand <bertrandop@gmail.com>
Date:   Thu Jan 4 13:51:13 2018 +0100

    - Fix MDEV-9844, MDEV-10179, MDEV-14214
     This is done by removing the tbl table type THREAD option
     that causes a multiple of sporadic bugs.
     This may be temporary depending on whether a real fix is found.
      modified:   storage/connect/mysql-test/connect/disabled.def
      modified:   storage/connect/tabtbl.cpp
      modified:   storage/connect/tabtbl.h

commit 54bc4ea024ca5fb5c137c618084d8cccfba2ee3f
Author: Olivier Bertrand <bertrandop@gmail.com>
Date:   Fri Nov 3 16:21:56 2017 +0100

    - Fix MDEV-13925: Actually this fixes SELECT queries when
      the WHERE clause have single quote.
      modified:   storage/connect/ha_connect.cc

    - Use Windows VirtualAlloc and VirtualFree for the Sarea workspace
      modified:   storage/connect/global.h
      modified:   storage/connect/ha_connect.cc
      modified:   storage/connect/jsonudf.cpp
      modified:   storage/connect/plgdbutl.cpp
      modified:   storage/connect/plugutil.cpp
      modified:   storage/connect/user_connect.cc

    - Change inihandl from c to c++.
      Because it now includes global.h that contains a bool function definition
      that make compile to fail on Linux.
      modified:   storage/connect/CMakeLists.txt
      removed:    storage/connect/inihandl.c
      added:      storage/connect/inihandl.cpp

    - Fix MDEV-13860 CONNECT engine does not build with JDBC without ODBC.
      By including Sergei's patch in connect_assisted_discovery.
      modified:   storage/connect/ha_connect.cc

commit c07064d31a4d7ee0533fec144648d93873c0dd17
Author: Olivier Bertrand <bertrandop@gmail.com>
Date:   Wed Oct 18 00:11:00 2017 +0200

    - Update version number
      modified:   storage/connect/ha_connect.cc

    - Include MONGO in all Java enabled distributions
      Mongo will be enabled only for 10.2 and 10.3
      modified:   storage/connect/CMakeLists.txt

    - Change JDBC_SUPPORT to JAVA_SUPPORT which also replaces MONGO_SUPPORT
      MONGO_SUPPORT is now just used to enable the MONGO table type
      modified:   storage/connect/filter.cpp
      modified:   storage/connect/ha_connect.cc
      modified:   storage/connect/ha_connect.h
      modified:   storage/connect/mongo.cpp
      modified:   storage/connect/mycat.cc
      modified:   storage/connect/plgdbutl.cpp
      modified:   storage/connect/tabjson.cpp
      modified:   storage/connect/tabjson.h

    - Move MakeSelector function from FILTER to mongo.cpp
      modified:   storage/connect/filter.cpp
      modified:   storage/connect/filter.h
      modified:   storage/connect/cmgoconn.cpp
      modified:   storage/connect/jmgoconn.cpp
      modified:   storage/connect/mongo.cpp

    - Do mongo_init only on first use of the MongoDB C Driver
      This will permit to delay load the mongo lib on Windows
      modified:   storage/connect/cmgoconn.cpp
      modified:   storage/connect/cmgoconn.h
      modified:   storage/connect/ha_connect.cc

    - Replace NEW_VAR by a test on MYSQL_VERSION_ID
      modified:   storage/connect/ha_connect.cc

    - Suppress enable_mongo session variable
      modified:   storage/connect/ha_connect.cc
      modified:   storage/connect/mycat.cc

    - Make some function headers identical in .h and .cc file
      (replacing const char* by PCSZ)
      modified:   storage/connect/ha_connect.cc
      modified:   storage/connect/ha_connect.h

    - Change a parameter type from uchar* to const uchar*
      (for ScanRecord and CheckRecord)
      modified:   storage/connect/ha_connect.cc
      modified:   storage/connect/ha_connect.h

    - Changes on LIKE and NOT LIKE does not fix a bug yet
      modified:   storage/connect/ha_connect.cc

    - Suppress PIVOT_SUPPORT (PIVOT type is unconditionnal)
      modified:   storage/connect/ha_connect.cc
      modified:   storage/connect/mycat.cc

    - Change the strz function from inline to static
      modified:   storage/connect/ha_connect.cc
      modified:   storage/connect/ha_connect.h

    - export the JavaConn class and the MgoColumns and IsNum functions
      modified:   storage/connect/javaconn.h
      modified:   storage/connect/json.h
      modified:   storage/connect/mongo.h

    - Fix MDEV-13924
      modified:   storage/connect/jdbconn.cpp

    - Make a temporary fix for the compiler bug in CalculateArray
      modified:   storage/connect/jsonudf.cpp
      modified:   storage/connect/tabjson.cpp

    - Typo
      modified:   storage/connect/jdbccat.h
      modified:   storage/connect/reldef.h
      modified:   storage/connect/tabext.h
      modified:   storage/connect/tabjmg.cpp
      modified:   storage/connect/tabxml.h
      modified:   storage/connect/valblk.h
      modified:   storage/connect/value.h
      modified:   storage/connect/xtable.h

    - Fix a bug in MONGO tests by changing 'MONGO' to $TYPE
      modified:   storage/connect/mysql-test/connect/t/mongo_test.inc

    - Record test results to reflect all changes
      modified:   storage/connect/mysql-test/connect/r/json_java_2.result
      modified:   storage/connect/mysql-test/connect/r/json_java_3.result
      modified:   storage/connect/mysql-test/connect/r/json_mongo_c.result
      modified:   storage/connect/mysql-test/connect/r/mongo_c.result
      modified:   storage/connect/mysql-test/connect/r/mongo_java_2.result
      modified:   storage/connect/mysql-test/connect/r/mongo_java_3.result

commit 3da90fd112e7d5ee6f0bd9c3fc3eeb4529b30e93
Author: Olivier Bertrand <bertrandop@gmail.com>
Date:   Wed Oct 11 12:21:56 2017 +0200

    Fix MDEV-13924 modified: storage/connect/jdbconn.cpp

commit 2566e67da80f291414f02c7dd6a8ca3557161d26
Author: Olivier Bertrand <bertrandop@gmail.com>
Date:   Mon Sep 11 16:38:41 2017 +0200

    Enable MONGO for the C driver. Modified: modified:   storage/connect/CMakeLists.txt

commit 27ae11db830c5d62bbf8b8b13cab976b74efe7dd
Author: Olivier Bertrand <bertrandop@gmail.com>
Date:   Tue Sep 5 19:52:04 2017 +0200

    - Update version number
      modified:   storage/connect/ha_connect.cc

    - Regard columns with binary charset as string (was binary)
      modified:   storage/connect/ha_connect.cc
      modified:   storage/connect/tabmysql.cpp
      modified:   storage/connect/tabutil.cpp

    - Support length 0 for CHAR and VARCHAR
      modified:   storage/connect/ha_connect.cc
      modified:   storage/connect/reldef.cpp
      modified:   storage/connect/value.cpp

    - Add ACCEPT option for void columns in discovery
      modified:   storage/connect/tabjson.cpp

    - Update some tests because of above change
      modified:   storage/connect/mysql-test/connect/r/json_java_2.result
      modified:   storage/connect/mysql-test/connect/r/json_java_3.result
      modified:   storage/connect/mysql-test/connect/r/json_mongo_c.result
      modified:   storage/connect/mysql-test/connect/r/mongo_c.result
      modified:   storage/connect/mysql-test/connect/r/mongo_java_2.result
      modified:   storage/connect/mysql-test/connect/r/mongo_java_3.result
      modified:   storage/connect/mysql-test/connect/r/odbc_oracle.result
      modified:   storage/connect/mysql-test/connect/r/updelx.result
      modified:   storage/connect/mysql-test/connect/t/mongo_test.inc

commit f6ee6cd1d42d861fa50fea8d9a7079347b7ddfd6
Author: Olivier Bertrand <bertrandop@gmail.com>
Date:   Sat Sep 2 16:06:10 2017 +0200

    - Fix MongoDB C Driver adding for CMAKE.
      Requires MongoDB C Driver version 1.7 now available
      modified:   storage/connect/CMakeLists.txt

    - Add more trace to tbl_thread.test (to debug failure)
      modified:   storage/connect/mysql-test/connect/r/tbl_thread.result
      modified:   storage/connect/mysql-test/connect/t/tbl_thread.test
2018-01-24 16:12:52 +02:00

168 lines
6.3 KiB
C++

/*************** TabTbl H Declares Source Code File (.H) ***************/
/* Name: TABTBL.H Version 1.3 */
/* */
/* (C) Copyright to the author Olivier BERTRAND 2008-2013 */
/* */
/* This file contains the TDBTBL classes declares. */
/***********************************************************************/
#include "block.h"
#include "colblk.h"
#include "tabutil.h"
typedef class TBLDEF *PTBLDEF;
typedef class TDBTBL *PTDBTBL;
typedef class MYSQLC *PMYC;
/***********************************************************************/
/* TBL table. */
/***********************************************************************/
class DllExport TBLDEF : public PRXDEF { /* Logical table description */
friend class TDBTBL;
friend class TDBTBC;
public:
// Constructor
TBLDEF(void);
// Implementation
virtual const char *GetType(void) {return "TBL";}
// Methods
virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff);
virtual PTDB GetTable(PGLOBAL g, MODE m);
protected:
// Members
bool Accept; /* TRUE if bad tables are accepted */
bool Thread; /* Use thread for remote tables */
int Maxerr; /* Maximum number of bad tables */
int Ntables; /* Number of tables */
}; // end of TBLDEF
/***********************************************************************/
/* This is the TBL Access Method class declaration. */
/***********************************************************************/
class DllExport TDBTBL : public TDBPRX {
friend class TBTBLK;
public:
// Constructor
TDBTBL(PTBLDEF tdp = NULL);
// Implementation
virtual AMT GetAmType(void) {return TYPE_AM_TBL;}
// Methods
virtual void ResetDB(void);
virtual int GetRecpos(void) {return Rows;}
virtual int GetBadLines(void) {return (int)Nbc;}
// Database routines
virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n);
virtual int Cardinality(PGLOBAL g);
virtual int GetMaxSize(PGLOBAL g);
virtual int RowNumber(PGLOBAL g, bool b = FALSE);
virtual PCOL InsertSpecialColumn(PCOL scp);
virtual bool OpenDB(PGLOBAL g);
virtual int ReadDB(PGLOBAL g);
protected:
// Internal functions
bool InitTableList(PGLOBAL g);
bool TestFil(PGLOBAL g, PCFIL filp, PTABLE tabp);
// Members
PTABLE Tablist; // Points to the table list
PTABLE CurTable; // Points to the current table
bool Accept; // TRUE if bad tables are accepted
int Maxerr; // Maximum number of bad tables
int Nbc; // Number of bad connections
int Rows; // Used for RowID
int Crp; // Used for CurPos
}; // end of class TDBTBL
/***********************************************************************/
/* Class TBTBLK: TDBPLG TABID special column descriptor. */
/***********************************************************************/
class TBTBLK : public TIDBLK {
public:
// The constructor must restore Value because XOBJECT has a void
// constructor called by default that set Value to NULL
TBTBLK(PVAL valp) {Value = valp;}
// Methods
virtual void ReadColumn(PGLOBAL g);
// Fake operator new used to change TIDBLK into SDTBLK
void * operator new(size_t size, TIDBLK *sp) {return sp;}
#if !defined(__BORLANDC__)
// Avoid warning C4291 by defining a matching dummy delete operator
void operator delete(void *, TIDBLK*) {}
void operator delete(void *, size_t size) {}
#endif
protected:
// Must not have additional members
}; // end of class TBTBLK
#if defined(DEVELOPMENT)
/***********************************************************************/
/* This table type is buggy and removed until a fix is found. */
/***********************************************************************/
typedef class TDBTBM *PTDBTBM;
/***********************************************************************/
/* Defines the structures used for distributed TBM tables. */
/***********************************************************************/
typedef struct _TBMtable *PTBMT;
typedef struct _TBMtable {
PTBMT Next; // Points to next data table struct
PTABLE Tap; // Points to the sub table
PGLOBAL G; // Needed in thread routine
bool Complete; // TRUE when all results are read
bool Ready; // TRUE when results are there
int Rows; // Total number of rows read so far
int ProgCur; // Current pos
int ProgMax; // Max pos
int Rc; // Return code
THD *Thd;
pthread_attr_t attr; // ???
pthread_t Tid; // CheckOpen thread ID
} TBMT;
/***********************************************************************/
/* This is the TBM Access Method class declaration. */
/***********************************************************************/
class DllExport TDBTBM : public TDBTBL {
friend class TBTBLK;
public:
// Constructor
TDBTBM(PTBLDEF tdp = NULL);
// Methods
virtual void ResetDB(void);
// Database routines
virtual int Cardinality(PGLOBAL g) { return 10; }
virtual int GetMaxSize(PGLOBAL g) { return 10; } // Temporary
virtual int RowNumber(PGLOBAL g, bool b = FALSE);
virtual bool OpenDB(PGLOBAL g);
virtual int ReadDB(PGLOBAL g);
protected:
// Internal functions
bool IsLocal(PTABLE tbp);
bool OpenTables(PGLOBAL g);
int ReadNextRemote(PGLOBAL g);
// Members
PTBMT Tmp; // To data table TBMT structures
PTBMT Cmp; // Current data table PLGF (to move to TDBTBL)
PTBMT Bmp; // To bad (unconnected) PLGF structures
bool Done; // TRUE after first GetAllResults
int Nrc; // Number of remote connections
int Nlc; // Number of local connections
}; // end of class TDBTBM
pthread_handler_t ThreadOpen(void *p);
#endif // DEVELOPMENT