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
|
||||
fmdlex.c osutil.c plugutil.c rcmsg.c rcmsg.h
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
@@ -38,7 +38,7 @@ user_connect.h valblk.h value.h xindex.h xobject.h xtable.h)
|
||||
# Definitions that are shared for all OSes
|
||||
#
|
||||
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 )
|
||||
|
||||
|
||||
#
|
||||
|
@@ -1,11 +1,11 @@
|
||||
/*********** File AM Zip C++ Program Source Code File (.CPP) ***********/
|
||||
/* PROGRAM NAME: FILAMZIP */
|
||||
/************ File AM GZ C++ Program Source Code File (.CPP) ***********/
|
||||
/* PROGRAM NAME: FILAMGZ */
|
||||
/* ------------- */
|
||||
/* Version 1.5 */
|
||||
/* */
|
||||
/* COPYRIGHT: */
|
||||
/* ---------- */
|
||||
/* (C) Copyright to the author Olivier BERTRAND 2005-2015 */
|
||||
/* (C) Copyright to the author Olivier BERTRAND 2005-2016 */
|
||||
/* */
|
||||
/* WHAT THIS PROGRAM DOES: */
|
||||
/* ----------------------- */
|
||||
@@ -56,7 +56,7 @@
|
||||
/***********************************************************************/
|
||||
//#define ZLIB_DLL
|
||||
|
||||
#include "filamzip.h"
|
||||
#include "filamgz.h"
|
||||
|
||||
/***********************************************************************/
|
||||
/* 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;
|
||||
Zpos = txfp->Zpos;
|
||||
} // end of ZIPFAM copy constructor
|
||||
} // end of GZFAM copy constructor
|
||||
|
||||
/***********************************************************************/
|
||||
/* 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 */
|
||||
/* errno to get the exact error code. */
|
||||
/***********************************************************************/
|
||||
int ZIPFAM::Zerror(PGLOBAL g)
|
||||
int GZFAM::Zerror(PGLOBAL g)
|
||||
{
|
||||
int errnum;
|
||||
|
||||
@@ -101,7 +101,7 @@ int ZIPFAM::Zerror(PGLOBAL g)
|
||||
/***********************************************************************/
|
||||
/* Reset: reset position values at the beginning of file. */
|
||||
/***********************************************************************/
|
||||
void ZIPFAM::Reset(void)
|
||||
void GZFAM::Reset(void)
|
||||
{
|
||||
TXTFAM::Reset();
|
||||
//gzrewind(Zfile); // Useful ?????
|
||||
@@ -109,10 +109,10 @@ void ZIPFAM::Reset(void)
|
||||
} // 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. */
|
||||
/***********************************************************************/
|
||||
int ZIPFAM::GetFileLength(PGLOBAL g)
|
||||
int GZFAM::GetFileLength(PGLOBAL g)
|
||||
{
|
||||
int len = TXTFAM::GetFileLength(g);
|
||||
|
||||
@@ -124,9 +124,9 @@ int ZIPFAM::GetFileLength(PGLOBAL g)
|
||||
} // 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];
|
||||
MODE mode = Tdbp->GetMode();
|
||||
@@ -137,7 +137,7 @@ bool ZIPFAM::OpenTableFile(PGLOBAL g)
|
||||
break;
|
||||
case MODE_UPDATE:
|
||||
/*****************************************************************/
|
||||
/* Updating ZIP files not implemented yet. */
|
||||
/* Updating GZ files not implemented yet. */
|
||||
/*****************************************************************/
|
||||
strcpy(g->Message, MSG(UPD_ZIP_NOT_IMP));
|
||||
return true;
|
||||
@@ -152,7 +152,7 @@ bool ZIPFAM::OpenTableFile(PGLOBAL g)
|
||||
// Last = Nrec; // For ZBKFAM
|
||||
Tdbp->ResetSize();
|
||||
} else {
|
||||
sprintf(g->Message, MSG(NO_PART_DEL), "ZIP");
|
||||
sprintf(g->Message, MSG(NO_PART_DEL), "GZ");
|
||||
return true;
|
||||
} // endif filter
|
||||
|
||||
@@ -196,7 +196,7 @@ bool ZIPFAM::OpenTableFile(PGLOBAL g)
|
||||
/* 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. */
|
||||
/***********************************************************************/
|
||||
bool ZIPFAM::AllocateBuffer(PGLOBAL g)
|
||||
bool GZFAM::AllocateBuffer(PGLOBAL g)
|
||||
{
|
||||
MODE mode = Tdbp->GetMode();
|
||||
|
||||
@@ -223,7 +223,7 @@ bool ZIPFAM::AllocateBuffer(PGLOBAL g)
|
||||
/***********************************************************************/
|
||||
/* GetRowID: return the RowID of last read record. */
|
||||
/***********************************************************************/
|
||||
int ZIPFAM::GetRowID(void)
|
||||
int GZFAM::GetRowID(void)
|
||||
{
|
||||
return Rows;
|
||||
} // end of GetRowID
|
||||
@@ -231,7 +231,7 @@ int ZIPFAM::GetRowID(void)
|
||||
/***********************************************************************/
|
||||
/* GetPos: return the position of last read record. */
|
||||
/***********************************************************************/
|
||||
int ZIPFAM::GetPos(void)
|
||||
int GZFAM::GetPos(void)
|
||||
{
|
||||
return (int)Zpos;
|
||||
} // end of GetPos
|
||||
@@ -239,7 +239,7 @@ int ZIPFAM::GetPos(void)
|
||||
/***********************************************************************/
|
||||
/* GetNextPos: return the position of next record. */
|
||||
/***********************************************************************/
|
||||
int ZIPFAM::GetNextPos(void)
|
||||
int GZFAM::GetNextPos(void)
|
||||
{
|
||||
return gztell(Zfile);
|
||||
} // end of GetNextPos
|
||||
@@ -247,9 +247,9 @@ int ZIPFAM::GetNextPos(void)
|
||||
/***********************************************************************/
|
||||
/* 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;
|
||||
#if 0
|
||||
Fpos = pos;
|
||||
@@ -267,7 +267,7 @@ bool ZIPFAM::SetPos(PGLOBAL g, int pos __attribute__((unused)))
|
||||
/***********************************************************************/
|
||||
/* Record file position in case of UPDATE or DELETE. */
|
||||
/***********************************************************************/
|
||||
bool ZIPFAM::RecordPos(PGLOBAL)
|
||||
bool GZFAM::RecordPos(PGLOBAL)
|
||||
{
|
||||
Zpos = gztell(Zfile);
|
||||
return false;
|
||||
@@ -276,7 +276,7 @@ bool ZIPFAM::RecordPos(PGLOBAL)
|
||||
/***********************************************************************/
|
||||
/* Skip one record in file. */
|
||||
/***********************************************************************/
|
||||
int ZIPFAM::SkipRecord(PGLOBAL g, bool header)
|
||||
int GZFAM::SkipRecord(PGLOBAL g, bool header)
|
||||
{
|
||||
// Skip this record
|
||||
if (gzeof(Zfile))
|
||||
@@ -293,7 +293,7 @@ int ZIPFAM::SkipRecord(PGLOBAL g, bool header)
|
||||
/***********************************************************************/
|
||||
/* ReadBuffer: Read one line from a compressed text file. */
|
||||
/***********************************************************************/
|
||||
int ZIPFAM::ReadBuffer(PGLOBAL g)
|
||||
int GZFAM::ReadBuffer(PGLOBAL g)
|
||||
{
|
||||
char *p;
|
||||
int rc;
|
||||
@@ -357,7 +357,7 @@ int ZIPFAM::ReadBuffer(PGLOBAL g)
|
||||
/* WriteDB: Data Base write routine for ZDOS access method. */
|
||||
/* Update is not possible without using a temporary file (NIY). */
|
||||
/***********************************************************************/
|
||||
int ZIPFAM::WriteBuffer(PGLOBAL g)
|
||||
int GZFAM::WriteBuffer(PGLOBAL g)
|
||||
{
|
||||
/*********************************************************************/
|
||||
/* Prepare the write buffer. */
|
||||
@@ -376,7 +376,7 @@ int ZIPFAM::WriteBuffer(PGLOBAL g)
|
||||
/***********************************************************************/
|
||||
/* 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));
|
||||
return RC_FX;
|
||||
@@ -385,21 +385,21 @@ int ZIPFAM::DeleteRecords(PGLOBAL g, int)
|
||||
/***********************************************************************/
|
||||
/* Data Base close routine for DOS access method. */
|
||||
/***********************************************************************/
|
||||
void ZIPFAM::CloseTableFile(PGLOBAL, bool)
|
||||
void GZFAM::CloseTableFile(PGLOBAL, bool)
|
||||
{
|
||||
int rc = gzclose(Zfile);
|
||||
|
||||
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
|
||||
//To_Fb->Count = 0; // Avoid double closing by PlugCloseAll
|
||||
} // 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);
|
||||
} // end of Rewind
|
||||
@@ -409,7 +409,7 @@ void ZIPFAM::Rewind(void)
|
||||
/***********************************************************************/
|
||||
/* Constructors. */
|
||||
/***********************************************************************/
|
||||
ZBKFAM::ZBKFAM(PDOSDEF tdp) : ZIPFAM(tdp)
|
||||
ZBKFAM::ZBKFAM(PDOSDEF tdp) : GZFAM(tdp)
|
||||
{
|
||||
Blocked = true;
|
||||
Block = tdp->GetBlock();
|
||||
@@ -421,7 +421,7 @@ ZBKFAM::ZBKFAM(PDOSDEF tdp) : ZIPFAM(tdp)
|
||||
BlkPos = tdp->GetTo_Pos();
|
||||
} // end of ZBKFAM standard constructor
|
||||
|
||||
ZBKFAM::ZBKFAM(PZBKFAM txfp) : ZIPFAM(txfp)
|
||||
ZBKFAM::ZBKFAM(PZBKFAM txfp) : GZFAM(txfp)
|
||||
{
|
||||
CurLine = txfp->CurLine;
|
||||
NxtLine = txfp->NxtLine;
|
||||
@@ -505,7 +505,7 @@ int ZBKFAM::GetPos(void)
|
||||
/***********************************************************************/
|
||||
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 RC_OK;
|
||||
} // end of RecordPos
|
||||
@@ -515,7 +515,7 @@ bool ZBKFAM::RecordPos(PGLOBAL /*g*/)
|
||||
/***********************************************************************/
|
||||
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_OK;
|
||||
} // end of SkipRecord
|
||||
@@ -615,7 +615,7 @@ int ZBKFAM::WriteBuffer(PGLOBAL g)
|
||||
|
||||
/*********************************************************************/
|
||||
/* 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) {
|
||||
/*******************************************************************/
|
||||
@@ -703,7 +703,7 @@ void ZBKFAM::CloseTableFile(PGLOBAL g, bool)
|
||||
rc = gzclose(Zfile);
|
||||
|
||||
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
|
||||
//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. */
|
||||
/* Note: Update mode is not handled for zip files. */
|
||||
/* Note: Update mode is not handled for gz files. */
|
||||
/*********************************************************************/
|
||||
if (++CurNum == Rbuf) {
|
||||
/*******************************************************************/
|
||||
@@ -1062,7 +1062,7 @@ int ZLBFAM::GetNextPos(void)
|
||||
/***********************************************************************/
|
||||
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;
|
||||
#if 0 // All this must be checked
|
||||
if (pos < 0) {
|
||||
@@ -1423,4 +1423,4 @@ void ZLBFAM::Rewind(void)
|
||||
//Rbuf = 0; commented out in case we reuse last read block
|
||||
} // end of Rewind
|
||||
|
||||
/* ------------------------ End of ZipFam ---------------------------- */
|
||||
/* ------------------------ End of GzFam ---------------------------- */
|
@@ -1,16 +1,16 @@
|
||||
/************** FilAmZip H Declares Source Code File (.H) **************/
|
||||
/* Name: FILAMZIP.H Version 1.2 */
|
||||
/*************** FilAmGz H Declares Source Code File (.H) **************/
|
||||
/* 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. */
|
||||
/***********************************************************************/
|
||||
#ifndef __FILAMZIP_H
|
||||
#define __FILAMZIP_H
|
||||
#ifndef __FILAMGZ_H
|
||||
#define __FILAMGZ_H
|
||||
|
||||
#include "zlib.h"
|
||||
|
||||
typedef class ZIPFAM *PZIPFAM;
|
||||
typedef class GZFAM *PGZFAM;
|
||||
typedef class ZBKFAM *PZBKFAM;
|
||||
typedef class ZIXFAM *PZIXFAM;
|
||||
typedef class ZLBFAM *PZLBFAM;
|
||||
@@ -20,19 +20,19 @@ typedef class ZLBFAM *PZLBFAM;
|
||||
/* variable record length files compressed using the gzip library */
|
||||
/* functions. File is accessed record by record (row). */
|
||||
/***********************************************************************/
|
||||
class DllExport ZIPFAM : public TXTFAM {
|
||||
class DllExport GZFAM : public TXTFAM {
|
||||
// friend class DOSCOL;
|
||||
public:
|
||||
// Constructor
|
||||
ZIPFAM(PDOSDEF tdp) : TXTFAM(tdp) {Zfile = NULL; Zpos = 0;}
|
||||
ZIPFAM(PZIPFAM txfp);
|
||||
GZFAM(PDOSDEF tdp) : TXTFAM(tdp) {Zfile = NULL; Zpos = 0;}
|
||||
GZFAM(PGZFAM txfp);
|
||||
|
||||
// Implementation
|
||||
virtual AMT GetAmType(void) {return TYPE_AM_ZIP;}
|
||||
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) ZIPFAM(this);}
|
||||
{return (PTXF)new(g) GZFAM(this);}
|
||||
|
||||
// Methods
|
||||
virtual void Reset(void);
|
||||
@@ -57,14 +57,14 @@ class DllExport ZIPFAM : public TXTFAM {
|
||||
// Members
|
||||
gzFile Zfile; // Points to GZ file structure
|
||||
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 */
|
||||
/* 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 ZBKFAM : public GZFAM {
|
||||
public:
|
||||
// Constructor
|
||||
ZBKFAM(PDOSDEF tdp);
|
||||
@@ -167,4 +167,4 @@ class DllExport ZLBFAM : public BLKFAM {
|
||||
bool Optimized; // true when opt file is available
|
||||
}; // 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_XTB = 130, /* SYS table access method type */
|
||||
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_JSON = 134, /* JSON access method type no */
|
||||
TYPE_AM_JSN = 135, /* JSN access method type no */
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/************* RelDef CPP Program Source Code File (.CPP) **************/
|
||||
/* PROGRAM NAME: RELDEF */
|
||||
/* ------------- */
|
||||
/* Version 1.5 */
|
||||
/* Version 1.6 */
|
||||
/* */
|
||||
/* COPYRIGHT: */
|
||||
/* ---------- */
|
||||
@@ -43,9 +43,9 @@
|
||||
#if defined(VCT_SUPPORT)
|
||||
#include "filamvct.h"
|
||||
#endif // VCT_SUPPORT
|
||||
#if defined(ZIP_SUPPORT)
|
||||
#include "filamzip.h"
|
||||
#endif // ZIP_SUPPORT
|
||||
#if defined(GZ_SUPPORT)
|
||||
#include "filamgz.h"
|
||||
#endif // GZ_SUPPORT
|
||||
#include "tabdos.h"
|
||||
#include "valblk.h"
|
||||
#include "tabmul.h"
|
||||
@@ -665,15 +665,15 @@ PTDB OEMDEF::GetTable(PGLOBAL g, MODE mode)
|
||||
/*********************************************************************/
|
||||
if (!((PTDBDOS)tdbp)->GetTxfp()) {
|
||||
if (cmpr) {
|
||||
#if defined(ZIP_SUPPORT)
|
||||
#if defined(GZ_SUPPORT)
|
||||
if (cmpr == 1)
|
||||
txfp = new(g) ZIPFAM(defp);
|
||||
txfp = new(g) GZFAM(defp);
|
||||
else
|
||||
txfp = new(g) ZLBFAM(defp);
|
||||
#else // !ZIP_SUPPORT
|
||||
#else // !GZ_SUPPORT
|
||||
strcpy(g->Message, "Compress not supported");
|
||||
return NULL;
|
||||
#endif // !ZIP_SUPPORT
|
||||
#endif // !GZ_SUPPORT
|
||||
} else if (rfm == RECFM_VAR) {
|
||||
if (map)
|
||||
txfp = new(g) MAPFAM(defp);
|
||||
|
@@ -1,11 +1,11 @@
|
||||
/************* TabDos C++ Program Source Code File (.CPP) **************/
|
||||
/* PROGRAM NAME: TABDOS */
|
||||
/* ------------- */
|
||||
/* Version 4.9 */
|
||||
/* Version 4.9.1 */
|
||||
/* */
|
||||
/* COPYRIGHT: */
|
||||
/* ---------- */
|
||||
/* (C) Copyright to the author Olivier BERTRAND 1998-2015 */
|
||||
/* (C) Copyright to the author Olivier BERTRAND 1998-2016 */
|
||||
/* */
|
||||
/* WHAT THIS PROGRAM DOES: */
|
||||
/* ----------------------- */
|
||||
@@ -51,9 +51,9 @@
|
||||
#include "filamap.h"
|
||||
#include "filamfix.h"
|
||||
#include "filamdbf.h"
|
||||
#if defined(ZIP_SUPPORT)
|
||||
#include "filamzip.h"
|
||||
#endif // ZIP_SUPPORT
|
||||
#if defined(GZ_SUPPORT)
|
||||
#include "filamgz.h"
|
||||
#endif // GZ_SUPPORT
|
||||
#include "tabdos.h"
|
||||
#include "tabfix.h"
|
||||
#include "tabmul.h"
|
||||
@@ -350,28 +350,28 @@ PTDB DOSDEF::GetTable(PGLOBAL g, MODE mode)
|
||||
else if (map)
|
||||
txfp = new(g) MPXFAM(this);
|
||||
else if (Compressed) {
|
||||
#if defined(ZIP_SUPPORT)
|
||||
#if defined(GZ_SUPPORT)
|
||||
txfp = new(g) ZIXFAM(this);
|
||||
#else // !ZIP_SUPPORT
|
||||
sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "ZIP");
|
||||
#else // !GZ_SUPPORT
|
||||
sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "GZ");
|
||||
return NULL;
|
||||
#endif // !ZIP_SUPPORT
|
||||
#endif // !GZ_SUPPORT
|
||||
} else
|
||||
txfp = new(g) FIXFAM(this);
|
||||
|
||||
tdbp = new(g) TDBFIX(this, txfp);
|
||||
} else {
|
||||
if (Compressed) {
|
||||
#if defined(ZIP_SUPPORT)
|
||||
#if defined(GZ_SUPPORT)
|
||||
if (Compressed == 1)
|
||||
txfp = new(g) ZIPFAM(this);
|
||||
txfp = new(g) GZFAM(this);
|
||||
else
|
||||
txfp = new(g) ZLBFAM(this);
|
||||
|
||||
#else // !ZIP_SUPPORT
|
||||
sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "ZIP");
|
||||
#else // !GZ_SUPPORT
|
||||
sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "GZ");
|
||||
return NULL;
|
||||
#endif // !ZIP_SUPPORT
|
||||
#endif // !GZ_SUPPORT
|
||||
} else if (map)
|
||||
txfp = new(g) MAPFAM(this);
|
||||
else
|
||||
@@ -396,7 +396,7 @@ PTDB DOSDEF::GetTable(PGLOBAL g, MODE mode)
|
||||
if (map) {
|
||||
txfp = new(g) MBKFAM(this);
|
||||
} else if (Compressed) {
|
||||
#if defined(ZIP_SUPPORT)
|
||||
#if defined(GZ_SUPPORT)
|
||||
if (Compressed == 1)
|
||||
txfp = new(g) ZBKFAM(this);
|
||||
else {
|
||||
@@ -404,7 +404,7 @@ PTDB DOSDEF::GetTable(PGLOBAL g, MODE mode)
|
||||
((PZLBFAM)txfp)->SetOptimized(To_Pos != NULL);
|
||||
} // endelse
|
||||
#else
|
||||
sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "ZIP");
|
||||
sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "GZ");
|
||||
return NULL;
|
||||
#endif
|
||||
} else
|
||||
@@ -531,13 +531,13 @@ int TDBDOS::ResetTableOpt(PGLOBAL g, bool dop, bool dox)
|
||||
// except for ZLIB access method.
|
||||
if (Txfp->GetAmType() == TYPE_AM_MAP) {
|
||||
Txfp = new(g) MAPFAM((PDOSDEF)To_Def);
|
||||
#if defined(ZIP_SUPPORT)
|
||||
} else if (Txfp->GetAmType() == TYPE_AM_ZIP) {
|
||||
Txfp = new(g) ZIPFAM((PDOSDEF)To_Def);
|
||||
#if defined(GZ_SUPPORT)
|
||||
} else if (Txfp->GetAmType() == TYPE_AM_GZ) {
|
||||
Txfp = new(g) GZFAM((PDOSDEF)To_Def);
|
||||
} else if (Txfp->GetAmType() == TYPE_AM_ZLIB) {
|
||||
Txfp->Reset();
|
||||
((PZLBFAM)Txfp)->SetOptimized(false);
|
||||
#endif // ZIP_SUPPORT
|
||||
#endif // GZ_SUPPORT
|
||||
} else if (Txfp->GetAmType() == TYPE_AM_BLK)
|
||||
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)
|
||||
Txfp = new(g) MAPFAM((PDOSDEF)To_Def);
|
||||
#if defined(ZIP_SUPPORT)
|
||||
else if (Txfp->GetAmType() == TYPE_AM_ZIP)
|
||||
Txfp = new(g) ZIPFAM((PDOSDEF)To_Def);
|
||||
#endif // ZIP_SUPPORT
|
||||
#if defined(GZ_SUPPORT)
|
||||
else if (Txfp->GetAmType() == TYPE_AM_GZ)
|
||||
Txfp = new(g) GZFAM((PDOSDEF)To_Def);
|
||||
#endif // GZ_SUPPORT
|
||||
else // if (Txfp->GetAmType() != TYPE_AM_DOS) ???
|
||||
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 ReadMode; /* Specific to DBF */
|
||||
int Ending; /* Length of end of lines */
|
||||
int Teds; /* Binary table default endian setting */
|
||||
char Teds; /* Binary table default endian setting */
|
||||
}; // end of DOSDEF
|
||||
|
||||
/***********************************************************************/
|
||||
|
@@ -1,11 +1,11 @@
|
||||
/************* TabFix C++ Program Source Code File (.CPP) **************/
|
||||
/* PROGRAM NAME: TABFIX */
|
||||
/* ------------- */
|
||||
/* Version 4.9 */
|
||||
/* Version 4.9.1 */
|
||||
/* */
|
||||
/* COPYRIGHT: */
|
||||
/* ---------- */
|
||||
/* (C) Copyright to the author Olivier BERTRAND 1998-2015 */
|
||||
/* (C) Copyright to the author Olivier BERTRAND 1998-2016 */
|
||||
/* */
|
||||
/* WHAT THIS PROGRAM DOES: */
|
||||
/* ----------------------- */
|
||||
@@ -589,9 +589,10 @@ void BINCOL::WriteColumn(PGLOBAL g)
|
||||
switch (Fmt) {
|
||||
case 'X':
|
||||
// Standard not converted values
|
||||
if (Eds && IsTypeChar(Buf_Type))
|
||||
*(longlong *)p = Value->GetBigintValue();
|
||||
else if (Value->GetBinValue(p, Long, Status)) {
|
||||
if (Eds && IsTypeChar(Buf_Type)) {
|
||||
if (Status)
|
||||
Value->GetValueNonAligned<longlong>(p, Value->GetBigintValue());
|
||||
} else if (Value->GetBinValue(p, Long, Status)) {
|
||||
sprintf(g->Message, MSG(BIN_F_TOO_LONG),
|
||||
Name, Value->GetSize(), Long);
|
||||
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);
|
||||
longjmp(g->jumper[g->jump_level], 31);
|
||||
} else if (Status)
|
||||
*(short *)p = (short)n;
|
||||
Value->GetValueNonAligned<short>(p, (short)n);
|
||||
|
||||
break;
|
||||
case 'T': // Tiny integer
|
||||
@@ -625,7 +626,7 @@ void BINCOL::WriteColumn(PGLOBAL g)
|
||||
sprintf(g->Message, MSG(VALUE_TOO_BIG), n, Name);
|
||||
longjmp(g->jumper[g->jump_level], 31);
|
||||
} else if (Status)
|
||||
*(int *)p = Value->GetIntValue();
|
||||
Value->GetValueNonAligned<int>(p, (int)n);
|
||||
|
||||
break;
|
||||
case 'G': // Large (great) integer
|
||||
@@ -636,12 +637,12 @@ void BINCOL::WriteColumn(PGLOBAL g)
|
||||
case 'F': // Float
|
||||
case 'R': // Real
|
||||
if (Status)
|
||||
*(float *)p = (float)Value->GetFloatValue();
|
||||
Value->GetValueNonAligned<float>(p, (float)Value->GetFloatValue());
|
||||
|
||||
break;
|
||||
case 'D': // Double
|
||||
if (Status)
|
||||
*(double *)p = Value->GetFloatValue();
|
||||
Value->GetValueNonAligned<double>(p, Value->GetFloatValue());
|
||||
|
||||
break;
|
||||
case 'C': // Characters
|
||||
|
@@ -1,11 +1,11 @@
|
||||
/************* TabFmt C++ Program Source Code File (.CPP) **************/
|
||||
/* PROGRAM NAME: TABFMT */
|
||||
/* ------------- */
|
||||
/* Version 3.9 */
|
||||
/* Version 3.9.1 */
|
||||
/* */
|
||||
/* COPYRIGHT: */
|
||||
/* ---------- */
|
||||
/* (C) Copyright to the author Olivier BERTRAND 2001 - 2015 */
|
||||
/* (C) Copyright to the author Olivier BERTRAND 2001 - 2016 */
|
||||
/* */
|
||||
/* WHAT THIS PROGRAM DOES: */
|
||||
/* ----------------------- */
|
||||
@@ -51,9 +51,9 @@
|
||||
#include "plgdbsem.h"
|
||||
#include "mycat.h"
|
||||
#include "filamap.h"
|
||||
#if defined(ZIP_SUPPORT)
|
||||
#include "filamzip.h"
|
||||
#endif // ZIP_SUPPORT
|
||||
#if defined(GZ_SUPPORT)
|
||||
#include "filamgz.h"
|
||||
#endif // GZ_SUPPORT
|
||||
#include "tabfmt.h"
|
||||
#include "tabmul.h"
|
||||
#define NO_FUNC
|
||||
@@ -462,16 +462,16 @@ PTDB CSVDEF::GetTable(PGLOBAL g, MODE mode)
|
||||
// Should be now compatible with UNIX
|
||||
txfp = new(g) MAPFAM(this);
|
||||
} else if (Compressed) {
|
||||
#if defined(ZIP_SUPPORT)
|
||||
#if defined(GZ_SUPPORT)
|
||||
if (Compressed == 1)
|
||||
txfp = new(g) ZIPFAM(this);
|
||||
txfp = new(g) GZFAM(this);
|
||||
else
|
||||
txfp = new(g) ZLBFAM(this);
|
||||
|
||||
#else // !ZIP_SUPPORT
|
||||
#else // !GZ_SUPPORT
|
||||
strcpy(g->Message, "Compress not supported");
|
||||
return NULL;
|
||||
#endif // !ZIP_SUPPORT
|
||||
#endif // !GZ_SUPPORT
|
||||
} else
|
||||
txfp = new(g) DOSFAM(this);
|
||||
|
||||
@@ -498,7 +498,7 @@ PTDB CSVDEF::GetTable(PGLOBAL g, MODE mode)
|
||||
if (map) {
|
||||
txfp = new(g) MBKFAM(this);
|
||||
} else if (Compressed) {
|
||||
#if defined(ZIP_SUPPORT)
|
||||
#if defined(GZ_SUPPORT)
|
||||
if (Compressed == 1)
|
||||
txfp = new(g) ZBKFAM(this);
|
||||
else {
|
||||
@@ -506,7 +506,7 @@ PTDB CSVDEF::GetTable(PGLOBAL g, MODE mode)
|
||||
((PZLBFAM)txfp)->SetOptimized(To_Pos != NULL);
|
||||
} // endelse
|
||||
#else
|
||||
sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "ZIP");
|
||||
sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "GZ");
|
||||
return NULL;
|
||||
#endif
|
||||
} else
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/************* tabjson C++ Program Source Code File (.CPP) *************/
|
||||
/* PROGRAM NAME: tabjson Version 1.1 */
|
||||
/* (C) Copyright to the author Olivier BERTRAND 2014 - 2015 */
|
||||
/* PROGRAM NAME: tabjson Version 1.2 */
|
||||
/* (C) Copyright to the author Olivier BERTRAND 2014 - 2016 */
|
||||
/* This program are the JSON class DB execution routines. */
|
||||
/***********************************************************************/
|
||||
|
||||
@@ -25,9 +25,9 @@
|
||||
//#include "resource.h" // for IDS_COLUMNS
|
||||
#include "tabjson.h"
|
||||
#include "filamap.h"
|
||||
#if defined(ZIP_SUPPORT)
|
||||
#include "filamzip.h"
|
||||
#endif // ZIP_SUPPORT
|
||||
#if defined(GZ_SUPPORT)
|
||||
#include "filamgz.h"
|
||||
#endif // GZ_SUPPORT
|
||||
#include "tabmul.h"
|
||||
#include "checklvl.h"
|
||||
#include "resource.h"
|
||||
@@ -396,15 +396,15 @@ PTDB JSONDEF::GetTable(PGLOBAL g, MODE m)
|
||||
(m == MODE_UPDATE || m == MODE_DELETE));
|
||||
|
||||
if (Compressed) {
|
||||
#if defined(ZIP_SUPPORT)
|
||||
#if defined(GZ_SUPPORT)
|
||||
if (Compressed == 1)
|
||||
txfp = new(g) ZIPFAM(this);
|
||||
txfp = new(g) GZFAM(this);
|
||||
else
|
||||
txfp = new(g) ZLBFAM(this);
|
||||
#else // !ZIP_SUPPORT
|
||||
sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "ZIP");
|
||||
#else // !GZ_SUPPORT
|
||||
sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "GZ");
|
||||
return NULL;
|
||||
#endif // !ZIP_SUPPORT
|
||||
#endif // !GZ_SUPPORT
|
||||
} else if (map)
|
||||
txfp = new(g) MAPFAM(this);
|
||||
else
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/************* 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. */
|
||||
/* 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. */
|
||||
/* Currently only used reading column of binary files. */
|
||||
/***********************************************************************/
|
||||
template <class TYPE>
|
||||
void TYPVAL<TYPE>::SetBinValue(void *p)
|
||||
{
|
||||
{
|
||||
#if defined(UNALIGNED_OK)
|
||||
// x86 can cast non-aligned memory directly
|
||||
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
|
||||
} // end of SetBinValue
|
||||
|
||||
/***********************************************************************/
|
||||
/* GetBinValue: fill a buffer with the internal binary value. */
|
||||
/* This function checks whether the buffer length is enough and */
|
||||
/* 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>
|
||||
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
|
||||
|
||||
if (go)
|
||||
#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;
|
||||
return false;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/**************** 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. */
|
||||
/***********************************************************************/
|
||||
@@ -16,6 +16,13 @@
|
||||
#include "assert.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. */
|
||||
/***********************************************************************/
|
||||
@@ -127,16 +134,35 @@ class DllExport VALUE : public BLOCK {
|
||||
template<typename TYPE>
|
||||
void SetValueNonAligned(const char *p)
|
||||
{
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
SetValue(*((TYPE*) p)); // x86 can cast non-aligned memory directly
|
||||
#if defined(UNALIGNED_OK)
|
||||
SetValue(*((TYPE*)p)); // x86 can cast non-aligned memory directly
|
||||
#else
|
||||
TYPE tmp; // a slower version for non-x86 platforms
|
||||
memcpy(&tmp, p, sizeof(tmp));
|
||||
SetValue(tmp);
|
||||
#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;
|
||||
const char *GetXfmt(void);
|
||||
|
||||
|
Reference in New Issue
Block a user