Skip to content

Commit 425437b

Browse files
committed
Merge remote-tracking branch 'connect/10.2' into 10.2
2 parents f8b5e14 + f0da39b commit 425437b

27 files changed

+529
-348
lines changed

storage/connect/CMakeLists.txt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,9 @@ ENDIF(CONNECT_WITH_MONGO)
318318
OPTION(CONNECT_WITH_REST "Compile CONNECT storage engine with REST support" ON)
319319

320320
IF(CONNECT_WITH_REST)
321+
MESSAGE(STATUS "=====> REST support is ON")
322+
SET(CONNECT_SOURCES ${CONNECT_SOURCES} tabrest.cpp tabrest.h)
323+
add_definitions(-DREST_SUPPORT)
321324
FIND_PACKAGE(cpprestsdk QUIET)
322325
IF (cpprestsdk_FOUND)
323326
IF(UNIX)
@@ -331,10 +334,10 @@ IF(CONNECT_WITH_REST)
331334
# Comment it out if not needed depending on your cpprestsdk installation.
332335
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd")
333336
ENDIF(UNIX)
334-
IF(REST_LIBRARY)
335-
SET(CONNECT_SOURCES ${CONNECT_SOURCES} tabrest.cpp restget.cpp tabrest.h)
336-
add_definitions(-DREST_SUPPORT)
337-
ENDIF()
337+
# IF(REST_LIBRARY) why this? how about Windows
338+
SET(CONNECT_SOURCES ${CONNECT_SOURCES} restget.cpp)
339+
add_definitions(-DREST_SOURCE)
340+
# ENDIF()
338341
ELSE(NOT cpprestsdk_FOUND)
339342
# MESSAGE(STATUS "=====> cpprestsdk package not found")
340343
ENDIF (cpprestsdk_FOUND)

storage/connect/connect.cc

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ int CntCloseTable(PGLOBAL g, PTDB tdbp, bool nox, bool abort)
566566
rc = tdbp->DeleteDB(g, RC_EF); // Specific A.M. delete routine
567567

568568
} else if (tdbp->GetMode() == MODE_UPDATE && tdbp->IsIndexed())
569-
rc = ((PTDBDOX)tdbp)->Txfp->UpdateSortedRows(g);
569+
rc = ((PTDBDOS)tdbp)->GetTxfp()->UpdateSortedRows(g);
570570

571571
switch (rc) {
572572
case RC_FX:
@@ -593,7 +593,7 @@ int CntCloseTable(PGLOBAL g, PTDB tdbp, bool nox, bool abort)
593593

594594
if (!tdbp->IsRemote()) {
595595
// Make all the eventual indexes
596-
PTDBDOX tbxp = (PTDBDOX)tdbp;
596+
PTDBDOS tbxp = (PTDBDOS)tdbp;
597597
tbxp->ResetKindex(g, NULL);
598598
tbxp->SetKey_Col(NULL);
599599
rc = tbxp->ResetTableOpt(g, true, tbxp->GetDef()->Indexable() == 1);
@@ -622,8 +622,8 @@ int CntCloseTable(PGLOBAL g, PTDB tdbp, bool nox, bool abort)
622622
int CntIndexInit(PGLOBAL g, PTDB ptdb, int id, bool sorted)
623623
{
624624
PIXDEF xdp;
625-
PTDBDOX tdbp;
626-
DOXDEF *dfp;
625+
PTDBDOS tdbp;
626+
DOSDEF *dfp;
627627

628628
if (!ptdb)
629629
return -1;
@@ -633,9 +633,9 @@ int CntIndexInit(PGLOBAL g, PTDB ptdb, int id, bool sorted)
633633
} else if (ptdb->GetDef()->Indexable() == 3) {
634634
return 1;
635635
} else
636-
tdbp= (PTDBDOX)ptdb;
636+
tdbp= (PTDBDOS)ptdb;
637637

638-
dfp= (DOXDEF*)tdbp->To_Def;
638+
dfp= (DOSDEF*)tdbp->GetDef();
639639

640640
//if (!(k= colp->GetKey()))
641641
// if (colp->GetOpt() >= 2) {
@@ -645,16 +645,16 @@ int CntIndexInit(PGLOBAL g, PTDB ptdb, int id, bool sorted)
645645
// This is a pseudo indexed sorted block optimized column
646646
// return 0;
647647

648-
if (tdbp->To_Kindex)
649-
if (((XXBASE*)tdbp->To_Kindex)->GetID() == id) {
650-
tdbp->To_Kindex->Reset(); // Same index
651-
return (tdbp->To_Kindex->IsMul()) ? 2 : 1;
648+
if (tdbp->GetKindex())
649+
if (((XXBASE*)tdbp->GetKindex())->GetID() == id) {
650+
tdbp->GetKindex()->Reset(); // Same index
651+
return (tdbp->GetKindex()->IsMul()) ? 2 : 1;
652652
} else {
653-
tdbp->To_Kindex->Close();
654-
tdbp->To_Kindex= NULL;
653+
tdbp->GetKindex()->Close();
654+
tdbp->SetKindex(NULL);
655655
} // endif colp
656656

657-
for (xdp= dfp->To_Indx; xdp; xdp= xdp->GetNext())
657+
for (xdp= dfp->GetIndx(); xdp; xdp= xdp->GetNext())
658658
if (xdp->GetID() == id)
659659
break;
660660

@@ -676,7 +676,7 @@ int CntIndexInit(PGLOBAL g, PTDB ptdb, int id, bool sorted)
676676
if (tdbp->InitialyzeIndex(g, xdp, sorted))
677677
return 0;
678678

679-
return (tdbp->To_Kindex->IsMul()) ? 2 : 1;
679+
return (tdbp->GetKindex()->IsMul()) ? 2 : 1;
680680
} // end of CntIndexInit
681681

682682
#if defined(WORDS_BIGENDIAN)
@@ -710,7 +710,7 @@ RCODE CntIndexRead(PGLOBAL g, PTDB ptdb, OPVAL op,
710710
int n, x;
711711
RCODE rc;
712712
XXBASE *xbp;
713-
PTDBDOX tdbp;
713+
PTDBDOS tdbp;
714714

715715
if (!ptdb)
716716
return RC_FX;
@@ -736,12 +736,12 @@ RCODE CntIndexRead(PGLOBAL g, PTDB ptdb, OPVAL op,
736736

737737
goto rnd;
738738
} else
739-
tdbp= (PTDBDOX)ptdb;
739+
tdbp= (PTDBDOS)ptdb;
740740

741741
// Set reference values and index operator
742-
if (!tdbp->To_Link || !tdbp->To_Kindex) {
742+
if (!tdbp->GetLink() || !tdbp->GetKindex()) {
743743
// if (!tdbp->To_Xdp) {
744-
sprintf(g->Message, "Index not initialized for table %s", tdbp->Name);
744+
sprintf(g->Message, "Index not initialized for table %s", tdbp->GetName());
745745
return RC_FX;
746746
#if 0
747747
} // endif !To_Xdp
@@ -754,7 +754,7 @@ RCODE CntIndexRead(PGLOBAL g, PTDB ptdb, OPVAL op,
754754
#endif // 0
755755
} // endif !To_Kindex
756756

757-
xbp= (XXBASE*)tdbp->To_Kindex;
757+
xbp= (XXBASE*)tdbp->GetKindex();
758758

759759
if (kr) {
760760
char *kp= (char*)kr->key;
@@ -764,13 +764,13 @@ RCODE CntIndexRead(PGLOBAL g, PTDB ptdb, OPVAL op,
764764
PVAL valp;
765765
PCOL colp;
766766

767-
for (n= 0; n < tdbp->Knum; n++) {
768-
colp= (PCOL)tdbp->To_Key_Col[n];
767+
for (n= 0; n < tdbp->GetKnum(); n++) {
768+
colp= (PCOL)tdbp->Key(n);
769769

770770
if (colp->GetColUse(U_NULLS))
771771
kp++; // Skip null byte
772772

773-
valp= tdbp->To_Link[n]->GetValue();
773+
valp= tdbp->Link(n)->GetValue();
774774

775775
if (!valp->IsTypeNum()) {
776776
if (colp->GetColUse(U_VAR)) {
@@ -840,7 +840,7 @@ int CntIndexRange(PGLOBAL g, PTDB ptdb, const uchar* *key, uint *len,
840840
bool b, rcb;
841841
PVAL valp;
842842
PCOL colp;
843-
PTDBDOX tdbp;
843+
PTDBDOS tdbp;
844844
XXBASE *xbp;
845845

846846
if (!ptdb)
@@ -865,35 +865,35 @@ int CntIndexRange(PGLOBAL g, PTDB ptdb, const uchar* *key, uint *len,
865865

866866
return k[1] - k[0] + 1;
867867
} else
868-
tdbp= (PTDBDOX)ptdb;
868+
tdbp= (PTDBDOS)ptdb;
869869

870-
if (!tdbp->To_Kindex || !tdbp->To_Link) {
871-
if (!tdbp->To_Xdp) {
872-
sprintf(g->Message, "Index not initialized for table %s", tdbp->Name);
870+
if (!tdbp->GetKindex() || !tdbp->GetLink()) {
871+
if (!tdbp->GetXdp()) {
872+
sprintf(g->Message, "Index not initialized for table %s", tdbp->GetName());
873873
DBUG_PRINT("Range", ("%s", g->Message));
874874
return -1;
875875
} else // Dynamic index
876-
return tdbp->To_Xdp->GetMaxSame(); // TODO a better estimate
876+
return tdbp->GetXdp()->GetMaxSame(); // TODO a better estimate
877877

878878
} else
879-
xbp= (XXBASE*)tdbp->To_Kindex;
879+
xbp= (XXBASE*)tdbp->GetKindex();
880880

881881
for (b= false, i= 0; i < 2; i++) {
882882
p= kp= key[i];
883883

884884
if (kp) {
885-
for (n= 0; n < tdbp->Knum; n++) {
885+
for (n= 0; n < tdbp->GetKnum(); n++) {
886886
if (kmap[i] & (key_part_map)(1 << n)) {
887887
if (b == true)
888888
// Cannot do indexing with missing intermediate key
889889
return -1;
890890

891-
colp= (PCOL)tdbp->To_Key_Col[n];
891+
colp= (PCOL)tdbp->Key(n);
892892

893893
if (colp->GetColUse(U_NULLS))
894894
p++; // Skip null byte ???
895895

896-
valp= tdbp->To_Link[n]->GetValue();
896+
valp= tdbp->Link(n)->GetValue();
897897

898898
if (!valp->IsTypeNum()) {
899899
if (colp->GetColUse(U_VAR)) {

storage/connect/connect.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ int CntIndexRange(PGLOBAL g, PTDB ptdb, const uchar* *key, uint *len,
4646
bool *incl, key_part_map *kmap);
4747
PGLOBAL CntExit(PGLOBAL g);
4848

49+
#if 0
4950
/***********************************************************************/
5051
/* Definition of classes XKPDEF, DOXDEF, TDBDOX */
5152
/* These classes purpose is chiefly to access protected items! */
@@ -76,3 +77,4 @@ class XKPDEF: public KPARTDEF {
7677
public:
7778
XKPDEF(const char *name, int n) : KPARTDEF((PSZ)name, n) {}
7879
}; // end of class XKPDEF
80+
#endif // 0

storage/connect/filter.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ class DllExport FILTER : public XOBJECT { /* Filter description block */
4848
PVAL &Val(int i) {return Test[i].Value;}
4949
bool &Conv(int i) {return Test[i].Conv;}
5050
void SetNext(PFIL filp) {Next = filp;}
51-
bool MakeSelector(PGLOBAL g, PSTRG s);
5251

5352
// Methods
5453
virtual void Reset(void);

storage/connect/ha_connect.cc

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,9 @@
170170
#define JSONMAX 10 // JSON Default max grp size
171171

172172
extern "C" {
173-
char version[]= "Version 1.06.0010 June 01, 2019";
173+
char version[]= "Version 1.07.0001 November 12, 2019";
174174
#if defined(__WIN__)
175-
char compver[]= "Version 1.06.0010 " __DATE__ " " __TIME__;
175+
char compver[]= "Version 1.07.0001 " __DATE__ " " __TIME__;
176176
char slash= '\\';
177177
#else // !__WIN__
178178
char slash= '/';
@@ -1045,6 +1045,8 @@ TABTYPE ha_connect::GetRealType(PTOS pos)
10451045
case TAB_REST:
10461046
type = TAB_NIY;
10471047
break;
1048+
default:
1049+
break;
10481050
} // endswitch type
10491051
#endif // REST_SUPPORT
10501052

@@ -2965,9 +2967,9 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, const Item *cond)
29652967
case Item_func::GE_FUNC: vop= OP_GE; break;
29662968
case Item_func::GT_FUNC: vop= OP_GT; break;
29672969
case Item_func::LIKE_FUNC:
2968-
vop= OP_LIKE;
2969-
neg= ((Item_func_opt_neg *)condf)->negated;
2970-
break;
2970+
vop = OP_LIKE;
2971+
neg= ((Item_func_like*)condf)->negated;
2972+
break;
29712973
case Item_func::ISNOTNULL_FUNC:
29722974
neg= true;
29732975
// fall through
@@ -3785,9 +3787,9 @@ int ha_connect::index_init(uint idx, bool sorted)
37853787
active_index= MAX_KEY;
37863788
rc= HA_ERR_INTERNAL_ERROR;
37873789
} else if (tdbp->GetKindex()) {
3788-
if (((PTDBDOX)tdbp)->To_Kindex->GetNum_K()) {
3790+
if (((PTDBDOS)tdbp)->GetKindex()->GetNum_K()) {
37893791
if (tdbp->GetFtype() != RECFM_NAF)
3790-
((PTDBDOX)tdbp)->GetTxfp()->ResetBuffer(g);
3792+
((PTDBDOS)tdbp)->GetTxfp()->ResetBuffer(g);
37913793

37923794
active_index= idx;
37933795
// } else { // Void table
@@ -5632,6 +5634,8 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
56325634
case TAB_CSV:
56335635
ttp = TAB_REST;
56345636
break;
5637+
default:
5638+
break;
56355639
} // endswitch type
56365640
#endif // REST_SUPPORT
56375641
} // endif ttp
@@ -6041,7 +6045,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
60416045
} // endif !nblin
60426046

60436047
for (i= 0; !rc && i < qrp->Nblin; i++) {
6044-
typ= len= prec= dec= 0;
6048+
typ= len= prec= dec= flg= 0;
60456049
tm= NOT_NULL_FLAG;
60466050
cnm= (char*)"noname";
60476051
dft= xtra= key= fmt= tn= NULL;
@@ -6081,6 +6085,9 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
60816085
if (crp->Kdata->GetIntValue(i))
60826086
tm= 0; // Nullable
60836087

6088+
break;
6089+
case FLD_FLAG:
6090+
flg = crp->Kdata->GetIntValue(i);
60846091
break;
60856092
case FLD_FORMAT:
60866093
fmt= (crp->Kdata) ? crp->Kdata->GetCharValue(i) : NULL;
@@ -6212,7 +6219,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
62126219

62136220
// Now add the field
62146221
if (add_field(&sql, cnm, typ, prec, dec, key, tm, rem, dft, xtra,
6215-
fmt, 0, dbf, v))
6222+
fmt, flg, dbf, v))
62166223
rc= HA_ERR_OUT_OF_MEM;
62176224
} // endfor i
62186225

@@ -7358,14 +7365,14 @@ maria_declare_plugin(connect)
73587365
&connect_storage_engine,
73597366
"CONNECT",
73607367
"Olivier Bertrand",
7361-
"Management of External Data (SQL/NOSQL/MED), including many file formats",
7368+
"Management of External Data (SQL/NOSQL/MED), including Rest query results",
73627369
PLUGIN_LICENSE_GPL,
73637370
connect_init_func, /* Plugin Init */
73647371
connect_done_func, /* Plugin Deinit */
7365-
0x0106, /* version number (1.06) */
7372+
0x0107, /* version number (1.07) */
73667373
NULL, /* status variables */
73677374
connect_system_variables, /* system variables */
7368-
"1.06.0010", /* string version */
7375+
"1.07.0001", /* string version */
73697376
MariaDB_PLUGIN_MATURITY_STABLE /* maturity */
73707377
}
73717378
maria_declare_plugin_end;

0 commit comments

Comments
 (0)