Commit 6d8af36b authored by Oleksandr Byelkin's avatar Oleksandr Byelkin

Merge remote-tracking branch 'connect/10.2' into 10.2

parents ef7cb0a0 ad0d2424
...@@ -355,7 +355,6 @@ bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE mode, char *c1, char *c2, ...@@ -355,7 +355,6 @@ bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE mode, char *c1, char *c2,
} // endif mode } // endif mode
rcop = false; rcop = false;
} catch (int n) { } catch (int n) {
if (trace(1)) if (trace(1))
htrc("Exception %d: %s\n", n, g->Message); htrc("Exception %d: %s\n", n, g->Message);
......
This diff is collapsed.
...@@ -19,7 +19,7 @@ typedef class DBMFAM *PDBMFAM; ...@@ -19,7 +19,7 @@ typedef class DBMFAM *PDBMFAM;
/****************************************************************************/ /****************************************************************************/
/* Functions used externally. */ /* Functions used externally. */
/****************************************************************************/ /****************************************************************************/
PQRYRES DBFColumns(PGLOBAL g, PCSZ dp, PCSZ fn, bool info); PQRYRES DBFColumns(PGLOBAL g, PCSZ dp, PCSZ fn, PTOS tiop, bool info);
/****************************************************************************/ /****************************************************************************/
/* This is the base class for dBASE file access methods. */ /* This is the base class for dBASE file access methods. */
......
This diff is collapsed.
/************** filamzip H Declares Source Code File (.H) **************/ /************** filamzip H Declares Source Code File (.H) **************/
/* Name: filamzip.h Version 1.2 */ /* Name: filamzip.h Version 1.3 */
/* */ /* */
/* (C) Copyright to the author Olivier BERTRAND 2016-2017 */ /* (C) Copyright to the author Olivier BERTRAND 2016-2020 */
/* */ /* */
/* This file contains the ZIP file access method classes declares. */ /* This file contains the ZIP file access method classes declares. */
/***********************************************************************/ /***********************************************************************/
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "block.h" #include "block.h"
#include "filamap.h" #include "filamap.h"
#include "filamfix.h" #include "filamfix.h"
#include "filamdbf.h"
#include "zip.h" #include "zip.h"
#include "unzip.h" #include "unzip.h"
...@@ -18,6 +19,7 @@ ...@@ -18,6 +19,7 @@
typedef class UNZFAM *PUNZFAM; typedef class UNZFAM *PUNZFAM;
typedef class UZXFAM *PUZXFAM; typedef class UZXFAM *PUZXFAM;
typedef class UZDFAM* PUZDFAM;
typedef class ZIPFAM *PZIPFAM; typedef class ZIPFAM *PZIPFAM;
typedef class ZPXFAM *PZPXFAM; typedef class ZPXFAM *PZPXFAM;
...@@ -53,7 +55,7 @@ class DllExport ZIPUTIL : public BLOCK { ...@@ -53,7 +55,7 @@ class DllExport ZIPUTIL : public BLOCK {
class DllExport UNZIPUTL : public BLOCK { class DllExport UNZIPUTL : public BLOCK {
public: public:
// Constructor // Constructor
UNZIPUTL(PCSZ tgt, bool mul); UNZIPUTL(PCSZ tgt, PCSZ pw, bool mul);
UNZIPUTL(PDOSDEF tdp); UNZIPUTL(PDOSDEF tdp);
// Implementation // Implementation
...@@ -143,6 +145,36 @@ class DllExport UZXFAM : public MPXFAM { ...@@ -143,6 +145,36 @@ class DllExport UZXFAM : public MPXFAM {
PDOSDEF tdfp; PDOSDEF tdfp;
}; // end of UZXFAM }; // end of UZXFAM
/***********************************************************************/
/* This is the fixed unzip file access method. */
/***********************************************************************/
class DllExport UZDFAM : public DBMFAM {
//friend class UNZFAM;
public:
// Constructors
UZDFAM(PDOSDEF tdp);
UZDFAM(PUZDFAM txfp);
// Implementation
virtual AMT GetAmType(void) { return TYPE_AM_ZIP; }
virtual PTXF Duplicate(PGLOBAL g) { return (PTXF) new(g)UZDFAM(this); }
// Methods
virtual int GetFileLength(PGLOBAL g);
virtual int Cardinality(PGLOBAL g);
virtual bool OpenTableFile(PGLOBAL g);
virtual int GetNext(PGLOBAL g);
//virtual int ReadBuffer(PGLOBAL g);
protected:
int dbfhead(PGLOBAL g, void* buf);
int ScanHeader(PGLOBAL g, int* rln);
// Members
UNZIPUTL* zutp;
PDOSDEF tdfp;
}; // end of UZDFAM
/***********************************************************************/ /***********************************************************************/
/* This is the zip file access method. */ /* This is the zip file access method. */
/***********************************************************************/ /***********************************************************************/
......
...@@ -5884,7 +5884,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd, ...@@ -5884,7 +5884,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
} else switch (ttp) { } else switch (ttp) {
case TAB_DBF: case TAB_DBF:
qrp= DBFColumns(g, dpath, fn, fnc == FNC_COL); qrp= DBFColumns(g, dpath, fn, topt, fnc == FNC_COL);
break; break;
#if defined(ODBC_SUPPORT) #if defined(ODBC_SUPPORT)
case TAB_ODBC: case TAB_ODBC:
...@@ -6735,11 +6735,6 @@ int ha_connect::create(const char *name, TABLE *table_arg, ...@@ -6735,11 +6735,6 @@ int ha_connect::create(const char *name, TABLE *table_arg,
PCSZ m= GetListOption(g, "Mulentries", options->oplist, "NO"); PCSZ m= GetListOption(g, "Mulentries", options->oplist, "NO");
bool mul= *m == '1' || *m == 'Y' || *m == 'y' || !stricmp(m, "ON"); bool mul= *m == '1' || *m == 'Y' || *m == 'y' || !stricmp(m, "ON");
if (!entry && !mul) {
my_message(ER_UNKNOWN_ERROR, "Missing entry name", MYF(0));
DBUG_RETURN(HA_ERR_INTERNAL_ERROR);
} // endif entry
strcat(strcat(strcpy(dbpath, "./"), table->s->db.str), "/"); strcat(strcat(strcpy(dbpath, "./"), table->s->db.str), "/");
PlugSetPath(zbuf, options->filename, dbpath); PlugSetPath(zbuf, options->filename, dbpath);
PlugSetPath(buf, fn, dbpath); PlugSetPath(buf, fn, dbpath);
......
...@@ -380,7 +380,6 @@ MGODEF::MGODEF(void) ...@@ -380,7 +380,6 @@ MGODEF::MGODEF(void)
Uri = NULL; Uri = NULL;
Colist = NULL; Colist = NULL;
Filter = NULL; Filter = NULL;
Level = 0;
Base = 0; Base = 0;
Version = 0; Version = 0;
Pipe = false; Pipe = false;
......
...@@ -82,7 +82,6 @@ class DllExport MGODEF : public EXTDEF { /* Table description */ ...@@ -82,7 +82,6 @@ class DllExport MGODEF : public EXTDEF { /* Table description */
PSZ Wrapname; /* Java wrapper name */ PSZ Wrapname; /* Java wrapper name */
PCSZ Colist; /* Options list */ PCSZ Colist; /* Options list */
PCSZ Filter; /* Filtering query */ PCSZ Filter; /* Filtering query */
int Level; /* Used for catalog table */
int Base; /* The array index base */ int Base; /* The array index base */
int Version; /* The Java driver version */ int Version; /* The Java driver version */
bool Pipe; /* True is Colist is a pipeline */ bool Pipe; /* True is Colist is a pipeline */
......
...@@ -49,7 +49,7 @@ bool XMLDOCUMENT::InitZip(PGLOBAL g, PCSZ entry) ...@@ -49,7 +49,7 @@ bool XMLDOCUMENT::InitZip(PGLOBAL g, PCSZ entry)
{ {
#if defined(ZIP_SUPPORT) #if defined(ZIP_SUPPORT)
bool mul = (entry) ? strchr(entry, '*') || strchr(entry, '?') : false; bool mul = (entry) ? strchr(entry, '*') || strchr(entry, '?') : false;
zip = new(g) UNZIPUTL(entry, mul); zip = new(g) UNZIPUTL(entry, NULL, mul);
return zip == NULL; return zip == NULL;
#else // !ZIP_SUPPORT #else // !ZIP_SUPPORT
sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "ZIP"); sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "ZIP");
......
...@@ -26,6 +26,8 @@ ...@@ -26,6 +26,8 @@
#include "tabmul.h" #include "tabmul.h"
#include "filter.h" #include "filter.h"
PQRYRES MGOColumns(PGLOBAL g, PCSZ db, PCSZ uri, PTOS topt, bool info);
/* -------------------------- Class CMGDISC -------------------------- */ /* -------------------------- Class CMGDISC -------------------------- */
/***********************************************************************/ /***********************************************************************/
......
/************* TabDos C++ Program Source Code File (.CPP) **************/ /************* TabDos C++ Program Source Code File (.CPP) **************/
/* PROGRAM NAME: TABDOS */ /* PROGRAM NAME: TABDOS */
/* ------------- */ /* ------------- */
/* Version 4.9.4 */ /* Version 4.9.5 */
/* */ /* */
/* COPYRIGHT: */ /* COPYRIGHT: */
/* ---------- */ /* ---------- */
/* (C) Copyright to the author Olivier BERTRAND 1998-2019 */ /* (C) Copyright to the author Olivier BERTRAND 1998-2020 */
/* */ /* */
/* WHAT THIS PROGRAM DOES: */ /* WHAT THIS PROGRAM DOES: */
/* ----------------------- */ /* ----------------------- */
...@@ -359,7 +359,26 @@ PTDB DOSDEF::GetTable(PGLOBAL g, MODE mode) ...@@ -359,7 +359,26 @@ PTDB DOSDEF::GetTable(PGLOBAL g, MODE mode)
/* Allocate table and file processing class of the proper type. */ /* Allocate table and file processing class of the proper type. */
/* Column blocks will be allocated only when needed. */ /* Column blocks will be allocated only when needed. */
/*********************************************************************/ /*********************************************************************/
if (Zipped) { if (Recfm == RECFM_DBF) {
if (Catfunc == FNC_NO) {
if (Zipped) {
if (mode == MODE_READ || mode == MODE_ANY || mode == MODE_ALTER) {
txfp = new(g) UZDFAM(this);
} else {
strcpy(g->Message, "Zipped DBF tables are read only");
return NULL;
} // endif's mode
} else if (map)
txfp = new(g) DBMFAM(this);
else
txfp = new(g) DBFFAM(this);
tdbp = new(g) TDBFIX(this, txfp);
} else
tdbp = new(g) TDBDCL(this); // Catfunc should be 'C'
} else if (Zipped) {
#if defined(ZIP_SUPPORT) #if defined(ZIP_SUPPORT)
if (Recfm == RECFM_VAR) { if (Recfm == RECFM_VAR) {
if (mode == MODE_READ || mode == MODE_ANY || mode == MODE_ALTER) { if (mode == MODE_READ || mode == MODE_ANY || mode == MODE_ALTER) {
...@@ -389,17 +408,6 @@ PTDB DOSDEF::GetTable(PGLOBAL g, MODE mode) ...@@ -389,17 +408,6 @@ PTDB DOSDEF::GetTable(PGLOBAL g, MODE mode)
sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "ZIP"); sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "ZIP");
return NULL; return NULL;
#endif // !ZIP_SUPPORT #endif // !ZIP_SUPPORT
} else if (Recfm == RECFM_DBF) {
if (Catfunc == FNC_NO) {
if (map)
txfp = new(g) DBMFAM(this);
else
txfp = new(g) DBFFAM(this);
tdbp = new(g) TDBFIX(this, txfp);
} else // Catfunc should be 'C'
tdbp = new(g) TDBDCL(this);
} else if (Recfm != RECFM_VAR && Compressed < 2) { } else if (Recfm != RECFM_VAR && Compressed < 2) {
if (Huge) if (Huge)
txfp = new(g) BGXFAM(this); txfp = new(g) BGXFAM(this);
......
...@@ -30,6 +30,7 @@ class DllExport DOSDEF : public TABDEF { /* Logical table description */ ...@@ -30,6 +30,7 @@ class DllExport DOSDEF : public TABDEF { /* Logical table description */
friend class DBFBASE; friend class DBFBASE;
friend class UNZIPUTL; friend class UNZIPUTL;
friend class JSONCOL; friend class JSONCOL;
friend class TDBDCL;
public: public:
// Constructor // Constructor
DOSDEF(void); DOSDEF(void);
......
...@@ -98,18 +98,20 @@ class DllExport BINCOL : public DOSCOL { ...@@ -98,18 +98,20 @@ class DllExport BINCOL : public DOSCOL {
/* This is the class declaration for the DBF columns catalog table. */ /* This is the class declaration for the DBF columns catalog table. */
/***********************************************************************/ /***********************************************************************/
class TDBDCL : public TDBCAT { class TDBDCL : public TDBCAT {
public: public:
// Constructor // Constructor
TDBDCL(PDOSDEF tdp) : TDBCAT(tdp) {Fn = tdp->GetFn();} TDBDCL(PDOSDEF tdp) : TDBCAT(tdp)
{Fn = tdp->GetFn(); Topt = tdp->GetTopt();}
protected: protected:
// Specific routines // Specific routines
virtual PQRYRES GetResult(PGLOBAL g) virtual PQRYRES GetResult(PGLOBAL g)
{return DBFColumns(g, ((PTABDEF)To_Def)->GetPath(), Fn, false);} {return DBFColumns(g, ((PTABDEF)To_Def)->GetPath(), Fn, Topt, false);}
// Members // Members
PCSZ Fn; // The DBF file (path) name PCSZ Fn; // The DBF file (path) name
}; // end of class TDBOCL PTOS Topt;
}; // end of class TDBOCL
#endif // __TABFIX__ #endif // __TABFIX__
...@@ -739,6 +739,7 @@ PTDB JSONDEF::GetTable(PGLOBAL g, MODE m) ...@@ -739,6 +739,7 @@ PTDB JSONDEF::GetTable(PGLOBAL g, MODE m)
/***********************************************************************/ /***********************************************************************/
TDBJSN::TDBJSN(PJDEF tdp, PTXF txfp) : TDBDOS(tdp, txfp) TDBJSN::TDBJSN(PJDEF tdp, PTXF txfp) : TDBDOS(tdp, txfp)
{ {
G = NULL;
Top = NULL; Top = NULL;
Row = NULL; Row = NULL;
Val = NULL; Val = NULL;
......
...@@ -104,7 +104,6 @@ class DllExport JSONDEF : public DOSDEF { /* Table description */ ...@@ -104,7 +104,6 @@ class DllExport JSONDEF : public DOSDEF { /* Table description */
PCSZ Xcol; /* Name of expandable column */ PCSZ Xcol; /* Name of expandable column */
int Limit; /* Limit of multiple values */ int Limit; /* Limit of multiple values */
int Pretty; /* Depends on file structure */ int Pretty; /* Depends on file structure */
int Level; /* Used for catalog table */
int Base; /* The array index base */ int Base; /* The array index base */
bool Strict; /* Strict syntax checking */ bool Strict; /* Strict syntax checking */
char Sep; /* The Jpath separator */ char Sep; /* The Jpath separator */
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "filamzip.h" #include "filamzip.h"
#include "resource.h" // for IDS_COLUMNS #include "resource.h" // for IDS_COLUMNS
#include "tabdos.h" #include "tabdos.h"
#include "tabmul.h"
#include "tabzip.h" #include "tabzip.h"
/* -------------------------- Class ZIPDEF --------------------------- */ /* -------------------------- Class ZIPDEF --------------------------- */
...@@ -41,7 +42,14 @@ bool ZIPDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) ...@@ -41,7 +42,14 @@ bool ZIPDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
/***********************************************************************/ /***********************************************************************/
PTDB ZIPDEF::GetTable(PGLOBAL g, MODE m) PTDB ZIPDEF::GetTable(PGLOBAL g, MODE m)
{ {
return new(g) TDBZIP(this); PTDB tdbp = NULL;
tdbp = new(g) TDBZIP(this);
if (Multiple)
tdbp = new(g) TDBMUL(tdbp);
return tdbp;
} // end of GetTable } // end of GetTable
/* ------------------------------------------------------------------- */ /* ------------------------------------------------------------------- */
...@@ -108,7 +116,7 @@ int TDBZIP::Cardinality(PGLOBAL g) ...@@ -108,7 +116,7 @@ int TDBZIP::Cardinality(PGLOBAL g)
Cardinal = (err == UNZ_OK) ? (int)ginfo.number_entry : 0; Cardinal = (err == UNZ_OK) ? (int)ginfo.number_entry : 0;
} else } else
Cardinal = 0; Cardinal = 10; // Dummy for multiple tables
} // endif Cardinal } // endif Cardinal
...@@ -187,6 +195,7 @@ int TDBZIP::DeleteDB(PGLOBAL g, int irc) ...@@ -187,6 +195,7 @@ int TDBZIP::DeleteDB(PGLOBAL g, int irc)
void TDBZIP::CloseDB(PGLOBAL g) void TDBZIP::CloseDB(PGLOBAL g)
{ {
close(); close();
nexterr = UNZ_OK; // For multiple tables
Use = USE_READY; // Just to be clean Use = USE_READY; // Just to be clean
} // end of CloseDB } // end of CloseDB
......
...@@ -48,6 +48,8 @@ class DllExport TDBZIP : public TDBASE { ...@@ -48,6 +48,8 @@ class DllExport TDBZIP : public TDBASE {
// Implementation // Implementation
virtual AMT GetAmType(void) {return TYPE_AM_ZIP;} virtual AMT GetAmType(void) {return TYPE_AM_ZIP;}
virtual PCSZ GetFile(PGLOBAL) {return zfn;}
virtual void SetFile(PGLOBAL, PCSZ fn) {zfn = fn;}
// Methods // Methods
virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n); virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n);
......
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