Commit 1a554555 authored by vicentiu's avatar vicentiu

Merge remote-tracking branch 'connect/10.0' into bb-10.0-vicentiu

parents e9aed131 43147681
...@@ -35,7 +35,10 @@ public class ApacheInterface extends JdbcInterface { ...@@ -35,7 +35,10 @@ public class ApacheInterface extends JdbcInterface {
ds.setPassword(parms[3]); ds.setPassword(parms[3]);
pool.put(url, ds); pool.put(url, ds);
} // endif ds } // endif ds
// if (parms.length > 4 && parms[4] != null)
// ds.setConnectionProperties(parms[4]);
// Get a connection from the data source // Get a connection from the data source
conn = ds.getConnection(); conn = ds.getConnection();
......
...@@ -20,25 +20,25 @@ SET(CONNECT_SOURCES ...@@ -20,25 +20,25 @@ SET(CONNECT_SOURCES
ha_connect.cc connect.cc user_connect.cc mycat.cc ha_connect.cc connect.cc user_connect.cc mycat.cc
fmdlex.c osutil.c plugutil.c rcmsg.c rcmsg.h fmdlex.c osutil.c plugutil.c rcmsg.c rcmsg.h
array.cpp blkfil.cpp colblk.cpp csort.cpp array.cpp blkfil.cpp colblk.cpp csort.cpp
filamap.cpp filamdbf.cpp filamfix.cpp filamtxt.cpp filamvct.cpp filamzip.cpp filamap.cpp filamdbf.cpp filamfix.cpp filamgz.cpp filamtxt.cpp
filter.cpp json.cpp jsonudf.cpp maputil.cpp myconn.cpp myutil.cpp plgdbutl.cpp filter.cpp json.cpp jsonudf.cpp maputil.cpp myconn.cpp myutil.cpp plgdbutl.cpp
reldef.cpp tabcol.cpp tabdos.cpp tabfix.cpp tabfmt.cpp tabjson.cpp table.cpp reldef.cpp tabcol.cpp tabdos.cpp tabfix.cpp tabfmt.cpp tabjson.cpp table.cpp
tabmul.cpp tabmysql.cpp taboccur.cpp tabpivot.cpp tabsys.cpp tabtbl.cpp tabutil.cpp tabmul.cpp tabmysql.cpp taboccur.cpp tabpivot.cpp tabsys.cpp tabtbl.cpp tabutil.cpp
tabvct.cpp tabvir.cpp tabxcl.cpp valblk.cpp value.cpp xindex.cpp xobject.cpp tabvir.cpp tabxcl.cpp valblk.cpp value.cpp xindex.cpp xobject.cpp
array.h blkfil.h block.h catalog.h checklvl.h colblk.h connect.h csort.h array.h blkfil.h block.h catalog.h checklvl.h colblk.h connect.h csort.h
engmsg.h filamap.h filamdbf.h filamfix.h filamtxt.h filamvct.h filamzip.h engmsg.h filamap.h filamdbf.h filamfix.h filamgz.h filamtxt.h
filter.h global.h ha_connect.h inihandl.h json.h jsonudf.h maputil.h msgid.h filter.h global.h ha_connect.h inihandl.h json.h jsonudf.h maputil.h msgid.h
mycat.h myconn.h myutil.h os.h osutil.h plgcnx.h plgdbsem.h preparse.h reldef.h mycat.h myconn.h myutil.h os.h osutil.h plgcnx.h plgdbsem.h preparse.h reldef.h
resource.h tabcol.h tabdos.h tabfix.h tabfmt.h tabjson.h tabmul.h tabmysql.h resource.h tabcol.h tabdos.h tabfix.h tabfmt.h tabjson.h tabmul.h tabmysql.h
taboccur.h tabpivot.h tabsys.h tabtbl.h tabutil.h tabvct.h tabvir.h tabxcl.h taboccur.h tabpivot.h tabsys.h tabtbl.h tabutil.h tabvir.h tabxcl.h
user_connect.h valblk.h value.h xindex.h xobject.h xtable.h) user_connect.h valblk.h value.h xindex.h xobject.h xtable.h)
# #
# Definitions that are shared for all OSes # Definitions that are shared for all OSes
# #
add_definitions( -DMARIADB -DFORCE_INIT_OF_VARS -Dconnect_EXPORTS) add_definitions( -DMARIADB -DFORCE_INIT_OF_VARS -Dconnect_EXPORTS)
add_definitions( -DHUGE_SUPPORT -DZIP_SUPPORT -DPIVOT_SUPPORT ) add_definitions( -DHUGE_SUPPORT -DGZ_SUPPORT -DPIVOT_SUPPORT )
# #
...@@ -89,6 +89,18 @@ ELSE(NOT UNIX) ...@@ -89,6 +89,18 @@ ELSE(NOT UNIX)
ENDIF(UNIX) ENDIF(UNIX)
#
# VCT: the VEC format might be not supported in future versions
#
OPTION(CONNECT_WITH_VCT "Compile CONNECT storage engine with VCT support" ON)
IF(CONNECT_WITH_VCT)
SET(CONNECT_SOURCES ${CONNECT_SOURCES} filamvct.cpp tabvct.cpp filamvct.h tabvct.h)
add_definitions(-DVCT_SUPPORT)
ENDIF(CONNECT_WITH_VCT)
# #
# XML # XML
# #
...@@ -236,9 +248,9 @@ ENDIF(CONNECT_WITH_ODBC) ...@@ -236,9 +248,9 @@ ENDIF(CONNECT_WITH_ODBC)
# JDBC # JDBC
# #
IF(APPLE) IF(APPLE)
OPTION(CONNECT_WITH_JDBC "some comment" OFF) OPTION(CONNECT_WITH_JDBC "Compile CONNECT storage engine without JDBC support" OFF)
ELSE() ELSE()
OPTION(CONNECT_WITH_JDBC "some comment" ON) OPTION(CONNECT_WITH_JDBC "Compile CONNECT storage engine with JDBC support" ON)
ENDIF() ENDIF()
IF(CONNECT_WITH_JDBC) IF(CONNECT_WITH_JDBC)
...@@ -252,18 +264,33 @@ IF(CONNECT_WITH_JDBC) ...@@ -252,18 +264,33 @@ IF(CONNECT_WITH_JDBC)
SET(CONNECT_SOURCES ${CONNECT_SOURCES} SET(CONNECT_SOURCES ${CONNECT_SOURCES}
jdbconn.cpp tabjdbc.cpp jdbconn.h tabjdbc.h jdbccat.h jdbconn.cpp tabjdbc.cpp jdbconn.h tabjdbc.h jdbccat.h
JdbcInterface.java ApacheInterface.java MariadbInterface.java JdbcInterface.java ApacheInterface.java MariadbInterface.java
MysqlInterface.java OracleInterface.java PostgresqlInterface.java) MysqlInterface.java OracleInterface.java PostgresqlInterface.java
JavaWrappers.jar)
# TODO: Find how to compile and install the java wrapper classes # TODO: Find how to compile and install the java wrapper classes
# Find required libraries and include directories # Find required libraries and include directories
SET (JAVA_SOURCES JdbcInterface.java) SET (JAVA_SOURCES JdbcInterface.java)
add_jar(JdbcInterface ${JAVA_SOURCES}) add_jar(JdbcInterface ${JAVA_SOURCES})
install_jar(JdbcInterface DESTINATION ${INSTALL_PLUGINDIR} COMPONENT connect-engine) install_jar(JdbcInterface DESTINATION ${INSTALL_PLUGINDIR} COMPONENT connect-engine)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/JavaWrappers.jar
DESTINATION ${INSTALL_PLUGINDIR} COMPONENT connect-engine)
add_definitions(-DJDBC_SUPPORT) add_definitions(-DJDBC_SUPPORT)
ELSE() ELSE()
SET(JDBC_LIBRARY "") SET(JDBC_LIBRARY "")
ENDIF() ENDIF()
ENDIF(CONNECT_WITH_JDBC) ENDIF(CONNECT_WITH_JDBC)
#
# ZIP
#
OPTION(CONNECT_WITH_ZIP "Compile CONNECT storage engine with ZIP support" ON)
IF(CONNECT_WITH_ZIP)
SET(CONNECT_SOURCES ${CONNECT_SOURCES} filamzip.cpp tabzip.cpp unzip.c ioapi.c zip.c
filamzip.h tabzip.h ioapi.h unzip.h zip.h)
add_definitions(-DZIP_SUPPORT -DNOCRYPT)
ENDIF(CONNECT_WITH_ZIP)
# #
# XMAP # XMAP
......
This diff was suppressed by a .gitattributes entry.
...@@ -82,6 +82,9 @@ public class JdbcInterface { ...@@ -82,6 +82,9 @@ public class JdbcInterface {
System.out.println("URL=" + parms[1]); System.out.println("URL=" + parms[1]);
CheckURL(parms[1], null); CheckURL(parms[1], null);
// This is required for drivers using context class loaders
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
if (parms[2] != null && !parms[2].isEmpty()) { if (parms[2] != null && !parms[2].isEmpty()) {
if (DEBUG) if (DEBUG)
...@@ -220,6 +223,19 @@ public class JdbcInterface { ...@@ -220,6 +223,19 @@ public class JdbcInterface {
} // end of SetTimestampParm } // end of SetTimestampParm
public int SetNullParm(int i, int typ) {
int rc = 0;
try {
pstmt.setNull(i, typ);
} catch (Exception e) {
SetErrmsg(e);
rc = -1;
} // end try/catch
return rc;
} // end of SetNullParm
public int ExecutePrep() { public int ExecutePrep() {
int n = -3; int n = -3;
......
...@@ -89,30 +89,43 @@ DOMDOC::DOMDOC(char *nsl, char *nsdf, char *enc, PFBLOCK fp) ...@@ -89,30 +89,43 @@ DOMDOC::DOMDOC(char *nsl, char *nsdf, char *enc, PFBLOCK fp)
/******************************************************************/ /******************************************************************/
/* Initialize XML parser and check library compatibility. */ /* Initialize XML parser and check library compatibility. */
/******************************************************************/ /******************************************************************/
bool DOMDOC::Initialize(PGLOBAL g) bool DOMDOC::Initialize(PGLOBAL g, char *entry, bool zipped)
{ {
if (TestHr(g, CoInitialize(NULL))) if (zipped && InitZip(g, entry))
return true;
if (TestHr(g, CoInitialize(NULL)))
return true; return true;
if (TestHr(g, Docp.CreateInstance("msxml2.domdocument"))) if (TestHr(g, Docp.CreateInstance("msxml2.domdocument")))
return true; return true;
return MakeNSlist(g); return MakeNSlist(g);
} // end of Initialize } // end of Initialize
/******************************************************************/ /******************************************************************/
/* Parse the XML file and construct node tree in memory. */ /* Parse the XML file and construct node tree in memory. */
/******************************************************************/ /******************************************************************/
bool DOMDOC::ParseFile(char *fn) bool DOMDOC::ParseFile(PGLOBAL g, char *fn)
{ {
// Load the document bool b;
Docp->async = false; Docp->async = false;
if (!(bool)Docp->load((_bstr_t)fn)) if (zip) {
// Parse an in memory document
char *xdoc = GetMemDoc(g, fn);
b = (xdoc) ? (bool)Docp->loadXML((_bstr_t)xdoc) : false;
} else
// Load the document
b = (bool)Docp->load((_bstr_t)fn);
if (!b)
return true; return true;
return false; return false;
} // end of ParseFile } // end of ParseFile
/******************************************************************/ /******************************************************************/
/* Create or reuse an Xblock for this document. */ /* Create or reuse an Xblock for this document. */
...@@ -239,6 +252,7 @@ int DOMDOC::DumpDoc(PGLOBAL g, char *ofn) ...@@ -239,6 +252,7 @@ int DOMDOC::DumpDoc(PGLOBAL g, char *ofn)
void DOMDOC::CloseDoc(PGLOBAL g, PFBLOCK xp) void DOMDOC::CloseDoc(PGLOBAL g, PFBLOCK xp)
{ {
CloseXMLFile(g, xp, false); CloseXMLFile(g, xp, false);
CloseZip();
} // end of Close } // end of Close
/* ----------------------- class DOMNODE ------------------------ */ /* ----------------------- class DOMNODE ------------------------ */
...@@ -616,13 +630,13 @@ PXNODE DOMNODELIST::GetItem(PGLOBAL g, int n, PXNODE np) ...@@ -616,13 +630,13 @@ PXNODE DOMNODELIST::GetItem(PGLOBAL g, int n, PXNODE np)
/* Reset the pointer on the deleted item. */ /* Reset the pointer on the deleted item. */
/******************************************************************/ /******************************************************************/
bool DOMNODELIST::DropItem(PGLOBAL g, int n) bool DOMNODELIST::DropItem(PGLOBAL g, int n)
{ {
if (Listp == NULL || Listp->length <= n) if (Listp == NULL || Listp->length < n)
return true; return true;
//Listp->item[n] = NULL; La proprit n'a pas de mthode 'set' //Listp->item[n] = NULL; La proprit n'a pas de mthode 'set'
return false; return false;
} // end of DeleteItem } // end of DeleteItem
/* ----------------------- class DOMATTR ------------------------ */ /* ----------------------- class DOMATTR ------------------------ */
......
...@@ -37,8 +37,8 @@ class DOMDOC : public XMLDOCUMENT { ...@@ -37,8 +37,8 @@ class DOMDOC : public XMLDOCUMENT {
virtual void SetNofree(bool b) {} // Only libxml2 virtual void SetNofree(bool b) {} // Only libxml2
// Methods // Methods
virtual bool Initialize(PGLOBAL g); virtual bool Initialize(PGLOBAL g, char *entry, bool zipped);
virtual bool ParseFile(char *fn); virtual bool ParseFile(PGLOBAL g, char *fn);
virtual bool NewDoc(PGLOBAL g, char *ver); virtual bool NewDoc(PGLOBAL g, char *ver);
virtual void AddComment(PGLOBAL g, char *com); virtual void AddComment(PGLOBAL g, char *com);
virtual PXNODE GetRoot(PGLOBAL g); virtual PXNODE GetRoot(PGLOBAL g);
......
...@@ -87,7 +87,7 @@ int MAPFAM::GetFileLength(PGLOBAL g) ...@@ -87,7 +87,7 @@ int MAPFAM::GetFileLength(PGLOBAL g)
{ {
int len; int len;
len = (To_Fb) ? To_Fb->Length : TXTFAM::GetFileLength(g); len = (To_Fb && To_Fb->Count) ? To_Fb->Length : TXTFAM::GetFileLength(g);
if (trace) if (trace)
htrc("Mapped file length=%d\n", len); htrc("Mapped file length=%d\n", len);
...@@ -319,11 +319,13 @@ int MAPFAM::SkipRecord(PGLOBAL g, bool header) ...@@ -319,11 +319,13 @@ int MAPFAM::SkipRecord(PGLOBAL g, bool header)
/***********************************************************************/ /***********************************************************************/
int MAPFAM::ReadBuffer(PGLOBAL g) int MAPFAM::ReadBuffer(PGLOBAL g)
{ {
int len; int rc, len;
// Are we at the end of the memory // Are we at the end of the memory
if (Mempos >= Top) if (Mempos >= Top)
return RC_EF; if ((rc = GetNext(g)) != RC_OK)
return rc;
if (!Placed) { if (!Placed) {
/*******************************************************************/ /*******************************************************************/
...@@ -341,8 +343,10 @@ int MAPFAM::ReadBuffer(PGLOBAL g) ...@@ -341,8 +343,10 @@ int MAPFAM::ReadBuffer(PGLOBAL g)
/*******************************************************************/ /*******************************************************************/
switch (Tdbp->TestBlock(g)) { switch (Tdbp->TestBlock(g)) {
case RC_EF: case RC_EF:
return RC_EF; if ((rc = GetNext(g)) != RC_OK)
case RC_NF: return rc;
case RC_NF:
// Skip this record // Skip this record
if ((rc = SkipRecord(g, false)) != RC_OK) if ((rc = SkipRecord(g, false)) != RC_OK)
return rc; return rc;
...@@ -413,7 +417,7 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc) ...@@ -413,7 +417,7 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc)
if (Tpos == Spos) { if (Tpos == Spos) {
/*******************************************************************/ /*******************************************************************/
/* First line to delete. Move of eventual preceeding lines is */ /* First line to delete. Move of eventual preceding lines is */
/* not required here, just setting of future Spos and Tpos. */ /* not required here, just setting of future Spos and Tpos. */
/*******************************************************************/ /*******************************************************************/
Tpos = Spos = Fpos; Tpos = Spos = Fpos;
...@@ -498,7 +502,7 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc) ...@@ -498,7 +502,7 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc)
void MAPFAM::CloseTableFile(PGLOBAL g, bool) void MAPFAM::CloseTableFile(PGLOBAL g, bool)
{ {
PlugCloseFile(g, To_Fb); PlugCloseFile(g, To_Fb);
To_Fb = NULL; // To get correct file size in Cardinality //To_Fb = NULL; // To get correct file size in Cardinality
if (trace) if (trace)
htrc("MAP Close: closing %s count=%d\n", htrc("MAP Close: closing %s count=%d\n",
...@@ -569,7 +573,7 @@ int MBKFAM::GetRowID(void) ...@@ -569,7 +573,7 @@ int MBKFAM::GetRowID(void)
/***********************************************************************/ /***********************************************************************/
int MBKFAM::ReadBuffer(PGLOBAL g) int MBKFAM::ReadBuffer(PGLOBAL g)
{ {
int len; int rc, len;
/*********************************************************************/ /*********************************************************************/
/* Sequential block reading when Placed is not true. */ /* Sequential block reading when Placed is not true. */
...@@ -577,8 +581,10 @@ int MBKFAM::ReadBuffer(PGLOBAL g) ...@@ -577,8 +581,10 @@ int MBKFAM::ReadBuffer(PGLOBAL g)
if (Placed) { if (Placed) {
Placed = false; Placed = false;
} else if (Mempos >= Top) { // Are we at the end of the memory } else if (Mempos >= Top) { // Are we at the end of the memory
return RC_EF; if ((rc = GetNext(g)) != RC_OK)
} else if (++CurNum < Nrec) { return rc;
} else if (++CurNum < Nrec) {
Fpos = Mempos; Fpos = Mempos;
} else { } else {
/*******************************************************************/ /*******************************************************************/
...@@ -588,7 +594,8 @@ int MBKFAM::ReadBuffer(PGLOBAL g) ...@@ -588,7 +594,8 @@ int MBKFAM::ReadBuffer(PGLOBAL g)
next: next:
if (++CurBlk >= Block) if (++CurBlk >= Block)
return RC_EF; if ((rc = GetNext(g)) != RC_OK)
return rc;
/*******************************************************************/ /*******************************************************************/
/* Before reading a new block, check whether block optimization */ /* Before reading a new block, check whether block optimization */
...@@ -596,8 +603,11 @@ int MBKFAM::ReadBuffer(PGLOBAL g) ...@@ -596,8 +603,11 @@ int MBKFAM::ReadBuffer(PGLOBAL g)
/*******************************************************************/ /*******************************************************************/
switch (Tdbp->TestBlock(g)) { switch (Tdbp->TestBlock(g)) {
case RC_EF: case RC_EF:
return RC_EF; if ((rc = GetNext(g)) != RC_OK)
case RC_NF: return rc;
break;
case RC_NF:
goto next; goto next;
} // endswitch rc } // endswitch rc
...@@ -697,14 +707,18 @@ int MPXFAM::InitDelete(PGLOBAL, int fpos, int) ...@@ -697,14 +707,18 @@ int MPXFAM::InitDelete(PGLOBAL, int fpos, int)
/***********************************************************************/ /***********************************************************************/
int MPXFAM::ReadBuffer(PGLOBAL g) int MPXFAM::ReadBuffer(PGLOBAL g)
{ {
int rc;
/*********************************************************************/ /*********************************************************************/
/* Sequential block reading when Placed is not true. */ /* Sequential block reading when Placed is not true. */
/*********************************************************************/ /*********************************************************************/
if (Placed) { if (Placed) {
Placed = false; Placed = false;
} else if (Mempos >= Top) { // Are we at the end of the memory } else if (Mempos >= Top) { // Are we at the end of the memory
return RC_EF; if ((rc = GetNext(g)) != RC_OK)
} else if (++CurNum < Nrec) { return rc;
} else if (++CurNum < Nrec) {
Fpos = Mempos; Fpos = Mempos;
} else { } else {
/*******************************************************************/ /*******************************************************************/
...@@ -714,7 +728,7 @@ int MPXFAM::ReadBuffer(PGLOBAL g) ...@@ -714,7 +728,7 @@ int MPXFAM::ReadBuffer(PGLOBAL g)
next: next:
if (++CurBlk >= Block) if (++CurBlk >= Block)
return RC_EF; return GetNext(g);
/*******************************************************************/ /*******************************************************************/
/* Before reading a new block, check whether block optimization */ /* Before reading a new block, check whether block optimization */
...@@ -722,8 +736,11 @@ int MPXFAM::ReadBuffer(PGLOBAL g) ...@@ -722,8 +736,11 @@ int MPXFAM::ReadBuffer(PGLOBAL g)
/*******************************************************************/ /*******************************************************************/
switch (Tdbp->TestBlock(g)) { switch (Tdbp->TestBlock(g)) {
case RC_EF: case RC_EF:
return RC_EF; if ((rc = GetNext(g)) != RC_OK)
case RC_NF: return rc;
break;
case RC_NF:
goto next; goto next;
} // endswitch rc } // endswitch rc
......
...@@ -41,7 +41,8 @@ class DllExport MAPFAM : public TXTFAM { ...@@ -41,7 +41,8 @@ class DllExport MAPFAM : public TXTFAM {
virtual int SkipRecord(PGLOBAL g, bool header); virtual int SkipRecord(PGLOBAL g, bool header);
virtual bool OpenTableFile(PGLOBAL g); virtual bool OpenTableFile(PGLOBAL g);
virtual bool DeferReading(void) {return false;} virtual bool DeferReading(void) {return false;}
virtual int ReadBuffer(PGLOBAL g); virtual int GetNext(PGLOBAL g) {return RC_EF;}
virtual int ReadBuffer(PGLOBAL g);
virtual int WriteBuffer(PGLOBAL g); virtual int WriteBuffer(PGLOBAL g);
virtual int DeleteRecords(PGLOBAL g, int irc); virtual int DeleteRecords(PGLOBAL g, int irc);
virtual void CloseTableFile(PGLOBAL g, bool abort); virtual void CloseTableFile(PGLOBAL g, bool abort);
......
This diff is collapsed.
/*************** FilAmGz H Declares Source Code File (.H) **************/
/* Name: FILAMGZ.H Version 1.3 */
/* */
/* (C) Copyright to the author Olivier BERTRAND 2005-2016 */
/* */
/* This file contains the GZIP access method classes declares. */
/***********************************************************************/
#ifndef __FILAMGZ_H
#define __FILAMGZ_H
#include "zlib.h"
typedef class GZFAM *PGZFAM;
typedef class ZBKFAM *PZBKFAM;
typedef class ZIXFAM *PZIXFAM;
typedef class ZLBFAM *PZLBFAM;
/***********************************************************************/
/* This is the access method class declaration for not optimized */
/* variable record length files compressed using the gzip library */
/* functions. File is accessed record by record (row). */
/***********************************************************************/
class DllExport GZFAM : public TXTFAM {
// friend class DOSCOL;
public:
// Constructor
GZFAM(PDOSDEF tdp) : TXTFAM(tdp) {Zfile = NULL; Zpos = 0;}
GZFAM(PGZFAM txfp);
// Implementation
virtual AMT GetAmType(void) {return TYPE_AM_GZ;}
virtual int GetPos(void);
virtual int GetNextPos(void);
virtual PTXF Duplicate(PGLOBAL g)
{return (PTXF)new(g) GZFAM(this);}
// Methods
virtual void Reset(void);
virtual int GetFileLength(PGLOBAL g);
virtual int Cardinality(PGLOBAL g) {return (g) ? -1 : 0;}
virtual int MaxBlkSize(PGLOBAL g, int s) {return s;}
virtual bool AllocateBuffer(PGLOBAL g);
virtual int GetRowID(void);
virtual bool RecordPos(PGLOBAL g);
virtual bool SetPos(PGLOBAL g, int recpos);
virtual int SkipRecord(PGLOBAL g, bool header);
virtual bool OpenTableFile(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);
virtual void Rewind(void);
protected:
int Zerror(PGLOBAL g); // GZ error function
// Members
gzFile Zfile; // Points to GZ file structure
z_off_t Zpos; // Uncompressed file position
}; // end of class GZFAM
/***********************************************************************/
/* This is the access method class declaration for optimized variable */
/* record length files compressed using the gzip library functions. */
/* The File is accessed by block (requires an opt file). */
/***********************************************************************/
class DllExport ZBKFAM : public GZFAM {
public:
// Constructor
ZBKFAM(PDOSDEF tdp);
ZBKFAM(PZBKFAM txfp);
// Implementation
virtual int GetPos(void);
virtual int GetNextPos(void) {return 0;}
virtual PTXF Duplicate(PGLOBAL g)
{return (PTXF)new(g) ZBKFAM(this);}
// Methods
virtual int Cardinality(PGLOBAL g);
virtual int MaxBlkSize(PGLOBAL g, int s);
virtual bool AllocateBuffer(PGLOBAL g);
virtual int GetRowID(void);
virtual bool RecordPos(PGLOBAL g);
virtual int SkipRecord(PGLOBAL g, bool header);
virtual int ReadBuffer(PGLOBAL g);
virtual int WriteBuffer(PGLOBAL g);
virtual int DeleteRecords(PGLOBAL g, int irc);
virtual void CloseTableFile(PGLOBAL g, bool abort);
virtual void Rewind(void);
protected:
// Members
char *CurLine; // Position of current line in buffer
char *NxtLine; // Position of Next line in buffer
bool Closing; // True when closing on Insert
}; // end of class ZBKFAM
/***********************************************************************/
/* This is the access method class declaration for fixed record */
/* length files compressed using the gzip library functions. */
/* The file is always accessed by block. */
/***********************************************************************/
class DllExport ZIXFAM : public ZBKFAM {
public:
// Constructor
ZIXFAM(PDOSDEF tdp);
ZIXFAM(PZIXFAM txfp) : ZBKFAM(txfp) {}
// Implementation
virtual int GetNextPos(void) {return 0;}
virtual PTXF Duplicate(PGLOBAL g)
{return (PTXF)new(g) ZIXFAM(this);}
// Methods
virtual int Cardinality(PGLOBAL g);
virtual bool AllocateBuffer(PGLOBAL g);
virtual int ReadBuffer(PGLOBAL g);
virtual int WriteBuffer(PGLOBAL g);
protected:
// No additional Members
}; // end of class ZIXFAM
/***********************************************************************/
/* This is the DOS/UNIX Access Method class declaration for PlugDB */
/* fixed/variable files compressed using the zlib library functions. */
/* Physically these are written and read using the same technique */
/* than blocked variable files, only the contain of each block is */
/* compressed using the deflate zlib function. The purpose of this */
/* specific format is to have a fast mechanism for direct access of */
/* records so blocked optimization is fast and direct access (joins) */
/* is allowed. Note that the block length is written ahead of each */
/* block to enable reading when optimization file is not available. */
/***********************************************************************/
class DllExport ZLBFAM : public BLKFAM {
public:
// Constructor
ZLBFAM(PDOSDEF tdp);
ZLBFAM(PZLBFAM txfp);
// Implementation
virtual AMT GetAmType(void) {return TYPE_AM_ZLIB;}
virtual int GetPos(void);
virtual int GetNextPos(void);
virtual PTXF Duplicate(PGLOBAL g)
{return (PTXF)new(g) ZLBFAM(this);}
inline void SetOptimized(bool b) {Optimized = b;}
// Methods
virtual int GetFileLength(PGLOBAL g);
virtual bool SetPos(PGLOBAL g, int recpos);
virtual bool AllocateBuffer(PGLOBAL g);
virtual int ReadBuffer(PGLOBAL g);
virtual int WriteBuffer(PGLOBAL g);
virtual void CloseTableFile(PGLOBAL g, bool abort);
virtual void Rewind(void);
protected:
bool WriteCompressedBuffer(PGLOBAL g);
int ReadCompressedBuffer(PGLOBAL g, void *rdbuf);
// Members
z_streamp Zstream; // Compression/decompression stream
Byte *Zbuffer; // Compressed block buffer
int *Zlenp; // Pointer to block length
bool Optimized; // true when opt file is available
}; // end of class ZLBFAM
#endif // __FILAMGZ_H
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.0 */
/* */ /* */
/* (C) Copyright to the author Olivier BERTRAND 2005-2014 */ /* (C) Copyright to the author Olivier BERTRAND 2016 */
/* */ /* */
/* This file contains the GZIP access method classes declares. */ /* This file contains the ZIP file access method classes declares. */
/***********************************************************************/ /***********************************************************************/
#ifndef __FILAMZIP_H #ifndef __FILAMZIP_H
#define __FILAMZIP_H #define __FILAMZIP_H
#include "zlib.h" #include "block.h"
#include "filamap.h"
#include "unzip.h"
typedef class ZIPFAM *PZIPFAM; #define DLLEXPORT extern "C"
typedef class ZBKFAM *PZBKFAM;
typedef class ZIXFAM *PZIXFAM;
typedef class ZLBFAM *PZLBFAM;
/***********************************************************************/ typedef class ZIPFAM *PZIPFAM;
/* This is the access method class declaration for not optimized */ typedef class ZPXFAM *PZPXFAM;
/* variable record length files compressed using the gzip library */
/* functions. File is accessed record by record (row). */
/***********************************************************************/
class DllExport ZIPFAM : public TXTFAM {
// friend class DOSCOL;
public:
// Constructor
ZIPFAM(PDOSDEF tdp) : TXTFAM(tdp) {Zfile = NULL; Zpos = 0;}
ZIPFAM(PZIPFAM txfp);
// Implementation
virtual AMT GetAmType(void) {return TYPE_AM_ZIP;}
virtual int GetPos(void);
virtual int GetNextPos(void);
virtual PTXF Duplicate(PGLOBAL g)
{return (PTXF)new(g) ZIPFAM(this);}
// Methods
virtual void Reset(void);
virtual int GetFileLength(PGLOBAL g);
virtual int Cardinality(PGLOBAL g) {return (g) ? -1 : 0;}
virtual int MaxBlkSize(PGLOBAL g, int s) {return s;}
virtual bool AllocateBuffer(PGLOBAL g);
virtual int GetRowID(void);
virtual bool RecordPos(PGLOBAL g);
virtual bool SetPos(PGLOBAL g, int recpos);
virtual int SkipRecord(PGLOBAL g, bool header);
virtual bool OpenTableFile(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);
virtual void Rewind(void);
protected:
int Zerror(PGLOBAL g); // GZ error function
// Members
gzFile Zfile; // Points to GZ file structure
z_off_t Zpos; // Uncompressed file position
}; // end of class ZIPFAM
/***********************************************************************/ /***********************************************************************/
/* This is the access method class declaration for optimized variable */ /* This is the ZIP utility fonctions class. */
/* record length files compressed using the gzip library functions. */
/* The File is accessed by block (requires an opt file). */
/***********************************************************************/ /***********************************************************************/
class DllExport ZBKFAM : public ZIPFAM { class DllExport ZIPUTIL : public BLOCK {
public: public:
// Constructor // Constructor
ZBKFAM(PDOSDEF tdp); ZIPUTIL(PSZ tgt, bool mul);
ZBKFAM(PZBKFAM txfp); //ZIPUTIL(ZIPUTIL *zutp);
// Implementation // Implementation
virtual int GetPos(void); //PTXF Duplicate(PGLOBAL g) { return (PTXF) new(g)ZIPFAM(this); }
virtual int GetNextPos(void) {return 0;}
virtual PTXF Duplicate(PGLOBAL g) // Methods
{return (PTXF)new(g) ZBKFAM(this);} virtual bool OpenTable(PGLOBAL g, MODE mode, char *fn);
bool open(PGLOBAL g, char *fn);
// Methods bool openEntry(PGLOBAL g);
virtual int Cardinality(PGLOBAL g); void close(void);
virtual int MaxBlkSize(PGLOBAL g, int s); void closeEntry(void);
virtual bool AllocateBuffer(PGLOBAL g); bool WildMatch(PSZ pat, PSZ str);
virtual int GetRowID(void); int findEntry(PGLOBAL g, bool next);
virtual bool RecordPos(PGLOBAL g); int nextEntry(PGLOBAL g);
virtual int SkipRecord(PGLOBAL g, bool header);
virtual int ReadBuffer(PGLOBAL g); // Members
virtual int WriteBuffer(PGLOBAL g); unzFile zipfile; // The ZIP container file
virtual int DeleteRecords(PGLOBAL g, int irc); PSZ target; // The target file name
virtual void CloseTableFile(PGLOBAL g, bool abort); unz_file_info finfo; // The current file info
virtual void Rewind(void); PFBLOCK fp;
char *memory;
protected: uint size;
// Members int multiple; // Multiple targets
char *CurLine; // Position of current line in buffer bool entryopen; // True when open current entry
char *NxtLine; // Position of Next line in buffer char fn[FILENAME_MAX]; // The current entry file name
bool Closing; // True when closing on Insert char mapCaseTable[256];
}; // end of class ZBKFAM }; // end of ZIPFAM
/***********************************************************************/ /***********************************************************************/
/* This is the access method class declaration for fixed record */ /* This is the ZIP file access method. */
/* length files compressed using the gzip library functions. */
/* The file is always accessed by block. */
/***********************************************************************/ /***********************************************************************/
class DllExport ZIXFAM : public ZBKFAM { class DllExport ZIPFAM : public MAPFAM {
public: friend class ZPXFAM;
// Constructor public:
ZIXFAM(PDOSDEF tdp); // Constructors
ZIXFAM(PZIXFAM txfp) : ZBKFAM(txfp) {} ZIPFAM(PDOSDEF tdp);
ZIPFAM(PZIPFAM txfp);
// Implementation ZIPFAM(PDOSDEF tdp, PZPXFAM txfp);
virtual int GetNextPos(void) {return 0;}
virtual PTXF Duplicate(PGLOBAL g) // Implementation
{return (PTXF)new(g) ZIXFAM(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); // Methods
virtual bool AllocateBuffer(PGLOBAL g); virtual int Cardinality(PGLOBAL g);
virtual int ReadBuffer(PGLOBAL g); virtual int GetFileLength(PGLOBAL g);
virtual int WriteBuffer(PGLOBAL g); //virtual int MaxBlkSize(PGLOBAL g, int s) {return s;}
virtual bool OpenTableFile(PGLOBAL g);
protected: virtual bool DeferReading(void) { return false; }
// No additional Members virtual int GetNext(PGLOBAL g);
}; // end of class ZIXFAM //virtual int ReadBuffer(PGLOBAL g);
//virtual int WriteBuffer(PGLOBAL g);
//virtual int DeleteRecords(PGLOBAL g, int irc);
//virtual void CloseTableFile(PGLOBAL g, bool abort);
protected:
// Members
ZIPUTIL *zutp;
PSZ target;
bool mul;
}; // end of ZIPFAM
/***********************************************************************/ /***********************************************************************/
/* This is the DOS/UNIX Access Method class declaration for PlugDB */ /* This is the fixed ZIP file access method. */
/* fixed/variable files compressed using the zlib library functions. */
/* Physically these are written and read using the same technique */
/* than blocked variable files, only the contain of each block is */
/* compressed using the deflate zlib function. The purpose of this */
/* specific format is to have a fast mechanism for direct access of */
/* records so blocked optimization is fast and direct access (joins) */
/* is allowed. Note that the block length is written ahead of each */
/* block to enable reading when optimization file is not available. */
/***********************************************************************/ /***********************************************************************/
class DllExport ZLBFAM : public BLKFAM { class DllExport ZPXFAM : public MPXFAM {
public: friend class ZIPFAM;
// Constructor public:
ZLBFAM(PDOSDEF tdp); // Constructors
ZLBFAM(PZLBFAM txfp); ZPXFAM(PDOSDEF tdp);
ZPXFAM(PZPXFAM txfp);
// Implementation
virtual AMT GetAmType(void) {return TYPE_AM_ZLIB;} // Implementation
virtual int GetPos(void); virtual AMT GetAmType(void) { return TYPE_AM_ZIP; }
virtual int GetNextPos(void); virtual PTXF Duplicate(PGLOBAL g) { return (PTXF) new(g)ZPXFAM(this); }
virtual PTXF Duplicate(PGLOBAL g)
{return (PTXF)new(g) ZLBFAM(this);} // Methods
inline void SetOptimized(bool b) {Optimized = b;} virtual int GetFileLength(PGLOBAL g);
virtual int Cardinality(PGLOBAL g);
// Methods virtual bool OpenTableFile(PGLOBAL g);
virtual int GetFileLength(PGLOBAL g); virtual int GetNext(PGLOBAL g);
virtual bool SetPos(PGLOBAL g, int recpos); //virtual int ReadBuffer(PGLOBAL g);
virtual bool AllocateBuffer(PGLOBAL g);
virtual int ReadBuffer(PGLOBAL g); protected:
virtual int WriteBuffer(PGLOBAL g); // Members
virtual void CloseTableFile(PGLOBAL g, bool abort); ZIPUTIL *zutp;
virtual void Rewind(void); PSZ target;
bool mul;
protected: }; // end of ZPXFAM
bool WriteCompressedBuffer(PGLOBAL g);
int ReadCompressedBuffer(PGLOBAL g, void *rdbuf);
// Members
z_streamp Zstream; // Compression/decompression stream
Byte *Zbuffer; // Compressed block buffer
int *Zlenp; // Pointer to block length
bool Optimized; // true when opt file is available
}; // end of class ZLBFAM
#endif // __FILAMZIP_H #endif // __FILAMZIP_H
...@@ -171,9 +171,9 @@ ...@@ -171,9 +171,9 @@
#define JSONMAX 10 // JSON Default max grp size #define JSONMAX 10 // JSON Default max grp size
extern "C" { extern "C" {
char version[]= "Version 1.04.0008 August 10, 2016"; char version[]= "Version 1.05.0001 December 13, 2016";
#if defined(__WIN__) #if defined(__WIN__)
char compver[]= "Version 1.04.0008 " __DATE__ " " __TIME__; char compver[]= "Version 1.05.0001 " __DATE__ " " __TIME__;
char slash= '\\'; char slash= '\\';
#else // !__WIN__ #else // !__WIN__
char slash= '/'; char slash= '/';
...@@ -512,13 +512,13 @@ ha_create_table_option connect_table_option_list[]= ...@@ -512,13 +512,13 @@ ha_create_table_option connect_table_option_list[]=
HA_TOPTION_NUMBER("QUOTED", quoted, (ulonglong) -1, 0, 3, 1), HA_TOPTION_NUMBER("QUOTED", quoted, (ulonglong) -1, 0, 3, 1),
HA_TOPTION_NUMBER("ENDING", ending, (ulonglong) -1, 0, INT_MAX32, 1), HA_TOPTION_NUMBER("ENDING", ending, (ulonglong) -1, 0, INT_MAX32, 1),
HA_TOPTION_NUMBER("COMPRESS", compressed, 0, 0, 2, 1), HA_TOPTION_NUMBER("COMPRESS", compressed, 0, 0, 2, 1),
//HA_TOPTION_BOOL("COMPRESS", compressed, 0),
HA_TOPTION_BOOL("MAPPED", mapped, 0), HA_TOPTION_BOOL("MAPPED", mapped, 0),
HA_TOPTION_BOOL("HUGE", huge, 0), HA_TOPTION_BOOL("HUGE", huge, 0),
HA_TOPTION_BOOL("SPLIT", split, 0), HA_TOPTION_BOOL("SPLIT", split, 0),
HA_TOPTION_BOOL("READONLY", readonly, 0), HA_TOPTION_BOOL("READONLY", readonly, 0),
HA_TOPTION_BOOL("SEPINDEX", sepindex, 0), HA_TOPTION_BOOL("SEPINDEX", sepindex, 0),
HA_TOPTION_END HA_TOPTION_BOOL("ZIPPED", zipped, 0),
HA_TOPTION_END
}; };
...@@ -532,7 +532,6 @@ ha_create_table_option connect_field_option_list[]= ...@@ -532,7 +532,6 @@ ha_create_table_option connect_field_option_list[]=
{ {
HA_FOPTION_NUMBER("FLAG", offset, (ulonglong) -1, 0, INT_MAX32, 1), HA_FOPTION_NUMBER("FLAG", offset, (ulonglong) -1, 0, INT_MAX32, 1),
HA_FOPTION_NUMBER("MAX_DIST", freq, 0, 0, INT_MAX32, 1), // BLK_INDX HA_FOPTION_NUMBER("MAX_DIST", freq, 0, 0, INT_MAX32, 1), // BLK_INDX
//HA_FOPTION_NUMBER("DISTRIB", opt, 0, 0, 2, 1), // used for BLK_INDX
HA_FOPTION_NUMBER("FIELD_LENGTH", fldlen, 0, 0, INT_MAX32, 1), HA_FOPTION_NUMBER("FIELD_LENGTH", fldlen, 0, 0, INT_MAX32, 1),
HA_FOPTION_STRING("DATE_FORMAT", dateformat), HA_FOPTION_STRING("DATE_FORMAT", dateformat),
HA_FOPTION_STRING("FIELD_FORMAT", fieldformat), HA_FOPTION_STRING("FIELD_FORMAT", fieldformat),
...@@ -678,7 +677,6 @@ static int connect_init_func(void *p) ...@@ -678,7 +677,6 @@ static int connect_init_func(void *p)
connect_hton= (handlerton *)p; connect_hton= (handlerton *)p;
connect_hton->state= SHOW_OPTION_YES; connect_hton->state= SHOW_OPTION_YES;
connect_hton->create= connect_create_handler; connect_hton->create= connect_create_handler;
//connect_hton->flags= HTON_TEMPORARY_NOT_SUPPORTED | HTON_NO_PARTITION;
connect_hton->flags= HTON_TEMPORARY_NOT_SUPPORTED; connect_hton->flags= HTON_TEMPORARY_NOT_SUPPORTED;
connect_hton->table_options= connect_table_option_list; connect_hton->table_options= connect_table_option_list;
connect_hton->field_options= connect_field_option_list; connect_hton->field_options= connect_field_option_list;
...@@ -1135,7 +1133,9 @@ bool GetBooleanTableOption(PGLOBAL g, PTOS options, char *opname, bool bdef) ...@@ -1135,7 +1133,9 @@ bool GetBooleanTableOption(PGLOBAL g, PTOS options, char *opname, bool bdef)
opval= options->sepindex; opval= options->sepindex;
else if (!stricmp(opname, "Header")) else if (!stricmp(opname, "Header"))
opval= (options->header != 0); // Is Boolean for some table types opval= (options->header != 0); // Is Boolean for some table types
else if (options->oplist) else if (!stricmp(opname, "Zipped"))
opval = options->zipped;
else if (options->oplist)
if ((pv= GetListOption(g, opname, options->oplist))) if ((pv= GetListOption(g, opname, options->oplist)))
opval= (!*pv || *pv == 'y' || *pv == 'Y' || atoi(pv) != 0); opval= (!*pv || *pv == 'y' || *pv == 'Y' || atoi(pv) != 0);
...@@ -1242,8 +1242,10 @@ char *ha_connect::GetStringOption(char *opname, char *sdef) ...@@ -1242,8 +1242,10 @@ char *ha_connect::GetStringOption(char *opname, char *sdef)
if (opval && (!stricmp(opname, "connect") if (opval && (!stricmp(opname, "connect")
|| !stricmp(opname, "tabname") || !stricmp(opname, "tabname")
|| !stricmp(opname, "filename"))) || !stricmp(opname, "filename")
opval = GetRealString(opval); || !stricmp(opname, "optname")
|| !stricmp(opname, "entry")))
opval = GetRealString(opval);
if (!opval) { if (!opval) {
if (sdef && !strcmp(sdef, "*")) { if (sdef && !strcmp(sdef, "*")) {
...@@ -4165,7 +4167,8 @@ bool ha_connect::check_privileges(THD *thd, PTOS options, char *dbn, bool quick) ...@@ -4165,7 +4167,8 @@ bool ha_connect::check_privileges(THD *thd, PTOS options, char *dbn, bool quick)
case TAB_DIR: case TAB_DIR:
case TAB_MAC: case TAB_MAC:
case TAB_WMI: case TAB_WMI:
case TAB_OEM: case TAB_ZIP:
case TAB_OEM:
#ifdef NO_EMBEDDED_ACCESS_CHECKS #ifdef NO_EMBEDDED_ACCESS_CHECKS
return false; return false;
#endif #endif
...@@ -5173,13 +5176,13 @@ static int connect_assisted_discovery(handlerton *, THD* thd, ...@@ -5173,13 +5176,13 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
char v=0, spc= ',', qch= 0; char v=0, spc= ',', qch= 0;
const char *fncn= "?"; const char *fncn= "?";
const char *user, *fn, *db, *host, *pwd, *sep, *tbl, *src; const char *user, *fn, *db, *host, *pwd, *sep, *tbl, *src;
const char *col, *ocl, *rnk, *pic, *fcl, *skc; const char *col, *ocl, *rnk, *pic, *fcl, *skc, *zfn;
char *tab, *dsn, *shm, *dpath; char *tab, *dsn, *shm, *dpath;
#if defined(__WIN__) #if defined(__WIN__)
char *nsp= NULL, *cls= NULL; char *nsp= NULL, *cls= NULL;
#endif // __WIN__ #endif // __WIN__
int port= 0, hdr= 0, mxr= 0, mxe= 0, rc= 0; //int hdr, mxe;
int cop __attribute__((unused))= 0, lrecl= 0; int port = 0, mxr = 0, rc = 0, mul = 0, lrecl = 0;
#if defined(ODBC_SUPPORT) #if defined(ODBC_SUPPORT)
POPARM sop= NULL; POPARM sop= NULL;
char *ucnc= NULL; char *ucnc= NULL;
...@@ -5190,7 +5193,8 @@ static int connect_assisted_discovery(handlerton *, THD* thd, ...@@ -5190,7 +5193,8 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
PJPARM sjp= NULL; PJPARM sjp= NULL;
char *driver= NULL; char *driver= NULL;
char *url= NULL; char *url= NULL;
char *tabtyp = NULL; //char *prop= NULL;
char *tabtyp= NULL;
#endif // JDBC_SUPPORT #endif // JDBC_SUPPORT
uint tm, fnc= FNC_NO, supfnc= (FNC_NO | FNC_COL); uint tm, fnc= FNC_NO, supfnc= (FNC_NO | FNC_COL);
bool bif, ok= false, dbf= false; bool bif, ok= false, dbf= false;
...@@ -5210,7 +5214,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd, ...@@ -5210,7 +5214,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
if (!g) if (!g)
return HA_ERR_INTERNAL_ERROR; return HA_ERR_INTERNAL_ERROR;
user= host= pwd= tbl= src= col= ocl= pic= fcl= skc= rnk= dsn= NULL; user= host= pwd= tbl= src= col= ocl= pic= fcl= skc= rnk= zfn= dsn= NULL;
// Get the useful create options // Get the useful create options
ttp= GetTypeID(topt->type); ttp= GetTypeID(topt->type);
...@@ -5223,7 +5227,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd, ...@@ -5223,7 +5227,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
sep= topt->separator; sep= topt->separator;
spc= (!sep) ? ',' : *sep; spc= (!sep) ? ',' : *sep;
qch= topt->qchar ? *topt->qchar : (signed)topt->quoted >= 0 ? '"' : 0; qch= topt->qchar ? *topt->qchar : (signed)topt->quoted >= 0 ? '"' : 0;
hdr= (int)topt->header; mul = (int)topt->multiple;
tbl= topt->tablist; tbl= topt->tablist;
col= topt->colist; col= topt->colist;
...@@ -5256,13 +5260,16 @@ static int connect_assisted_discovery(handlerton *, THD* thd, ...@@ -5256,13 +5260,16 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
#if defined(JDBC_SUPPORT) #if defined(JDBC_SUPPORT)
driver= GetListOption(g, "Driver", topt->oplist, NULL); driver= GetListOption(g, "Driver", topt->oplist, NULL);
// url= GetListOption(g, "URL", topt->oplist, NULL); // url= GetListOption(g, "URL", topt->oplist, NULL);
// prop = GetListOption(g, "Properties", topt->oplist, NULL);
tabtyp = GetListOption(g, "Tabtype", topt->oplist, NULL); tabtyp = GetListOption(g, "Tabtype", topt->oplist, NULL);
#endif // JDBC_SUPPORT #endif // JDBC_SUPPORT
mxe= atoi(GetListOption(g,"maxerr", topt->oplist, "0"));
#if defined(PROMPT_OK) #if defined(PROMPT_OK)
cop= atoi(GetListOption(g, "checkdsn", topt->oplist, "0")); cop= atoi(GetListOption(g, "checkdsn", topt->oplist, "0"));
#endif // PROMPT_OK #endif // PROMPT_OK
} else { #if defined(ZIP_SUPPORT)
zfn = GetListOption(g, "Zipfile", topt->oplist, NULL);
#endif // ZIP_SUPPORT
} else {
host= "localhost"; host= "localhost";
user= (ttp == TAB_ODBC ? NULL : "root"); user= (ttp == TAB_ODBC ? NULL : "root");
} // endif option_list } // endif option_list
...@@ -5366,6 +5373,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd, ...@@ -5366,6 +5373,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
jdef->SetName(create_info->alias); jdef->SetName(create_info->alias);
sjp= (PJPARM)PlugSubAlloc(g, NULL, sizeof(JDBCPARM)); sjp= (PJPARM)PlugSubAlloc(g, NULL, sizeof(JDBCPARM));
sjp->Driver= driver; sjp->Driver= driver;
// sjp->Properties = prop;
sjp->Fsize= 0; sjp->Fsize= 0;
sjp->Scrollable= false; sjp->Scrollable= false;
...@@ -5468,7 +5476,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd, ...@@ -5468,7 +5476,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
case TAB_XML: case TAB_XML:
#endif // LIBXML2_SUPPORT || DOMDOC_SUPPORT #endif // LIBXML2_SUPPORT || DOMDOC_SUPPORT
case TAB_JSON: case TAB_JSON:
if (!fn) if (!fn && !zfn && !mul)
sprintf(g->Message, "Missing %s file name", topt->type); sprintf(g->Message, "Missing %s file name", topt->type);
else else
ok= true; ok= true;
...@@ -5582,7 +5590,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd, ...@@ -5582,7 +5590,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
NULL, port, fnc == FNC_COL); NULL, port, fnc == FNC_COL);
break; break;
case TAB_CSV: case TAB_CSV:
qrp= CSVColumns(g, dpath, fn, spc, qch, hdr, mxe, fnc == FNC_COL); qrp = CSVColumns(g, dpath, topt, fnc == FNC_COL);
break; break;
#if defined(__WIN__) #if defined(__WIN__)
case TAB_WMI: case TAB_WMI:
...@@ -6947,7 +6955,7 @@ maria_declare_plugin(connect) ...@@ -6947,7 +6955,7 @@ maria_declare_plugin(connect)
0x0104, /* version number (1.04) */ 0x0104, /* version number (1.04) */
NULL, /* status variables */ NULL, /* status variables */
connect_system_variables, /* system variables */ connect_system_variables, /* system variables */
"1.04.0008", /* string version */ "1.05.0001", /* string version */
MariaDB_PLUGIN_MATURITY_GAMMA /* maturity */ MariaDB_PLUGIN_MATURITY_GAMMA /* maturity */
} }
maria_declare_plugin_end; maria_declare_plugin_end;
...@@ -83,42 +83,9 @@ extern handlerton *connect_hton; ...@@ -83,42 +83,9 @@ extern handlerton *connect_hton;
These can be specified in the CREATE TABLE: These can be specified in the CREATE TABLE:
CREATE TABLE ( ... ) {...here...} CREATE TABLE ( ... ) {...here...}
*/
#if 0 // moved to mycat.h ------ Was moved to mycat.h ------
typedef struct ha_table_option_struct TOS, *PTOS; */
struct ha_table_option_struct {
const char *type;
const char *filename;
const char *optname;
const char *tabname;
const char *tablist;
const char *dbname;
const char *separator;
//const char *connect;
const char *qchar;
const char *module;
const char *subtype;
const char *catfunc;
const char *srcdef;
const char *colist;
const char *oplist;
const char *data_charset;
ulonglong lrecl;
ulonglong elements;
//ulonglong estimate;
ulonglong multiple;
ulonglong header;
ulonglong quoted;
ulonglong ending;
ulonglong compressed;
bool mapped;
bool huge;
bool split;
bool readonly;
bool sepindex;
};
#endif // 0
/** /**
structure for CREATE TABLE options (field options) structure for CREATE TABLE options (field options)
......
/* ioapi.h -- IO base function header for compress/uncompress .zip
part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html )
Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html )
Modifications for Zip64 support
Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
For more info read MiniZip_info.txt
*/
#if defined(_WIN32) && (!(defined(_CRT_SECURE_NO_WARNINGS)))
#define _CRT_SECURE_NO_WARNINGS
#endif
#if defined(__APPLE__) || defined(IOAPI_NO_64)
// In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions
#define FOPEN_FUNC(filename, mode) fopen(filename, mode)
#define FTELLO_FUNC(stream) ftello(stream)
#define FSEEKO_FUNC(stream, offset, origin) fseeko(stream, offset, origin)
#else
#define FOPEN_FUNC(filename, mode) fopen64(filename, mode)
#define FTELLO_FUNC(stream) ftello64(stream)
#define FSEEKO_FUNC(stream, offset, origin) fseeko64(stream, offset, origin)
#endif
#include "ioapi.h"
voidpf call_zopen64 (const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode)
{
if (pfilefunc->zfile_func64.zopen64_file != NULL)
return (*(pfilefunc->zfile_func64.zopen64_file)) (pfilefunc->zfile_func64.opaque,filename,mode);
else
{
return (*(pfilefunc->zopen32_file))(pfilefunc->zfile_func64.opaque,(const char*)filename,mode);
}
}
long call_zseek64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin)
{
if (pfilefunc->zfile_func64.zseek64_file != NULL)
return (*(pfilefunc->zfile_func64.zseek64_file)) (pfilefunc->zfile_func64.opaque,filestream,offset,origin);
else
{
uLong offsetTruncated = (uLong)offset;
if (offsetTruncated != offset)
return -1;
else
return (*(pfilefunc->zseek32_file))(pfilefunc->zfile_func64.opaque,filestream,offsetTruncated,origin);
}
}
ZPOS64_T call_ztell64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream)
{
if (pfilefunc->zfile_func64.zseek64_file != NULL)
return (*(pfilefunc->zfile_func64.ztell64_file)) (pfilefunc->zfile_func64.opaque,filestream);
else
{
uLong tell_uLong = (*(pfilefunc->ztell32_file))(pfilefunc->zfile_func64.opaque,filestream);
if ((tell_uLong) == MAXU32)
return (ZPOS64_T)-1;
else
return tell_uLong;
}
}
void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32,const zlib_filefunc_def* p_filefunc32)
{
p_filefunc64_32->zfile_func64.zopen64_file = NULL;
p_filefunc64_32->zopen32_file = p_filefunc32->zopen_file;
p_filefunc64_32->zfile_func64.zerror_file = p_filefunc32->zerror_file;
p_filefunc64_32->zfile_func64.zread_file = p_filefunc32->zread_file;
p_filefunc64_32->zfile_func64.zwrite_file = p_filefunc32->zwrite_file;
p_filefunc64_32->zfile_func64.ztell64_file = NULL;
p_filefunc64_32->zfile_func64.zseek64_file = NULL;
p_filefunc64_32->zfile_func64.zclose_file = p_filefunc32->zclose_file;
p_filefunc64_32->zfile_func64.zerror_file = p_filefunc32->zerror_file;
p_filefunc64_32->zfile_func64.opaque = p_filefunc32->opaque;
p_filefunc64_32->zseek32_file = p_filefunc32->zseek_file;
p_filefunc64_32->ztell32_file = p_filefunc32->ztell_file;
}
static voidpf ZCALLBACK fopen_file_func OF((voidpf opaque, const char* filename, int mode));
static uLong ZCALLBACK fread_file_func OF((voidpf opaque, voidpf stream, void* buf, uLong size));
static uLong ZCALLBACK fwrite_file_func OF((voidpf opaque, voidpf stream, const void* buf,uLong size));
static ZPOS64_T ZCALLBACK ftell64_file_func OF((voidpf opaque, voidpf stream));
static long ZCALLBACK fseek64_file_func OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin));
static int ZCALLBACK fclose_file_func OF((voidpf opaque, voidpf stream));
static int ZCALLBACK ferror_file_func OF((voidpf opaque, voidpf stream));
static voidpf ZCALLBACK fopen_file_func (voidpf opaque, const char* filename, int mode)
{
FILE* file = NULL;
const char* mode_fopen = NULL;
if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)
mode_fopen = "rb";
else
if (mode & ZLIB_FILEFUNC_MODE_EXISTING)
mode_fopen = "r+b";
else
if (mode & ZLIB_FILEFUNC_MODE_CREATE)
mode_fopen = "wb";
if ((filename!=NULL) && (mode_fopen != NULL))
file = fopen(filename, mode_fopen);
return file;
}
static voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename, int mode)
{
FILE* file = NULL;
const char* mode_fopen = NULL;
if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)
mode_fopen = "rb";
else
if (mode & ZLIB_FILEFUNC_MODE_EXISTING)
mode_fopen = "r+b";
else
if (mode & ZLIB_FILEFUNC_MODE_CREATE)
mode_fopen = "wb";
if ((filename!=NULL) && (mode_fopen != NULL))
file = FOPEN_FUNC((const char*)filename, mode_fopen);
return file;
}
static uLong ZCALLBACK fread_file_func (voidpf opaque, voidpf stream, void* buf, uLong size)
{
uLong ret;
ret = (uLong)fread(buf, 1, (size_t)size, (FILE *)stream);
return ret;
}
static uLong ZCALLBACK fwrite_file_func (voidpf opaque, voidpf stream, const void* buf, uLong size)
{
uLong ret;
ret = (uLong)fwrite(buf, 1, (size_t)size, (FILE *)stream);
return ret;
}
static long ZCALLBACK ftell_file_func (voidpf opaque, voidpf stream)
{
long ret;
ret = ftell((FILE *)stream);
return ret;
}
static ZPOS64_T ZCALLBACK ftell64_file_func (voidpf opaque, voidpf stream)
{
ZPOS64_T ret;
ret = FTELLO_FUNC((FILE *)stream);
return ret;
}
static long ZCALLBACK fseek_file_func (voidpf opaque, voidpf stream, uLong offset, int origin)
{
int fseek_origin=0;
long ret;
switch (origin)
{
case ZLIB_FILEFUNC_SEEK_CUR :
fseek_origin = SEEK_CUR;
break;
case ZLIB_FILEFUNC_SEEK_END :
fseek_origin = SEEK_END;
break;
case ZLIB_FILEFUNC_SEEK_SET :
fseek_origin = SEEK_SET;
break;
default: return -1;
}
ret = 0;
if (fseek((FILE *)stream, offset, fseek_origin) != 0)
ret = -1;
return ret;
}
static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T offset, int origin)
{
int fseek_origin=0;
long ret;
switch (origin)
{
case ZLIB_FILEFUNC_SEEK_CUR :
fseek_origin = SEEK_CUR;
break;
case ZLIB_FILEFUNC_SEEK_END :
fseek_origin = SEEK_END;
break;
case ZLIB_FILEFUNC_SEEK_SET :
fseek_origin = SEEK_SET;
break;
default: return -1;
}
ret = 0;
if(FSEEKO_FUNC((FILE *)stream, offset, fseek_origin) != 0)
ret = -1;
return ret;
}
static int ZCALLBACK fclose_file_func (voidpf opaque, voidpf stream)
{
int ret;
ret = fclose((FILE *)stream);
return ret;
}
static int ZCALLBACK ferror_file_func (voidpf opaque, voidpf stream)
{
int ret;
ret = ferror((FILE *)stream);
return ret;
}
void fill_fopen_filefunc (pzlib_filefunc_def)
zlib_filefunc_def* pzlib_filefunc_def;
{
pzlib_filefunc_def->zopen_file = fopen_file_func;
pzlib_filefunc_def->zread_file = fread_file_func;
pzlib_filefunc_def->zwrite_file = fwrite_file_func;
pzlib_filefunc_def->ztell_file = ftell_file_func;
pzlib_filefunc_def->zseek_file = fseek_file_func;
pzlib_filefunc_def->zclose_file = fclose_file_func;
pzlib_filefunc_def->zerror_file = ferror_file_func;
pzlib_filefunc_def->opaque = NULL;
}
void fill_fopen64_filefunc (zlib_filefunc64_def* pzlib_filefunc_def)
{
pzlib_filefunc_def->zopen64_file = fopen64_file_func;
pzlib_filefunc_def->zread_file = fread_file_func;
pzlib_filefunc_def->zwrite_file = fwrite_file_func;
pzlib_filefunc_def->ztell64_file = ftell64_file_func;
pzlib_filefunc_def->zseek64_file = fseek64_file_func;
pzlib_filefunc_def->zclose_file = fclose_file_func;
pzlib_filefunc_def->zerror_file = ferror_file_func;
pzlib_filefunc_def->opaque = NULL;
}
/* ioapi.h -- IO base function header for compress/uncompress .zip
part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html )
Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html )
Modifications for Zip64 support
Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
For more info read MiniZip_info.txt
Changes
Oct-2009 - Defined ZPOS64_T to fpos_t on windows and u_int64_t on linux. (might need to find a better why for this)
Oct-2009 - Change to fseeko64, ftello64 and fopen64 so large files would work on linux.
More if/def section may be needed to support other platforms
Oct-2009 - Defined fxxxx64 calls to normal fopen/ftell/fseek so they would compile on windows.
(but you should use iowin32.c for windows instead)
*/
#ifndef _ZLIBIOAPI64_H
#define _ZLIBIOAPI64_H
#if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__))
// Linux needs this to support file operation on files larger then 4+GB
// But might need better if/def to select just the platforms that needs them.
#ifndef __USE_FILE_OFFSET64
#define __USE_FILE_OFFSET64
#endif
#ifndef __USE_LARGEFILE64
#define __USE_LARGEFILE64
#endif
#ifndef _LARGEFILE64_SOURCE
#define _LARGEFILE64_SOURCE
#endif
#ifndef _FILE_OFFSET_BIT
#define _FILE_OFFSET_BIT 64
#endif
#endif
#include <stdio.h>
#include <stdlib.h>
#include "zlib.h"
#if defined(USE_FILE32API)
#define fopen64 fopen
#define ftello64 ftell
#define fseeko64 fseek
#else
#ifdef __FreeBSD__
#define fopen64 fopen
#define ftello64 ftello
#define fseeko64 fseeko
#endif
#ifdef _MSC_VER
#define fopen64 fopen
#if (_MSC_VER >= 1400) && (!(defined(NO_MSCVER_FILE64_FUNC)))
#define ftello64 _ftelli64
#define fseeko64 _fseeki64
#else // old MSC
#define ftello64 ftell
#define fseeko64 fseek
#endif
#endif
#endif
/*
#ifndef ZPOS64_T
#ifdef _WIN32
#define ZPOS64_T fpos_t
#else
#include <stdint.h>
#define ZPOS64_T uint64_t
#endif
#endif
*/
#ifdef HAVE_MINIZIP64_CONF_H
#include "mz64conf.h"
#endif
/* a type choosen by DEFINE */
#ifdef HAVE_64BIT_INT_CUSTOM
typedef 64BIT_INT_CUSTOM_TYPE ZPOS64_T;
#else
#ifdef HAS_STDINT_H
#include "stdint.h"
typedef uint64_t ZPOS64_T;
#else
/* Maximum unsigned 32-bit value used as placeholder for zip64 */
#define MAXU32 0xffffffff
#if defined(_MSC_VER) || defined(__BORLANDC__)
typedef unsigned __int64 ZPOS64_T;
#else
typedef unsigned long long int ZPOS64_T;
#endif
#endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
#define ZLIB_FILEFUNC_SEEK_CUR (1)
#define ZLIB_FILEFUNC_SEEK_END (2)
#define ZLIB_FILEFUNC_SEEK_SET (0)
#define ZLIB_FILEFUNC_MODE_READ (1)
#define ZLIB_FILEFUNC_MODE_WRITE (2)
#define ZLIB_FILEFUNC_MODE_READWRITEFILTER (3)
#define ZLIB_FILEFUNC_MODE_EXISTING (4)
#define ZLIB_FILEFUNC_MODE_CREATE (8)
#ifndef ZCALLBACK
#if (defined(WIN32) || defined(_WIN32) || defined (WINDOWS) || defined (_WINDOWS)) && defined(CALLBACK) && defined (USEWINDOWS_CALLBACK)
#define ZCALLBACK CALLBACK
#else
#define ZCALLBACK
#endif
#endif
typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode));
typedef uLong (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size));
typedef uLong (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size));
typedef int (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream));
typedef int (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream));
typedef long (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream));
typedef long (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin));
/* here is the "old" 32 bits structure structure */
typedef struct zlib_filefunc_def_s
{
open_file_func zopen_file;
read_file_func zread_file;
write_file_func zwrite_file;
tell_file_func ztell_file;
seek_file_func zseek_file;
close_file_func zclose_file;
testerror_file_func zerror_file;
voidpf opaque;
} zlib_filefunc_def;
typedef ZPOS64_T (ZCALLBACK *tell64_file_func) OF((voidpf opaque, voidpf stream));
typedef long (ZCALLBACK *seek64_file_func) OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin));
typedef voidpf (ZCALLBACK *open64_file_func) OF((voidpf opaque, const void* filename, int mode));
typedef struct zlib_filefunc64_def_s
{
open64_file_func zopen64_file;
read_file_func zread_file;
write_file_func zwrite_file;
tell64_file_func ztell64_file;
seek64_file_func zseek64_file;
close_file_func zclose_file;
testerror_file_func zerror_file;
voidpf opaque;
} zlib_filefunc64_def;
void fill_fopen64_filefunc OF((zlib_filefunc64_def* pzlib_filefunc_def));
void fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def));
/* now internal definition, only for zip.c and unzip.h */
typedef struct zlib_filefunc64_32_def_s
{
zlib_filefunc64_def zfile_func64;
open_file_func zopen32_file;
tell_file_func ztell32_file;
seek_file_func zseek32_file;
} zlib_filefunc64_32_def;
#define ZREAD64(filefunc,filestream,buf,size) ((*((filefunc).zfile_func64.zread_file)) ((filefunc).zfile_func64.opaque,filestream,buf,size))
#define ZWRITE64(filefunc,filestream,buf,size) ((*((filefunc).zfile_func64.zwrite_file)) ((filefunc).zfile_func64.opaque,filestream,buf,size))
//#define ZTELL64(filefunc,filestream) ((*((filefunc).ztell64_file)) ((filefunc).opaque,filestream))
//#define ZSEEK64(filefunc,filestream,pos,mode) ((*((filefunc).zseek64_file)) ((filefunc).opaque,filestream,pos,mode))
#define ZCLOSE64(filefunc,filestream) ((*((filefunc).zfile_func64.zclose_file)) ((filefunc).zfile_func64.opaque,filestream))
#define ZERROR64(filefunc,filestream) ((*((filefunc).zfile_func64.zerror_file)) ((filefunc).zfile_func64.opaque,filestream))
voidpf call_zopen64 OF((const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode));
long call_zseek64 OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin));
ZPOS64_T call_ztell64 OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream));
void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32,const zlib_filefunc_def* p_filefunc32);
#define ZOPEN64(filefunc,filename,mode) (call_zopen64((&(filefunc)),(filename),(mode)))
#define ZTELL64(filefunc,filestream) (call_ztell64((&(filefunc)),(filestream)))
#define ZSEEK64(filefunc,filestream,pos,mode) (call_zseek64((&(filefunc)),(filestream),(pos),(mode)))
#ifdef __cplusplus
}
#endif
#endif
...@@ -8,6 +8,7 @@ typedef struct jdbc_parms { ...@@ -8,6 +8,7 @@ typedef struct jdbc_parms {
char *Url; // Driver URL char *Url; // Driver URL
char *User; // User connect info char *User; // User connect info
char *Pwd; // Password connect info char *Pwd; // Password connect info
//char *Properties; // Connection property list
//int Cto; // Connect timeout //int Cto; // Connect timeout
//int Qto; // Query timeout //int Qto; // Query timeout
int Fsize; // Fetch size int Fsize; // Fetch size
......
This diff is collapsed.
...@@ -180,9 +180,9 @@ class JDBConn : public BLOCK { ...@@ -180,9 +180,9 @@ class JDBConn : public BLOCK {
char *Msg; char *Msg;
char *m_Wrap; char *m_Wrap;
char m_IDQuoteChar[2]; char m_IDQuoteChar[2];
PSZ m_Driver; //PSZ m_Driver;
PSZ m_Url; //PSZ m_Url;
PSZ m_User; //PSZ m_User;
PSZ m_Pwd; PSZ m_Pwd;
int m_Ncol; int m_Ncol;
int m_Aff; int m_Aff;
......
...@@ -5264,3 +5264,50 @@ char *envar(UDF_INIT *initid, UDF_ARGS *args, char *result, ...@@ -5264,3 +5264,50 @@ char *envar(UDF_INIT *initid, UDF_ARGS *args, char *result,
return str; return str;
} // end of envar } // end of envar
/*********************************************************************************/
/* Returns the distinct number of B occurences in A. */
/*********************************************************************************/
my_bool countin_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
{
if (args->arg_count != 2) {
strcpy(message, "This function must have 2 arguments");
return true;
} else if (args->arg_type[0] != STRING_RESULT) {
strcpy(message, "First argument must be string");
return true;
} else if (args->arg_type[1] != STRING_RESULT) {
strcpy(message, "Second argument is not a string");
return true;
} // endif args
return false;
} // end of countin_init
long long countin(UDF_INIT *initid, UDF_ARGS *args, char *result,
unsigned long *res_length, char *is_null, char *)
{
PSZ str1, str2;
char *s;
long long n = 0;
size_t lg;
lg = (size_t)args->lengths[0];
s = str1 = (PSZ)malloc(lg + 1);
memcpy(str1, args->args[0], lg);
str1[lg] = 0;
lg = (size_t)args->lengths[1];
str2 = (PSZ)malloc(lg + 1);
memcpy(str2, args->args[1], lg);
str2[lg] = 0;
while (s = strstr(s, str2)) {
n++;
s += lg;
} // endwhile
free(str1);
free(str2);
return n;
} // end of countin
...@@ -221,6 +221,9 @@ extern "C" { ...@@ -221,6 +221,9 @@ extern "C" {
DllExport my_bool envar_init(UDF_INIT*, UDF_ARGS*, char*); DllExport my_bool envar_init(UDF_INIT*, UDF_ARGS*, char*);
DllExport char *envar(UDF_EXEC_ARGS); DllExport char *envar(UDF_EXEC_ARGS);
DllExport my_bool countin_init(UDF_INIT*, UDF_ARGS*, char*);
DllExport long long countin(UDF_EXEC_ARGS);
} // extern "C" } // extern "C"
......
/******************************************************************/ /******************************************************************/
/* Implementation of XML document processing using libxml2 */ /* Implementation of XML document processing using libxml2 */
/* Author: Olivier Bertrand 2007-2015 */ /* Author: Olivier Bertrand 2007-2016 */
/******************************************************************/ /******************************************************************/
#include "my_global.h" #include "my_global.h"
#include <string.h> #include <string.h>
...@@ -68,8 +68,8 @@ class LIBXMLDOC : public XMLDOCUMENT { ...@@ -68,8 +68,8 @@ class LIBXMLDOC : public XMLDOCUMENT {
virtual void SetNofree(bool b) {Nofreelist = b;} virtual void SetNofree(bool b) {Nofreelist = b;}
// Methods // Methods
virtual bool Initialize(PGLOBAL g); virtual bool Initialize(PGLOBAL g, char *entry, bool zipped);
virtual bool ParseFile(char *fn); virtual bool ParseFile(PGLOBAL g, char *fn);
virtual bool NewDoc(PGLOBAL g, char *ver); virtual bool NewDoc(PGLOBAL g, char *ver);
virtual void AddComment(PGLOBAL g, char *com); virtual void AddComment(PGLOBAL g, char *com);
virtual PXNODE GetRoot(PGLOBAL g); virtual PXNODE GetRoot(PGLOBAL g);
...@@ -373,22 +373,33 @@ LIBXMLDOC::LIBXMLDOC(char *nsl, char *nsdf, char *enc, PFBLOCK fp) ...@@ -373,22 +373,33 @@ LIBXMLDOC::LIBXMLDOC(char *nsl, char *nsdf, char *enc, PFBLOCK fp)
/******************************************************************/ /******************************************************************/
/* Initialize XML parser and check library compatibility. */ /* Initialize XML parser and check library compatibility. */
/******************************************************************/ /******************************************************************/
bool LIBXMLDOC::Initialize(PGLOBAL g) bool LIBXMLDOC::Initialize(PGLOBAL g, char *entry, bool zipped)
{ {
if (zipped && InitZip(g, entry))
return true;
int n = xmlKeepBlanksDefault(1); int n = xmlKeepBlanksDefault(1);
return MakeNSlist(g); return MakeNSlist(g);
} // end of Initialize } // end of Initialize
/******************************************************************/ /******************************************************************/
/* Parse the XML file and construct node tree in memory. */ /* Parse the XML file and construct node tree in memory. */
/******************************************************************/ /******************************************************************/
bool LIBXMLDOC::ParseFile(char *fn) bool LIBXMLDOC::ParseFile(PGLOBAL g, char *fn)
{ {
if (trace) if (trace)
htrc("ParseFile\n"); htrc("ParseFile\n");
if ((Docp = xmlParseFile(fn))) { if (zip) {
if (Docp->encoding) // Parse an in memory document
char *xdoc = GetMemDoc(g, fn);
Docp = (xdoc) ? xmlParseDoc((const xmlChar *)xdoc) : NULL;
} else
Docp = xmlParseFile(fn);
if (Docp) {
if (Docp->encoding)
Encoding = (char*)Docp->encoding; Encoding = (char*)Docp->encoding;
return false; return false;
...@@ -609,6 +620,7 @@ void LIBXMLDOC::CloseDoc(PGLOBAL g, PFBLOCK xp) ...@@ -609,6 +620,7 @@ void LIBXMLDOC::CloseDoc(PGLOBAL g, PFBLOCK xp)
} // endif xp } // endif xp
CloseXML2File(g, xp, false); CloseXML2File(g, xp, false);
CloseZip();
} // end of Close } // end of Close
/******************************************************************/ /******************************************************************/
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
/*************** Mycat CC Program Source Code File (.CC) ***************/ /*************** Mycat CC Program Source Code File (.CC) ***************/
/* PROGRAM NAME: MYCAT */ /* PROGRAM NAME: MYCAT */
/* ------------- */ /* ------------- */
/* Version 1.4 */ /* Version 1.5 */
/* */ /* */
/* Author: Olivier Bertrand 2012 - 2016 */ /* Author: Olivier Bertrand 2012 - 2016 */
/* */ /* */
...@@ -64,7 +64,9 @@ ...@@ -64,7 +64,9 @@
#include "filamtxt.h" #include "filamtxt.h"
#include "tabdos.h" #include "tabdos.h"
#include "tabfmt.h" #include "tabfmt.h"
#if defined(VCT_SUPPORT)
#include "tabvct.h" #include "tabvct.h"
#endif // VCT_SUPPORT
#include "tabsys.h" #include "tabsys.h"
#if defined(__WIN__) #if defined(__WIN__)
#include "tabmac.h" #include "tabmac.h"
...@@ -93,6 +95,9 @@ ...@@ -93,6 +95,9 @@
#if defined(XML_SUPPORT) #if defined(XML_SUPPORT)
#include "tabxml.h" #include "tabxml.h"
#endif // XML_SUPPORT #endif // XML_SUPPORT
#if defined(ZIP_SUPPORT)
#include "tabzip.h"
#endif // ZIP_SUPPORT
#include "mycat.h" #include "mycat.h"
/***********************************************************************/ /***********************************************************************/
...@@ -152,7 +157,10 @@ TABTYPE GetTypeID(const char *type) ...@@ -152,7 +157,10 @@ TABTYPE GetTypeID(const char *type)
#endif #endif
: (!stricmp(type, "VIR")) ? TAB_VIR : (!stricmp(type, "VIR")) ? TAB_VIR
: (!stricmp(type, "JSON")) ? TAB_JSON : (!stricmp(type, "JSON")) ? TAB_JSON
: (!stricmp(type, "OEM")) ? TAB_OEM : TAB_NIY; #ifdef ZIP_SUPPORT
: (!stricmp(type, "ZIP")) ? TAB_ZIP
#endif
: (!stricmp(type, "OEM")) ? TAB_OEM : TAB_NIY;
} // end of GetTypeID } // end of GetTypeID
/***********************************************************************/ /***********************************************************************/
...@@ -173,6 +181,7 @@ bool IsFileType(TABTYPE type) ...@@ -173,6 +181,7 @@ bool IsFileType(TABTYPE type)
case TAB_INI: case TAB_INI:
case TAB_VEC: case TAB_VEC:
case TAB_JSON: case TAB_JSON:
// case TAB_ZIP:
isfile= true; isfile= true;
break; break;
default: default:
...@@ -549,7 +558,9 @@ PRELDEF MYCAT::MakeTableDesc(PGLOBAL g, PTABLE tablep, LPCSTR am) ...@@ -549,7 +558,9 @@ PRELDEF MYCAT::MakeTableDesc(PGLOBAL g, PTABLE tablep, LPCSTR am)
#if defined(XML_SUPPORT) #if defined(XML_SUPPORT)
case TAB_XML: tdp= new(g) XMLDEF; break; case TAB_XML: tdp= new(g) XMLDEF; break;
#endif // XML_SUPPORT #endif // XML_SUPPORT
case TAB_VEC: tdp= new(g) VCTDEF; break; #if defined(VCT_SUPPORT)
case TAB_VEC: tdp = new(g)VCTDEF; break;
#endif // VCT_SUPPORT
#if defined(ODBC_SUPPORT) #if defined(ODBC_SUPPORT)
case TAB_ODBC: tdp= new(g) ODBCDEF; break; case TAB_ODBC: tdp= new(g) ODBCDEF; break;
#endif // ODBC_SUPPORT #endif // ODBC_SUPPORT
...@@ -571,7 +582,10 @@ PRELDEF MYCAT::MakeTableDesc(PGLOBAL g, PTABLE tablep, LPCSTR am) ...@@ -571,7 +582,10 @@ PRELDEF MYCAT::MakeTableDesc(PGLOBAL g, PTABLE tablep, LPCSTR am)
#endif // PIVOT_SUPPORT #endif // PIVOT_SUPPORT
case TAB_VIR: tdp= new(g) VIRDEF; break; case TAB_VIR: tdp= new(g) VIRDEF; break;
case TAB_JSON: tdp= new(g) JSONDEF; break; case TAB_JSON: tdp= new(g) JSONDEF; break;
default: #if defined(ZIP_SUPPORT)
case TAB_ZIP: tdp= new(g) ZIPDEF; break;
#endif // ZIP_SUPPORT
default:
sprintf(g->Message, MSG(BAD_TABLE_TYPE), am, name); sprintf(g->Message, MSG(BAD_TABLE_TYPE), am, name);
} // endswitch } // endswitch
......
...@@ -62,6 +62,7 @@ struct ha_table_option_struct { ...@@ -62,6 +62,7 @@ struct ha_table_option_struct {
bool split; bool split;
bool readonly; bool readonly;
bool sepindex; bool sepindex;
bool zipped;
}; };
// Possible value for catalog functions // Possible value for catalog functions
......
-- source windows.inc
-- source jdbconn.inc -- source jdbconn.inc
SET GLOBAL time_zone='+1:00'; SET GLOBAL time_zone='+1:00';
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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