mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
- MDEV-11366 SIGBUS errors in Connect Storage Engine for ArmHF and MIPS.
Fix includes launchpad fix plus more to cover writing BIN tables. modified: storage/connect/tabfix.cpp modified: storage/connect/value.cpp modified: storage/connect/value.h - Typo: Change the name of filamzip to filamgz to prepare future ZIP tables. modified: storage/connect/CMakeLists.txt added: storage/connect/filamgz.cpp added: storage/connect/filamgz.h deleted: storage/connect/filamzip.cpp deleted: storage/connect/filamzip.h modified: storage/connect/plgdbsem.h modified: storage/connect/reldef.cpp modified: storage/connect/tabdos.cpp modified: storage/connect/tabdos.h modified: storage/connect/tabfix.cpp modified: storage/connect/tabfmt.cpp modified: storage/connect/tabjson.cpp
This commit is contained in:
@@ -20,14 +20,14 @@ 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 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
|
||||||
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 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
|
||||||
@@ -38,7 +38,7 @@ 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 )
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -270,9 +270,9 @@ IF(CONNECT_WITH_JDBC)
|
|||||||
# 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
|
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/JavaWrappers.jar
|
||||||
DESTINATION ${INSTALL_PLUGINDIR} COMPONENT connect-engine)
|
DESTINATION ${INSTALL_PLUGINDIR} COMPONENT connect-engine)
|
||||||
add_definitions(-DJDBC_SUPPORT)
|
add_definitions(-DJDBC_SUPPORT)
|
||||||
ELSE()
|
ELSE()
|
||||||
SET(JDBC_LIBRARY "")
|
SET(JDBC_LIBRARY "")
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
/*********** File AM Zip C++ Program Source Code File (.CPP) ***********/
|
/************ File AM GZ C++ Program Source Code File (.CPP) ***********/
|
||||||
/* PROGRAM NAME: FILAMZIP */
|
/* PROGRAM NAME: FILAMGZ */
|
||||||
/* ------------- */
|
/* ------------- */
|
||||||
/* Version 1.5 */
|
/* Version 1.5 */
|
||||||
/* */
|
/* */
|
||||||
/* COPYRIGHT: */
|
/* COPYRIGHT: */
|
||||||
/* ---------- */
|
/* ---------- */
|
||||||
/* (C) Copyright to the author Olivier BERTRAND 2005-2015 */
|
/* (C) Copyright to the author Olivier BERTRAND 2005-2016 */
|
||||||
/* */
|
/* */
|
||||||
/* WHAT THIS PROGRAM DOES: */
|
/* WHAT THIS PROGRAM DOES: */
|
||||||
/* ----------------------- */
|
/* ----------------------- */
|
||||||
@@ -56,7 +56,7 @@
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
//#define ZLIB_DLL
|
//#define ZLIB_DLL
|
||||||
|
|
||||||
#include "filamzip.h"
|
#include "filamgz.h"
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* DB static variables. */
|
/* DB static variables. */
|
||||||
@@ -66,13 +66,13 @@ extern int num_read, num_there, num_eq[]; // Statistics
|
|||||||
/* ------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------- */
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Implementation of the ZIPFAM class. */
|
/* Implementation of the GZFAM class. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
ZIPFAM::ZIPFAM(PZIPFAM txfp) : TXTFAM(txfp)
|
GZFAM::GZFAM(PGZFAM txfp) : TXTFAM(txfp)
|
||||||
{
|
{
|
||||||
Zfile = txfp->Zfile;
|
Zfile = txfp->Zfile;
|
||||||
Zpos = txfp->Zpos;
|
Zpos = txfp->Zpos;
|
||||||
} // end of ZIPFAM copy constructor
|
} // end of GZFAM copy constructor
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Zerror: Error function for gz calls. */
|
/* Zerror: Error function for gz calls. */
|
||||||
@@ -82,7 +82,7 @@ ZIPFAM::ZIPFAM(PZIPFAM txfp) : TXTFAM(txfp)
|
|||||||
/* library, errnum is set to Z_ERRNO and the application may consult */
|
/* library, errnum is set to Z_ERRNO and the application may consult */
|
||||||
/* errno to get the exact error code. */
|
/* errno to get the exact error code. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
int ZIPFAM::Zerror(PGLOBAL g)
|
int GZFAM::Zerror(PGLOBAL g)
|
||||||
{
|
{
|
||||||
int errnum;
|
int errnum;
|
||||||
|
|
||||||
@@ -101,7 +101,7 @@ int ZIPFAM::Zerror(PGLOBAL g)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Reset: reset position values at the beginning of file. */
|
/* Reset: reset position values at the beginning of file. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
void ZIPFAM::Reset(void)
|
void GZFAM::Reset(void)
|
||||||
{
|
{
|
||||||
TXTFAM::Reset();
|
TXTFAM::Reset();
|
||||||
//gzrewind(Zfile); // Useful ?????
|
//gzrewind(Zfile); // Useful ?????
|
||||||
@@ -109,10 +109,10 @@ void ZIPFAM::Reset(void)
|
|||||||
} // end of Reset
|
} // end of Reset
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* ZIP GetFileLength: returns an estimate of what would be the */
|
/* GZ GetFileLength: returns an estimate of what would be the */
|
||||||
/* uncompressed file size in number of bytes. */
|
/* uncompressed file size in number of bytes. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
int ZIPFAM::GetFileLength(PGLOBAL g)
|
int GZFAM::GetFileLength(PGLOBAL g)
|
||||||
{
|
{
|
||||||
int len = TXTFAM::GetFileLength(g);
|
int len = TXTFAM::GetFileLength(g);
|
||||||
|
|
||||||
@@ -124,9 +124,9 @@ int ZIPFAM::GetFileLength(PGLOBAL g)
|
|||||||
} // end of GetFileLength
|
} // end of GetFileLength
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* ZIP Access Method opening routine. */
|
/* GZ Access Method opening routine. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
bool ZIPFAM::OpenTableFile(PGLOBAL g)
|
bool GZFAM::OpenTableFile(PGLOBAL g)
|
||||||
{
|
{
|
||||||
char opmode[4], filename[_MAX_PATH];
|
char opmode[4], filename[_MAX_PATH];
|
||||||
MODE mode = Tdbp->GetMode();
|
MODE mode = Tdbp->GetMode();
|
||||||
@@ -137,7 +137,7 @@ bool ZIPFAM::OpenTableFile(PGLOBAL g)
|
|||||||
break;
|
break;
|
||||||
case MODE_UPDATE:
|
case MODE_UPDATE:
|
||||||
/*****************************************************************/
|
/*****************************************************************/
|
||||||
/* Updating ZIP files not implemented yet. */
|
/* Updating GZ files not implemented yet. */
|
||||||
/*****************************************************************/
|
/*****************************************************************/
|
||||||
strcpy(g->Message, MSG(UPD_ZIP_NOT_IMP));
|
strcpy(g->Message, MSG(UPD_ZIP_NOT_IMP));
|
||||||
return true;
|
return true;
|
||||||
@@ -152,7 +152,7 @@ bool ZIPFAM::OpenTableFile(PGLOBAL g)
|
|||||||
// Last = Nrec; // For ZBKFAM
|
// Last = Nrec; // For ZBKFAM
|
||||||
Tdbp->ResetSize();
|
Tdbp->ResetSize();
|
||||||
} else {
|
} else {
|
||||||
sprintf(g->Message, MSG(NO_PART_DEL), "ZIP");
|
sprintf(g->Message, MSG(NO_PART_DEL), "GZ");
|
||||||
return true;
|
return true;
|
||||||
} // endif filter
|
} // endif filter
|
||||||
|
|
||||||
@@ -196,7 +196,7 @@ bool ZIPFAM::OpenTableFile(PGLOBAL g)
|
|||||||
/* Allocate the line buffer. For mode Delete a bigger buffer has to */
|
/* Allocate the line buffer. For mode Delete a bigger buffer has to */
|
||||||
/* be allocated because is it also used to move lines into the file. */
|
/* be allocated because is it also used to move lines into the file. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
bool ZIPFAM::AllocateBuffer(PGLOBAL g)
|
bool GZFAM::AllocateBuffer(PGLOBAL g)
|
||||||
{
|
{
|
||||||
MODE mode = Tdbp->GetMode();
|
MODE mode = Tdbp->GetMode();
|
||||||
|
|
||||||
@@ -223,7 +223,7 @@ bool ZIPFAM::AllocateBuffer(PGLOBAL g)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* GetRowID: return the RowID of last read record. */
|
/* GetRowID: return the RowID of last read record. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
int ZIPFAM::GetRowID(void)
|
int GZFAM::GetRowID(void)
|
||||||
{
|
{
|
||||||
return Rows;
|
return Rows;
|
||||||
} // end of GetRowID
|
} // end of GetRowID
|
||||||
@@ -231,7 +231,7 @@ int ZIPFAM::GetRowID(void)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* GetPos: return the position of last read record. */
|
/* GetPos: return the position of last read record. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
int ZIPFAM::GetPos(void)
|
int GZFAM::GetPos(void)
|
||||||
{
|
{
|
||||||
return (int)Zpos;
|
return (int)Zpos;
|
||||||
} // end of GetPos
|
} // end of GetPos
|
||||||
@@ -239,7 +239,7 @@ int ZIPFAM::GetPos(void)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* GetNextPos: return the position of next record. */
|
/* GetNextPos: return the position of next record. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
int ZIPFAM::GetNextPos(void)
|
int GZFAM::GetNextPos(void)
|
||||||
{
|
{
|
||||||
return gztell(Zfile);
|
return gztell(Zfile);
|
||||||
} // end of GetNextPos
|
} // end of GetNextPos
|
||||||
@@ -247,9 +247,9 @@ int ZIPFAM::GetNextPos(void)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* SetPos: Replace the table at the specified position. */
|
/* SetPos: Replace the table at the specified position. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
bool ZIPFAM::SetPos(PGLOBAL g, int pos __attribute__((unused)))
|
bool GZFAM::SetPos(PGLOBAL g, int pos __attribute__((unused)))
|
||||||
{
|
{
|
||||||
sprintf(g->Message, MSG(NO_SETPOS_YET), "ZIP");
|
sprintf(g->Message, MSG(NO_SETPOS_YET), "GZ");
|
||||||
return true;
|
return true;
|
||||||
#if 0
|
#if 0
|
||||||
Fpos = pos;
|
Fpos = pos;
|
||||||
@@ -267,7 +267,7 @@ bool ZIPFAM::SetPos(PGLOBAL g, int pos __attribute__((unused)))
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Record file position in case of UPDATE or DELETE. */
|
/* Record file position in case of UPDATE or DELETE. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
bool ZIPFAM::RecordPos(PGLOBAL)
|
bool GZFAM::RecordPos(PGLOBAL)
|
||||||
{
|
{
|
||||||
Zpos = gztell(Zfile);
|
Zpos = gztell(Zfile);
|
||||||
return false;
|
return false;
|
||||||
@@ -276,7 +276,7 @@ bool ZIPFAM::RecordPos(PGLOBAL)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Skip one record in file. */
|
/* Skip one record in file. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
int ZIPFAM::SkipRecord(PGLOBAL g, bool header)
|
int GZFAM::SkipRecord(PGLOBAL g, bool header)
|
||||||
{
|
{
|
||||||
// Skip this record
|
// Skip this record
|
||||||
if (gzeof(Zfile))
|
if (gzeof(Zfile))
|
||||||
@@ -293,7 +293,7 @@ int ZIPFAM::SkipRecord(PGLOBAL g, bool header)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* ReadBuffer: Read one line from a compressed text file. */
|
/* ReadBuffer: Read one line from a compressed text file. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
int ZIPFAM::ReadBuffer(PGLOBAL g)
|
int GZFAM::ReadBuffer(PGLOBAL g)
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
int rc;
|
int rc;
|
||||||
@@ -357,7 +357,7 @@ int ZIPFAM::ReadBuffer(PGLOBAL g)
|
|||||||
/* WriteDB: Data Base write routine for ZDOS access method. */
|
/* WriteDB: Data Base write routine for ZDOS access method. */
|
||||||
/* Update is not possible without using a temporary file (NIY). */
|
/* Update is not possible without using a temporary file (NIY). */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
int ZIPFAM::WriteBuffer(PGLOBAL g)
|
int GZFAM::WriteBuffer(PGLOBAL g)
|
||||||
{
|
{
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
/* Prepare the write buffer. */
|
/* Prepare the write buffer. */
|
||||||
@@ -376,7 +376,7 @@ int ZIPFAM::WriteBuffer(PGLOBAL g)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Data Base delete line routine for ZDOS access method. (NIY) */
|
/* Data Base delete line routine for ZDOS access method. (NIY) */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
int ZIPFAM::DeleteRecords(PGLOBAL g, int)
|
int GZFAM::DeleteRecords(PGLOBAL g, int)
|
||||||
{
|
{
|
||||||
strcpy(g->Message, MSG(NO_ZIP_DELETE));
|
strcpy(g->Message, MSG(NO_ZIP_DELETE));
|
||||||
return RC_FX;
|
return RC_FX;
|
||||||
@@ -385,21 +385,21 @@ int ZIPFAM::DeleteRecords(PGLOBAL g, int)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Data Base close routine for DOS access method. */
|
/* Data Base close routine for DOS access method. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
void ZIPFAM::CloseTableFile(PGLOBAL, bool)
|
void GZFAM::CloseTableFile(PGLOBAL, bool)
|
||||||
{
|
{
|
||||||
int rc = gzclose(Zfile);
|
int rc = gzclose(Zfile);
|
||||||
|
|
||||||
if (trace)
|
if (trace)
|
||||||
htrc("ZIP CloseDB: closing %s rc=%d\n", To_File, rc);
|
htrc("GZ CloseDB: closing %s rc=%d\n", To_File, rc);
|
||||||
|
|
||||||
Zfile = NULL; // So we can know whether table is open
|
Zfile = NULL; // So we can know whether table is open
|
||||||
//To_Fb->Count = 0; // Avoid double closing by PlugCloseAll
|
//To_Fb->Count = 0; // Avoid double closing by PlugCloseAll
|
||||||
} // end of CloseTableFile
|
} // end of CloseTableFile
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Rewind routine for ZIP access method. */
|
/* Rewind routine for GZ access method. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
void ZIPFAM::Rewind(void)
|
void GZFAM::Rewind(void)
|
||||||
{
|
{
|
||||||
gzrewind(Zfile);
|
gzrewind(Zfile);
|
||||||
} // end of Rewind
|
} // end of Rewind
|
||||||
@@ -409,7 +409,7 @@ void ZIPFAM::Rewind(void)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Constructors. */
|
/* Constructors. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
ZBKFAM::ZBKFAM(PDOSDEF tdp) : ZIPFAM(tdp)
|
ZBKFAM::ZBKFAM(PDOSDEF tdp) : GZFAM(tdp)
|
||||||
{
|
{
|
||||||
Blocked = true;
|
Blocked = true;
|
||||||
Block = tdp->GetBlock();
|
Block = tdp->GetBlock();
|
||||||
@@ -421,7 +421,7 @@ ZBKFAM::ZBKFAM(PDOSDEF tdp) : ZIPFAM(tdp)
|
|||||||
BlkPos = tdp->GetTo_Pos();
|
BlkPos = tdp->GetTo_Pos();
|
||||||
} // end of ZBKFAM standard constructor
|
} // end of ZBKFAM standard constructor
|
||||||
|
|
||||||
ZBKFAM::ZBKFAM(PZBKFAM txfp) : ZIPFAM(txfp)
|
ZBKFAM::ZBKFAM(PZBKFAM txfp) : GZFAM(txfp)
|
||||||
{
|
{
|
||||||
CurLine = txfp->CurLine;
|
CurLine = txfp->CurLine;
|
||||||
NxtLine = txfp->NxtLine;
|
NxtLine = txfp->NxtLine;
|
||||||
@@ -505,7 +505,7 @@ int ZBKFAM::GetPos(void)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
bool ZBKFAM::RecordPos(PGLOBAL /*g*/)
|
bool ZBKFAM::RecordPos(PGLOBAL /*g*/)
|
||||||
{
|
{
|
||||||
//strcpy(g->Message, "RecordPos not implemented for zip blocked tables");
|
//strcpy(g->Message, "RecordPos not implemented for gz blocked tables");
|
||||||
//return true;
|
//return true;
|
||||||
return RC_OK;
|
return RC_OK;
|
||||||
} // end of RecordPos
|
} // end of RecordPos
|
||||||
@@ -515,7 +515,7 @@ bool ZBKFAM::RecordPos(PGLOBAL /*g*/)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
int ZBKFAM::SkipRecord(PGLOBAL /*g*/, bool)
|
int ZBKFAM::SkipRecord(PGLOBAL /*g*/, bool)
|
||||||
{
|
{
|
||||||
//strcpy(g->Message, "SkipRecord not implemented for zip blocked tables");
|
//strcpy(g->Message, "SkipRecord not implemented for gz blocked tables");
|
||||||
//return RC_FX;
|
//return RC_FX;
|
||||||
return RC_OK;
|
return RC_OK;
|
||||||
} // end of SkipRecord
|
} // end of SkipRecord
|
||||||
@@ -615,7 +615,7 @@ int ZBKFAM::WriteBuffer(PGLOBAL g)
|
|||||||
|
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
/* In Insert mode, blocs are added sequentialy to the file end. */
|
/* In Insert mode, blocs are added sequentialy to the file end. */
|
||||||
/* Note: Update mode is not handled for zip files. */
|
/* Note: Update mode is not handled for gz files. */
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
if (++CurNum == Rbuf) {
|
if (++CurNum == Rbuf) {
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
@@ -703,7 +703,7 @@ void ZBKFAM::CloseTableFile(PGLOBAL g, bool)
|
|||||||
rc = gzclose(Zfile);
|
rc = gzclose(Zfile);
|
||||||
|
|
||||||
if (trace)
|
if (trace)
|
||||||
htrc("ZIP CloseDB: closing %s rc=%d\n", To_File, rc);
|
htrc("GZ CloseDB: closing %s rc=%d\n", To_File, rc);
|
||||||
|
|
||||||
Zfile = NULL; // So we can know whether table is open
|
Zfile = NULL; // So we can know whether table is open
|
||||||
//To_Fb->Count = 0; // Avoid double closing by PlugCloseAll
|
//To_Fb->Count = 0; // Avoid double closing by PlugCloseAll
|
||||||
@@ -854,7 +854,7 @@ int ZIXFAM::WriteBuffer(PGLOBAL g)
|
|||||||
{
|
{
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
/* In Insert mode, blocs are added sequentialy to the file end. */
|
/* In Insert mode, blocs are added sequentialy to the file end. */
|
||||||
/* Note: Update mode is not handled for zip files. */
|
/* Note: Update mode is not handled for gz files. */
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
if (++CurNum == Rbuf) {
|
if (++CurNum == Rbuf) {
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
@@ -1062,7 +1062,7 @@ int ZLBFAM::GetNextPos(void)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
bool ZLBFAM::SetPos(PGLOBAL g, int pos __attribute__((unused)))
|
bool ZLBFAM::SetPos(PGLOBAL g, int pos __attribute__((unused)))
|
||||||
{
|
{
|
||||||
sprintf(g->Message, MSG(NO_SETPOS_YET), "ZIP");
|
sprintf(g->Message, MSG(NO_SETPOS_YET), "GZ");
|
||||||
return true;
|
return true;
|
||||||
#if 0 // All this must be checked
|
#if 0 // All this must be checked
|
||||||
if (pos < 0) {
|
if (pos < 0) {
|
||||||
@@ -1423,4 +1423,4 @@ void ZLBFAM::Rewind(void)
|
|||||||
//Rbuf = 0; commented out in case we reuse last read block
|
//Rbuf = 0; commented out in case we reuse last read block
|
||||||
} // end of Rewind
|
} // end of Rewind
|
||||||
|
|
||||||
/* ------------------------ End of ZipFam ---------------------------- */
|
/* ------------------------ End of GzFam ---------------------------- */
|
@@ -1,16 +1,16 @@
|
|||||||
/************** FilAmZip H Declares Source Code File (.H) **************/
|
/*************** FilAmGz H Declares Source Code File (.H) **************/
|
||||||
/* Name: FILAMZIP.H Version 1.2 */
|
/* Name: FILAMGZ.H Version 1.3 */
|
||||||
/* */
|
/* */
|
||||||
/* (C) Copyright to the author Olivier BERTRAND 2005-2014 */
|
/* (C) Copyright to the author Olivier BERTRAND 2005-2016 */
|
||||||
/* */
|
/* */
|
||||||
/* This file contains the GZIP access method classes declares. */
|
/* This file contains the GZIP access method classes declares. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
#ifndef __FILAMZIP_H
|
#ifndef __FILAMGZ_H
|
||||||
#define __FILAMZIP_H
|
#define __FILAMGZ_H
|
||||||
|
|
||||||
#include "zlib.h"
|
#include "zlib.h"
|
||||||
|
|
||||||
typedef class ZIPFAM *PZIPFAM;
|
typedef class GZFAM *PGZFAM;
|
||||||
typedef class ZBKFAM *PZBKFAM;
|
typedef class ZBKFAM *PZBKFAM;
|
||||||
typedef class ZIXFAM *PZIXFAM;
|
typedef class ZIXFAM *PZIXFAM;
|
||||||
typedef class ZLBFAM *PZLBFAM;
|
typedef class ZLBFAM *PZLBFAM;
|
||||||
@@ -20,19 +20,19 @@ typedef class ZLBFAM *PZLBFAM;
|
|||||||
/* variable record length files compressed using the gzip library */
|
/* variable record length files compressed using the gzip library */
|
||||||
/* functions. File is accessed record by record (row). */
|
/* functions. File is accessed record by record (row). */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
class DllExport ZIPFAM : public TXTFAM {
|
class DllExport GZFAM : public TXTFAM {
|
||||||
// friend class DOSCOL;
|
// friend class DOSCOL;
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
ZIPFAM(PDOSDEF tdp) : TXTFAM(tdp) {Zfile = NULL; Zpos = 0;}
|
GZFAM(PDOSDEF tdp) : TXTFAM(tdp) {Zfile = NULL; Zpos = 0;}
|
||||||
ZIPFAM(PZIPFAM txfp);
|
GZFAM(PGZFAM txfp);
|
||||||
|
|
||||||
// Implementation
|
// Implementation
|
||||||
virtual AMT GetAmType(void) {return TYPE_AM_ZIP;}
|
virtual AMT GetAmType(void) {return TYPE_AM_GZ;}
|
||||||
virtual int GetPos(void);
|
virtual int GetPos(void);
|
||||||
virtual int GetNextPos(void);
|
virtual int GetNextPos(void);
|
||||||
virtual PTXF Duplicate(PGLOBAL g)
|
virtual PTXF Duplicate(PGLOBAL g)
|
||||||
{return (PTXF)new(g) ZIPFAM(this);}
|
{return (PTXF)new(g) GZFAM(this);}
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
virtual void Reset(void);
|
virtual void Reset(void);
|
||||||
@@ -57,14 +57,14 @@ class DllExport ZIPFAM : public TXTFAM {
|
|||||||
// Members
|
// Members
|
||||||
gzFile Zfile; // Points to GZ file structure
|
gzFile Zfile; // Points to GZ file structure
|
||||||
z_off_t Zpos; // Uncompressed file position
|
z_off_t Zpos; // Uncompressed file position
|
||||||
}; // end of class ZIPFAM
|
}; // end of class GZFAM
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* This is the access method class declaration for optimized variable */
|
/* This is the access method class declaration for optimized variable */
|
||||||
/* record length files compressed using the gzip library functions. */
|
/* record length files compressed using the gzip library functions. */
|
||||||
/* The File is accessed by block (requires an opt file). */
|
/* The File is accessed by block (requires an opt file). */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
class DllExport ZBKFAM : public ZIPFAM {
|
class DllExport ZBKFAM : public GZFAM {
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
ZBKFAM(PDOSDEF tdp);
|
ZBKFAM(PDOSDEF tdp);
|
||||||
@@ -167,4 +167,4 @@ class DllExport ZLBFAM : public BLKFAM {
|
|||||||
bool Optimized; // true when opt file is available
|
bool Optimized; // true when opt file is available
|
||||||
}; // end of class ZLBFAM
|
}; // end of class ZLBFAM
|
||||||
|
|
||||||
#endif // __FILAMZIP_H
|
#endif // __FILAMGZ_H
|
@@ -123,7 +123,7 @@ enum AMT {TYPE_AM_ERROR = 0, /* Type not defined */
|
|||||||
TYPE_AM_PRX = 129, /* PROXY access method type no */
|
TYPE_AM_PRX = 129, /* PROXY access method type no */
|
||||||
TYPE_AM_XTB = 130, /* SYS table access method type */
|
TYPE_AM_XTB = 130, /* SYS table access method type */
|
||||||
TYPE_AM_BLK = 131, /* BLK access method type no */
|
TYPE_AM_BLK = 131, /* BLK access method type no */
|
||||||
TYPE_AM_ZIP = 132, /* ZIP access method type no */
|
TYPE_AM_GZ = 132, /* GZ access method type no */
|
||||||
TYPE_AM_ZLIB = 133, /* ZLIB access method type no */
|
TYPE_AM_ZLIB = 133, /* ZLIB access method type no */
|
||||||
TYPE_AM_JSON = 134, /* JSON access method type no */
|
TYPE_AM_JSON = 134, /* JSON access method type no */
|
||||||
TYPE_AM_JSN = 135, /* JSN access method type no */
|
TYPE_AM_JSN = 135, /* JSN access method type no */
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/************* RelDef CPP Program Source Code File (.CPP) **************/
|
/************* RelDef CPP Program Source Code File (.CPP) **************/
|
||||||
/* PROGRAM NAME: RELDEF */
|
/* PROGRAM NAME: RELDEF */
|
||||||
/* ------------- */
|
/* ------------- */
|
||||||
/* Version 1.5 */
|
/* Version 1.6 */
|
||||||
/* */
|
/* */
|
||||||
/* COPYRIGHT: */
|
/* COPYRIGHT: */
|
||||||
/* ---------- */
|
/* ---------- */
|
||||||
@@ -43,9 +43,9 @@
|
|||||||
#if defined(VCT_SUPPORT)
|
#if defined(VCT_SUPPORT)
|
||||||
#include "filamvct.h"
|
#include "filamvct.h"
|
||||||
#endif // VCT_SUPPORT
|
#endif // VCT_SUPPORT
|
||||||
#if defined(ZIP_SUPPORT)
|
#if defined(GZ_SUPPORT)
|
||||||
#include "filamzip.h"
|
#include "filamgz.h"
|
||||||
#endif // ZIP_SUPPORT
|
#endif // GZ_SUPPORT
|
||||||
#include "tabdos.h"
|
#include "tabdos.h"
|
||||||
#include "valblk.h"
|
#include "valblk.h"
|
||||||
#include "tabmul.h"
|
#include "tabmul.h"
|
||||||
@@ -665,15 +665,15 @@ PTDB OEMDEF::GetTable(PGLOBAL g, MODE mode)
|
|||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
if (!((PTDBDOS)tdbp)->GetTxfp()) {
|
if (!((PTDBDOS)tdbp)->GetTxfp()) {
|
||||||
if (cmpr) {
|
if (cmpr) {
|
||||||
#if defined(ZIP_SUPPORT)
|
#if defined(GZ_SUPPORT)
|
||||||
if (cmpr == 1)
|
if (cmpr == 1)
|
||||||
txfp = new(g) ZIPFAM(defp);
|
txfp = new(g) GZFAM(defp);
|
||||||
else
|
else
|
||||||
txfp = new(g) ZLBFAM(defp);
|
txfp = new(g) ZLBFAM(defp);
|
||||||
#else // !ZIP_SUPPORT
|
#else // !GZ_SUPPORT
|
||||||
strcpy(g->Message, "Compress not supported");
|
strcpy(g->Message, "Compress not supported");
|
||||||
return NULL;
|
return NULL;
|
||||||
#endif // !ZIP_SUPPORT
|
#endif // !GZ_SUPPORT
|
||||||
} else if (rfm == RECFM_VAR) {
|
} else if (rfm == RECFM_VAR) {
|
||||||
if (map)
|
if (map)
|
||||||
txfp = new(g) MAPFAM(defp);
|
txfp = new(g) MAPFAM(defp);
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
/************* TabDos C++ Program Source Code File (.CPP) **************/
|
/************* TabDos C++ Program Source Code File (.CPP) **************/
|
||||||
/* PROGRAM NAME: TABDOS */
|
/* PROGRAM NAME: TABDOS */
|
||||||
/* ------------- */
|
/* ------------- */
|
||||||
/* Version 4.9 */
|
/* Version 4.9.1 */
|
||||||
/* */
|
/* */
|
||||||
/* COPYRIGHT: */
|
/* COPYRIGHT: */
|
||||||
/* ---------- */
|
/* ---------- */
|
||||||
/* (C) Copyright to the author Olivier BERTRAND 1998-2015 */
|
/* (C) Copyright to the author Olivier BERTRAND 1998-2016 */
|
||||||
/* */
|
/* */
|
||||||
/* WHAT THIS PROGRAM DOES: */
|
/* WHAT THIS PROGRAM DOES: */
|
||||||
/* ----------------------- */
|
/* ----------------------- */
|
||||||
@@ -51,9 +51,9 @@
|
|||||||
#include "filamap.h"
|
#include "filamap.h"
|
||||||
#include "filamfix.h"
|
#include "filamfix.h"
|
||||||
#include "filamdbf.h"
|
#include "filamdbf.h"
|
||||||
#if defined(ZIP_SUPPORT)
|
#if defined(GZ_SUPPORT)
|
||||||
#include "filamzip.h"
|
#include "filamgz.h"
|
||||||
#endif // ZIP_SUPPORT
|
#endif // GZ_SUPPORT
|
||||||
#include "tabdos.h"
|
#include "tabdos.h"
|
||||||
#include "tabfix.h"
|
#include "tabfix.h"
|
||||||
#include "tabmul.h"
|
#include "tabmul.h"
|
||||||
@@ -350,28 +350,28 @@ PTDB DOSDEF::GetTable(PGLOBAL g, MODE mode)
|
|||||||
else if (map)
|
else if (map)
|
||||||
txfp = new(g) MPXFAM(this);
|
txfp = new(g) MPXFAM(this);
|
||||||
else if (Compressed) {
|
else if (Compressed) {
|
||||||
#if defined(ZIP_SUPPORT)
|
#if defined(GZ_SUPPORT)
|
||||||
txfp = new(g) ZIXFAM(this);
|
txfp = new(g) ZIXFAM(this);
|
||||||
#else // !ZIP_SUPPORT
|
#else // !GZ_SUPPORT
|
||||||
sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "ZIP");
|
sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "GZ");
|
||||||
return NULL;
|
return NULL;
|
||||||
#endif // !ZIP_SUPPORT
|
#endif // !GZ_SUPPORT
|
||||||
} else
|
} else
|
||||||
txfp = new(g) FIXFAM(this);
|
txfp = new(g) FIXFAM(this);
|
||||||
|
|
||||||
tdbp = new(g) TDBFIX(this, txfp);
|
tdbp = new(g) TDBFIX(this, txfp);
|
||||||
} else {
|
} else {
|
||||||
if (Compressed) {
|
if (Compressed) {
|
||||||
#if defined(ZIP_SUPPORT)
|
#if defined(GZ_SUPPORT)
|
||||||
if (Compressed == 1)
|
if (Compressed == 1)
|
||||||
txfp = new(g) ZIPFAM(this);
|
txfp = new(g) GZFAM(this);
|
||||||
else
|
else
|
||||||
txfp = new(g) ZLBFAM(this);
|
txfp = new(g) ZLBFAM(this);
|
||||||
|
|
||||||
#else // !ZIP_SUPPORT
|
#else // !GZ_SUPPORT
|
||||||
sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "ZIP");
|
sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "GZ");
|
||||||
return NULL;
|
return NULL;
|
||||||
#endif // !ZIP_SUPPORT
|
#endif // !GZ_SUPPORT
|
||||||
} else if (map)
|
} else if (map)
|
||||||
txfp = new(g) MAPFAM(this);
|
txfp = new(g) MAPFAM(this);
|
||||||
else
|
else
|
||||||
@@ -396,7 +396,7 @@ PTDB DOSDEF::GetTable(PGLOBAL g, MODE mode)
|
|||||||
if (map) {
|
if (map) {
|
||||||
txfp = new(g) MBKFAM(this);
|
txfp = new(g) MBKFAM(this);
|
||||||
} else if (Compressed) {
|
} else if (Compressed) {
|
||||||
#if defined(ZIP_SUPPORT)
|
#if defined(GZ_SUPPORT)
|
||||||
if (Compressed == 1)
|
if (Compressed == 1)
|
||||||
txfp = new(g) ZBKFAM(this);
|
txfp = new(g) ZBKFAM(this);
|
||||||
else {
|
else {
|
||||||
@@ -404,7 +404,7 @@ PTDB DOSDEF::GetTable(PGLOBAL g, MODE mode)
|
|||||||
((PZLBFAM)txfp)->SetOptimized(To_Pos != NULL);
|
((PZLBFAM)txfp)->SetOptimized(To_Pos != NULL);
|
||||||
} // endelse
|
} // endelse
|
||||||
#else
|
#else
|
||||||
sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "ZIP");
|
sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "GZ");
|
||||||
return NULL;
|
return NULL;
|
||||||
#endif
|
#endif
|
||||||
} else
|
} else
|
||||||
@@ -531,13 +531,13 @@ int TDBDOS::ResetTableOpt(PGLOBAL g, bool dop, bool dox)
|
|||||||
// except for ZLIB access method.
|
// except for ZLIB access method.
|
||||||
if (Txfp->GetAmType() == TYPE_AM_MAP) {
|
if (Txfp->GetAmType() == TYPE_AM_MAP) {
|
||||||
Txfp = new(g) MAPFAM((PDOSDEF)To_Def);
|
Txfp = new(g) MAPFAM((PDOSDEF)To_Def);
|
||||||
#if defined(ZIP_SUPPORT)
|
#if defined(GZ_SUPPORT)
|
||||||
} else if (Txfp->GetAmType() == TYPE_AM_ZIP) {
|
} else if (Txfp->GetAmType() == TYPE_AM_GZ) {
|
||||||
Txfp = new(g) ZIPFAM((PDOSDEF)To_Def);
|
Txfp = new(g) GZFAM((PDOSDEF)To_Def);
|
||||||
} else if (Txfp->GetAmType() == TYPE_AM_ZLIB) {
|
} else if (Txfp->GetAmType() == TYPE_AM_ZLIB) {
|
||||||
Txfp->Reset();
|
Txfp->Reset();
|
||||||
((PZLBFAM)Txfp)->SetOptimized(false);
|
((PZLBFAM)Txfp)->SetOptimized(false);
|
||||||
#endif // ZIP_SUPPORT
|
#endif // GZ_SUPPORT
|
||||||
} else if (Txfp->GetAmType() == TYPE_AM_BLK)
|
} else if (Txfp->GetAmType() == TYPE_AM_BLK)
|
||||||
Txfp = new(g) DOSFAM((PDOSDEF)To_Def);
|
Txfp = new(g) DOSFAM((PDOSDEF)To_Def);
|
||||||
|
|
||||||
@@ -2079,10 +2079,10 @@ bool TDBDOS::OpenDB(PGLOBAL g)
|
|||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
if (Txfp->GetAmType() == TYPE_AM_MAP && Mode == MODE_DELETE)
|
if (Txfp->GetAmType() == TYPE_AM_MAP && Mode == MODE_DELETE)
|
||||||
Txfp = new(g) MAPFAM((PDOSDEF)To_Def);
|
Txfp = new(g) MAPFAM((PDOSDEF)To_Def);
|
||||||
#if defined(ZIP_SUPPORT)
|
#if defined(GZ_SUPPORT)
|
||||||
else if (Txfp->GetAmType() == TYPE_AM_ZIP)
|
else if (Txfp->GetAmType() == TYPE_AM_GZ)
|
||||||
Txfp = new(g) ZIPFAM((PDOSDEF)To_Def);
|
Txfp = new(g) GZFAM((PDOSDEF)To_Def);
|
||||||
#endif // ZIP_SUPPORT
|
#endif // GZ_SUPPORT
|
||||||
else // if (Txfp->GetAmType() != TYPE_AM_DOS) ???
|
else // if (Txfp->GetAmType() != TYPE_AM_DOS) ???
|
||||||
Txfp = new(g) DOSFAM((PDOSDEF)To_Def);
|
Txfp = new(g) DOSFAM((PDOSDEF)To_Def);
|
||||||
|
|
||||||
|
@@ -91,7 +91,7 @@ class DllExport DOSDEF : public TABDEF { /* Logical table description */
|
|||||||
int Maxerr; /* Maximum number of bad records (DBF) */
|
int Maxerr; /* Maximum number of bad records (DBF) */
|
||||||
int ReadMode; /* Specific to DBF */
|
int ReadMode; /* Specific to DBF */
|
||||||
int Ending; /* Length of end of lines */
|
int Ending; /* Length of end of lines */
|
||||||
int Teds; /* Binary table default endian setting */
|
char Teds; /* Binary table default endian setting */
|
||||||
}; // end of DOSDEF
|
}; // end of DOSDEF
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
/************* TabFix C++ Program Source Code File (.CPP) **************/
|
/************* TabFix C++ Program Source Code File (.CPP) **************/
|
||||||
/* PROGRAM NAME: TABFIX */
|
/* PROGRAM NAME: TABFIX */
|
||||||
/* ------------- */
|
/* ------------- */
|
||||||
/* Version 4.9 */
|
/* Version 4.9.1 */
|
||||||
/* */
|
/* */
|
||||||
/* COPYRIGHT: */
|
/* COPYRIGHT: */
|
||||||
/* ---------- */
|
/* ---------- */
|
||||||
/* (C) Copyright to the author Olivier BERTRAND 1998-2015 */
|
/* (C) Copyright to the author Olivier BERTRAND 1998-2016 */
|
||||||
/* */
|
/* */
|
||||||
/* WHAT THIS PROGRAM DOES: */
|
/* WHAT THIS PROGRAM DOES: */
|
||||||
/* ----------------------- */
|
/* ----------------------- */
|
||||||
@@ -589,9 +589,10 @@ void BINCOL::WriteColumn(PGLOBAL g)
|
|||||||
switch (Fmt) {
|
switch (Fmt) {
|
||||||
case 'X':
|
case 'X':
|
||||||
// Standard not converted values
|
// Standard not converted values
|
||||||
if (Eds && IsTypeChar(Buf_Type))
|
if (Eds && IsTypeChar(Buf_Type)) {
|
||||||
*(longlong *)p = Value->GetBigintValue();
|
if (Status)
|
||||||
else if (Value->GetBinValue(p, Long, Status)) {
|
Value->GetValueNonAligned<longlong>(p, Value->GetBigintValue());
|
||||||
|
} else if (Value->GetBinValue(p, Long, Status)) {
|
||||||
sprintf(g->Message, MSG(BIN_F_TOO_LONG),
|
sprintf(g->Message, MSG(BIN_F_TOO_LONG),
|
||||||
Name, Value->GetSize(), Long);
|
Name, Value->GetSize(), Long);
|
||||||
longjmp(g->jumper[g->jump_level], 31);
|
longjmp(g->jumper[g->jump_level], 31);
|
||||||
@@ -605,7 +606,7 @@ void BINCOL::WriteColumn(PGLOBAL g)
|
|||||||
sprintf(g->Message, MSG(VALUE_TOO_BIG), n, Name);
|
sprintf(g->Message, MSG(VALUE_TOO_BIG), n, Name);
|
||||||
longjmp(g->jumper[g->jump_level], 31);
|
longjmp(g->jumper[g->jump_level], 31);
|
||||||
} else if (Status)
|
} else if (Status)
|
||||||
*(short *)p = (short)n;
|
Value->GetValueNonAligned<short>(p, (short)n);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'T': // Tiny integer
|
case 'T': // Tiny integer
|
||||||
@@ -625,7 +626,7 @@ void BINCOL::WriteColumn(PGLOBAL g)
|
|||||||
sprintf(g->Message, MSG(VALUE_TOO_BIG), n, Name);
|
sprintf(g->Message, MSG(VALUE_TOO_BIG), n, Name);
|
||||||
longjmp(g->jumper[g->jump_level], 31);
|
longjmp(g->jumper[g->jump_level], 31);
|
||||||
} else if (Status)
|
} else if (Status)
|
||||||
*(int *)p = Value->GetIntValue();
|
Value->GetValueNonAligned<int>(p, (int)n);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'G': // Large (great) integer
|
case 'G': // Large (great) integer
|
||||||
@@ -636,12 +637,12 @@ void BINCOL::WriteColumn(PGLOBAL g)
|
|||||||
case 'F': // Float
|
case 'F': // Float
|
||||||
case 'R': // Real
|
case 'R': // Real
|
||||||
if (Status)
|
if (Status)
|
||||||
*(float *)p = (float)Value->GetFloatValue();
|
Value->GetValueNonAligned<float>(p, (float)Value->GetFloatValue());
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'D': // Double
|
case 'D': // Double
|
||||||
if (Status)
|
if (Status)
|
||||||
*(double *)p = Value->GetFloatValue();
|
Value->GetValueNonAligned<double>(p, Value->GetFloatValue());
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'C': // Characters
|
case 'C': // Characters
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
/************* TabFmt C++ Program Source Code File (.CPP) **************/
|
/************* TabFmt C++ Program Source Code File (.CPP) **************/
|
||||||
/* PROGRAM NAME: TABFMT */
|
/* PROGRAM NAME: TABFMT */
|
||||||
/* ------------- */
|
/* ------------- */
|
||||||
/* Version 3.9 */
|
/* Version 3.9.1 */
|
||||||
/* */
|
/* */
|
||||||
/* COPYRIGHT: */
|
/* COPYRIGHT: */
|
||||||
/* ---------- */
|
/* ---------- */
|
||||||
/* (C) Copyright to the author Olivier BERTRAND 2001 - 2015 */
|
/* (C) Copyright to the author Olivier BERTRAND 2001 - 2016 */
|
||||||
/* */
|
/* */
|
||||||
/* WHAT THIS PROGRAM DOES: */
|
/* WHAT THIS PROGRAM DOES: */
|
||||||
/* ----------------------- */
|
/* ----------------------- */
|
||||||
@@ -51,9 +51,9 @@
|
|||||||
#include "plgdbsem.h"
|
#include "plgdbsem.h"
|
||||||
#include "mycat.h"
|
#include "mycat.h"
|
||||||
#include "filamap.h"
|
#include "filamap.h"
|
||||||
#if defined(ZIP_SUPPORT)
|
#if defined(GZ_SUPPORT)
|
||||||
#include "filamzip.h"
|
#include "filamgz.h"
|
||||||
#endif // ZIP_SUPPORT
|
#endif // GZ_SUPPORT
|
||||||
#include "tabfmt.h"
|
#include "tabfmt.h"
|
||||||
#include "tabmul.h"
|
#include "tabmul.h"
|
||||||
#define NO_FUNC
|
#define NO_FUNC
|
||||||
@@ -462,16 +462,16 @@ PTDB CSVDEF::GetTable(PGLOBAL g, MODE mode)
|
|||||||
// Should be now compatible with UNIX
|
// Should be now compatible with UNIX
|
||||||
txfp = new(g) MAPFAM(this);
|
txfp = new(g) MAPFAM(this);
|
||||||
} else if (Compressed) {
|
} else if (Compressed) {
|
||||||
#if defined(ZIP_SUPPORT)
|
#if defined(GZ_SUPPORT)
|
||||||
if (Compressed == 1)
|
if (Compressed == 1)
|
||||||
txfp = new(g) ZIPFAM(this);
|
txfp = new(g) GZFAM(this);
|
||||||
else
|
else
|
||||||
txfp = new(g) ZLBFAM(this);
|
txfp = new(g) ZLBFAM(this);
|
||||||
|
|
||||||
#else // !ZIP_SUPPORT
|
#else // !GZ_SUPPORT
|
||||||
strcpy(g->Message, "Compress not supported");
|
strcpy(g->Message, "Compress not supported");
|
||||||
return NULL;
|
return NULL;
|
||||||
#endif // !ZIP_SUPPORT
|
#endif // !GZ_SUPPORT
|
||||||
} else
|
} else
|
||||||
txfp = new(g) DOSFAM(this);
|
txfp = new(g) DOSFAM(this);
|
||||||
|
|
||||||
@@ -498,7 +498,7 @@ PTDB CSVDEF::GetTable(PGLOBAL g, MODE mode)
|
|||||||
if (map) {
|
if (map) {
|
||||||
txfp = new(g) MBKFAM(this);
|
txfp = new(g) MBKFAM(this);
|
||||||
} else if (Compressed) {
|
} else if (Compressed) {
|
||||||
#if defined(ZIP_SUPPORT)
|
#if defined(GZ_SUPPORT)
|
||||||
if (Compressed == 1)
|
if (Compressed == 1)
|
||||||
txfp = new(g) ZBKFAM(this);
|
txfp = new(g) ZBKFAM(this);
|
||||||
else {
|
else {
|
||||||
@@ -506,7 +506,7 @@ PTDB CSVDEF::GetTable(PGLOBAL g, MODE mode)
|
|||||||
((PZLBFAM)txfp)->SetOptimized(To_Pos != NULL);
|
((PZLBFAM)txfp)->SetOptimized(To_Pos != NULL);
|
||||||
} // endelse
|
} // endelse
|
||||||
#else
|
#else
|
||||||
sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "ZIP");
|
sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "GZ");
|
||||||
return NULL;
|
return NULL;
|
||||||
#endif
|
#endif
|
||||||
} else
|
} else
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/************* tabjson C++ Program Source Code File (.CPP) *************/
|
/************* tabjson C++ Program Source Code File (.CPP) *************/
|
||||||
/* PROGRAM NAME: tabjson Version 1.1 */
|
/* PROGRAM NAME: tabjson Version 1.2 */
|
||||||
/* (C) Copyright to the author Olivier BERTRAND 2014 - 2015 */
|
/* (C) Copyright to the author Olivier BERTRAND 2014 - 2016 */
|
||||||
/* This program are the JSON class DB execution routines. */
|
/* This program are the JSON class DB execution routines. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
|
|
||||||
@@ -25,9 +25,9 @@
|
|||||||
//#include "resource.h" // for IDS_COLUMNS
|
//#include "resource.h" // for IDS_COLUMNS
|
||||||
#include "tabjson.h"
|
#include "tabjson.h"
|
||||||
#include "filamap.h"
|
#include "filamap.h"
|
||||||
#if defined(ZIP_SUPPORT)
|
#if defined(GZ_SUPPORT)
|
||||||
#include "filamzip.h"
|
#include "filamgz.h"
|
||||||
#endif // ZIP_SUPPORT
|
#endif // GZ_SUPPORT
|
||||||
#include "tabmul.h"
|
#include "tabmul.h"
|
||||||
#include "checklvl.h"
|
#include "checklvl.h"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
@@ -396,15 +396,15 @@ PTDB JSONDEF::GetTable(PGLOBAL g, MODE m)
|
|||||||
(m == MODE_UPDATE || m == MODE_DELETE));
|
(m == MODE_UPDATE || m == MODE_DELETE));
|
||||||
|
|
||||||
if (Compressed) {
|
if (Compressed) {
|
||||||
#if defined(ZIP_SUPPORT)
|
#if defined(GZ_SUPPORT)
|
||||||
if (Compressed == 1)
|
if (Compressed == 1)
|
||||||
txfp = new(g) ZIPFAM(this);
|
txfp = new(g) GZFAM(this);
|
||||||
else
|
else
|
||||||
txfp = new(g) ZLBFAM(this);
|
txfp = new(g) ZLBFAM(this);
|
||||||
#else // !ZIP_SUPPORT
|
#else // !GZ_SUPPORT
|
||||||
sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "ZIP");
|
sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "GZ");
|
||||||
return NULL;
|
return NULL;
|
||||||
#endif // !ZIP_SUPPORT
|
#endif // !GZ_SUPPORT
|
||||||
} else if (map)
|
} else if (map)
|
||||||
txfp = new(g) MAPFAM(this);
|
txfp = new(g) MAPFAM(this);
|
||||||
else
|
else
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/************* Value C++ Functions Source Code File (.CPP) *************/
|
/************* Value C++ Functions Source Code File (.CPP) *************/
|
||||||
/* Name: VALUE.CPP Version 2.5 */
|
/* Name: VALUE.CPP Version 2.6 */
|
||||||
/* */
|
/* */
|
||||||
/* (C) Copyright to the author Olivier BERTRAND 2001-2015 */
|
/* (C) Copyright to the author Olivier BERTRAND 2001-2016 */
|
||||||
/* */
|
/* */
|
||||||
/* This file contains the VALUE and derived classes family functions. */
|
/* This file contains the VALUE and derived classes family functions. */
|
||||||
/* These classes contain values of different types. They are used so */
|
/* These classes contain values of different types. They are used so */
|
||||||
@@ -792,19 +792,29 @@ uchar TYPVAL<uchar>::GetTypedValue(PVBLK blk, int n)
|
|||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* TYPVAL SetBinValue: with bytes extracted from a line. */
|
/* TYPVAL SetBinValue: with bytes extracted from a line. */
|
||||||
|
/* Currently only used reading column of binary files. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
template <class TYPE>
|
template <class TYPE>
|
||||||
void TYPVAL<TYPE>::SetBinValue(void *p)
|
void TYPVAL<TYPE>::SetBinValue(void *p)
|
||||||
{
|
{
|
||||||
Tval = *(TYPE *)p;
|
#if defined(UNALIGNED_OK)
|
||||||
Null = false;
|
// x86 can cast non-aligned memory directly
|
||||||
} // end of SetBinValue
|
Tval = *(TYPE *)p;
|
||||||
|
#else
|
||||||
|
// Prevent unaligned memory access on MIPS and ArmHF platforms.
|
||||||
|
// Make use of memcpy instead of straight pointer dereferencing.
|
||||||
|
// Currently only used by WriteColumn of binary files.
|
||||||
|
// From original author: Vicentiu Ciorbaru <vicentiu@mariadb.org>
|
||||||
|
memcpy(&Tval, p, sizeof(TYPE));
|
||||||
|
#endif
|
||||||
|
Null = false;
|
||||||
|
} // end of SetBinValue
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* GetBinValue: fill a buffer with the internal binary value. */
|
/* GetBinValue: fill a buffer with the internal binary value. */
|
||||||
/* This function checks whether the buffer length is enough and */
|
/* This function checks whether the buffer length is enough and */
|
||||||
/* returns true if not. Actual filling occurs only if go is true. */
|
/* returns true if not. Actual filling occurs only if go is true. */
|
||||||
/* Currently used by WriteColumn of binary files. */
|
/* Currently only used writing column of binary files. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
template <class TYPE>
|
template <class TYPE>
|
||||||
bool TYPVAL<TYPE>::GetBinValue(void *buf, int buflen, bool go)
|
bool TYPVAL<TYPE>::GetBinValue(void *buf, int buflen, bool go)
|
||||||
@@ -819,7 +829,16 @@ bool TYPVAL<TYPE>::GetBinValue(void *buf, int buflen, bool go)
|
|||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
if (go)
|
if (go)
|
||||||
*(TYPE *)buf = Tval;
|
#if defined(UNALIGNED_OK)
|
||||||
|
// x86 can cast non-aligned memory directly
|
||||||
|
*(TYPE *)buf = Tval;
|
||||||
|
#else
|
||||||
|
// Prevent unaligned memory access on MIPS and ArmHF platforms.
|
||||||
|
// Make use of memcpy instead of straight pointer dereferencing.
|
||||||
|
// Currently only used by WriteColumn of binary files.
|
||||||
|
// From original author: Vicentiu Ciorbaru <vicentiu@mariadb.org>
|
||||||
|
memcpy(buf, &Tval, sizeof(TYPE));
|
||||||
|
#endif
|
||||||
|
|
||||||
Null = false;
|
Null = false;
|
||||||
return false;
|
return false;
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/**************** Value H Declares Source Code File (.H) ***************/
|
/**************** Value H Declares Source Code File (.H) ***************/
|
||||||
/* Name: VALUE.H Version 2.1 */
|
/* Name: VALUE.H Version 2.2 */
|
||||||
/* */
|
/* */
|
||||||
/* (C) Copyright to the author Olivier BERTRAND 2001-2014 */
|
/* (C) Copyright to the author Olivier BERTRAND 2001-2016 */
|
||||||
/* */
|
/* */
|
||||||
/* This file contains the VALUE and derived classes declares. */
|
/* This file contains the VALUE and derived classes declares. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@@ -16,6 +16,13 @@
|
|||||||
#include "assert.h"
|
#include "assert.h"
|
||||||
#include "block.h"
|
#include "block.h"
|
||||||
|
|
||||||
|
/***********************************************************************/
|
||||||
|
/* This should list the processors accepting unaligned numeral values.*/
|
||||||
|
/***********************************************************************/
|
||||||
|
#if defined(__i386__) || defined(__x86_64__) || defined(_M_IX86) || defined(_M_X64) || defined(_M_AMD64) || defined(_M_IA64)
|
||||||
|
#define UNALIGNED_OK
|
||||||
|
#endif
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Types used in some class definitions. */
|
/* Types used in some class definitions. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@@ -116,27 +123,46 @@ class DllExport VALUE : public BLOCK {
|
|||||||
virtual bool Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op);
|
virtual bool Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op);
|
||||||
virtual bool FormatValue(PVAL vp, char *fmt) = 0;
|
virtual bool FormatValue(PVAL vp, char *fmt) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Set value from a non-aligned in-memory value in the machine byte order.
|
Set value from a non-aligned in-memory value in the machine byte order.
|
||||||
TYPE can be either of:
|
TYPE can be either of:
|
||||||
- int, short, longlong
|
- int, short, longlong
|
||||||
- uint, ushort, ulonglong
|
- uint, ushort, ulonglong
|
||||||
- float, double
|
- float, double
|
||||||
@param - a pointer to a non-aligned value of type TYPE.
|
@param - a pointer to a non-aligned value of type TYPE.
|
||||||
*/
|
*/
|
||||||
template<typename TYPE>
|
template<typename TYPE>
|
||||||
void SetValueNonAligned(const char *p)
|
void SetValueNonAligned(const char *p)
|
||||||
{
|
{
|
||||||
#if defined(__i386__) || defined(__x86_64__)
|
#if defined(UNALIGNED_OK)
|
||||||
SetValue(*((TYPE*) p)); // x86 can cast non-aligned memory directly
|
SetValue(*((TYPE*)p)); // x86 can cast non-aligned memory directly
|
||||||
#else
|
#else
|
||||||
TYPE tmp; // a slower version for non-x86 platforms
|
TYPE tmp; // a slower version for non-x86 platforms
|
||||||
memcpy(&tmp, p, sizeof(tmp));
|
memcpy(&tmp, p, sizeof(tmp));
|
||||||
SetValue(tmp);
|
SetValue(tmp);
|
||||||
#endif
|
#endif
|
||||||
}
|
} // end of SetValueNonAligned
|
||||||
|
|
||||||
protected:
|
/**
|
||||||
|
Get value from a non-aligned in-memory value in the machine byte order.
|
||||||
|
TYPE can be either of:
|
||||||
|
- int, short, longlong
|
||||||
|
- uint, ushort, ulonglong
|
||||||
|
- float, double
|
||||||
|
@params - a pointer to a non-aligned value of type TYPE, the TYPE value.
|
||||||
|
*/
|
||||||
|
template<typename TYPE>
|
||||||
|
void GetValueNonAligned(char *p, TYPE n)
|
||||||
|
{
|
||||||
|
#if defined(UNALIGNED_OK)
|
||||||
|
*(TYPE *)p = n; // x86 can cast non-aligned memory directly
|
||||||
|
#else
|
||||||
|
TYPE tmp = n; // a slower version for non-x86 platforms
|
||||||
|
memcpy(p, &tmp, sizeof(tmp));
|
||||||
|
#endif
|
||||||
|
} // end of SetValueNonAligned
|
||||||
|
|
||||||
|
protected:
|
||||||
virtual bool SetConstFormat(PGLOBAL, FORMAT&) = 0;
|
virtual bool SetConstFormat(PGLOBAL, FORMAT&) = 0;
|
||||||
const char *GetXfmt(void);
|
const char *GetXfmt(void);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user