Commit b3f9838f authored by Olivier Bertrand's avatar Olivier Bertrand

Update 10.1 with changes from 10.0

parent 48a77e61
...@@ -42,7 +42,6 @@ ...@@ -42,7 +42,6 @@
#include "tabcol.h" #include "tabcol.h"
#include "catalog.h" #include "catalog.h"
#include "ha_connect.h" #include "ha_connect.h"
#include "mycat.h"
#define my_strupr(p) my_caseup_str(default_charset_info, (p)); #define my_strupr(p) my_caseup_str(default_charset_info, (p));
#define my_strlwr(p) my_casedn_str(default_charset_info, (p)); #define my_strlwr(p) my_casedn_str(default_charset_info, (p));
......
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level='asInvoker' uiAccess='false' />
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
La ressource de manifeste a ‚t‚ mise … jour pour la derniŠre fois … 15:13:07,47 le 21/03/2015
...@@ -275,7 +275,7 @@ PXNODE DOMNODE::GetNext(PGLOBAL g) ...@@ -275,7 +275,7 @@ PXNODE DOMNODE::GetNext(PGLOBAL g)
{ {
if (Nodep->nextSibling == NULL) if (Nodep->nextSibling == NULL)
Next = NULL; Next = NULL;
else if (!Next) else // if (!Next)
Next = new(g) DOMNODE(Doc, Nodep->nextSibling); Next = new(g) DOMNODE(Doc, Nodep->nextSibling);
return Next; return Next;
...@@ -288,7 +288,7 @@ PXNODE DOMNODE::GetChild(PGLOBAL g) ...@@ -288,7 +288,7 @@ PXNODE DOMNODE::GetChild(PGLOBAL g)
{ {
if (Nodep->firstChild == NULL) if (Nodep->firstChild == NULL)
Children = NULL; Children = NULL;
else if (!Children) else // if (!Children)
Children = new(g) DOMNODE(Doc, Nodep->firstChild); Children = new(g) DOMNODE(Doc, Nodep->firstChild);
return Children; return Children;
...@@ -441,15 +441,27 @@ PXNODE DOMNODE::SelectSingleNode(PGLOBAL g, char *xp, PXNODE np) ...@@ -441,15 +441,27 @@ PXNODE DOMNODE::SelectSingleNode(PGLOBAL g, char *xp, PXNODE np)
/******************************************************************/ /******************************************************************/
PXATTR DOMNODE::GetAttribute(PGLOBAL g, char *name, PXATTR ap) PXATTR DOMNODE::GetAttribute(PGLOBAL g, char *name, PXATTR ap)
{ {
MSXML2::IXMLDOMElementPtr ep = Nodep; MSXML2::IXMLDOMElementPtr ep;
MSXML2::IXMLDOMAttributePtr atp = ep->getAttributeNode(name); MSXML2::IXMLDOMNamedNodeMapPtr nmp;
MSXML2::IXMLDOMAttributePtr atp;
if (name) {
ep = Nodep;
atp = ep->getAttributeNode(name);
nmp = NULL;
} else {
nmp = Nodep->Getattributes();
atp = nmp->Getitem(0);
} // endif name
if (atp) { if (atp) {
if (ap) { if (ap) {
((PDOMATTR)ap)->Atrp = atp; ((PDOMATTR)ap)->Atrp = atp;
((PDOMATTR)ap)->Nmp = nmp;
((PDOMATTR)ap)->K = 0;
return ap; return ap;
} else } else
return new(g) DOMATTR(Doc, atp); return new(g) DOMATTR(Doc, atp, nmp);
} else } else
return NULL; return NULL;
...@@ -617,14 +629,85 @@ bool DOMNODELIST::DropItem(PGLOBAL g, int n) ...@@ -617,14 +629,85 @@ bool DOMNODELIST::DropItem(PGLOBAL g, int n)
/******************************************************************/ /******************************************************************/
/* DOMATTR constructor. */ /* DOMATTR constructor. */
/******************************************************************/ /******************************************************************/
DOMATTR::DOMATTR(PXDOC dp, MSXML2::IXMLDOMAttributePtr ap) DOMATTR::DOMATTR(PXDOC dp, MSXML2::IXMLDOMAttributePtr ap,
MSXML2::IXMLDOMNamedNodeMapPtr nmp)
: XMLATTRIBUTE(dp) : XMLATTRIBUTE(dp)
{ {
Atrp = ap; Atrp = ap;
Nmp = nmp;
Ws = NULL; Ws = NULL;
Len = 0; Len = 0;
K = 0;
} // end of DOMATTR constructor } // end of DOMATTR constructor
/******************************************************************/
/* Return the attribute name. */
/******************************************************************/
char *DOMATTR::GetName(PGLOBAL g)
{
if (!WideCharToMultiByte(CP_ACP, 0, Atrp->nodeName, -1,
Name, sizeof(Name), NULL, NULL)) {
strcpy(g->Message, MSG(NAME_CONV_ERR));
return NULL;
} // endif
return Name;
} // end of GetName
/******************************************************************/
/* Return the next attribute node. */
/* This funtion is implemented as needed by XMLColumns. */
/******************************************************************/
PXATTR DOMATTR::GetNext(PGLOBAL g)
{
if (!Nmp)
return NULL;
if (++K >= Nmp->Getlength()) {
Nmp->reset();
Nmp = NULL;
K = 0;
return NULL;
} // endif K
Atrp = Nmp->Getitem(K);
return this;
} // end of GetNext
/******************************************************************/
/* Return the content of a node and subnodes. */
/******************************************************************/
RCODE DOMATTR::GetText(PGLOBAL g, char *buf, int len)
{
RCODE rc = RC_OK;
if (!WideCharToMultiByte(CP_UTF8, 0, Atrp->text, -1,
buf, len, NULL, NULL)) {
DWORD lsr = GetLastError();
switch (lsr) {
case 0:
case ERROR_INSUFFICIENT_BUFFER: // 122L
sprintf(g->Message, "Truncated %s content", GetName(g));
rc = RC_INFO;
break;
case ERROR_NO_UNICODE_TRANSLATION: // 1113L
sprintf(g->Message, "Invalid character(s) in %s content",
GetName(g));
rc = RC_INFO;
break;
default:
sprintf(g->Message, "System error getting %s content",
GetName(g));
rc = RC_FX;
break;
} // endswitch
} // endif
return rc;
} // end of GetText
/******************************************************************/ /******************************************************************/
/* Set the text content of an attribute. */ /* Set the text content of an attribute. */
/******************************************************************/ /******************************************************************/
......
...@@ -122,15 +122,24 @@ class DOMATTR : public XMLATTRIBUTE { ...@@ -122,15 +122,24 @@ class DOMATTR : public XMLATTRIBUTE {
friend class DOMDOC; friend class DOMDOC;
friend class DOMNODE; friend class DOMNODE;
public: public:
// Properties
virtual char *GetName(PGLOBAL g);
virtual PXATTR GetNext(PGLOBAL);
// Methods // Methods
virtual bool SetText(PGLOBAL g, char *txtp, int len); virtual RCODE GetText(PGLOBAL g, char *bufp, int len);
virtual bool SetText(PGLOBAL g, char *txtp, int len);
protected: protected:
// Constructor // Constructor
DOMATTR(PXDOC dp, MSXML2::IXMLDOMAttributePtr ap); DOMATTR(PXDOC dp, MSXML2::IXMLDOMAttributePtr ap,
MSXML2::IXMLDOMNamedNodeMapPtr nmp = NULL);
// Members // Members
MSXML2::IXMLDOMAttributePtr Atrp; MSXML2::IXMLDOMAttributePtr Atrp;
WCHAR *Ws; MSXML2::IXMLDOMNamedNodeMapPtr Nmp;
int Len; char Name[64];
WCHAR *Ws;
int Len;
long K;
}; // end of class DOMATTR }; // end of class DOMATTR
...@@ -17,6 +17,7 @@ typedef class MAPFAM *PMAPFAM; ...@@ -17,6 +17,7 @@ typedef class MAPFAM *PMAPFAM;
/* This is the variable file access method using file mapping. */ /* This is the variable file access method using file mapping. */
/***********************************************************************/ /***********************************************************************/
class DllExport MAPFAM : public TXTFAM { class DllExport MAPFAM : public TXTFAM {
friend class TDBJSON;
public: public:
// Constructor // Constructor
MAPFAM(PDOSDEF tdp); MAPFAM(PDOSDEF tdp);
......
...@@ -42,6 +42,7 @@ class DllExport TXTFAM : public BLOCK { ...@@ -42,6 +42,7 @@ class DllExport TXTFAM : public BLOCK {
virtual PTXF Duplicate(PGLOBAL g) = 0; virtual PTXF Duplicate(PGLOBAL g) = 0;
virtual bool GetUseTemp(void) {return false;} virtual bool GetUseTemp(void) {return false;}
virtual int GetDelRows(void) {return DelRows;} virtual int GetDelRows(void) {return DelRows;}
PFBLOCK GetTo_Fb(void) {return To_Fb;}
int GetCurBlk(void) {return CurBlk;} int GetCurBlk(void) {return CurBlk;}
void SetTdbp(PTDBDOS tdbp) {Tdbp = tdbp;} void SetTdbp(PTDBDOS tdbp) {Tdbp = tdbp;}
int GetBlock(void) {return Block;} int GetBlock(void) {return Block;}
......
...@@ -145,7 +145,6 @@ ...@@ -145,7 +145,6 @@
#include "connect.h" #include "connect.h"
#include "user_connect.h" #include "user_connect.h"
#include "ha_connect.h" #include "ha_connect.h"
#include "mycat.h"
#include "myutil.h" #include "myutil.h"
#include "preparse.h" #include "preparse.h"
#include "inihandl.h" #include "inihandl.h"
...@@ -169,7 +168,7 @@ ...@@ -169,7 +168,7 @@
#define JSONMAX 10 // JSON Default max grp size #define JSONMAX 10 // JSON Default max grp size
extern "C" { extern "C" {
char version[]= "Version 1.03.0006 March 16, 2015"; char version[]= "Version 1.03.0006 April 12, 2015";
#if defined(WIN32) #if defined(WIN32)
char compver[]= "Version 1.03.0006 " __DATE__ " " __TIME__; char compver[]= "Version 1.03.0006 " __DATE__ " " __TIME__;
...@@ -211,6 +210,7 @@ PQRYRES OEMColumns(PGLOBAL g, PTOS topt, char *tab, char *db, bool info); ...@@ -211,6 +210,7 @@ PQRYRES OEMColumns(PGLOBAL g, PTOS topt, char *tab, char *db, bool info);
PQRYRES VirColumns(PGLOBAL g, char *tab, char *db, bool info); PQRYRES VirColumns(PGLOBAL g, char *tab, char *db, bool info);
PQRYRES JSONColumns(PGLOBAL g, char *dp, const char *fn, char *objn, PQRYRES JSONColumns(PGLOBAL g, char *dp, const char *fn, char *objn,
int pretty, int lvl, int mxr, bool info); int pretty, int lvl, int mxr, bool info);
PQRYRES XMLColumns(PGLOBAL g, char *dp, char *tab, PTOS topt, bool info);
void PushWarning(PGLOBAL g, THD *thd, int level); void PushWarning(PGLOBAL g, THD *thd, int level);
bool CheckSelf(PGLOBAL g, TABLE_SHARE *s, const char *host, bool CheckSelf(PGLOBAL g, TABLE_SHARE *s, const char *host,
const char *db, char *tab, const char *src, int port); const char *db, char *tab, const char *src, int port);
...@@ -5228,6 +5228,9 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd, ...@@ -5228,6 +5228,9 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
strcpy(g->Message, "Missing OEM module or subtype"); strcpy(g->Message, "Missing OEM module or subtype");
break; break;
#if defined(LIBXML2_SUPPORT) || defined(DOMDOC_SUPPORT)
case TAB_XML:
#endif // LIBXML2_SUPPORT || DOMDOC_SUPPORT
case TAB_JSON: case TAB_JSON:
if (!fn) if (!fn)
sprintf(g->Message, "Missing %s file name", topt->type); sprintf(g->Message, "Missing %s file name", topt->type);
...@@ -5348,6 +5351,11 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd, ...@@ -5348,6 +5351,11 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
case TAB_JSON: case TAB_JSON:
qrp= JSONColumns(g, (char*)db, fn, objn, pty, lrecl, lvl, fnc == FNC_COL); qrp= JSONColumns(g, (char*)db, fn, objn, pty, lrecl, lvl, fnc == FNC_COL);
break; break;
#if defined(LIBXML2_SUPPORT) || defined(DOMDOC_SUPPORT)
case TAB_XML:
qrp= XMLColumns(g, (char*)db, tab, topt, fnc == FNC_COL);
break;
#endif // LIBXML2_SUPPORT || DOMDOC_SUPPORT
case TAB_OEM: case TAB_OEM:
qrp= OEMColumns(g, topt, tab, (char*)db, fnc == FNC_COL); qrp= OEMColumns(g, topt, tab, (char*)db, fnc == FNC_COL);
break; break;
...@@ -5385,7 +5393,9 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd, ...@@ -5385,7 +5393,9 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
#endif // !NEW_WAY #endif // !NEW_WAY
} // endfor crp } // endfor crp
} else { } else {
char *schem= NULL;
// Not a catalog table // Not a catalog table
if (!qrp->Nblin) { if (!qrp->Nblin) {
if (tab) if (tab)
...@@ -5469,6 +5479,19 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd, ...@@ -5469,6 +5479,19 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
key= crp->Kdata->GetCharValue(i); key= crp->Kdata->GetCharValue(i);
break; break;
case FLD_SCHEM:
#if defined(ODBC_SUPPORT)
if (ttp == TAB_ODBC && crp->Kdata) {
if (schem && stricmp(schem, crp->Kdata->GetCharValue(i))) {
sprintf(g->Message,
"Several %s tables found, specify DBNAME", tab);
my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
goto err;
} else if (!schem)
schem= crp->Kdata->GetCharValue(i);
} // endif ttp
#endif // ODBC_SUPPORT
default: default:
break; // Ignore break; // Ignore
} // endswitch Fld } // endswitch Fld
...@@ -5790,6 +5813,18 @@ int ha_connect::create(const char *name, TABLE *table_arg, ...@@ -5790,6 +5813,18 @@ int ha_connect::create(const char *name, TABLE *table_arg,
} // endif type } // endif type
if (type == TAB_JSON) {
int pretty= atoi(GetListOption(g, "Pretty", options->oplist, "2"));
if (!options->lrecl && pretty != 2) {
sprintf(g->Message, "LRECL must be specified for pretty=%d", pretty);
my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
rc= HA_ERR_INTERNAL_ERROR;
DBUG_RETURN(rc);
} // endif lrecl
} // endif type
// Check column types // Check column types
for (field= table_arg->field; *field; field++) { for (field= table_arg->field; *field; field++) {
fp= *field; fp= *field;
......
...@@ -26,6 +26,11 @@ ...@@ -26,6 +26,11 @@
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif
/****************************************************************************/
/* mycat.h contains the TOS, PTOS, ha_table_option_struct declarations. */
/****************************************************************************/
#include "mycat.h"
static char *strz(PGLOBAL g, LEX_STRING &ls); static char *strz(PGLOBAL g, LEX_STRING &ls);
/****************************************************************************/ /****************************************************************************/
...@@ -68,7 +73,6 @@ class XCHK : public BLOCK { ...@@ -68,7 +73,6 @@ class XCHK : public BLOCK {
typedef class XCHK *PCHK; typedef class XCHK *PCHK;
typedef class user_connect *PCONNECT; typedef class user_connect *PCONNECT;
typedef struct ha_table_option_struct TOS, *PTOS;
typedef struct ha_field_option_struct FOS, *PFOS; typedef struct ha_field_option_struct FOS, *PFOS;
typedef struct ha_index_option_struct XOS, *PXOS; typedef struct ha_index_option_struct XOS, *PXOS;
...@@ -80,6 +84,9 @@ extern handlerton *connect_hton; ...@@ -80,6 +84,9 @@ extern handlerton *connect_hton;
These can be specified in the CREATE TABLE: These can be specified in the CREATE TABLE:
CREATE TABLE ( ... ) {...here...} CREATE TABLE ( ... ) {...here...}
*/ */
#if 0 // moved to mycat.h
typedef struct ha_table_option_struct TOS, *PTOS;
struct ha_table_option_struct { struct ha_table_option_struct {
const char *type; const char *type;
const char *filename; const char *filename;
...@@ -111,6 +118,7 @@ struct ha_table_option_struct { ...@@ -111,6 +118,7 @@ struct ha_table_option_struct {
bool readonly; bool readonly;
bool sepindex; bool sepindex;
}; };
#endif // 0
/** /**
structure for CREATE TABLE options (field options) structure for CREATE TABLE options (field options)
......
...@@ -162,10 +162,12 @@ class XML2ATTR : public XMLATTRIBUTE { ...@@ -162,10 +162,12 @@ class XML2ATTR : public XMLATTRIBUTE {
friend class XML2NODE; friend class XML2NODE;
public: public:
// Properties // Properties
//virtual char *GetText(void); virtual char *GetName(PGLOBAL g) {return (char*)Atrp->name;}
virtual PXATTR GetNext(PGLOBAL g);
// Methods // Methods
virtual bool SetText(PGLOBAL g, char *txtp, int len); virtual RCODE GetText(PGLOBAL g, char *bufp, int len);
virtual bool SetText(PGLOBAL g, char *txtp, int len);
protected: protected:
// Constructor // Constructor
...@@ -812,7 +814,7 @@ PXNODE XML2NODE::GetNext(PGLOBAL g) ...@@ -812,7 +814,7 @@ PXNODE XML2NODE::GetNext(PGLOBAL g)
if (!Nodep->next) if (!Nodep->next)
Next = NULL; Next = NULL;
else if (!Next) else // if (!Next)
Next = new(g) XML2NODE(Doc, Nodep->next); Next = new(g) XML2NODE(Doc, Nodep->next);
return Next; return Next;
...@@ -828,7 +830,7 @@ PXNODE XML2NODE::GetChild(PGLOBAL g) ...@@ -828,7 +830,7 @@ PXNODE XML2NODE::GetChild(PGLOBAL g)
if (!Nodep->children) if (!Nodep->children)
Children = NULL; Children = NULL;
else if (!Children) else // if (!Children)
Children = new(g) XML2NODE(Doc, Nodep->children); Children = new(g) XML2NODE(Doc, Nodep->children);
return Children; return Children;
...@@ -978,10 +980,16 @@ PXNODE XML2NODE::SelectSingleNode(PGLOBAL g, char *xp, PXNODE np) ...@@ -978,10 +980,16 @@ PXNODE XML2NODE::SelectSingleNode(PGLOBAL g, char *xp, PXNODE np)
/******************************************************************/ /******************************************************************/
PXATTR XML2NODE::GetAttribute(PGLOBAL g, char *name, PXATTR ap) PXATTR XML2NODE::GetAttribute(PGLOBAL g, char *name, PXATTR ap)
{ {
xmlAttrPtr atp;
if (trace) if (trace)
htrc("GetAttribute: %s\n", name); htrc("GetAttribute: %s\n", SVP(name));
if (name)
atp = xmlHasProp(Nodep, BAD_CAST name);
else
atp = Nodep->properties;
xmlAttrPtr atp = xmlHasProp(Nodep, BAD_CAST name);
if (atp) { if (atp) {
if (ap) { if (ap) {
...@@ -1209,6 +1217,52 @@ XML2ATTR::XML2ATTR(PXDOC dp, xmlAttrPtr ap, xmlNodePtr np) ...@@ -1209,6 +1217,52 @@ XML2ATTR::XML2ATTR(PXDOC dp, xmlAttrPtr ap, xmlNodePtr np)
Parent = np; Parent = np;
} // end of XML2ATTR constructor } // end of XML2ATTR constructor
/******************************************************************/
/* Return the next sibling of the attribute. */
/******************************************************************/
PXATTR XML2ATTR::GetNext(PGLOBAL g)
{
if (trace)
htrc("Attr GetNext\n");
if (!Atrp->next)
return NULL;
else
return new(g) XML2ATTR(Doc, Atrp->next, Atrp->parent);
} // end of GetNext
/******************************************************************/
/* Return the text of an attribute. */
/******************************************************************/
RCODE XML2ATTR::GetText(PGLOBAL g, char *buf, int len)
{
RCODE rc = RC_OK;
xmlChar *txt;
if (trace)
htrc("GetText\n");
if ((txt = xmlGetProp(Atrp->parent, Atrp->name))) {
// Copy the text to the buffer
if (strlen((char*)txt) >= (unsigned)len) {
memcpy(buf, txt, len - 1);
buf[len - 1] = 0;
sprintf(g->Message, "Truncated %s content", Atrp->name);
rc = RC_INFO;
} else
strcpy(buf, (const char*)txt);
xmlFree(txt);
} else
*buf = '\0';
if (trace)
htrc("GetText: %s\n", buf);
return rc;
} // end of GetText
/******************************************************************/ /******************************************************************/
/* Set the content of an attribute. */ /* Set the content of an attribute. */
/******************************************************************/ /******************************************************************/
......
...@@ -74,9 +74,6 @@ ...@@ -74,9 +74,6 @@
#include "tabxcl.h" #include "tabxcl.h"
#include "tabtbl.h" #include "tabtbl.h"
#include "taboccur.h" #include "taboccur.h"
#if defined(XML_SUPPORT)
#include "tabxml.h"
#endif // XML_SUPPORT
#include "tabmul.h" #include "tabmul.h"
#include "tabmysql.h" #include "tabmysql.h"
#if defined(ODBC_SUPPORT) #if defined(ODBC_SUPPORT)
...@@ -89,7 +86,9 @@ ...@@ -89,7 +86,9 @@
#include "tabvir.h" #include "tabvir.h"
#include "tabjson.h" #include "tabjson.h"
#include "ha_connect.h" #include "ha_connect.h"
#include "mycat.h" #if defined(XML_SUPPORT)
#include "tabxml.h"
#endif // XML_SUPPORT
/***********************************************************************/ /***********************************************************************/
/* Extern static variables. */ /* Extern static variables. */
......
...@@ -24,6 +24,46 @@ ...@@ -24,6 +24,46 @@
#include "block.h" #include "block.h"
#include "catalog.h" #include "catalog.h"
typedef struct ha_table_option_struct TOS, *PTOS;
/**
structure for CREATE TABLE options (table options)
These can be specified in the CREATE TABLE:
CREATE TABLE ( ... ) {...here...}
*/
struct ha_table_option_struct {
const char *type;
const char *filename;
const char *optname;
const char *tabname;
const char *tablist;
const char *dbname;
const char *separator;
//const char *connect;
const char *qchar;
const char *module;
const char *subtype;
const char *catfunc;
const char *srcdef;
const char *colist;
const char *oplist;
const char *data_charset;
ulonglong lrecl;
ulonglong elements;
//ulonglong estimate;
ulonglong multiple;
ulonglong header;
ulonglong quoted;
ulonglong ending;
ulonglong compressed;
bool mapped;
bool huge;
bool split;
bool readonly;
bool sepindex;
};
// Possible value for catalog functions // Possible value for catalog functions
#define FNC_NO (1 << 0) // Not a catalog table #define FNC_NO (1 << 0) // Not a catalog table
#define FNC_COL (1 << 1) // Column catalog function #define FNC_COL (1 << 1) // Column catalog function
......
...@@ -15,7 +15,7 @@ DATEPUB int(4) ...@@ -15,7 +15,7 @@ DATEPUB int(4)
) ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='biblio.json'; ) ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='biblio.json';
SELECT * FROM t1; SELECT * FROM t1;
ISBN LANG SUBJECT AUTHOR TITLE TRANSLATION TRANSLATOR PUBLISHER DATEPUB ISBN LANG SUBJECT AUTHOR TITLE TRANSLATION TRANSLATOR PUBLISHER DATEPUB
9782212090819 fr applications Jean-Christophe Bernadac Construire une application XML Eyrolles Paris 1999 9782212090819 fr applications Jean-Christophe Bernadac Construire une application XML NULL NULL Eyrolles Paris 1999
9782840825685 fr applications William J. Pardi XML en Action adapt de l'anglais par James Guerin Microsoft Press Paris 1999 9782840825685 fr applications William J. Pardi XML en Action adapt de l'anglais par James Guerin Microsoft Press Paris 1999
DROP TABLE t1; DROP TABLE t1;
# #
...@@ -37,7 +37,7 @@ Year int(4) FIELD_FORMAT='DATEPUB' ...@@ -37,7 +37,7 @@ Year int(4) FIELD_FORMAT='DATEPUB'
ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='biblio.json'; ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='biblio.json';
SELECT * FROM t1; SELECT * FROM t1;
ISBN Language Subject Authors Title Translation Translator Publisher Location Year ISBN Language Subject Authors Title Translation Translator Publisher Location Year
9782212090819 fr applications 2 Construire une application XML Eyrolles Paris 1999 9782212090819 fr applications 2 Construire une application XML NULL NULL Eyrolles Paris 1999
9782840825685 fr applications 1 XML en Action adapt de l'anglais par James Guerin Microsoft Press Paris 1999 9782840825685 fr applications 1 XML en Action adapt de l'anglais par James Guerin Microsoft Press Paris 1999
DROP TABLE t1; DROP TABLE t1;
# #
...@@ -60,7 +60,7 @@ Year int(4) FIELD_FORMAT='DATEPUB' ...@@ -60,7 +60,7 @@ Year int(4) FIELD_FORMAT='DATEPUB'
ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='biblio.json'; ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='biblio.json';
SELECT * FROM t1; SELECT * FROM t1;
ISBN Language Subject AuthorFN AuthorLN Title Translation Translator Publisher Location Year ISBN Language Subject AuthorFN AuthorLN Title Translation Translator Publisher Location Year
9782212090819 fr applications Jean-Christophe and Franois Bernadac and Knab Construire une application XML Eyrolles Paris 1999 9782212090819 fr applications Jean-Christophe and Franois Bernadac and Knab Construire une application XML NULL NULL Eyrolles Paris 1999
9782840825685 fr applications William J. Pardi XML en Action adapt de l'anglais par James Guerin Microsoft Press Paris 1999 9782840825685 fr applications William J. Pardi XML en Action adapt de l'anglais par James Guerin Microsoft Press Paris 1999
DROP TABLE t1; DROP TABLE t1;
# #
...@@ -83,14 +83,14 @@ Year int(4) FIELD_FORMAT='DATEPUB' ...@@ -83,14 +83,14 @@ Year int(4) FIELD_FORMAT='DATEPUB'
ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='biblio.json'; ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='biblio.json';
SELECT * FROM t1; SELECT * FROM t1;
ISBN Language Subject AuthorFN AuthorLN Title Translation Translator Publisher Location Year ISBN Language Subject AuthorFN AuthorLN Title Translation Translator Publisher Location Year
9782212090819 fr applications Jean-Christophe Bernadac Construire une application XML Eyrolles Paris 1999 9782212090819 fr applications Jean-Christophe Bernadac Construire une application XML NULL NULL Eyrolles Paris 1999
9782212090819 fr applications Franois Knab Construire une application XML Eyrolles Paris 1999 9782212090819 fr applications Franois Knab Construire une application XML NULL NULL Eyrolles Paris 1999
9782840825685 fr applications William J. Pardi XML en Action adapt de l'anglais par James Guerin Microsoft Press Paris 1999 9782840825685 fr applications William J. Pardi XML en Action adapt de l'anglais par James Guerin Microsoft Press Paris 1999
UPDATE t1 SET AuthorFN = 'Philippe' WHERE AuthorLN = 'Knab'; UPDATE t1 SET AuthorFN = 'Philippe' WHERE AuthorLN = 'Knab';
SELECT * FROM t1 WHERE ISBN = '9782212090819'; SELECT * FROM t1 WHERE ISBN = '9782212090819';
ISBN Language Subject AuthorFN AuthorLN Title Translation Translator Publisher Location Year ISBN Language Subject AuthorFN AuthorLN Title Translation Translator Publisher Location Year
9782212090819 fr applications Philippe Bernadac Construire une application XML Eyrolles Paris 1999 9782212090819 fr applications Philippe Bernadac Construire une application XML NULL NULL Eyrolles Paris 1999
9782212090819 fr applications Franois Knab Construire une application XML Eyrolles Paris 1999 9782212090819 fr applications Franois Knab Construire une application XML NULL NULL Eyrolles Paris 1999
# #
# To add an author a new table must be created # To add an author a new table must be created
# #
...@@ -104,8 +104,8 @@ William J. Pardi ...@@ -104,8 +104,8 @@ William J. Pardi
INSERT INTO t2 VALUES('Charles','Dickens'); INSERT INTO t2 VALUES('Charles','Dickens');
SELECT * FROM t1; SELECT * FROM t1;
ISBN Language Subject AuthorFN AuthorLN Title Translation Translator Publisher Location Year ISBN Language Subject AuthorFN AuthorLN Title Translation Translator Publisher Location Year
9782212090819 fr applications Philippe Bernadac Construire une application XML Eyrolles Paris 1999 9782212090819 fr applications Philippe Bernadac Construire une application XML NULL NULL Eyrolles Paris 1999
9782212090819 fr applications Franois Knab Construire une application XML Eyrolles Paris 1999 9782212090819 fr applications Franois Knab Construire une application XML NULL NULL Eyrolles Paris 1999
9782840825685 fr applications William J. Pardi XML en Action adapt de l'anglais par James Guerin Microsoft Press Paris 1999 9782840825685 fr applications William J. Pardi XML en Action adapt de l'anglais par James Guerin Microsoft Press Paris 1999
9782840825685 fr applications Charles Dickens XML en Action adapt de l'anglais par James Guerin Microsoft Press Paris 1999 9782840825685 fr applications Charles Dickens XML en Action adapt de l'anglais par James Guerin Microsoft Press Paris 1999
DROP TABLE t1; DROP TABLE t1;
......
/******************************************************************/ /******************************************************************/
/* Dual XML implementation base classes defines. */ /* Dual XML implementation base classes defines. */
/******************************************************************/ /******************************************************************/
#if !defined(BASE_BUFFER_SIZE) #if !defined(BASE_BUFFER_SIZE)
enum ElementType { // libxml2 enum ElementType { // libxml2
...@@ -43,7 +43,7 @@ enum NodeType { // MS DOM ...@@ -43,7 +43,7 @@ enum NodeType { // MS DOM
NODE_NOTATION = 12}; NODE_NOTATION = 12};
#endif // !NODE_TYPE_LIST #endif // !NODE_TYPE_LIST
typedef class XMLDOCUMENT *PXDOC; // Document typedef class XMLDOCUMENT *PXDOC; // Document
typedef class XMLNODE *PXNODE; // Node (Element) typedef class XMLNODE *PXNODE; // Node (Element)
typedef class XMLNODELIST *PXLIST; // Node list typedef class XMLNODELIST *PXLIST; // Node list
typedef class XMLATTRIBUTE *PXATTR; // Attribute typedef class XMLATTRIBUTE *PXATTR; // Attribute
...@@ -93,9 +93,9 @@ class XMLDOCUMENT : public BLOCK { ...@@ -93,9 +93,9 @@ class XMLDOCUMENT : public BLOCK {
bool MakeNSlist(PGLOBAL g); bool MakeNSlist(PGLOBAL g);
// Members // Members
PNS Namespaces; /* To the namespaces */ PNS Namespaces; /* To the namespaces */
char *Encoding; /* The document encoding */ char *Encoding; /* The document encoding */
char *Nslist; /* Namespace list */ char *Nslist; /* Namespace list */
char *DefNs; /* Default namespace */ char *DefNs; /* Default namespace */
}; // end of class XMLDOCUMENT }; // end of class XMLDOCUMENT
...@@ -109,6 +109,7 @@ class XMLNODE : public BLOCK { ...@@ -109,6 +109,7 @@ class XMLNODE : public BLOCK {
virtual int GetType(void) = 0; virtual int GetType(void) = 0;
virtual PXNODE GetNext(PGLOBAL) = 0; virtual PXNODE GetNext(PGLOBAL) = 0;
virtual PXNODE GetChild(PGLOBAL) = 0; virtual PXNODE GetChild(PGLOBAL) = 0;
virtual int GetLen(void) {return Len;}
// Methods // Methods
virtual RCODE GetContent(PGLOBAL, char *, int) = 0; virtual RCODE GetContent(PGLOBAL, char *, int) = 0;
...@@ -163,10 +164,12 @@ class XMLNODELIST : public BLOCK { ...@@ -163,10 +164,12 @@ class XMLNODELIST : public BLOCK {
class XMLATTRIBUTE : public BLOCK { class XMLATTRIBUTE : public BLOCK {
public: public:
// Properties // Properties
//virtual char *GetText(void) = 0; virtual char *GetName(PGLOBAL) = 0;
virtual PXATTR GetNext(PGLOBAL) = 0;
// Methods // Methods
virtual bool SetText(PGLOBAL, char *, int) = 0; virtual RCODE GetText(PGLOBAL, char *, int) = 0;
virtual bool SetText(PGLOBAL, char *, int) = 0;
protected: protected:
// Constructor // Constructor
......
/************* RelDef CPP Program Source Code File (.CPP) **************/ /************* RelDef CPP Program Source Code File (.CPP) **************/
/* PROGRAM NAME: REFDEF */ /* PROGRAM NAME: RELDEF */
/* ------------- */ /* ------------- */
/* Version 1.4 */ /* Version 1.4 */
/* */ /* */
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
/***********************************************************************/ /***********************************************************************/
#include "global.h" #include "global.h"
#include "plgdbsem.h" #include "plgdbsem.h"
#include "mycat.h"
#include "reldef.h" #include "reldef.h"
#include "colblk.h" #include "colblk.h"
#include "filamap.h" #include "filamap.h"
...@@ -73,6 +72,14 @@ RELDEF::RELDEF(void) ...@@ -73,6 +72,14 @@ RELDEF::RELDEF(void)
Hc = NULL; Hc = NULL;
} // end of RELDEF constructor } // end of RELDEF constructor
/***********************************************************************/
/* This function return a pointer to the Table Option Struct. */
/***********************************************************************/
PTOS RELDEF::GetTopt(void)
{
return Hc->GetTableOptionStruct();
} // end of GetTopt
/***********************************************************************/ /***********************************************************************/
/* This function sets an integer table information. */ /* This function sets an integer table information. */
/***********************************************************************/ /***********************************************************************/
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "block.h" #include "block.h"
#include "catalog.h" #include "catalog.h"
#include "my_sys.h" #include "my_sys.h"
#include "mycat.h"
typedef class INDEXDEF *PIXDEF; typedef class INDEXDEF *PIXDEF;
typedef class ha_connect *PHC; typedef class ha_connect *PHC;
...@@ -40,6 +41,7 @@ class DllExport RELDEF : public BLOCK { // Relation definition block ...@@ -40,6 +41,7 @@ class DllExport RELDEF : public BLOCK { // Relation definition block
void SetCat(PCATLG cat) { Cat=cat; } void SetCat(PCATLG cat) { Cat=cat; }
// Methods // Methods
PTOS GetTopt(void);
bool GetBoolCatInfo(PSZ what, bool bdef); bool GetBoolCatInfo(PSZ what, bool bdef);
bool SetIntCatInfo(PSZ what, int ival); bool SetIntCatInfo(PSZ what, int ival);
bool Partitioned(void); bool Partitioned(void);
......
This diff is collapsed.
...@@ -35,6 +35,8 @@ class JSONDEF : public DOSDEF { /* Table description */ ...@@ -35,6 +35,8 @@ class JSONDEF : public DOSDEF { /* Table description */
friend class TDBJSON; friend class TDBJSON;
friend class TDBJSN; friend class TDBJSN;
friend class TDBJCL; friend class TDBJCL;
friend PQRYRES JSONColumns(PGLOBAL, char *, const char *, char *,
int, int, int, bool);
public: public:
// Constructor // Constructor
JSONDEF(void); JSONDEF(void);
...@@ -71,29 +73,36 @@ class TDBJSN : public TDBDOS { ...@@ -71,29 +73,36 @@ class TDBJSN : public TDBDOS {
TDBJSN(TDBJSN *tdbp); TDBJSN(TDBJSN *tdbp);
// Implementation // Implementation
virtual AMT GetAmType(void) {return TYPE_AM_JSN;} virtual AMT GetAmType(void) {return TYPE_AM_JSN;}
virtual bool SkipHeader(PGLOBAL g); virtual bool SkipHeader(PGLOBAL g);
virtual PTDB Duplicate(PGLOBAL g) {return (PTDB)new(g) TDBJSN(this);} virtual PTDB Duplicate(PGLOBAL g) {return (PTDB)new(g) TDBJSN(this);}
PJSON GetRow(void) {return Row;}
// Methods // Methods
virtual PTDB CopyOne(PTABS t); virtual PTDB CopyOne(PTABS t);
virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n); virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n);
virtual PCOL InsertSpecialColumn(PGLOBAL g, PCOL colp); virtual PCOL InsertSpecialColumn(PGLOBAL g, PCOL colp);
virtual int RowNumber(PGLOBAL g, bool b = FALSE) virtual int RowNumber(PGLOBAL g, bool b = FALSE)
{return (b) ? N : Fpos + 1;} {return (b) ? N : Fpos + 1;}
// Database routines // Database routines
virtual int Cardinality(PGLOBAL g); virtual int Cardinality(PGLOBAL g);
virtual int GetMaxSize(PGLOBAL g); virtual int GetMaxSize(PGLOBAL g);
virtual bool OpenDB(PGLOBAL g); virtual bool OpenDB(PGLOBAL g);
virtual bool PrepareWriting(PGLOBAL g); virtual bool PrepareWriting(PGLOBAL g);
virtual int ReadDB(PGLOBAL g); virtual int ReadDB(PGLOBAL g);
protected: protected:
PJSON FindRow(PGLOBAL g);
int MakeTopTree(PGLOBAL g, PJSON jsp);
// Members // Members
PJSON Top; // The top JSON tree
PJSON Row; // The current row PJSON Row; // The current row
PJSON Val; // The value of the current row
PJCOL Colp; // The multiple column PJCOL Colp; // The multiple column
JMODE Jmode; // MODE_OBJECT by default JMODE Jmode; // MODE_OBJECT by default
char *Objname; // The table object name
char *Xcol; // Name of expandable column char *Xcol; // Name of expandable column
int Fpos; // The current row index int Fpos; // The current row index
//int Spos; // DELETE start index //int Spos; // DELETE start index
...@@ -168,6 +177,7 @@ class TDBJSON : public TDBJSN { ...@@ -168,6 +177,7 @@ class TDBJSON : public TDBJSN {
// Implementation // Implementation
virtual AMT GetAmType(void) {return TYPE_AM_JSON;} virtual AMT GetAmType(void) {return TYPE_AM_JSON;}
virtual PTDB Duplicate(PGLOBAL g) {return (PTDB)new(g) TDBJSON(this);} virtual PTDB Duplicate(PGLOBAL g) {return (PTDB)new(g) TDBJSON(this);}
PJAR GetDoc(void) {return Doc;}
// Methods // Methods
virtual PTDB CopyOne(PTABS t); virtual PTDB CopyOne(PTABS t);
...@@ -185,18 +195,16 @@ class TDBJSON : public TDBJSN { ...@@ -185,18 +195,16 @@ class TDBJSON : public TDBJSN {
virtual int WriteDB(PGLOBAL g); virtual int WriteDB(PGLOBAL g);
virtual int DeleteDB(PGLOBAL g, int irc); virtual int DeleteDB(PGLOBAL g, int irc);
virtual void CloseDB(PGLOBAL g); virtual void CloseDB(PGLOBAL g);
int MakeDocument(PGLOBAL g);
// Optimization routines // Optimization routines
virtual int MakeIndex(PGLOBAL g, PIXDEF pxdf, bool add); virtual int MakeIndex(PGLOBAL g, PIXDEF pxdf, bool add);
protected: protected:
int MakeNewDoc(PGLOBAL g); int MakeNewDoc(PGLOBAL g);
int MakeDocument(PGLOBAL g);
// Members // Members
PJSON Top; // The file JSON tree
PJAR Doc; // The document array PJAR Doc; // The document array
char *Objname; // The table object name
int Multiple; // 0: No 1: DIR 2: Section 3: filelist int Multiple; // 0: No 1: DIR 2: Section 3: filelist
bool Done; // True when document parsing is done bool Done; // True when document parsing is done
bool Changed; // After Update, Insert or Delete bool Changed; // After Update, Insert or Delete
......
...@@ -587,6 +587,10 @@ CATCOL::CATCOL(PCOLDEF cdp, PTDB tdbp, int n) ...@@ -587,6 +587,10 @@ CATCOL::CATCOL(PCOLDEF cdp, PTDB tdbp, int n)
void CATCOL::ReadColumn(PGLOBAL g) void CATCOL::ReadColumn(PGLOBAL g)
{ {
// Get the value of the Name or Description property // Get the value of the Name or Description property
Value->SetValue_pvblk(Crp->Kdata, Tdbp->N); if (Crp->Kdata)
Value->SetValue_pvblk(Crp->Kdata, Tdbp->N);
else
Value->Reset();
} // end of ReadColumn } // end of ReadColumn
...@@ -56,7 +56,6 @@ ...@@ -56,7 +56,6 @@
#include "xtable.h" #include "xtable.h"
#include "tabcol.h" #include "tabcol.h"
#include "colblk.h" #include "colblk.h"
#include "mycat.h"
#include "reldef.h" #include "reldef.h"
#include "tabmysql.h" #include "tabmysql.h"
#include "valblk.h" #include "valblk.h"
......
...@@ -47,7 +47,6 @@ ...@@ -47,7 +47,6 @@
#include "xtable.h" #include "xtable.h"
#include "tabmysql.h" #include "tabmysql.h"
#include "ha_connect.h" #include "ha_connect.h"
#include "mycat.h"
/***********************************************************************/ /***********************************************************************/
/* Prepare and count columns in the column list. */ /* Prepare and count columns in the column list. */
......
...@@ -49,7 +49,6 @@ ...@@ -49,7 +49,6 @@
#include "tabpivot.h" #include "tabpivot.h"
#include "valblk.h" #include "valblk.h"
#include "ha_connect.h" #include "ha_connect.h"
#include "mycat.h" // For GetHandler
/***********************************************************************/ /***********************************************************************/
/* Make the Pivot table column list. */ /* Make the Pivot table column list. */
......
...@@ -72,7 +72,6 @@ ...@@ -72,7 +72,6 @@
#include "tabtbl.h" #include "tabtbl.h"
#include "tabmysql.h" #include "tabmysql.h"
#include "ha_connect.h" #include "ha_connect.h"
#include "mycat.h" // For GetHandler
#if defined(WIN32) #if defined(WIN32)
#if defined(__BORLANDC__) #if defined(__BORLANDC__)
......
...@@ -43,7 +43,6 @@ ...@@ -43,7 +43,6 @@
#include "plgdbsem.h" #include "plgdbsem.h"
#include "plgcnx.h" // For DB types #include "plgcnx.h" // For DB types
#include "myutil.h" #include "myutil.h"
#include "mycat.h"
#include "valblk.h" #include "valblk.h"
#include "resource.h" #include "resource.h"
#include "reldef.h" #include "reldef.h"
......
...@@ -53,7 +53,6 @@ ...@@ -53,7 +53,6 @@
#include "xtable.h" #include "xtable.h"
#include "tabmysql.h" #include "tabmysql.h"
#include "ha_connect.h" #include "ha_connect.h"
#include "mycat.h"
/* -------------- Implementation of the XCOL classes ---------------- */ /* -------------- Implementation of the XCOL classes ---------------- */
......
This diff is collapsed.
...@@ -16,6 +16,8 @@ typedef class XMLCOL *PXMLCOL; ...@@ -16,6 +16,8 @@ typedef class XMLCOL *PXMLCOL;
/***********************************************************************/ /***********************************************************************/
class DllExport XMLDEF : public TABDEF { /* Logical table description */ class DllExport XMLDEF : public TABDEF { /* Logical table description */
friend class TDBXML; friend class TDBXML;
friend class TDBXCT;
friend PQRYRES XMLColumns(PGLOBAL, char*, char*, PTOS, bool);
public: public:
// Constructor // Constructor
XMLDEF(void); XMLDEF(void);
...@@ -55,6 +57,7 @@ class DllExport TDBXML : public TDBASE { ...@@ -55,6 +57,7 @@ class DllExport TDBXML : public TDBASE {
friend class XMLCOL; friend class XMLCOL;
friend class XMULCOL; friend class XMULCOL;
friend class XPOSCOL; friend class XPOSCOL;
friend PQRYRES XMLColumns(PGLOBAL, char*, char*, PTOS, bool);
public: public:
// Constructor // Constructor
TDBXML(PXMLDEF tdp); TDBXML(PXMLDEF tdp);
...@@ -237,4 +240,24 @@ class XPOSCOL : public XMLCOLX { ...@@ -237,4 +240,24 @@ class XPOSCOL : public XMLCOLX {
virtual void ReadColumn(PGLOBAL g); virtual void ReadColumn(PGLOBAL g);
virtual void WriteColumn(PGLOBAL g); virtual void WriteColumn(PGLOBAL g);
}; // end of class XPOSCOL }; // end of class XPOSCOL
/***********************************************************************/
/* This is the class declaration for the XML catalog table. */
/***********************************************************************/
class TDBXCT : public TDBCAT {
public:
// Constructor
TDBXCT(PXMLDEF tdp);
protected:
// Specific routines
virtual PQRYRES GetResult(PGLOBAL g);
// Members
PTOS Topt;
char *Dp;
//const char *Fn;
char *Tabn;
}; // end of class TDBXCT
#endif // INCLUDE_TDBXML #endif // INCLUDE_TDBXML
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment