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
e3b3e225
Commit
e3b3e225
authored
Jan 04, 2019
by
Olivier Bertrand
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ob-10.1' into 10.1
parents
faa1d149
261e9a8a
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
185 additions
and
145 deletions
+185
-145
storage/connect/mysql-test/connect/r/part_table.result
storage/connect/mysql-test/connect/r/part_table.result
+2
-2
storage/connect/mysql-test/connect/t/part_table.test
storage/connect/mysql-test/connect/t/part_table.test
+1
-1
storage/connect/tabjson.cpp
storage/connect/tabjson.cpp
+27
-15
storage/connect/tabjson.h
storage/connect/tabjson.h
+1
-1
storage/connect/tabxml.cpp
storage/connect/tabxml.cpp
+153
-126
storage/connect/tabxml.h
storage/connect/tabxml.h
+1
-0
No files found.
storage/connect/mysql-test/connect/r/part_table.result
View file @
e3b3e225
...
...
@@ -23,7 +23,7 @@ id msg
CREATE TABLE xt3 (
id INT KEY NOT NULL,
msg VARCHAR(32))
ENGINE=CONNECT TABLE_TYPE=CSV AVG_ROW_LENGTH=
10
;
ENGINE=CONNECT TABLE_TYPE=CSV AVG_ROW_LENGTH=
6
;
Warnings:
Warning 1105 No file name. Table will use xt3.csv
INSERT INTO xt3 VALUES(60,'sixty'),(81,'eighty one'),(72,'seventy two');
...
...
@@ -92,7 +92,7 @@ id msg
EXPLAIN PARTITIONS
SELECT * FROM t1 WHERE id = 81;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 3 ALL NULL NULL NULL NULL
4
Using where
1 SIMPLE t1 3 ALL NULL NULL NULL NULL
6
Using where
DELETE FROM t1;
Warnings:
Note 1105 xt1: 4 affected rows
...
...
storage/connect/mysql-test/connect/t/part_table.test
View file @
e3b3e225
...
...
@@ -22,7 +22,7 @@ SELECT * FROM xt2;
CREATE
TABLE
xt3
(
id
INT
KEY
NOT
NULL
,
msg
VARCHAR
(
32
))
ENGINE
=
CONNECT
TABLE_TYPE
=
CSV
AVG_ROW_LENGTH
=
10
;
ENGINE
=
CONNECT
TABLE_TYPE
=
CSV
AVG_ROW_LENGTH
=
6
;
INSERT
INTO
xt3
VALUES
(
60
,
'sixty'
),(
81
,
'eighty one'
),(
72
,
'seventy two'
);
SELECT
*
FROM
xt3
;
...
...
storage/connect/tabjson.cpp
View file @
e3b3e225
/************* tabjson C++ Program Source Code File (.CPP) *************/
/* PROGRAM NAME: tabjson Version 1.
5
*/
/* (C) Copyright to the author Olivier BERTRAND 2014 - 201
7
*/
/* PROGRAM NAME: tabjson Version 1.
6
*/
/* (C) Copyright to the author Olivier BERTRAND 2014 - 201
8
*/
/* This program are the JSON class DB execution routines. */
/***********************************************************************/
...
...
@@ -173,6 +173,7 @@ JSONDISC::JSONDISC(PGLOBAL g, uint *lg)
int
JSONDISC
::
GetColumns
(
PGLOBAL
g
,
PCSZ
db
,
PCSZ
dsn
,
PTOS
topt
)
{
char
filename
[
_MAX_PATH
];
bool
mgo
=
(
GetTypeID
(
topt
->
type
)
==
TAB_MONGO
);
PCSZ
level
=
GetStringTableOption
(
g
,
topt
,
"Level"
,
NULL
);
...
...
@@ -209,6 +210,12 @@ int JSONDISC::GetColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt)
return
0
;
}
// endif Fn
if
(
tdp
->
Fn
)
{
// We used the file name relative to recorded datapath
PlugSetPath
(
filename
,
tdp
->
Fn
,
tdp
->
GetPath
());
tdp
->
Fn
=
PlugDup
(
g
,
filename
);
}
// endif Fn
if
(
trace
(
1
))
htrc
(
"File %s objname=%s pretty=%d lvl=%d
\n
"
,
tdp
->
Fn
,
tdp
->
Objname
,
tdp
->
Pretty
,
lvl
);
...
...
@@ -342,7 +349,7 @@ int JSONDISC::GetColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt)
strncpy
(
colname
,
jpp
->
GetKey
(),
64
);
fmt
[
bf
]
=
0
;
if
(
Find
(
g
,
jpp
->
GetVal
(),
MY_MIN
(
lvl
,
0
)))
if
(
Find
(
g
,
jpp
->
GetVal
(),
colname
,
MY_MIN
(
lvl
,
0
)))
goto
err
;
}
// endfor jpp
...
...
@@ -385,7 +392,7 @@ int JSONDISC::GetColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt)
return
0
;
}
// end of GetColumns
bool
JSONDISC
::
Find
(
PGLOBAL
g
,
PJVAL
jvp
,
int
j
)
bool
JSONDISC
::
Find
(
PGLOBAL
g
,
PJVAL
jvp
,
PCSZ
key
,
int
j
)
{
char
*
p
,
*
pc
=
colname
+
strlen
(
colname
);
int
ars
;
...
...
@@ -413,12 +420,14 @@ bool JSONDISC::Find(PGLOBAL g, PJVAL jvp, int j)
job
=
(
PJOB
)
jsp
;
for
(
PJPR
jrp
=
job
->
GetFirst
();
jrp
;
jrp
=
jrp
->
GetNext
())
{
if
(
*
jrp
->
GetKey
()
!=
'$'
)
{
strncat
(
strncat
(
fmt
,
sep
,
128
),
jrp
->
GetKey
(),
128
);
strncat
(
strncat
(
colname
,
"_"
,
64
),
jrp
->
GetKey
(),
64
);
PCSZ
k
=
jrp
->
GetKey
();
if
(
*
k
!=
'$'
)
{
strncat
(
strncat
(
fmt
,
sep
,
128
),
k
,
128
);
strncat
(
strncat
(
colname
,
"_"
,
64
),
k
,
64
);
}
// endif Key
if
(
Find
(
g
,
jrp
->
GetVal
(),
j
+
1
))
if
(
Find
(
g
,
jrp
->
GetVal
(),
k
,
j
+
1
))
return
true
;
*
p
=
*
pc
=
0
;
...
...
@@ -428,13 +437,13 @@ bool JSONDISC::Find(PGLOBAL g, PJVAL jvp, int j)
case
TYPE_JAR
:
jar
=
(
PJAR
)
jsp
;
if
(
all
||
(
tdp
->
Xcol
&&
!
stricmp
(
tdp
->
Xcol
,
colname
)))
if
(
all
||
(
tdp
->
Xcol
&&
!
stricmp
(
tdp
->
Xcol
,
key
)))
ars
=
jar
->
GetSize
(
false
);
else
ars
=
MY_MIN
(
jar
->
GetSize
(
false
),
1
);
for
(
int
k
=
0
;
k
<
ars
;
k
++
)
{
if
(
!
tdp
->
Xcol
||
stricmp
(
tdp
->
Xcol
,
colname
))
{
if
(
!
tdp
->
Xcol
||
stricmp
(
tdp
->
Xcol
,
key
))
{
sprintf
(
buf
,
"%d"
,
k
);
if
(
tdp
->
Uri
)
...
...
@@ -448,7 +457,7 @@ bool JSONDISC::Find(PGLOBAL g, PJVAL jvp, int j)
}
else
strncat
(
fmt
,
(
tdp
->
Uri
?
sep
:
"[*]"
),
128
);
if
(
Find
(
g
,
jar
->
GetValue
(
k
),
j
))
if
(
Find
(
g
,
jar
->
GetValue
(
k
),
""
,
j
))
return
true
;
*
p
=
*
pc
=
0
;
...
...
@@ -522,7 +531,9 @@ void JSONDISC::AddColumn(PGLOBAL g)
n
++
;
}
// endif jcp
pjcp
=
jcp
;
if
(
jcp
)
pjcp
=
jcp
;
}
// end of AddColumn
...
...
@@ -549,7 +560,7 @@ JSONDEF::JSONDEF(void)
/***********************************************************************/
/* DefineAM: define specific AM block values. */
/***********************************************************************/
bool
JSONDEF
::
DefineAM
(
PGLOBAL
g
,
LPCSTR
,
int
poff
)
bool
JSONDEF
::
DefineAM
(
PGLOBAL
g
,
LPCSTR
am
,
int
poff
)
{
Schema
=
GetStringCatInfo
(
g
,
"DBname"
,
Schema
);
Jmode
=
(
JMODE
)
GetIntCatInfo
(
"Jmode"
,
MODE_OBJECT
);
...
...
@@ -561,7 +572,8 @@ bool JSONDEF::DefineAM(PGLOBAL g, LPCSTR, int poff)
Sep
=
*
GetStringCatInfo
(
g
,
"Separator"
,
"."
);
Accept
=
GetBoolCatInfo
(
"Accept"
,
false
);
if
(
Uri
=
GetStringCatInfo
(
g
,
"Connect"
,
NULL
))
{
// Don't use url as uri when called from REST OEM module
if
(
stricmp
(
am
,
"REST"
)
&&
(
Uri
=
GetStringCatInfo
(
g
,
"Connect"
,
NULL
)))
{
#if defined(JAVA_SUPPORT) || defined(CMGO_SUPPORT)
Collname
=
GetStringCatInfo
(
g
,
"Name"
,
(
Catfunc
&
(
FNC_TABLE
|
FNC_COL
))
?
NULL
:
Name
);
...
...
@@ -2340,7 +2352,7 @@ void TDBJSON::CloseDB(PGLOBAL g)
TDBJCL
::
TDBJCL
(
PJDEF
tdp
)
:
TDBCAT
(
tdp
)
{
Topt
=
tdp
->
GetTopt
();
Db
=
tdp
->
Schema
;
Db
=
tdp
->
Schema
;
Dsn
=
tdp
->
Uri
;
}
// end of TDBJCL constructor
...
...
storage/connect/tabjson.h
View file @
e3b3e225
...
...
@@ -52,7 +52,7 @@ class JSONDISC : public BLOCK {
// Functions
int
GetColumns
(
PGLOBAL
g
,
PCSZ
db
,
PCSZ
dsn
,
PTOS
topt
);
bool
Find
(
PGLOBAL
g
,
PJVAL
jvp
,
int
j
);
bool
Find
(
PGLOBAL
g
,
PJVAL
jvp
,
PCSZ
key
,
int
j
);
void
AddColumn
(
PGLOBAL
g
);
// Members
...
...
storage/connect/tabxml.cpp
View file @
e3b3e225
This diff is collapsed.
Click to expand it.
storage/connect/tabxml.h
View file @
e3b3e225
...
...
@@ -52,6 +52,7 @@ class DllExport XMLDEF : public TABDEF { /* Logical table description */
bool
Usedom
;
/* True: DOM, False: libxml2 */
bool
Zipped
;
/* True: Zipped XML file(s) */
bool
Mulentries
;
/* True: multiple entries in zip file*/
bool
Skip
;
/* Skip null columns */
};
// end of XMLDEF
#if defined(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