summaryrefslogtreecommitdiff
path: root/storage/connect/filamzip.h
diff options
context:
space:
mode:
authorOlivier Bertrand <bertrandop@gmail.com>2016-12-23 16:58:32 +0100
committerOlivier Bertrand <bertrandop@gmail.com>2016-12-23 16:58:32 +0100
commite6b563f8be68d57df2a4c9b8e2b6c130855b18e4 (patch)
tree4aa72a2eb96696302cfc996e28ccdf76d9bfdeaa /storage/connect/filamzip.h
parent952306502ebf1b26c627c5dc8b141581eeb30671 (diff)
downloadmariadb-git-e6b563f8be68d57df2a4c9b8e2b6c130855b18e4.tar.gz
Fix some XML table type bugs:
- in DOMNODELIST::DropItem if (Listp == NULL || Listp->length <= n) return true; is wrong, should be: if (Listp == NULL || Listp->length < n) return true; - Crash in discovery with libxml2 in XMLColumns because: if (!tdp->Usedom) // nl was destroyed vp->nl = vp->pn->GetChildElements(g); is executed with vp->pn uninitialized. Fixed by adding: vp->pn = node; line 264. -In discovery with libxml2 some columns are not found. Because list was not recovered properly, nodes being modified and not reallocated. Fixed lines 214 and 277. modified: storage/connect/domdoc.cpp modified: storage/connect/tabxml.cpp Add support for zipped table files modified: storage/connect/domdoc.cpp modified: storage/connect/domdoc.h modified: storage/connect/filamap.cpp modified: storage/connect/filamap.h modified: storage/connect/filamzip.cpp modified: storage/connect/filamzip.h modified: storage/connect/ha_connect.cc modified: storage/connect/libdoc.cpp modified: storage/connect/plgdbutl.cpp modified: storage/connect/plgxml.cpp modified: storage/connect/plgxml.h modified: storage/connect/tabdos.cpp modified: storage/connect/tabdos.h modified: storage/connect/tabfmt.cpp modified: storage/connect/tabjson.cpp modified: storage/connect/tabxml.cpp
Diffstat (limited to 'storage/connect/filamzip.h')
-rw-r--r--storage/connect/filamzip.h86
1 files changed, 60 insertions, 26 deletions
diff --git a/storage/connect/filamzip.h b/storage/connect/filamzip.h
index c3c04b2b3bb..9312fb2f70e 100644
--- a/storage/connect/filamzip.h
+++ b/storage/connect/filamzip.h
@@ -18,66 +18,100 @@ typedef class ZIPFAM *PZIPFAM;
typedef class ZPXFAM *PZPXFAM;
/***********************************************************************/
+/* This is the ZIP utility fonctions class. */
+/***********************************************************************/
+class DllExport ZIPUTIL : public BLOCK {
+public:
+ // Constructor
+ ZIPUTIL(PSZ tgt, bool mul);
+//ZIPUTIL(ZIPUTIL *zutp);
+
+ // Implementation
+//PTXF Duplicate(PGLOBAL g) { return (PTXF) new(g)ZIPFAM(this); }
+
+ // Methods
+ virtual bool OpenTable(PGLOBAL g, MODE mode, char *fn);
+ bool open(PGLOBAL g, char *fn);
+ bool openEntry(PGLOBAL g);
+ void close(void);
+ void closeEntry(void);
+ bool WildMatch(PSZ pat, PSZ str);
+ int findEntry(PGLOBAL g, bool next);
+ int nextEntry(PGLOBAL g);
+
+ // Members
+ unzFile zipfile; // The ZIP container file
+ PSZ target; // The target file name
+ unz_file_info finfo; // The current file info
+ PFBLOCK fp;
+ char *memory;
+ uint size;
+ int multiple; // Multiple targets
+ bool entryopen; // True when open current entry
+ char fn[FILENAME_MAX]; // The current entry file name
+ char mapCaseTable[256];
+}; // end of ZIPFAM
+
+/***********************************************************************/
/* This is the ZIP file access method. */
/***********************************************************************/
class DllExport ZIPFAM : public MAPFAM {
+ friend class ZPXFAM;
public:
- // Constructor
+ // Constructors
ZIPFAM(PDOSDEF tdp);
ZIPFAM(PZIPFAM txfp);
+ ZIPFAM(PDOSDEF tdp, PZPXFAM txfp);
// Implementation
- virtual AMT GetAmType(void) {return TYPE_AM_ZIP;}
- virtual PTXF Duplicate(PGLOBAL g) {return (PTXF) new(g) ZIPFAM(this);}
+ virtual AMT GetAmType(void) { return TYPE_AM_ZIP; }
+ virtual PTXF Duplicate(PGLOBAL g) { return (PTXF) new(g)ZIPFAM(this); }
// Methods
+ virtual int Cardinality(PGLOBAL g);
virtual int GetFileLength(PGLOBAL g);
- virtual int Cardinality(PGLOBAL g) {return (g) ? 10 : 1;}
//virtual int MaxBlkSize(PGLOBAL g, int s) {return s;}
virtual bool OpenTableFile(PGLOBAL g);
- virtual bool DeferReading(void) {return false;}
- virtual int ReadBuffer(PGLOBAL g);
+ virtual bool DeferReading(void) { return false; }
+ virtual int GetNext(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);
- void close(void);
protected:
- bool open(PGLOBAL g, const char *filename);
- bool openEntry(PGLOBAL g);
- void closeEntry(void);
- bool WildMatch(PSZ pat, PSZ str);
- int findEntry(PGLOBAL g, bool next);
-
// Members
- unzFile zipfile; // The ZIP container file
-//PSZ zfn; // The ZIP file name
- PSZ target; // The target file name
- unz_file_info finfo; // The current file info
-//char fn[FILENAME_MAX]; // The current file name
- bool entryopen; // True when open current entry
- int multiple; // Multiple targets
- char mapCaseTable[256];
+ ZIPUTIL *zutp;
+ PSZ target;
+ bool mul;
}; // end of ZIPFAM
/***********************************************************************/
/* This is the fixed ZIP file access method. */
/***********************************************************************/
-class DllExport ZPXFAM : public ZIPFAM {
+class DllExport ZPXFAM : public MPXFAM {
+ friend class ZIPFAM;
public:
- // Constructor
+ // Constructors
ZPXFAM(PDOSDEF tdp);
ZPXFAM(PZPXFAM txfp);
// Implementation
- virtual PTXF Duplicate(PGLOBAL g) {return (PTXF) new(g) ZPXFAM(this);}
+ virtual AMT GetAmType(void) { return TYPE_AM_ZIP; }
+ virtual PTXF Duplicate(PGLOBAL g) { return (PTXF) new(g)ZPXFAM(this); }
// Methods
- virtual int ReadBuffer(PGLOBAL g);
+ 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:
// Members
- int Lrecl;
+ ZIPUTIL *zutp;
+ PSZ target;
+ bool mul;
}; // end of ZPXFAM
#endif // __FILAMZIP_H