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
a7867410
Commit
a7867410
authored
Dec 17, 2020
by
Olivier Bertrand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Fix crash with JsonContains UDF + BSON development
parent
ceacffbb
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
25 deletions
+17
-25
storage/connect/bson.cpp
storage/connect/bson.cpp
+1
-1
storage/connect/jsonudf.cpp
storage/connect/jsonudf.cpp
+7
-14
storage/connect/jsonudf.h
storage/connect/jsonudf.h
+3
-3
storage/connect/tabbson.cpp
storage/connect/tabbson.cpp
+6
-7
No files found.
storage/connect/bson.cpp
View file @
a7867410
...
...
@@ -27,7 +27,7 @@
#if defined(_DEBUG)
#define CheckType(X,Y) if (!X || X ->Type != Y) throw MSG(VALTYPE_NOMATCH);
#else
#define CheckType(
V
)
#define CheckType(
X,Y
)
#endif
#if defined(__WIN__)
...
...
storage/connect/jsonudf.cpp
View file @
a7867410
...
...
@@ -4066,17 +4066,14 @@ my_bool jsoncontains_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
return
JsonInit
(
initid
,
args
,
message
,
false
,
reslen
,
memlen
,
more
);
}
// end of jsoncontains_init
long
long
jsoncontains
(
UDF_INIT
*
initid
,
UDF_ARGS
*
args
,
char
*
result
,
unsigned
long
*
res_length
,
char
*
is_null
,
char
*
error
)
long
long
jsoncontains
(
UDF_INIT
*
initid
,
UDF_ARGS
*
args
,
char
*
,
char
*
error
)
{
char
*
p
__attribute__
((
unused
)),
res
[
256
];
long
long
n
;
char
isn
,
res
[
256
];
unsigned
long
reslen
;
*
is_null
=
0
;
p
=
jsonlocate
(
initid
,
args
,
res
,
&
reslen
,
is_null
,
error
);
n
=
(
*
is_null
)
?
0LL
:
1LL
;
return
n
;
isn
=
0
;
jsonlocate
(
initid
,
args
,
res
,
&
reslen
,
&
isn
,
error
);
return
(
isn
)
?
0LL
:
1LL
;
}
// end of jsoncontains
void
jsoncontains_deinit
(
UDF_INIT
*
initid
)
...
...
@@ -4118,8 +4115,7 @@ my_bool jsoncontains_path_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
return
JsonInit
(
initid
,
args
,
message
,
true
,
reslen
,
memlen
,
more
);
}
// end of jsoncontains_path_init
long
long
jsoncontains_path
(
UDF_INIT
*
initid
,
UDF_ARGS
*
args
,
char
*
result
,
unsigned
long
*
res_length
,
char
*
is_null
,
char
*
error
)
long
long
jsoncontains_path
(
UDF_INIT
*
initid
,
UDF_ARGS
*
args
,
char
*
,
char
*
error
)
{
char
*
p
,
*
path
;
long
long
n
;
...
...
@@ -4130,7 +4126,6 @@ long long jsoncontains_path(UDF_INIT *initid, UDF_ARGS *args, char *result,
if
(
g
->
N
)
{
if
(
!
g
->
Activityp
)
{
*
is_null
=
1
;
return
0LL
;
}
else
return
*
(
long
long
*
)
g
->
Activityp
;
...
...
@@ -4188,7 +4183,6 @@ long long jsoncontains_path(UDF_INIT *initid, UDF_ARGS *args, char *result,
err:
if
(
g
->
Mrr
)
*
error
=
1
;
*
is_null
=
1
;
return
0LL
;
}
// end of jsoncontains_path
...
...
@@ -6528,8 +6522,7 @@ my_bool countin_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
return
false
;
}
// end of countin_init
long
long
countin
(
UDF_INIT
*
initid
,
UDF_ARGS
*
args
,
char
*
result
,
unsigned
long
*
res_length
,
char
*
is_null
,
char
*
)
long
long
countin
(
UDF_INIT
*
initid
,
UDF_ARGS
*
args
,
char
*
is_null
,
char
*
)
{
PSZ
str1
,
str2
;
char
*
s
;
...
...
storage/connect/jsonudf.h
View file @
a7867410
...
...
@@ -174,7 +174,7 @@ extern "C" {
DllExport
void
jsonget_real_deinit
(
UDF_INIT
*
);
DllExport
my_bool
jsoncontains_init
(
UDF_INIT
*
,
UDF_ARGS
*
,
char
*
);
DllExport
long
long
jsoncontains
(
UDF_
EXEC_ARGS
);
DllExport
long
long
jsoncontains
(
UDF_
INIT
*
,
UDF_ARGS
*
,
char
*
,
char
*
);
DllExport
void
jsoncontains_deinit
(
UDF_INIT
*
);
DllExport
my_bool
jsonlocate_init
(
UDF_INIT
*
,
UDF_ARGS
*
,
char
*
);
...
...
@@ -186,7 +186,7 @@ extern "C" {
DllExport
void
json_locate_all_deinit
(
UDF_INIT
*
);
DllExport
my_bool
jsoncontains_path_init
(
UDF_INIT
*
,
UDF_ARGS
*
,
char
*
);
DllExport
long
long
jsoncontains_path
(
UDF_
EXEC_ARGS
);
DllExport
long
long
jsoncontains_path
(
UDF_
INIT
*
,
UDF_ARGS
*
,
char
*
,
char
*
);
DllExport
void
jsoncontains_path_deinit
(
UDF_INIT
*
);
DllExport
my_bool
json_set_item_init
(
UDF_INIT
*
,
UDF_ARGS
*
,
char
*
);
...
...
@@ -294,7 +294,7 @@ extern "C" {
#endif // DEVELOPMENT
DllExport
my_bool
countin_init
(
UDF_INIT
*
,
UDF_ARGS
*
,
char
*
);
DllExport
long
long
countin
(
UDF_
EXEC_ARGS
);
DllExport
long
long
countin
(
UDF_
INIT
*
,
UDF_ARGS
*
,
char
*
,
char
*
);
}
// extern "C"
...
...
storage/connect/tabbson.cpp
View file @
a7867410
...
...
@@ -1161,18 +1161,19 @@ PTDB BSONDEF::GetTable(PGLOBAL g, MODE m)
USETEMP
tmp
=
UseTemp
();
bool
map
=
Mapped
&&
Pretty
>=
0
&&
m
!=
MODE_INSERT
&&
!
(
tmp
!=
TMP_NO
&&
m
==
MODE_UPDATE
)
&&
!
(
tmp
==
TMP_FORCE
&&
(
m
==
MODE_UPDATE
||
m
==
MODE_DELETE
));
!
(
tmp
==
TMP_FORCE
&&
(
m
==
MODE_UPDATE
||
m
==
MODE_DELETE
));
if
(
Lrecl
)
{
// Allocate the parse work memory
G
=
PlugInit
(
NULL
,
(
size_t
)
Lrecl
*
4
);
G
=
PlugInit
(
NULL
,
(
size_t
)
Lrecl
*
(
Pretty
<
0
?
2
:
4
)
);
}
else
{
strcpy
(
g
->
Message
,
"LRECL is not defined"
);
return
NULL
;
}
// endif Lrecl
if
(
Uri
)
{
if
(
Pretty
<
0
)
{
// BJsonfile
txfp
=
new
(
g
)
BINFAM
(
this
);
}
else
if
(
Uri
)
{
if
(
Driver
&&
toupper
(
*
Driver
)
==
'C'
)
{
#if defined(CMGO_SUPPORT)
txfp
=
new
(
g
)
CMGFAM
(
this
);
...
...
@@ -1222,10 +1223,8 @@ PTDB BSONDEF::GetTable(PGLOBAL g, MODE m)
sprintf
(
g
->
Message
,
MSG
(
NO_FEAT_SUPPORT
),
"GZ"
);
return
NULL
;
#endif // !GZ_SUPPORT
}
else
if
(
map
)
}
else
if
(
map
)
{
txfp
=
new
(
g
)
MAPFAM
(
this
);
else
if
(
Pretty
<
0
)
{
// BJsonfile
txfp
=
new
(
g
)
BINFAM
(
this
);
}
else
txfp
=
new
(
g
)
DOSFAM
(
this
);
...
...
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