mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 21:12:26 +01:00
1c88b9a8d3
When null and the column is NOT NULL the value was not reset. modified: storage/connect/tabjson.cpp Fix converting bstr_t string to set error message modified: storage/connect/domdoc.cpp Fix MDEV-12768: -Wformat-overflow compile warnings modified: storage/connect/global.h modified: storage/connect/jsonudf.cpp modified: storage/connect/plugutil.cpp modified: storage/connect/tabvct.cpp Typo (in external_lock) modified: storage/connect/ha_connect.cc Remove some warnings modified: storage/connect/odbconn.cpp modified: storage/connect/tabmysql.cpp Add MEM_RESERVE flag to virtualAlloc modified: storage/connect/plgdbutl.cpp Fix MDEV-12573: Accept=1 may show incorrect value for NULL column in CONNECT TBL modified: storage/connect/tabutil.cpp Fix wrong setting of key size when greater than 2G modified: storage/connect/xindex.cpp Fixing MDEV-12149: compile errors on Windows with /Zc:strictStrings Introduce typedef PCSZ and replace PSZ by it where it matters All done on CONNECT but compile still fails because of an included system file modified: storage/connect/array.cpp modified: storage/connect/catalog.h modified: storage/connect/colblk.cpp modified: storage/connect/colblk.h modified: storage/connect/connect.cc modified: storage/connect/domdoc.cpp modified: storage/connect/domdoc.h modified: storage/connect/filamdbf.cpp modified: storage/connect/filamdbf.h modified: storage/connect/filamfix.cpp modified: storage/connect/filamgz.cpp modified: storage/connect/filamtxt.h modified: storage/connect/filamvct.cpp modified: storage/connect/filamvct.h modified: storage/connect/filamzip.cpp modified: storage/connect/filamzip.h modified: storage/connect/ha_connect.cc modified: storage/connect/ha_connect.h modified: storage/connect/jdbccat.h modified: storage/connect/jdbconn.cpp modified: storage/connect/jdbconn.h modified: storage/connect/json.cpp modified: storage/connect/json.h modified: storage/connect/jsonudf.cpp modified: storage/connect/jsonudf.h modified: storage/connect/libdoc.cpp modified: storage/connect/macutil.cpp modified: storage/connect/myconn.cpp modified: storage/connect/myutil.cpp modified: storage/connect/myutil.h modified: storage/connect/odbccat.h modified: storage/connect/odbconn.cpp modified: storage/connect/odbconn.h modified: storage/connect/os.h modified: storage/connect/plgdbsem.h modified: storage/connect/plgdbutl.cpp modified: storage/connect/plgxml.cpp modified: storage/connect/plgxml.h modified: storage/connect/plugutil.cpp modified: storage/connect/preparse.h modified: storage/connect/reldef.cpp modified: storage/connect/reldef.h modified: storage/connect/tabdos.cpp modified: storage/connect/tabdos.h modified: storage/connect/tabext.cpp modified: storage/connect/tabext.h modified: storage/connect/tabfix.cpp modified: storage/connect/tabfix.h modified: storage/connect/tabfmt.cpp modified: storage/connect/tabfmt.h modified: storage/connect/tabjdbc.cpp modified: storage/connect/tabjdbc.h modified: storage/connect/tabjson.cpp modified: storage/connect/tabjson.h modified: storage/connect/table.cpp modified: storage/connect/tabmac.cpp modified: storage/connect/tabmul.cpp modified: storage/connect/tabmul.h modified: storage/connect/tabmysql.cpp modified: storage/connect/tabmysql.h modified: storage/connect/tabodbc.cpp modified: storage/connect/tabodbc.h modified: storage/connect/tabpivot.cpp modified: storage/connect/tabpivot.h modified: storage/connect/tabsys.cpp modified: storage/connect/tabsys.h modified: storage/connect/tabutil.cpp modified: storage/connect/tabutil.h modified: storage/connect/tabvir.cpp modified: storage/connect/tabvir.h modified: storage/connect/tabwmi.cpp modified: storage/connect/tabwmi.h modified: storage/connect/tabxml.cpp modified: storage/connect/tabxml.h modified: storage/connect/tabzip.cpp modified: storage/connect/tabzip.h modified: storage/connect/valblk.cpp modified: storage/connect/valblk.h modified: storage/connect/value.cpp modified: storage/connect/value.h modified: storage/connect/xindex.cpp modified: storage/connect/xobject.cpp modified: storage/connect/xobject.h modified: storage/connect/xtable.h Fix MDEV-12603 Insert replaces values in ZIP file modified: storage/connect/filamzip.cpp modified: storage/connect/filamzip.h Fix MDEV-12686 Handle null in json Fix MDEV-12688 Insert does not handle type TINYINT modified: storage/connect/json.cpp modified: storage/connect/tabjson.cpp Fix MDEV-12653 Cannot add index for ZIP CONNECT table modified: storage/connect/filamzip.cpp modified: storage/connect/ha_connect.cc modified: storage/connect/tabdos.cpp modified: storage/connect/tabfmt.cpp modified: storage/connect/tabjson.cpp modified: storage/connect/xindex.cpp
164 lines
6.7 KiB
C++
164 lines
6.7 KiB
C++
/*************** Xobject H Declares Source Code File (.H) **************/
|
|
/* Name: XOBJECT.H Version 2.4 */
|
|
/* */
|
|
/* (C) Copyright to the author Olivier BERTRAND 1998-2014 */
|
|
/* */
|
|
/* This file contains the XOBJECT and derived classes declares. */
|
|
/***********************************************************************/
|
|
|
|
#ifndef __XOBJECT__H
|
|
#define __XOBJECT__H
|
|
|
|
/***********************************************************************/
|
|
/* Include required application header files */
|
|
/* block.h is header containing Block global declarations. */
|
|
/***********************************************************************/
|
|
#include "block.h"
|
|
#include "valblk.h" // includes value.h
|
|
|
|
/***********************************************************************/
|
|
/* Types used in some class definitions. */
|
|
/***********************************************************************/
|
|
typedef class STRING *PSTRG;
|
|
|
|
/***********************************************************************/
|
|
/* The pointer to the one and only needed void object. */
|
|
/***********************************************************************/
|
|
extern PXOB const pXVOID;
|
|
|
|
/***********************************************************************/
|
|
/* Class XOBJECT is the base class for all classes that can be used */
|
|
/* in evaluation operations: FILTER, EXPRESSION, SCALF, FNC, COLBLK, */
|
|
/* SELECT, FILTER as well as all the constant object types. */
|
|
/***********************************************************************/
|
|
class DllExport XOBJECT : public BLOCK {
|
|
public:
|
|
XOBJECT(void) {Value = NULL; Constant = false;}
|
|
|
|
// Implementation
|
|
PVAL GetValue(void) {return Value;}
|
|
bool IsConstant(void) {return Constant;}
|
|
virtual int GetType(void) {return TYPE_XOBJECT;}
|
|
virtual int GetResultType(void) {return TYPE_VOID;}
|
|
virtual int GetKey(void) {return 0;}
|
|
#if defined(_DEBUG)
|
|
virtual void SetKey(int) {assert(false);}
|
|
#else // !_DEBUG
|
|
virtual void SetKey(int) {} // Only defined for COLBLK
|
|
#endif // !_DEBUG
|
|
virtual int GetLength(void) = 0;
|
|
virtual int GetLengthEx(void) = 0;
|
|
virtual PSZ GetCharValue(void);
|
|
virtual short GetShortValue(void);
|
|
virtual int GetIntValue(void);
|
|
virtual double GetFloatValue(void);
|
|
virtual int GetScale(void) = 0;
|
|
|
|
// Methods
|
|
virtual void Reset(void) {}
|
|
virtual bool Compare(PXOB) = 0;
|
|
virtual bool Init(PGLOBAL) {return false;}
|
|
virtual bool Eval(PGLOBAL) {return false;}
|
|
virtual bool SetFormat(PGLOBAL, FORMAT&) = 0;
|
|
|
|
protected:
|
|
PVAL Value; // The current value of the object.
|
|
bool Constant; // true for an object having a constant value.
|
|
}; // end of class XOBJECT
|
|
|
|
/***********************************************************************/
|
|
/* Class XVOID: represent a void (null) object. */
|
|
/* Used to represent a void parameter for count(*) or for a filter. */
|
|
/***********************************************************************/
|
|
class DllExport XVOID : public XOBJECT {
|
|
public:
|
|
XVOID(void) {Constant = true;}
|
|
|
|
// Implementation
|
|
virtual int GetType(void) {return TYPE_VOID;}
|
|
virtual int GetLength(void) {return 0;}
|
|
virtual int GetLengthEx(void) {return 0;}
|
|
virtual PSZ GetCharValue(void) {return NULL;}
|
|
virtual int GetIntValue(void) {return 0;}
|
|
virtual double GetFloatValue(void) {return 0.0;}
|
|
virtual int GetScale() {return 0;}
|
|
|
|
// Methods
|
|
virtual bool Compare(PXOB xp) {return xp->GetType() == TYPE_VOID;}
|
|
virtual bool SetFormat(PGLOBAL, FORMAT&) {return true;}
|
|
}; // end of class XVOID
|
|
|
|
|
|
/***********************************************************************/
|
|
/* Class CONSTANT: represents a constant XOBJECT of any value type. */
|
|
/* Note that the CONSTANT class is a friend of the VALUE class; */
|
|
/***********************************************************************/
|
|
class DllExport CONSTANT : public XOBJECT {
|
|
public:
|
|
CONSTANT(PGLOBAL g, void *value, short type);
|
|
CONSTANT(PGLOBAL g, int n);
|
|
CONSTANT(PVAL valp) {Value = valp; Constant = true;}
|
|
|
|
// Implementation
|
|
virtual int GetType(void) {return TYPE_CONST;}
|
|
virtual int GetResultType(void) {return Value->Type;}
|
|
virtual int GetLength(void) {return Value->GetValLen();}
|
|
virtual int GetScale() {return Value->GetValPrec();}
|
|
virtual int GetLengthEx(void);
|
|
|
|
// Methods
|
|
virtual bool Compare(PXOB xp);
|
|
virtual bool SetFormat(PGLOBAL g, FORMAT& fmt)
|
|
{return Value->SetConstFormat(g, fmt);}
|
|
void Convert(PGLOBAL g, int newtype);
|
|
void SetValue(PVAL vp) {Value = vp;}
|
|
virtual void Print(PGLOBAL g, FILE *, uint);
|
|
virtual void Print(PGLOBAL g, char *, uint);
|
|
}; // end of class CONSTANT
|
|
|
|
/***********************************************************************/
|
|
/* Class STRING handles variable length char strings. */
|
|
/* It is mainly used to avoid buffer overrun. */
|
|
/***********************************************************************/
|
|
class DllExport STRING : public BLOCK {
|
|
public:
|
|
// Constructor
|
|
STRING(PGLOBAL g, uint n, PCSZ str = NULL);
|
|
|
|
// Implementation
|
|
inline int GetLength(void) {return (int)Length;}
|
|
inline void SetLength(uint n) {Length = n;}
|
|
inline PSZ GetStr(void) {return Strp;}
|
|
inline uint32 GetSize(void) {return Size;}
|
|
inline bool IsTruncated(void) {return Trc;}
|
|
|
|
// Methods
|
|
inline void Reset(void) {*Strp = 0;}
|
|
bool Set(PCSZ s);
|
|
bool Set(char *s, uint n);
|
|
bool Append(const char *s, uint ln, bool nq = false);
|
|
bool Append(PCSZ s);
|
|
bool Append(STRING &str);
|
|
bool Append(char c);
|
|
bool Resize(uint n);
|
|
bool Append_quoted(PCSZ s);
|
|
inline void Trim(void) {(void)Resize(Length + 1);}
|
|
inline void Chop(void) {if (Length) Strp[--Length] = 0;}
|
|
inline void RepLast(char c) {if (Length) Strp[Length-1] = c;}
|
|
inline void Truncate(uint n) {if (n < Length) {Strp[n] = 0; Length = n;}}
|
|
|
|
protected:
|
|
char *Realloc(uint len);
|
|
inline char *GetNext(void)
|
|
{return ((char*)G->Sarea)+((PPOOLHEADER)G->Sarea)->To_Free;}
|
|
|
|
// Members
|
|
PGLOBAL G; // To avoid parameter
|
|
PSZ Strp; // The char string
|
|
uint Length; // String length
|
|
uint Size; // Allocated size
|
|
bool Trc; // When truncated
|
|
char *Next; // Next alloc position
|
|
}; // end of class STRING
|
|
|
|
#endif
|