Skip to content

Commit

Permalink
- Add a define making ha_connect.cc source unique for all MariaDB ver…
Browse files Browse the repository at this point in the history
…sion.

#if defined(NEW_MAR)
#define stored_in_db stored_in_db()
#endif   // NEW_MAR)
  modified:   storage/connect/CMakeLists.txt
  modified:   storage/connect/ha_connect.cc

- Fix compile failure for some configuration of CONNECT.
This by updating the #ifdef's JDBC, MONGO and CMGO_SUPPORT.
  modified:   storage/connect/ha_connect.cc
  modified:   storage/connect/tabjson.cpp
  modified:   storage/connect/tabjson.h

- Fix failure of zip.test (restore code wrongly deleted)
  modified:   storage/connect/tabjson.cpp

- Make sure thread TBL table structure is correctly initialized.
  modified:   storage/connect/tabtbl.cpp

- Add new test case in tbl_thread.test
  modified:   storage/connect/mysql-test/connect/r/tbl_thread.result
  modified:   storage/connect/mysql-test/connect/t/tbl_thread.test

- Remake a jar file after Java was updated
  modified:   storage/connect/mysql-test/connect/std_data/Mongo3.jar
  • Loading branch information
Buggynours committed Aug 6, 2017
1 parent d8f99f1 commit 0387c13
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 15 deletions.
2 changes: 1 addition & 1 deletion storage/connect/CMakeLists.txt
Expand Up @@ -38,7 +38,7 @@ user_connect.h valblk.h value.h xindex.h xobject.h xtable.h)
# Definitions that are shared for all OSes
#
add_definitions( -DMARIADB -DFORCE_INIT_OF_VARS -Dconnect_EXPORTS)
add_definitions( -DHUGE_SUPPORT -DGZ_SUPPORT -DPIVOT_SUPPORT )
add_definitions( -DNEW_MAR -DHUGE_SUPPORT -DGZ_SUPPORT -DPIVOT_SUPPORT )


#
Expand Down
17 changes: 10 additions & 7 deletions storage/connect/ha_connect.cc
Expand Up @@ -180,6 +180,10 @@ extern "C" {
#endif // !__WIN__
} // extern "C"

#if defined(NEW_MAR)
#define stored_in_db stored_in_db()
#endif // NEW_MAR)

#if defined(XMAP)
my_bool xmap= false;
#endif // XMAP
Expand Down Expand Up @@ -1559,7 +1563,7 @@ void *ha_connect::GetColumnOption(PGLOBAL g, void *field, PCOLINFO pcf)
pcf->Flags |= U_NULLS;

// Mark virtual columns as such
if (fp->vcol_info && !fp->stored_in_db())
if (fp->vcol_info && !fp->stored_in_db)
pcf->Flags |= U_VIRTUAL;

pcf->Key= 0; // Not used when called from MySQL
Expand Down Expand Up @@ -2055,7 +2059,7 @@ int ha_connect::MakeRecord(char *buf)
for (field= table->field; *field && !rc; field++) {
fp= *field;

if (fp->vcol_info && !fp->stored_in_db())
if (fp->vcol_info && !fp->stored_in_db)
continue; // This is a virtual column

if (bitmap_is_set(map, fp->field_index) || alter) {
Expand Down Expand Up @@ -2176,7 +2180,7 @@ int ha_connect::ScanRecord(PGLOBAL g, uchar *)
for (Field **field=table->field ; *field ; field++) {
fp= *field;

if ((fp->vcol_info && !fp->stored_in_db()) ||
if ((fp->vcol_info && !fp->stored_in_db) ||
fp->option_struct->special)
continue; // Is a virtual column possible here ???

Expand Down Expand Up @@ -5359,14 +5363,13 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
bool cnc= false;
int cto= -1, qto= -1;
#endif // ODBC_SUPPORT
#if defined(JDBC_SUPPORT) || defined(MONGO_SUPPORT)
#if defined(JDBC_SUPPORT)
PJPARM sjp= NULL;
#endif // JDBC_SUPPORT
#if defined(MONGO_SUPPORT)
PCSZ driver= NULL;
char *url= NULL;
//char *prop= NULL;
#endif // MONGO_SUPPORT
#endif // JDBC_SUPPORT || MONGO_SUPPORT
uint tm, fnc= FNC_NO, supfnc= (FNC_NO | FNC_COL);
bool bif, ok= false, dbf= false;
TABTYPE ttp= TAB_UNDEF;
Expand Down Expand Up @@ -6339,7 +6342,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
for (field= table_arg->field; *field; field++) {
fp= *field;

if (fp->vcol_info && !fp->stored_in_db())
if (fp->vcol_info && !fp->stored_in_db)
continue; // This is a virtual column

if (fp->flags & AUTO_INCREMENT_FLAG) {
Expand Down
19 changes: 18 additions & 1 deletion storage/connect/mysql-test/connect/r/tbl_thread.result
Expand Up @@ -75,7 +75,7 @@ DROP TABLE rt3;
connection default;
DROP TABLE t1,t2,t3,total;
#
# Old thread TBL tables test
# Old thread TBL tables test modified
#
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL SRCDEF='select 11 as v' OPTION_LIST='port=MASTER_PORT';
SELECT * FROM t1;
Expand All @@ -90,6 +90,23 @@ SELECT * FROM total order by v desc;
v
22
11
DROP TABLE t1,t2,total;
#
# Old thread TBL tables test not modified
#
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL SRCDEF='select 11 as v';
SELECT * FROM t1;
v
11
CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL SRCDEF='select 22 as v';
SELECT * FROM t2;
v
22
CREATE TABLE total (v BIGINT(20) UNSIGNED NOT NULL) ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2' OPTION_LIST='thread=yes,port=PORT';;
SELECT * FROM total order by v desc;
v
22
11
DROP TABLE total;
DROP TABLE t1;
DROP TABLE t2;
Expand Down
Binary file modified storage/connect/mysql-test/connect/std_data/Mongo3.jar
Binary file not shown.
16 changes: 15 additions & 1 deletion storage/connect/mysql-test/connect/t/tbl_thread.test
Expand Up @@ -54,7 +54,7 @@ connection default;
DROP TABLE t1,t2,t3,total;

--echo #
--echo # Old thread TBL tables test
--echo # Old thread TBL tables test modified
--echo #
--replace_result $MASTER_MYPORT MASTER_PORT
--eval CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL SRCDEF='select 11 as v' OPTION_LIST='port=$MASTER_MYPORT'
Expand All @@ -64,6 +64,20 @@ SELECT * FROM t1;
--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL SRCDEF='select 22 as v' OPTION_LIST='port=$SLAVE_MYPORT'
SELECT * FROM t2;

--replace_result $PORT PORT
--eval CREATE TABLE total (v BIGINT(20) UNSIGNED NOT NULL) ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2' OPTION_LIST='thread=yes,port=$PORT';
SELECT * FROM total order by v desc;
DROP TABLE t1,t2,total;

--echo #
--echo # Old thread TBL tables test not modified
--echo #
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL SRCDEF='select 11 as v';
SELECT * FROM t1;

CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL SRCDEF='select 22 as v';
SELECT * FROM t2;

--replace_result $PORT PORT
--eval CREATE TABLE total (v BIGINT(20) UNSIGNED NOT NULL) ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2' OPTION_LIST='thread=yes,port=$PORT';
SELECT * FROM total order by v desc;
Expand Down
8 changes: 5 additions & 3 deletions storage/connect/tabjson.cpp
Expand Up @@ -31,11 +31,13 @@
#if defined(ZIP_SUPPORT)
#include "filamzip.h"
#endif // ZIP_SUPPORT
#if defined(MONGO_SUPPORT)
#if defined(JDBC_SUPPORT)
#include "jmgfam.h"
#endif // JDBC_SUPPORT
#if defined(CMGO_SUPPORT)
#include "cmgfam.h"
#endif // CMGO_SUPPORT
#endif // MONGO_SUPPORT
#include "tabmul.h"
#include "checklvl.h"
Expand Down Expand Up @@ -129,8 +131,8 @@ PQRYRES JSONColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt, bool info)
#endif // ZIP_SUPPORT
tdp->Fn = GetStringTableOption(g, topt, "Filename", NULL);

//if (!(tdp->Database = SetPath(g, db)))
// return NULL;
if (!(tdp->Database = SetPath(g, db)))
return NULL;

tdp->Objname = GetStringTableOption(g, topt, "Object", NULL);
tdp->Base = GetIntegerTableOption(g, topt, "Base", 0) ? 1 : 0;
Expand Down Expand Up @@ -502,10 +504,10 @@ JSONDEF::JSONDEF(void)
Pipe = false;
Driver = NULL;
Version = 0;
#endif // MONGO_SUPPORT
#if defined(JDBC_SUPPORT)
Wrapname = NULL;
#endif // JDBC_SUPPORT
#endif // MONGO_SUPPORT
} // end of JSONDEF constructor

/***********************************************************************/
Expand Down
10 changes: 8 additions & 2 deletions storage/connect/tabjson.h
Expand Up @@ -37,7 +37,9 @@ class DllExport JSONDEF : public DOSDEF { /* Table description */
friend class TDBJSN;
friend class TDBJCL;
#if defined(MONGO_SUPPORT)
#if defined(CMGO_SUPPORT)
friend class CMGFAM;
#endif // CMGO_SUPPORT
#if defined(JDBC_SUPPORT)
friend class JMGFAM;
#endif // JDBC_SUPPORT
Expand Down Expand Up @@ -90,7 +92,9 @@ class DllExport TDBJSN : public TDBDOS {
friend class JSONCOL;
friend class JSONDEF;
#if defined(MONGO_SUPPORT)
#if defined(CMGO_SUPPORT)
friend class CMGFAM;
#endif // CMGO_SUPPORT
#if defined(JDBC_SUPPORT)
friend class JMGFAM;
#endif // JDBC_SUPPORT
Expand Down Expand Up @@ -159,11 +163,13 @@ class DllExport TDBJSN : public TDBDOS {
class DllExport JSONCOL : public DOSCOL {
friend class TDBJSN;
friend class TDBJSON;
#if defined(MONGO_SUPPORT)
#if defined(CMGO_SUPPORT)
friend class CMGFAM;
#endif // CMGO_SUPPORT
#if defined(JDBC_SUPPORT)
friend class JMGFAM;
#endif // JDBC_SUPPORT
#if defined(MONGO_SUPPORT)
friend class CMGFAM;
#endif // MONGO_SUPPORT
public:
// Constructors
Expand Down
1 change: 1 addition & 0 deletions storage/connect/tabtbl.cpp
Expand Up @@ -652,6 +652,7 @@ bool TDBTBM::OpenTables(PGLOBAL g)
tp = (PTBMT)PlugSubAlloc(g, NULL, sizeof(TBMT));
memset(tp, 0, sizeof(TBMT));
tp->G = g;
tp->Ready = false;
tp->Tap = tabp;
tp->Thd = thd;

Expand Down

0 comments on commit 0387c13

Please sign in to comment.