Commit e3163524 authored by Olivier Bertrand's avatar Olivier Bertrand

- Fix MDEV-22571 and MDEV-22572. Allow multiple ZIP table

  and enable using special column in them.
  modified:   storage/connect/tabzip.cpp
  modified:   storage/connect/tabzip.h
parent 674197e2
...@@ -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