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
d0766449
Commit
d0766449
authored
Jan 20, 2020
by
Oleksandr Byelkin
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'connect/10.2' into 10.2
parents
90d39f2f
8ff3eb41
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
39 additions
and
21 deletions
+39
-21
storage/connect/ha_connect.cc
storage/connect/ha_connect.cc
+5
-1
storage/connect/reldef.cpp
storage/connect/reldef.cpp
+5
-7
storage/connect/restget.cpp
storage/connect/restget.cpp
+2
-0
storage/connect/tabrest.cpp
storage/connect/tabrest.cpp
+24
-12
storage/connect/tabrest.h
storage/connect/tabrest.h
+3
-1
No files found.
storage/connect/ha_connect.cc
View file @
d0766449
...
@@ -2966,10 +2966,12 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, const Item *cond)
...
@@ -2966,10 +2966,12 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, const Item *cond)
case
Item_func
:
:
LE_FUNC
:
vop
=
OP_LE
;
break
;
case
Item_func
:
:
LE_FUNC
:
vop
=
OP_LE
;
break
;
case
Item_func
:
:
GE_FUNC
:
vop
=
OP_GE
;
break
;
case
Item_func
:
:
GE_FUNC
:
vop
=
OP_GE
;
break
;
case
Item_func
:
:
GT_FUNC
:
vop
=
OP_GT
;
break
;
case
Item_func
:
:
GT_FUNC
:
vop
=
OP_GT
;
break
;
#if MYSQL_VERSION_ID > 100200
case
Item_func
:
:
LIKE_FUNC
:
case
Item_func
:
:
LIKE_FUNC
:
vop
=
OP_LIKE
;
vop
=
OP_LIKE
;
neg
=
((
Item_func_like
*
)
condf
)
->
negated
;
neg
=
((
Item_func_like
*
)
condf
)
->
negated
;
break
;
break
;
#endif // VERSION_ID > 100200
case
Item_func
:
:
ISNOTNULL_FUNC
:
case
Item_func
:
:
ISNOTNULL_FUNC
:
neg
=
true
;
neg
=
true
;
// fall through
// fall through
...
@@ -4507,7 +4509,9 @@ bool ha_connect::check_privileges(THD *thd, PTOS options, char *dbn, bool quick)
...
@@ -4507,7 +4509,9 @@ bool ha_connect::check_privileges(THD *thd, PTOS options, char *dbn, bool quick)
case
TAB_OEM
:
case
TAB_OEM
:
if
(
table
&&
table
->
pos_in_table_list
)
// if SELECT
if
(
table
&&
table
->
pos_in_table_list
)
// if SELECT
{
{
Switch_to_definer_security_ctx
backup_ctx
(
thd
,
table
->
pos_in_table_list
);
#if MYSQL_VERSION_ID > 100200
Switch_to_definer_security_ctx
backup_ctx
(
thd
,
table
->
pos_in_table_list
);
#endif // VERSION_ID > 100200
return
check_global_access
(
thd
,
FILE_ACL
);
return
check_global_access
(
thd
,
FILE_ACL
);
}
}
else
else
...
...
storage/connect/reldef.cpp
View file @
d0766449
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
#if defined(__WIN__)
#if defined(__WIN__)
#include <sqlext.h>
#include <sqlext.h>
#else
#else
#include <dlfcn.h> // dlopen(), dlclose(), dlsym() ...
//
#include <dlfcn.h> // dlopen(), dlclose(), dlsym() ...
#include "osutil.h"
#include "osutil.h"
//#include "sqlext.h"
//#include "sqlext.h"
#endif
#endif
...
@@ -324,11 +324,11 @@ RECFM TABDEF::GetTableFormat(const char* type)
...
@@ -324,11 +324,11 @@ RECFM TABDEF::GetTableFormat(const char* type)
{
{
RECFM
recfm
=
Recfm
;
RECFM
recfm
=
Recfm
;
if
(
recfm
==
RECFM_DFLT
)
{
if
(
Catfunc
!=
FNC_NO
)
recfm
=
RECFM_NAF
;
else
if
(
recfm
==
RECFM_DFLT
)
// Default format depends on the table type
// Default format depends on the table type
TABTYPE
tc
=
(
Catfunc
==
FNC_NO
)
?
GetTypeID
(
type
)
:
TAB_PRX
;
switch
(
GetTypeID
(
type
))
{
switch
(
tc
)
{
case
TAB_DOS
:
recfm
=
RECFM_VAR
;
break
;
case
TAB_DOS
:
recfm
=
RECFM_VAR
;
break
;
case
TAB_CSV
:
recfm
=
RECFM_CSV
;
break
;
case
TAB_CSV
:
recfm
=
RECFM_CSV
;
break
;
case
TAB_FMT
:
recfm
=
RECFM_FMT
;
break
;
case
TAB_FMT
:
recfm
=
RECFM_FMT
;
break
;
...
@@ -341,8 +341,6 @@ RECFM TABDEF::GetTableFormat(const char* type)
...
@@ -341,8 +341,6 @@ RECFM TABDEF::GetTableFormat(const char* type)
default:
recfm
=
RECFM_NAF
;
break
;
default:
recfm
=
RECFM_NAF
;
break
;
}
// endswitch type
}
// endswitch type
}
// endif recfm
return
recfm
;
return
recfm
;
}
// end of GetTableFormat
}
// end of GetTableFormat
...
...
storage/connect/restget.cpp
View file @
d0766449
...
@@ -13,6 +13,8 @@ using namespace concurrency::streams; // Asynchronous streams
...
@@ -13,6 +13,8 @@ using namespace concurrency::streams; // Asynchronous streams
typedef
const
char
*
PCSZ
;
typedef
const
char
*
PCSZ
;
extern
"C"
int
restGetFile
(
char
*
m
,
bool
xt
,
PCSZ
http
,
PCSZ
uri
,
PCSZ
fn
);
/***********************************************************************/
/***********************************************************************/
/* Make a local copy of the requested file. */
/* Make a local copy of the requested file. */
/***********************************************************************/
/***********************************************************************/
...
...
storage/connect/tabrest.cpp
View file @
d0766449
/**************
* Rest C++ Program Source Code File (.CPP) **
************/
/**************
tabrest C++ Program Source Code File (.CPP)
************/
/* PROGRAM NAME:
Rest Version 1.6
*/
/* PROGRAM NAME:
tabrest Version 1.7
*/
/* (C) Copyright to the author Olivier BERTRAND 2018 - 2019 */
/* (C) Copyright to the author Olivier BERTRAND 2018 - 2019 */
/* This program is the REST Web API support for MariaDB. */
/* This program is the REST Web API support for MariaDB. */
/* When compiled without MARIADB defined, it is the EOM module code. */
/* When compiled without MARIADB defined, it is the EOM module code. */
...
@@ -9,13 +9,18 @@
...
@@ -9,13 +9,18 @@
/* Definitions needed by the included files. */
/* Definitions needed by the included files. */
/***********************************************************************/
/***********************************************************************/
#if defined(MARIADB)
#if defined(MARIADB)
#include <my_global.h> // All MariaDB stuff
#include <my_global.h>
// All MariaDB stuff
#else // !MARIADB OEM module
#else // !MARIADB OEM module
#include "mini-global.h"
#include "mini-global.h"
#define _MAX_PATH 260
#define _MAX_PATH 260
#if !defined(__WIN__)
#if !defined(REST_SOURCE)
#if defined(__WIN__) || defined(_WINDOWS)
#include <windows.h>
#else // !__WIN__
#define __stdcall
#define __stdcall
#include <dlfcn.h> // dlopen(), dlclose(), dlsym() ...
#endif // !__WIN__
#endif // !__WIN__
#endif // !REST_SOURCE
#define _OS_H_INCLUDED // Prevent os.h to be called
#define _OS_H_INCLUDED // Prevent os.h to be called
#endif // !MARIADB
#endif // !MARIADB
...
@@ -23,7 +28,6 @@
...
@@ -23,7 +28,6 @@
/* Include application header files: */
/* Include application header files: */
/* global.h is header containing all global declarations. */
/* global.h is header containing all global declarations. */
/* plgdbsem.h is header containing the DB application declarations. */
/* plgdbsem.h is header containing the DB application declarations. */
/* (x)table.h is header containing the TDBASE declarations. */
/***********************************************************************/
/***********************************************************************/
#include "global.h"
#include "global.h"
#include "plgdbsem.h"
#include "plgdbsem.h"
...
@@ -31,7 +35,9 @@
...
@@ -31,7 +35,9 @@
#include "filamtxt.h"
#include "filamtxt.h"
#include "tabdos.h"
#include "tabdos.h"
#include "plgxml.h"
#include "plgxml.h"
#if defined(XML_SUPPORT)
#include "tabxml.h"
#include "tabxml.h"
#endif // XML_SUPPORT
#include "tabjson.h"
#include "tabjson.h"
#include "tabfmt.h"
#include "tabfmt.h"
#include "tabrest.h"
#include "tabrest.h"
...
@@ -73,11 +79,11 @@ XGETREST GetRestFunction(PGLOBAL g)
...
@@ -73,11 +79,11 @@ XGETREST GetRestFunction(PGLOBAL g)
if
(
getRestFnc
)
if
(
getRestFnc
)
return
getRestFnc
;
return
getRestFnc
;
#if !defined(REST_SOURCE)
#if !defined(
MARIADB) || !defined(
REST_SOURCE)
if
(
trace
(
515
))
if
(
trace
(
515
))
htrc
(
"Looking for GetRest library
\n
"
);
htrc
(
"Looking for GetRest library
\n
"
);
#if defined(__WIN__)
#if defined(__WIN__)
|| defined(_WINDOWS)
HANDLE
Hdll
;
HANDLE
Hdll
;
const
char
*
soname
=
"GetRest.dll"
;
// Module name
const
char
*
soname
=
"GetRest.dll"
;
// Module name
...
@@ -167,13 +173,15 @@ PQRYRES __stdcall ColREST(PGLOBAL g, PTOS tp, char *tab, char *db, bool info)
...
@@ -167,13 +173,15 @@ PQRYRES __stdcall ColREST(PGLOBAL g, PTOS tp, char *tab, char *db, bool info)
// Retrieve the file from the web and copy it locally
// Retrieve the file from the web and copy it locally
if
(
http
&&
grf
(
g
->
Message
,
trace
(
515
),
http
,
uri
,
filename
))
{
if
(
http
&&
grf
(
g
->
Message
,
trace
(
515
),
http
,
uri
,
filename
))
{
// sprintf(g->Message, "Failed to get file at %s", http);
// sprintf(g->Message, "Failed to get file at %s", http);
}
else
if
(
!
stricmp
(
ftype
,
"XML"
))
}
else
if
(
!
stricmp
(
ftype
,
"JSON"
))
qrp
=
XMLColumns
(
g
,
db
,
tab
,
tp
,
info
);
else
if
(
!
stricmp
(
ftype
,
"JSON"
))
qrp
=
JSONColumns
(
g
,
db
,
NULL
,
tp
,
info
);
qrp
=
JSONColumns
(
g
,
db
,
NULL
,
tp
,
info
);
else
if
(
!
stricmp
(
ftype
,
"CSV"
))
else
if
(
!
stricmp
(
ftype
,
"CSV"
))
qrp
=
CSVColumns
(
g
,
NULL
,
tp
,
info
);
qrp
=
CSVColumns
(
g
,
NULL
,
tp
,
info
);
else
#if defined(XML_SUPPORT)
else
if
(
!
stricmp
(
ftype
,
"XML"
))
qrp
=
XMLColumns
(
g
,
db
,
tab
,
tp
,
info
);
#endif // XML_SUPPORT
else
sprintf
(
g
->
Message
,
"Usupported file type %s"
,
ftype
);
sprintf
(
g
->
Message
,
"Usupported file type %s"
,
ftype
);
return
qrp
;
return
qrp
;
...
@@ -206,7 +214,9 @@ bool RESTDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
...
@@ -206,7 +214,9 @@ bool RESTDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
htrc
(
"ftype = %s am = %s
\n
"
,
ftype
,
SVP
(
am
));
htrc
(
"ftype = %s am = %s
\n
"
,
ftype
,
SVP
(
am
));
n
=
(
!
stricmp
(
ftype
,
"JSON"
))
?
1
n
=
(
!
stricmp
(
ftype
,
"JSON"
))
?
1
#if defined(XML_SUPPORT)
:
(
!
stricmp
(
ftype
,
"XML"
))
?
2
:
(
!
stricmp
(
ftype
,
"XML"
))
?
2
#endif // XML_SUPPORT
:
(
!
stricmp
(
ftype
,
"CSV"
))
?
3
:
0
;
:
(
!
stricmp
(
ftype
,
"CSV"
))
?
3
:
0
;
if
(
n
==
0
)
{
if
(
n
==
0
)
{
...
@@ -234,7 +244,9 @@ bool RESTDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
...
@@ -234,7 +244,9 @@ bool RESTDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
return
true
;
return
true
;
else
switch
(
n
)
{
else
switch
(
n
)
{
case
1
:
Tdp
=
new
(
g
)
JSONDEF
;
break
;
case
1
:
Tdp
=
new
(
g
)
JSONDEF
;
break
;
case
2
:
Tdp
=
new
(
g
)
XMLDEF
;
break
;
#if defined(XML_SUPPORT)
case
2
:
Tdp
=
new
(
g
)
XMLDEF
;
break
;
#endif // XML_SUPPORT
case
3
:
Tdp
=
new
(
g
)
CSVDEF
;
break
;
case
3
:
Tdp
=
new
(
g
)
CSVDEF
;
break
;
default:
Tdp
=
NULL
;
default:
Tdp
=
NULL
;
}
// endswitch n
}
// endswitch n
...
...
storage/connect/tabrest.h
View file @
d0766449
...
@@ -18,7 +18,9 @@ typedef int(__stdcall* XGETREST) (char*, bool, PCSZ, PCSZ, PCSZ);
...
@@ -18,7 +18,9 @@ typedef int(__stdcall* XGETREST) (char*, bool, PCSZ, PCSZ, PCSZ);
/* Functions used by REST. */
/* Functions used by REST. */
/***********************************************************************/
/***********************************************************************/
XGETREST
GetRestFunction
(
PGLOBAL
g
);
XGETREST
GetRestFunction
(
PGLOBAL
g
);
int
restGetFile
(
char
*
m
,
bool
x
,
PCSZ
http
,
PCSZ
uri
,
PCSZ
fn
);
#if defined(REST_SOURCE)
extern
"C"
int
restGetFile
(
char
*
m
,
bool
xt
,
PCSZ
http
,
PCSZ
uri
,
PCSZ
fn
);
#endif // REST_SOURCE
#if defined(MARIADB)
#if defined(MARIADB)
PQRYRES
RESTColumns
(
PGLOBAL
g
,
PTOS
tp
,
char
*
tab
,
char
*
db
,
bool
info
);
PQRYRES
RESTColumns
(
PGLOBAL
g
,
PTOS
tp
,
char
*
tab
,
char
*
db
,
bool
info
);
#endif // !MARIADB
#endif // !MARIADB
...
...
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