summaryrefslogtreecommitdiff
path: root/storage/connect/filamzip.cpp
diff options
context:
space:
mode:
authorOlivier Bertrand <bertrandop@gmail.com>2016-12-14 14:20:23 +0100
committerOlivier Bertrand <bertrandop@gmail.com>2016-12-14 14:20:23 +0100
commit952306502ebf1b26c627c5dc8b141581eeb30671 (patch)
tree571d99c7035ad62c489f88ead60e5cbf32a14a9e /storage/connect/filamzip.cpp
parentd44723e62153d9fb4165d038e9448c20a3ad890b (diff)
downloadmariadb-git-952306502ebf1b26c627c5dc8b141581eeb30671.tar.gz
- MDEV-11295: developing handling files contained in ZIP file.
Enable using multiple zip files modified: storage/connect/filamzip.cpp modified: storage/connect/ha_connect.cc modified: storage/connect/ha_connect.h modified: storage/connect/mycat.h modified: storage/connect/tabdos.cpp modified: storage/connect/tabdos.h modified: storage/connect/tabfmt.cpp modified: storage/connect/tabjson.cpp
Diffstat (limited to 'storage/connect/filamzip.cpp')
-rw-r--r--storage/connect/filamzip.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/storage/connect/filamzip.cpp b/storage/connect/filamzip.cpp
index ea8b827974b..8386e5be481 100644
--- a/storage/connect/filamzip.cpp
+++ b/storage/connect/filamzip.cpp
@@ -48,11 +48,11 @@
ZIPFAM::ZIPFAM(PDOSDEF tdp) : MAPFAM(tdp)
{
zipfile = NULL;
- zfn = tdp->Zipfn;
- target = tdp->Fn;
+//zfn = tdp->Fn;
+ target = tdp->Entry;
//*fn = 0;
entryopen = false;
- multiple = tdp->Multiple;
+ multiple = (target && !(strchr(target, '*') || strchr(target, '?'))) ? 0 : 1;
// Init the case mapping table.
#if defined(__WIN__)
@@ -65,7 +65,7 @@ ZIPFAM::ZIPFAM(PDOSDEF tdp) : MAPFAM(tdp)
ZIPFAM::ZIPFAM(PZIPFAM txfp) : MAPFAM(txfp)
{
zipfile = txfp->zipfile;
- zfn = txfp->zfn;
+//zfn = txfp->zfn;
target = txfp->target;
//strcpy(fn, txfp->fn);
finfo = txfp->finfo;
@@ -129,7 +129,7 @@ int ZIPFAM::GetFileLength(PGLOBAL g)
bool ZIPFAM::open(PGLOBAL g, const char *filename)
{
if (!zipfile && !(zipfile = unzOpen64(filename)))
- sprintf(g->Message, "Zipfile open error");
+ sprintf(g->Message, "Zipfile open error on %s", filename);
return (zipfile == NULL);
} // end of open
@@ -205,7 +205,7 @@ bool ZIPFAM::OpenTableFile(PGLOBAL g)
/*********************************************************************/
if (mode == MODE_READ) {
// We used the file name relative to recorded datapath
- PlugSetPath(filename, zfn, Tdbp->GetPath());
+ PlugSetPath(filename, To_File, Tdbp->GetPath());
bool b = open(g, filename);
@@ -218,7 +218,7 @@ bool ZIPFAM::OpenTableFile(PGLOBAL g)
if (rc == UNZ_END_OF_LIST_OF_FILE) {
sprintf(g->Message, "Target file %s not in %s", target, filename);
- return true;
+ return false;
} else if (rc != UNZ_OK) {
sprintf(g->Message, "unzLocateFile rc=%d", rc);
return true;
@@ -229,7 +229,7 @@ bool ZIPFAM::OpenTableFile(PGLOBAL g)
return true;
else if (rc == RC_NF) {
sprintf(g->Message, "No match of %s in %s", target, filename);
- return true;
+ return false;
} // endif rc
} // endif multiple
@@ -258,7 +258,8 @@ bool ZIPFAM::OpenTableFile(PGLOBAL g)
} // endif fp
To_Fb = fp; // Useful when closing
- } // endif b
+ } else
+ return true;
} else {
strcpy(g->Message, "Only READ mode supported for ZIP files");