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
000268d4
Commit
000268d4
authored
Nov 19, 2020
by
Olivier Bertrand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix some json discovery problems. Modified tabjson.cpp tabjson.h
parent
da10bf2d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
7 deletions
+27
-7
storage/connect/tabjson.cpp
storage/connect/tabjson.cpp
+26
-6
storage/connect/tabjson.h
storage/connect/tabjson.h
+1
-1
No files found.
storage/connect/tabjson.cpp
View file @
000268d4
...
...
@@ -159,7 +159,7 @@ JSONDISC::JSONDISC(PGLOBAL g, uint *lg)
jsp
=
NULL
;
row
=
NULL
;
sep
=
NULL
;
i
=
n
=
bf
=
ncol
=
lvl
=
sz
=
0
;
i
=
n
=
bf
=
ncol
=
lvl
=
sz
=
limit
=
0
;
all
=
strfy
=
false
;
}
// end of JSONDISC constructor
...
...
@@ -172,7 +172,8 @@ int JSONDISC::GetColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt)
lvl
=
GetIntegerTableOption
(
g
,
topt
,
"Depth"
,
lvl
);
sep
=
GetStringTableOption
(
g
,
topt
,
"Separator"
,
"."
);
sz
=
GetIntegerTableOption
(
g
,
topt
,
"Jsize"
,
1024
);
strfy
=
GetBooleanTableOption
(
g
,
topt
,
"Stringify"
,
false
);
limit
=
GetIntegerTableOption
(
g
,
topt
,
"Limit"
,
10
);
strfy
=
GetBooleanTableOption
(
g
,
topt
,
"Stringify"
,
false
);
/*********************************************************************/
/* Open the input file. */
...
...
@@ -458,7 +459,7 @@ bool JSONDISC::Find(PGLOBAL g, PJVAL jvp, PCSZ key, int j)
jar
=
(
PJAR
)
jsp
;
if
(
all
||
(
tdp
->
Xcol
&&
!
stricmp
(
tdp
->
Xcol
,
key
)))
ars
=
jar
->
GetSize
(
false
);
ars
=
MY_MIN
(
jar
->
GetSize
(
false
),
limit
);
else
ars
=
MY_MIN
(
jar
->
GetSize
(
false
),
1
);
...
...
@@ -527,10 +528,29 @@ void JSONDISC::AddColumn(PGLOBAL g)
if
(
jcp
)
{
if
(
jcp
->
Type
!=
jcol
.
Type
)
{
if
(
jcp
->
Type
==
TYPE_UNKNOWN
)
if
(
jcp
->
Type
==
TYPE_UNKNOWN
||
jcol
.
Type
==
TYPE_VOID
)
jcp
->
Type
=
jcol
.
Type
;
else
if
(
jcol
.
Type
!=
TYPE_UNKNOWN
&&
jcol
.
Type
!=
TYPE_VOID
)
jcp
->
Type
=
TYPE_STRING
;
// else if (jcol.Type != TYPE_UNKNOWN && jcol.Type != TYPE_VOID)
// jcp->Type = TYPE_STRING;
else
if
(
jcp
->
Type
!=
TYPE_STRING
)
switch
(
jcol
.
Type
)
{
case
TYPE_STRING
:
case
TYPE_DOUBLE
:
jcp
->
Type
=
jcol
.
Type
;
break
;
case
TYPE_BIGINT
:
if
(
jcp
->
Type
==
TYPE_INT
||
jcp
->
Type
==
TYPE_TINY
)
jcp
->
Type
=
jcol
.
Type
;
break
;
case
TYPE_INT
:
if
(
jcp
->
Type
==
TYPE_TINY
)
jcp
->
Type
=
jcol
.
Type
;
break
;
default:
break
;
}
// endswith Type
}
// endif Type
...
...
storage/connect/tabjson.h
View file @
000268d4
...
...
@@ -68,7 +68,7 @@ class JSONDISC : public BLOCK {
PCSZ
sep
;
char
colname
[
65
],
fmt
[
129
],
buf
[
16
];
uint
*
length
;
int
i
,
n
,
bf
,
ncol
,
lvl
,
sz
;
int
i
,
n
,
bf
,
ncol
,
lvl
,
sz
,
limit
;
bool
all
,
strfy
;
};
// end of JSONDISC
...
...
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