Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
b3f9838f
Commit
b3f9838f
authored
Apr 19, 2015
by
Olivier Bertrand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update 10.1 with changes from 10.0
parent
48a77e61
Changes
30
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
905 additions
and
393 deletions
+905
-393
storage/connect/RelWithDebInfo/ha_connect.exp
storage/connect/RelWithDebInfo/ha_connect.exp
+0
-0
storage/connect/connect.cc
storage/connect/connect.cc
+0
-1
storage/connect/connect.dir/RelWithDebInfo/ha_connect.dll.intermediate.manifest
...t.dir/RelWithDebInfo/ha_connect.dll.intermediate.manifest
+10
-0
storage/connect/connect.dir/RelWithDebInfo/mt.dep
storage/connect/connect.dir/RelWithDebInfo/mt.dep
+1
-0
storage/connect/connect.dir/RelWithDebInfo/vc90.idb
storage/connect/connect.dir/RelWithDebInfo/vc90.idb
+0
-0
storage/connect/connect.dir/RelWithDebInfo/versioninfo_dll.res
...ge/connect/connect.dir/RelWithDebInfo/versioninfo_dll.res
+0
-0
storage/connect/domdoc.cpp
storage/connect/domdoc.cpp
+89
-6
storage/connect/domdoc.h
storage/connect/domdoc.h
+14
-5
storage/connect/filamap.h
storage/connect/filamap.h
+1
-0
storage/connect/filamtxt.h
storage/connect/filamtxt.h
+1
-0
storage/connect/ha_connect.cc
storage/connect/ha_connect.cc
+38
-3
storage/connect/ha_connect.h
storage/connect/ha_connect.h
+9
-1
storage/connect/libdoc.cpp
storage/connect/libdoc.cpp
+60
-6
storage/connect/mycat.cc
storage/connect/mycat.cc
+3
-4
storage/connect/mycat.h
storage/connect/mycat.h
+40
-0
storage/connect/mysql-test/connect/r/json.result
storage/connect/mysql-test/connect/r/json.result
+9
-9
storage/connect/plgxml.h
storage/connect/plgxml.h
+9
-6
storage/connect/reldef.cpp
storage/connect/reldef.cpp
+9
-2
storage/connect/reldef.h
storage/connect/reldef.h
+2
-0
storage/connect/tabjson.cpp
storage/connect/tabjson.cpp
+193
-316
storage/connect/tabjson.h
storage/connect/tabjson.h
+24
-16
storage/connect/table.cpp
storage/connect/table.cpp
+5
-1
storage/connect/tabmysql.cpp
storage/connect/tabmysql.cpp
+0
-1
storage/connect/taboccur.cpp
storage/connect/taboccur.cpp
+0
-1
storage/connect/tabpivot.cpp
storage/connect/tabpivot.cpp
+0
-1
storage/connect/tabtbl.cpp
storage/connect/tabtbl.cpp
+0
-1
storage/connect/tabutil.cpp
storage/connect/tabutil.cpp
+0
-1
storage/connect/tabxcl.cpp
storage/connect/tabxcl.cpp
+0
-1
storage/connect/tabxml.cpp
storage/connect/tabxml.cpp
+365
-11
storage/connect/tabxml.h
storage/connect/tabxml.h
+23
-0
No files found.
storage/connect/RelWithDebInfo/ha_connect.exp
0 → 100644
View file @
b3f9838f
File added
storage/connect/connect.cc
View file @
b3f9838f
...
...
@@ -42,7 +42,6 @@
#include "tabcol.h"
#include "catalog.h"
#include "ha_connect.h"
#include "mycat.h"
#define my_strupr(p) my_caseup_str(default_charset_info, (p));
#define my_strlwr(p) my_casedn_str(default_charset_info, (p));
...
...
storage/connect/connect.dir/RelWithDebInfo/ha_connect.dll.intermediate.manifest
0 → 100644
View file @
b3f9838f
<?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>
storage/connect/connect.dir/RelWithDebInfo/mt.dep
0 → 100644
View file @
b3f9838f
La ressource de manifeste a ‚t‚ mise … jour pour la derniŠre fois … 15:13:07,47 le 21/03/2015
storage/connect/connect.dir/RelWithDebInfo/vc90.idb
0 → 100644
View file @
b3f9838f
File added
storage/connect/connect.dir/RelWithDebInfo/versioninfo_dll.res
0 → 100644
View file @
b3f9838f
File added
storage/connect/domdoc.cpp
View file @
b3f9838f
...
...
@@ -275,7 +275,7 @@ PXNODE DOMNODE::GetNext(PGLOBAL g)
{
if
(
Nodep
->
nextSibling
==
NULL
)
Next
=
NULL
;
else
if
(
!
Next
)
else
//
if (!Next)
Next
=
new
(
g
)
DOMNODE
(
Doc
,
Nodep
->
nextSibling
);
return
Next
;
...
...
@@ -288,7 +288,7 @@ PXNODE DOMNODE::GetChild(PGLOBAL g)
{
if
(
Nodep
->
firstChild
==
NULL
)
Children
=
NULL
;
else
if
(
!
Children
)
else
//
if (!Children)
Children
=
new
(
g
)
DOMNODE
(
Doc
,
Nodep
->
firstChild
);
return
Children
;
...
...
@@ -441,15 +441,27 @@ PXNODE DOMNODE::SelectSingleNode(PGLOBAL g, char *xp, PXNODE np)
/******************************************************************/
PXATTR
DOMNODE
::
GetAttribute
(
PGLOBAL
g
,
char
*
name
,
PXATTR
ap
)
{
MSXML2
::
IXMLDOMElementPtr
ep
=
Nodep
;
MSXML2
::
IXMLDOMAttributePtr
atp
=
ep
->
getAttributeNode
(
name
);
MSXML2
::
IXMLDOMElementPtr
ep
;
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
(
ap
)
{
((
PDOMATTR
)
ap
)
->
Atrp
=
atp
;
((
PDOMATTR
)
ap
)
->
Nmp
=
nmp
;
((
PDOMATTR
)
ap
)
->
K
=
0
;
return
ap
;
}
else
return
new
(
g
)
DOMATTR
(
Doc
,
atp
);
return
new
(
g
)
DOMATTR
(
Doc
,
atp
,
nmp
);
}
else
return
NULL
;
...
...
@@ -617,14 +629,85 @@ bool DOMNODELIST::DropItem(PGLOBAL g, int n)
/******************************************************************/
/* DOMATTR constructor. */
/******************************************************************/
DOMATTR
::
DOMATTR
(
PXDOC
dp
,
MSXML2
::
IXMLDOMAttributePtr
ap
)
DOMATTR
::
DOMATTR
(
PXDOC
dp
,
MSXML2
::
IXMLDOMAttributePtr
ap
,
MSXML2
::
IXMLDOMNamedNodeMapPtr
nmp
)
:
XMLATTRIBUTE
(
dp
)
{
Atrp
=
ap
;
Nmp
=
nmp
;
Ws
=
NULL
;
Len
=
0
;
K
=
0
;
}
// 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. */
/******************************************************************/
...
...
storage/connect/domdoc.h
View file @
b3f9838f
...
...
@@ -122,15 +122,24 @@ class DOMATTR : public XMLATTRIBUTE {
friend
class
DOMDOC
;
friend
class
DOMNODE
;
public:
// Properties
virtual
char
*
GetName
(
PGLOBAL
g
);
virtual
PXATTR
GetNext
(
PGLOBAL
);
// 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:
// Constructor
DOMATTR
(
PXDOC
dp
,
MSXML2
::
IXMLDOMAttributePtr
ap
);
DOMATTR
(
PXDOC
dp
,
MSXML2
::
IXMLDOMAttributePtr
ap
,
MSXML2
::
IXMLDOMNamedNodeMapPtr
nmp
=
NULL
);
// Members
MSXML2
::
IXMLDOMAttributePtr
Atrp
;
WCHAR
*
Ws
;
int
Len
;
MSXML2
::
IXMLDOMAttributePtr
Atrp
;
MSXML2
::
IXMLDOMNamedNodeMapPtr
Nmp
;
char
Name
[
64
];
WCHAR
*
Ws
;
int
Len
;
long
K
;
};
// end of class DOMATTR
storage/connect/filamap.h
View file @
b3f9838f
...
...
@@ -17,6 +17,7 @@ typedef class MAPFAM *PMAPFAM;
/* This is the variable file access method using file mapping. */
/***********************************************************************/
class
DllExport
MAPFAM
:
public
TXTFAM
{
friend
class
TDBJSON
;
public:
// Constructor
MAPFAM
(
PDOSDEF
tdp
);
...
...
storage/connect/filamtxt.h
View file @
b3f9838f
...
...
@@ -42,6 +42,7 @@ class DllExport TXTFAM : public BLOCK {
virtual
PTXF
Duplicate
(
PGLOBAL
g
)
=
0
;
virtual
bool
GetUseTemp
(
void
)
{
return
false
;}
virtual
int
GetDelRows
(
void
)
{
return
DelRows
;}
PFBLOCK
GetTo_Fb
(
void
)
{
return
To_Fb
;}
int
GetCurBlk
(
void
)
{
return
CurBlk
;}
void
SetTdbp
(
PTDBDOS
tdbp
)
{
Tdbp
=
tdbp
;}
int
GetBlock
(
void
)
{
return
Block
;}
...
...
storage/connect/ha_connect.cc
View file @
b3f9838f
...
...
@@ -145,7 +145,6 @@
#include "connect.h"
#include "user_connect.h"
#include "ha_connect.h"
#include "mycat.h"
#include "myutil.h"
#include "preparse.h"
#include "inihandl.h"
...
...
@@ -169,7 +168,7 @@
#define JSONMAX 10 // JSON Default max grp size
extern
"C"
{
char
version
[]
=
"Version 1.03.0006
March 16
, 2015"
;
char
version
[]
=
"Version 1.03.0006
April 12
, 2015"
;
#if defined(WIN32)
char
compver
[]
=
"Version 1.03.0006 "
__DATE__
" "
__TIME__
;
...
...
@@ -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
JSONColumns
(
PGLOBAL
g
,
char
*
dp
,
const
char
*
fn
,
char
*
objn
,
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
);
bool
CheckSelf
(
PGLOBAL
g
,
TABLE_SHARE
*
s
,
const
char
*
host
,
const
char
*
db
,
char
*
tab
,
const
char
*
src
,
int
port
);
...
...
@@ -5228,6 +5228,9 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
strcpy
(
g
->
Message
,
"Missing OEM module or subtype"
);
break
;
#if defined(LIBXML2_SUPPORT) || defined(DOMDOC_SUPPORT)
case
TAB_XML
:
#endif // LIBXML2_SUPPORT || DOMDOC_SUPPORT
case
TAB_JSON
:
if
(
!
fn
)
sprintf
(
g
->
Message
,
"Missing %s file name"
,
topt
->
type
);
...
...
@@ -5348,6 +5351,11 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
case
TAB_JSON
:
qrp
=
JSONColumns
(
g
,
(
char
*
)
db
,
fn
,
objn
,
pty
,
lrecl
,
lvl
,
fnc
==
FNC_COL
);
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
:
qrp
=
OEMColumns
(
g
,
topt
,
tab
,
(
char
*
)
db
,
fnc
==
FNC_COL
);
break
;
...
...
@@ -5385,7 +5393,9 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
#endif // !NEW_WAY
}
// endfor crp
}
else
{
}
else
{
char
*
schem
=
NULL
;
// Not a catalog table
if
(
!
qrp
->
Nblin
)
{
if
(
tab
)
...
...
@@ -5469,6 +5479,19 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
key
=
crp
->
Kdata
->
GetCharValue
(
i
);
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:
break
;
// Ignore
}
// endswitch Fld
...
...
@@ -5790,6 +5813,18 @@ int ha_connect::create(const char *name, TABLE *table_arg,
}
// 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
for
(
field
=
table_arg
->
field
;
*
field
;
field
++
)
{
fp
=
*
field
;
...
...
storage/connect/ha_connect.h
View file @
b3f9838f
...
...
@@ -26,6 +26,11 @@
#pragma interface
/* gcc class implementation */
#endif
/****************************************************************************/
/* mycat.h contains the TOS, PTOS, ha_table_option_struct declarations. */
/****************************************************************************/
#include "mycat.h"
static
char
*
strz
(
PGLOBAL
g
,
LEX_STRING
&
ls
);
/****************************************************************************/
...
...
@@ -68,7 +73,6 @@ class XCHK : public BLOCK {
typedef
class
XCHK
*
PCHK
;
typedef
class
user_connect
*
PCONNECT
;
typedef
struct
ha_table_option_struct
TOS
,
*
PTOS
;
typedef
struct
ha_field_option_struct
FOS
,
*
PFOS
;
typedef
struct
ha_index_option_struct
XOS
,
*
PXOS
;
...
...
@@ -80,6 +84,9 @@ extern handlerton *connect_hton;
These can be specified in the CREATE TABLE:
CREATE TABLE ( ... ) {...here...}
*/
#if 0 // moved to mycat.h
typedef struct ha_table_option_struct TOS, *PTOS;
struct ha_table_option_struct {
const char *type;
const char *filename;
...
...
@@ -111,6 +118,7 @@ struct ha_table_option_struct {
bool readonly;
bool sepindex;
};
#endif // 0
/**
structure for CREATE TABLE options (field options)
...
...
storage/connect/libdoc.cpp
View file @
b3f9838f
...
...
@@ -162,10 +162,12 @@ class XML2ATTR : public XMLATTRIBUTE {
friend
class
XML2NODE
;
public:
// Properties
//virtual char *GetText(void);
virtual
char
*
GetName
(
PGLOBAL
g
)
{
return
(
char
*
)
Atrp
->
name
;}
virtual
PXATTR
GetNext
(
PGLOBAL
g
);
// 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:
// Constructor
...
...
@@ -812,7 +814,7 @@ PXNODE XML2NODE::GetNext(PGLOBAL g)
if
(
!
Nodep
->
next
)
Next
=
NULL
;
else
if
(
!
Next
)
else
//
if (!Next)
Next
=
new
(
g
)
XML2NODE
(
Doc
,
Nodep
->
next
);
return
Next
;
...
...
@@ -828,7 +830,7 @@ PXNODE XML2NODE::GetChild(PGLOBAL g)
if
(
!
Nodep
->
children
)
Children
=
NULL
;
else
if
(
!
Children
)
else
//
if (!Children)
Children
=
new
(
g
)
XML2NODE
(
Doc
,
Nodep
->
children
);
return
Children
;
...
...
@@ -978,10 +980,16 @@ PXNODE XML2NODE::SelectSingleNode(PGLOBAL g, char *xp, PXNODE np)
/******************************************************************/
PXATTR
XML2NODE
::
GetAttribute
(
PGLOBAL
g
,
char
*
name
,
PXATTR
ap
)
{
xmlAttrPtr
atp
;
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
(
ap
)
{
...
...
@@ -1209,6 +1217,52 @@ XML2ATTR::XML2ATTR(PXDOC dp, xmlAttrPtr ap, xmlNodePtr np)
Parent
=
np
;
}
// 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. */
/******************************************************************/
...
...
storage/connect/mycat.cc
View file @
b3f9838f
...
...
@@ -74,9 +74,6 @@
#include "tabxcl.h"
#include "tabtbl.h"
#include "taboccur.h"
#if defined(XML_SUPPORT)
#include "tabxml.h"
#endif // XML_SUPPORT
#include "tabmul.h"
#include "tabmysql.h"
#if defined(ODBC_SUPPORT)
...
...
@@ -89,7 +86,9 @@
#include "tabvir.h"
#include "tabjson.h"
#include "ha_connect.h"
#include "mycat.h"
#if defined(XML_SUPPORT)
#include "tabxml.h"
#endif // XML_SUPPORT
/***********************************************************************/
/* Extern static variables. */
...
...
storage/connect/mycat.h
View file @
b3f9838f
...
...
@@ -24,6 +24,46 @@
#include "block.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
#define FNC_NO (1 << 0) // Not a catalog table
#define FNC_COL (1 << 1) // Column catalog function
...
...
storage/connect/mysql-test/connect/r/json.result
View file @
b3f9838f
...
...
@@ -15,7 +15,7 @@ DATEPUB int(4)
) ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='biblio.json';
SELECT * FROM t1;
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
DROP TABLE t1;
#
...
...
@@ -37,7 +37,7 @@ Year int(4) FIELD_FORMAT='DATEPUB'
ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='biblio.json';
SELECT * FROM t1;
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
DROP TABLE t1;
#
...
...
@@ -60,7 +60,7 @@ Year int(4) FIELD_FORMAT='DATEPUB'
ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='biblio.json';
SELECT * FROM t1;
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 N
ULL NULL
Eyrolles 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;
#
...
...
@@ -83,14 +83,14 @@ Year int(4) FIELD_FORMAT='DATEPUB'
ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='biblio.json';
SELECT * FROM t1;
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 Franois Knab 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 N
ULL NULL
Eyrolles 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';
SELECT * FROM t1 WHERE ISBN = '9782212090819';
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 Franois Knab 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 N
ULL NULL
Eyrolles Paris 1999
#
# To add an author a new table must be created
#
...
...
@@ -104,8 +104,8 @@ William J. Pardi
INSERT INTO t2 VALUES('Charles','Dickens');
SELECT * FROM t1;
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 Franois Knab 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 N
ULL 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 Charles Dickens XML en Action adapt de l'anglais par James Guerin Microsoft Press Paris 1999
DROP TABLE t1;
...
...
storage/connect/plgxml.h
View file @
b3f9838f
/******************************************************************/
/* Dual XML implementation
base classes defines.
*/
/* Dual XML implementation
base classes defines.
*/
/******************************************************************/
#if !defined(BASE_BUFFER_SIZE)
enum
ElementType
{
// libxml2
...
...
@@ -43,7 +43,7 @@ enum NodeType { // MS DOM
NODE_NOTATION
=
12
};
#endif // !NODE_TYPE_LIST
typedef
class
XMLDOCUMENT
*
PXDOC
;
// Document
typedef
class
XMLDOCUMENT
*
PXDOC
;
// Document
typedef
class
XMLNODE
*
PXNODE
;
// Node (Element)
typedef
class
XMLNODELIST
*
PXLIST
;
// Node list
typedef
class
XMLATTRIBUTE
*
PXATTR
;
// Attribute
...
...
@@ -93,9 +93,9 @@ class XMLDOCUMENT : public BLOCK {
bool
MakeNSlist
(
PGLOBAL
g
);
// Members
PNS
Namespaces
;
/* To the namespaces */
PNS
Namespaces
;
/* To the namespaces */
char
*
Encoding
;
/* The document encoding */
char
*
Nslist
;
/* Namespace list */
char
*
Nslist
;
/* Namespace list */
char
*
DefNs
;
/* Default namespace */
};
// end of class XMLDOCUMENT
...
...
@@ -109,6 +109,7 @@ class XMLNODE : public BLOCK {
virtual
int
GetType
(
void
)
=
0
;
virtual
PXNODE
GetNext
(
PGLOBAL
)
=
0
;
virtual
PXNODE
GetChild
(
PGLOBAL
)
=
0
;
virtual
int
GetLen
(
void
)
{
return
Len
;}
// Methods
virtual
RCODE
GetContent
(
PGLOBAL
,
char
*
,
int
)
=
0
;
...
...
@@ -163,10 +164,12 @@ class XMLNODELIST : public BLOCK {
class
XMLATTRIBUTE
:
public
BLOCK
{
public:
// Properties
//virtual char *GetText(void) = 0;
virtual
char
*
GetName
(
PGLOBAL
)
=
0
;
virtual
PXATTR
GetNext
(
PGLOBAL
)
=
0
;
// Methods
virtual
bool
SetText
(
PGLOBAL
,
char
*
,
int
)
=
0
;
virtual
RCODE
GetText
(
PGLOBAL
,
char
*
,
int
)
=
0
;
virtual
bool
SetText
(
PGLOBAL
,
char
*
,
int
)
=
0
;
protected:
// Constructor
...
...
storage/connect/reldef.cpp
View file @
b3f9838f
/************* RelDef CPP Program Source Code File (.CPP) **************/
/* PROGRAM NAME: RE
F
DEF */
/* PROGRAM NAME: RE
L
DEF */
/* ------------- */
/* Version 1.4 */
/* */
...
...
@@ -35,7 +35,6 @@
/***********************************************************************/
#include "global.h"
#include "plgdbsem.h"
#include "mycat.h"
#include "reldef.h"
#include "colblk.h"
#include "filamap.h"
...
...
@@ -73,6 +72,14 @@ RELDEF::RELDEF(void)
Hc
=
NULL
;
}
// 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. */
/***********************************************************************/
...
...
storage/connect/reldef.h
View file @
b3f9838f
...
...
@@ -12,6 +12,7 @@
#include "block.h"
#include "catalog.h"
#include "my_sys.h"
#include "mycat.h"
typedef
class
INDEXDEF
*
PIXDEF
;
typedef
class
ha_connect
*
PHC
;
...
...
@@ -40,6 +41,7 @@ class DllExport RELDEF : public BLOCK { // Relation definition block
void
SetCat
(
PCATLG
cat
)
{
Cat
=
cat
;
}
// Methods
PTOS
GetTopt
(
void
);
bool
GetBoolCatInfo
(
PSZ
what
,
bool
bdef
);
bool
SetIntCatInfo
(
PSZ
what
,
int
ival
);
bool
Partitioned
(
void
);
...
...
storage/connect/tabjson.cpp
View file @
b3f9838f
This diff is collapsed.
Click to expand it.
storage/connect/tabjson.h
View file @
b3f9838f
...
...
@@ -35,6 +35,8 @@ class JSONDEF : public DOSDEF { /* Table description */
friend
class
TDBJSON
;
friend
class
TDBJSN
;
friend
class
TDBJCL
;
friend
PQRYRES
JSONColumns
(
PGLOBAL
,
char
*
,
const
char
*
,
char
*
,
int
,
int
,
int
,
bool
);
public:
// Constructor
JSONDEF
(
void
);
...
...
@@ -71,29 +73,36 @@ class TDBJSN : public TDBDOS {
TDBJSN
(
TDBJSN
*
tdbp
);
// Implementation
virtual
AMT
GetAmType
(
void
)
{
return
TYPE_AM_JSN
;}
virtual
bool
SkipHeader
(
PGLOBAL
g
);
virtual
PTDB
Duplicate
(
PGLOBAL
g
)
{
return
(
PTDB
)
new
(
g
)
TDBJSN
(
this
);}
virtual
AMT
GetAmType
(
void
)
{
return
TYPE_AM_JSN
;}
virtual
bool
SkipHeader
(
PGLOBAL
g
);
virtual
PTDB
Duplicate
(
PGLOBAL
g
)
{
return
(
PTDB
)
new
(
g
)
TDBJSN
(
this
);}
PJSON
GetRow
(
void
)
{
return
Row
;}
// Methods
virtual
PTDB
CopyOne
(
PTABS
t
);
virtual
PCOL
MakeCol
(
PGLOBAL
g
,
PCOLDEF
cdp
,
PCOL
cprec
,
int
n
);
virtual
PCOL
InsertSpecialColumn
(
PGLOBAL
g
,
PCOL
colp
);
virtual
int
RowNumber
(
PGLOBAL
g
,
bool
b
=
FALSE
)
{
return
(
b
)
?
N
:
Fpos
+
1
;}
virtual
PTDB
CopyOne
(
PTABS
t
);
virtual
PCOL
MakeCol
(
PGLOBAL
g
,
PCOLDEF
cdp
,
PCOL
cprec
,
int
n
);
virtual
PCOL
InsertSpecialColumn
(
PGLOBAL
g
,
PCOL
colp
);
virtual
int
RowNumber
(
PGLOBAL
g
,
bool
b
=
FALSE
)
{
return
(
b
)
?
N
:
Fpos
+
1
;}
// Database routines
virtual
int
Cardinality
(
PGLOBAL
g
);
virtual
int
GetMaxSize
(
PGLOBAL
g
);
virtual
bool
OpenDB
(
PGLOBAL
g
);
virtual
bool
PrepareWriting
(
PGLOBAL
g
);
virtual
int
ReadDB
(
PGLOBAL
g
);
virtual
int
Cardinality
(
PGLOBAL
g
);
virtual
int
GetMaxSize
(
PGLOBAL
g
);
virtual
bool
OpenDB
(
PGLOBAL
g
);
virtual
bool
PrepareWriting
(
PGLOBAL
g
);
virtual
int
ReadDB
(
PGLOBAL
g
);
protected:
PJSON
FindRow
(
PGLOBAL
g
);
int
MakeTopTree
(
PGLOBAL
g
,
PJSON
jsp
);
// Members
PJSON
Top
;
// The top JSON tree
PJSON
Row
;
// The current row
PJSON
Val
;
// The value of the current row
PJCOL
Colp
;
// The multiple column
JMODE
Jmode
;
// MODE_OBJECT by default
char
*
Objname
;
// The table object name
char
*
Xcol
;
// Name of expandable column
int
Fpos
;
// The current row index
//int Spos; // DELETE start index
...
...
@@ -168,6 +177,7 @@ class TDBJSON : public TDBJSN {
// Implementation
virtual
AMT
GetAmType
(
void
)
{
return
TYPE_AM_JSON
;}
virtual
PTDB
Duplicate
(
PGLOBAL
g
)
{
return
(
PTDB
)
new
(
g
)
TDBJSON
(
this
);}
PJAR
GetDoc
(
void
)
{
return
Doc
;}
// Methods
virtual
PTDB
CopyOne
(
PTABS
t
);
...
...
@@ -185,18 +195,16 @@ class TDBJSON : public TDBJSN {
virtual
int
WriteDB
(
PGLOBAL
g
);
virtual
int
DeleteDB
(
PGLOBAL
g
,
int
irc
);
virtual
void
CloseDB
(
PGLOBAL
g
);
int
MakeDocument
(
PGLOBAL
g
);
// Optimization routines
virtual
int
MakeIndex
(
PGLOBAL
g
,
PIXDEF
pxdf
,
bool
add
);
protected:
int
MakeNewDoc
(
PGLOBAL
g
);
int
MakeDocument
(
PGLOBAL
g
);
// Members
PJSON
Top
;
// The file JSON tree
PJAR
Doc
;
// The document array
char
*
Objname
;
// The table object name
int
Multiple
;
// 0: No 1: DIR 2: Section 3: filelist
bool
Done
;
// True when document parsing is done
bool
Changed
;
// After Update, Insert or Delete
...
...
storage/connect/table.cpp
View file @
b3f9838f
...
...
@@ -587,6 +587,10 @@ CATCOL::CATCOL(PCOLDEF cdp, PTDB tdbp, int n)
void
CATCOL
::
ReadColumn
(
PGLOBAL
g
)
{
// 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
storage/connect/tabmysql.cpp
View file @
b3f9838f
...
...
@@ -56,7 +56,6 @@
#include "xtable.h"
#include "tabcol.h"
#include "colblk.h"
#include "mycat.h"
#include "reldef.h"
#include "tabmysql.h"
#include "valblk.h"
...
...
storage/connect/taboccur.cpp
View file @
b3f9838f
...
...
@@ -47,7 +47,6 @@
#include "xtable.h"
#include "tabmysql.h"
#include "ha_connect.h"
#include "mycat.h"
/***********************************************************************/
/* Prepare and count columns in the column list. */
...
...
storage/connect/tabpivot.cpp
View file @
b3f9838f
...
...
@@ -49,7 +49,6 @@
#include "tabpivot.h"
#include "valblk.h"
#include "ha_connect.h"
#include "mycat.h" // For GetHandler
/***********************************************************************/
/* Make the Pivot table column list. */
...
...
storage/connect/tabtbl.cpp
View file @
b3f9838f
...
...
@@ -72,7 +72,6 @@
#include "tabtbl.h"
#include "tabmysql.h"
#include "ha_connect.h"
#include "mycat.h" // For GetHandler
#if defined(WIN32)
#if defined(__BORLANDC__)
...
...
storage/connect/tabutil.cpp
View file @
b3f9838f
...
...
@@ -43,7 +43,6 @@
#include "plgdbsem.h"
#include "plgcnx.h" // For DB types
#include "myutil.h"
#include "mycat.h"
#include "valblk.h"
#include "resource.h"
#include "reldef.h"
...
...
storage/connect/tabxcl.cpp
View file @
b3f9838f
...
...
@@ -53,7 +53,6 @@
#include "xtable.h"
#include "tabmysql.h"
#include "ha_connect.h"
#include "mycat.h"
/* -------------- Implementation of the XCOL classes ---------------- */
...
...
storage/connect/tabxml.cpp
View file @
b3f9838f
This diff is collapsed.
Click to expand it.
storage/connect/tabxml.h
View file @
b3f9838f
...
...
@@ -16,6 +16,8 @@ typedef class XMLCOL *PXMLCOL;
/***********************************************************************/
class
DllExport
XMLDEF
:
public
TABDEF
{
/* Logical table description */
friend
class
TDBXML
;
friend
class
TDBXCT
;
friend
PQRYRES
XMLColumns
(
PGLOBAL
,
char
*
,
char
*
,
PTOS
,
bool
);
public:
// Constructor
XMLDEF
(
void
);
...
...
@@ -55,6 +57,7 @@ class DllExport TDBXML : public TDBASE {
friend
class
XMLCOL
;
friend
class
XMULCOL
;
friend
class
XPOSCOL
;
friend
PQRYRES
XMLColumns
(
PGLOBAL
,
char
*
,
char
*
,
PTOS
,
bool
);
public:
// Constructor
TDBXML
(
PXMLDEF
tdp
);
...
...
@@ -237,4 +240,24 @@ class XPOSCOL : public XMLCOLX {
virtual
void
ReadColumn
(
PGLOBAL
g
);
virtual
void
WriteColumn
(
PGLOBAL
g
);
};
// 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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment