Skip to content

Commit 1a55455

Browse files
committed
Merge remote-tracking branch 'connect/10.0' into bb-10.0-vicentiu
2 parents e9aed13 + 4314768 commit 1a55455

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+8797
-1866
lines changed

storage/connect/ApacheInterface.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ public int JdbcConnect(String[] parms, int fsize, boolean scrollable) {
3535
ds.setPassword(parms[3]);
3636
pool.put(url, ds);
3737
} // endif ds
38-
38+
39+
// if (parms.length > 4 && parms[4] != null)
40+
// ds.setConnectionProperties(parms[4]);
41+
3942
// Get a connection from the data source
4043
conn = ds.getConnection();
4144

storage/connect/CMakeLists.txt

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,25 @@ SET(CONNECT_SOURCES
2020
ha_connect.cc connect.cc user_connect.cc mycat.cc
2121
fmdlex.c osutil.c plugutil.c rcmsg.c rcmsg.h
2222
array.cpp blkfil.cpp colblk.cpp csort.cpp
23-
filamap.cpp filamdbf.cpp filamfix.cpp filamtxt.cpp filamvct.cpp filamzip.cpp
23+
filamap.cpp filamdbf.cpp filamfix.cpp filamgz.cpp filamtxt.cpp
2424
filter.cpp json.cpp jsonudf.cpp maputil.cpp myconn.cpp myutil.cpp plgdbutl.cpp
2525
reldef.cpp tabcol.cpp tabdos.cpp tabfix.cpp tabfmt.cpp tabjson.cpp table.cpp
2626
tabmul.cpp tabmysql.cpp taboccur.cpp tabpivot.cpp tabsys.cpp tabtbl.cpp tabutil.cpp
27-
tabvct.cpp tabvir.cpp tabxcl.cpp valblk.cpp value.cpp xindex.cpp xobject.cpp
27+
tabvir.cpp tabxcl.cpp valblk.cpp value.cpp xindex.cpp xobject.cpp
2828

2929
array.h blkfil.h block.h catalog.h checklvl.h colblk.h connect.h csort.h
30-
engmsg.h filamap.h filamdbf.h filamfix.h filamtxt.h filamvct.h filamzip.h
30+
engmsg.h filamap.h filamdbf.h filamfix.h filamgz.h filamtxt.h
3131
filter.h global.h ha_connect.h inihandl.h json.h jsonudf.h maputil.h msgid.h
3232
mycat.h myconn.h myutil.h os.h osutil.h plgcnx.h plgdbsem.h preparse.h reldef.h
3333
resource.h tabcol.h tabdos.h tabfix.h tabfmt.h tabjson.h tabmul.h tabmysql.h
34-
taboccur.h tabpivot.h tabsys.h tabtbl.h tabutil.h tabvct.h tabvir.h tabxcl.h
34+
taboccur.h tabpivot.h tabsys.h tabtbl.h tabutil.h tabvir.h tabxcl.h
3535
user_connect.h valblk.h value.h xindex.h xobject.h xtable.h)
3636

3737
#
3838
# Definitions that are shared for all OSes
3939
#
4040
add_definitions( -DMARIADB -DFORCE_INIT_OF_VARS -Dconnect_EXPORTS)
41-
add_definitions( -DHUGE_SUPPORT -DZIP_SUPPORT -DPIVOT_SUPPORT )
41+
add_definitions( -DHUGE_SUPPORT -DGZ_SUPPORT -DPIVOT_SUPPORT )
4242

4343

4444
#
@@ -89,6 +89,18 @@ ELSE(NOT UNIX)
8989
ENDIF(UNIX)
9090

9191

92+
#
93+
# VCT: the VEC format might be not supported in future versions
94+
#
95+
96+
OPTION(CONNECT_WITH_VCT "Compile CONNECT storage engine with VCT support" ON)
97+
98+
IF(CONNECT_WITH_VCT)
99+
SET(CONNECT_SOURCES ${CONNECT_SOURCES} filamvct.cpp tabvct.cpp filamvct.h tabvct.h)
100+
add_definitions(-DVCT_SUPPORT)
101+
ENDIF(CONNECT_WITH_VCT)
102+
103+
92104
#
93105
# XML
94106
#
@@ -236,9 +248,9 @@ ENDIF(CONNECT_WITH_ODBC)
236248
# JDBC
237249
#
238250
IF(APPLE)
239-
OPTION(CONNECT_WITH_JDBC "some comment" OFF)
251+
OPTION(CONNECT_WITH_JDBC "Compile CONNECT storage engine without JDBC support" OFF)
240252
ELSE()
241-
OPTION(CONNECT_WITH_JDBC "some comment" ON)
253+
OPTION(CONNECT_WITH_JDBC "Compile CONNECT storage engine with JDBC support" ON)
242254
ENDIF()
243255

244256
IF(CONNECT_WITH_JDBC)
@@ -252,18 +264,33 @@ IF(CONNECT_WITH_JDBC)
252264
SET(CONNECT_SOURCES ${CONNECT_SOURCES}
253265
jdbconn.cpp tabjdbc.cpp jdbconn.h tabjdbc.h jdbccat.h
254266
JdbcInterface.java ApacheInterface.java MariadbInterface.java
255-
MysqlInterface.java OracleInterface.java PostgresqlInterface.java)
267+
MysqlInterface.java OracleInterface.java PostgresqlInterface.java
268+
JavaWrappers.jar)
256269
# TODO: Find how to compile and install the java wrapper classes
257270
# Find required libraries and include directories
258271
SET (JAVA_SOURCES JdbcInterface.java)
259272
add_jar(JdbcInterface ${JAVA_SOURCES})
260-
install_jar(JdbcInterface DESTINATION ${INSTALL_PLUGINDIR} COMPONENT connect-engine)
273+
install_jar(JdbcInterface DESTINATION ${INSTALL_PLUGINDIR} COMPONENT connect-engine)
274+
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/JavaWrappers.jar
275+
DESTINATION ${INSTALL_PLUGINDIR} COMPONENT connect-engine)
261276
add_definitions(-DJDBC_SUPPORT)
262277
ELSE()
263278
SET(JDBC_LIBRARY "")
264279
ENDIF()
265280
ENDIF(CONNECT_WITH_JDBC)
266281

282+
#
283+
# ZIP
284+
#
285+
286+
OPTION(CONNECT_WITH_ZIP "Compile CONNECT storage engine with ZIP support" ON)
287+
288+
IF(CONNECT_WITH_ZIP)
289+
SET(CONNECT_SOURCES ${CONNECT_SOURCES} filamzip.cpp tabzip.cpp unzip.c ioapi.c zip.c
290+
filamzip.h tabzip.h ioapi.h unzip.h zip.h)
291+
add_definitions(-DZIP_SUPPORT -DNOCRYPT)
292+
ENDIF(CONNECT_WITH_ZIP)
293+
267294

268295
#
269296
# XMAP

storage/connect/JavaWrappers.jar

19.2 KB
Binary file not shown.

storage/connect/JdbcInterface.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ public int JdbcConnect(String[] parms, int fsize, boolean scrollable) {
8282
System.out.println("URL=" + parms[1]);
8383

8484
CheckURL(parms[1], null);
85+
86+
// This is required for drivers using context class loaders
87+
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
8588

8689
if (parms[2] != null && !parms[2].isEmpty()) {
8790
if (DEBUG)
@@ -220,6 +223,19 @@ public void SetTimestampParm(int i, Timestamp t) {
220223

221224
} // end of SetTimestampParm
222225

226+
public int SetNullParm(int i, int typ) {
227+
int rc = 0;
228+
229+
try {
230+
pstmt.setNull(i, typ);
231+
} catch (Exception e) {
232+
SetErrmsg(e);
233+
rc = -1;
234+
} // end try/catch
235+
236+
return rc;
237+
} // end of SetNullParm
238+
223239
public int ExecutePrep() {
224240
int n = -3;
225241

storage/connect/domdoc.cpp

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -89,30 +89,43 @@ DOMDOC::DOMDOC(char *nsl, char *nsdf, char *enc, PFBLOCK fp)
8989
/******************************************************************/
9090
/* Initialize XML parser and check library compatibility. */
9191
/******************************************************************/
92-
bool DOMDOC::Initialize(PGLOBAL g)
93-
{
94-
if (TestHr(g, CoInitialize(NULL)))
92+
bool DOMDOC::Initialize(PGLOBAL g, char *entry, bool zipped)
93+
{
94+
if (zipped && InitZip(g, entry))
95+
return true;
96+
97+
if (TestHr(g, CoInitialize(NULL)))
9598
return true;
9699

97100
if (TestHr(g, Docp.CreateInstance("msxml2.domdocument")))
98101
return true;
99102

100103
return MakeNSlist(g);
101-
} // end of Initialize
104+
} // end of Initialize
102105

103106
/******************************************************************/
104107
/* Parse the XML file and construct node tree in memory. */
105108
/******************************************************************/
106-
bool DOMDOC::ParseFile(char *fn)
107-
{
108-
// Load the document
109+
bool DOMDOC::ParseFile(PGLOBAL g, char *fn)
110+
{
111+
bool b;
112+
109113
Docp->async = false;
110114

111-
if (!(bool)Docp->load((_bstr_t)fn))
115+
if (zip) {
116+
// Parse an in memory document
117+
char *xdoc = GetMemDoc(g, fn);
118+
119+
b = (xdoc) ? (bool)Docp->loadXML((_bstr_t)xdoc) : false;
120+
} else
121+
// Load the document
122+
b = (bool)Docp->load((_bstr_t)fn);
123+
124+
if (!b)
112125
return true;
113126

114127
return false;
115-
} // end of ParseFile
128+
} // end of ParseFile
116129

117130
/******************************************************************/
118131
/* Create or reuse an Xblock for this document. */
@@ -239,6 +252,7 @@ int DOMDOC::DumpDoc(PGLOBAL g, char *ofn)
239252
void DOMDOC::CloseDoc(PGLOBAL g, PFBLOCK xp)
240253
{
241254
CloseXMLFile(g, xp, false);
255+
CloseZip();
242256
} // end of Close
243257

244258
/* ----------------------- class DOMNODE ------------------------ */
@@ -616,13 +630,13 @@ PXNODE DOMNODELIST::GetItem(PGLOBAL g, int n, PXNODE np)
616630
/* Reset the pointer on the deleted item. */
617631
/******************************************************************/
618632
bool DOMNODELIST::DropItem(PGLOBAL g, int n)
619-
{
620-
if (Listp == NULL || Listp->length <= n)
621-
return true;
633+
{
634+
if (Listp == NULL || Listp->length < n)
635+
return true;
622636

623637
//Listp->item[n] = NULL; La propriété n'a pas de méthode 'set'
624638
return false;
625-
} // end of DeleteItem
639+
} // end of DeleteItem
626640

627641
/* ----------------------- class DOMATTR ------------------------ */
628642

storage/connect/domdoc.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ class DOMDOC : public XMLDOCUMENT {
3737
virtual void SetNofree(bool b) {} // Only libxml2
3838

3939
// Methods
40-
virtual bool Initialize(PGLOBAL g);
41-
virtual bool ParseFile(char *fn);
40+
virtual bool Initialize(PGLOBAL g, char *entry, bool zipped);
41+
virtual bool ParseFile(PGLOBAL g, char *fn);
4242
virtual bool NewDoc(PGLOBAL g, char *ver);
4343
virtual void AddComment(PGLOBAL g, char *com);
4444
virtual PXNODE GetRoot(PGLOBAL g);

storage/connect/filamap.cpp

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ int MAPFAM::GetFileLength(PGLOBAL g)
8787
{
8888
int len;
8989

90-
len = (To_Fb) ? To_Fb->Length : TXTFAM::GetFileLength(g);
90+
len = (To_Fb && To_Fb->Count) ? To_Fb->Length : TXTFAM::GetFileLength(g);
9191

9292
if (trace)
9393
htrc("Mapped file length=%d\n", len);
@@ -319,11 +319,13 @@ int MAPFAM::SkipRecord(PGLOBAL g, bool header)
319319
/***********************************************************************/
320320
int MAPFAM::ReadBuffer(PGLOBAL g)
321321
{
322-
int len;
322+
int rc, len;
323323

324324
// Are we at the end of the memory
325-
if (Mempos >= Top)
326-
return RC_EF;
325+
if (Mempos >= Top)
326+
if ((rc = GetNext(g)) != RC_OK)
327+
return rc;
328+
327329

328330
if (!Placed) {
329331
/*******************************************************************/
@@ -341,8 +343,10 @@ int MAPFAM::ReadBuffer(PGLOBAL g)
341343
/*******************************************************************/
342344
switch (Tdbp->TestBlock(g)) {
343345
case RC_EF:
344-
return RC_EF;
345-
case RC_NF:
346+
if ((rc = GetNext(g)) != RC_OK)
347+
return rc;
348+
349+
case RC_NF:
346350
// Skip this record
347351
if ((rc = SkipRecord(g, false)) != RC_OK)
348352
return rc;
@@ -413,7 +417,7 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc)
413417

414418
if (Tpos == Spos) {
415419
/*******************************************************************/
416-
/* First line to delete. Move of eventual preceeding lines is */
420+
/* First line to delete. Move of eventual preceding lines is */
417421
/* not required here, just setting of future Spos and Tpos. */
418422
/*******************************************************************/
419423
Tpos = Spos = Fpos;
@@ -498,7 +502,7 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc)
498502
void MAPFAM::CloseTableFile(PGLOBAL g, bool)
499503
{
500504
PlugCloseFile(g, To_Fb);
501-
To_Fb = NULL; // To get correct file size in Cardinality
505+
//To_Fb = NULL; // To get correct file size in Cardinality
502506

503507
if (trace)
504508
htrc("MAP Close: closing %s count=%d\n",
@@ -569,16 +573,18 @@ int MBKFAM::GetRowID(void)
569573
/***********************************************************************/
570574
int MBKFAM::ReadBuffer(PGLOBAL g)
571575
{
572-
int len;
576+
int rc, len;
573577

574578
/*********************************************************************/
575579
/* Sequential block reading when Placed is not true. */
576580
/*********************************************************************/
577581
if (Placed) {
578582
Placed = false;
579583
} else if (Mempos >= Top) { // Are we at the end of the memory
580-
return RC_EF;
581-
} else if (++CurNum < Nrec) {
584+
if ((rc = GetNext(g)) != RC_OK)
585+
return rc;
586+
587+
} else if (++CurNum < Nrec) {
582588
Fpos = Mempos;
583589
} else {
584590
/*******************************************************************/
@@ -588,16 +594,20 @@ int MBKFAM::ReadBuffer(PGLOBAL g)
588594

589595
next:
590596
if (++CurBlk >= Block)
591-
return RC_EF;
597+
if ((rc = GetNext(g)) != RC_OK)
598+
return rc;
592599

593600
/*******************************************************************/
594601
/* Before reading a new block, check whether block optimization */
595602
/* can be done, as well as for join as for local filtering. */
596603
/*******************************************************************/
597604
switch (Tdbp->TestBlock(g)) {
598605
case RC_EF:
599-
return RC_EF;
600-
case RC_NF:
606+
if ((rc = GetNext(g)) != RC_OK)
607+
return rc;
608+
609+
break;
610+
case RC_NF:
601611
goto next;
602612
} // endswitch rc
603613

@@ -697,14 +707,18 @@ int MPXFAM::InitDelete(PGLOBAL, int fpos, int)
697707
/***********************************************************************/
698708
int MPXFAM::ReadBuffer(PGLOBAL g)
699709
{
710+
int rc;
711+
700712
/*********************************************************************/
701713
/* Sequential block reading when Placed is not true. */
702714
/*********************************************************************/
703715
if (Placed) {
704716
Placed = false;
705717
} else if (Mempos >= Top) { // Are we at the end of the memory
706-
return RC_EF;
707-
} else if (++CurNum < Nrec) {
718+
if ((rc = GetNext(g)) != RC_OK)
719+
return rc;
720+
721+
} else if (++CurNum < Nrec) {
708722
Fpos = Mempos;
709723
} else {
710724
/*******************************************************************/
@@ -714,16 +728,19 @@ int MPXFAM::ReadBuffer(PGLOBAL g)
714728

715729
next:
716730
if (++CurBlk >= Block)
717-
return RC_EF;
731+
return GetNext(g);
718732

719733
/*******************************************************************/
720734
/* Before reading a new block, check whether block optimization */
721735
/* can be done, as well as for join as for local filtering. */
722736
/*******************************************************************/
723737
switch (Tdbp->TestBlock(g)) {
724738
case RC_EF:
725-
return RC_EF;
726-
case RC_NF:
739+
if ((rc = GetNext(g)) != RC_OK)
740+
return rc;
741+
742+
break;
743+
case RC_NF:
727744
goto next;
728745
} // endswitch rc
729746

storage/connect/filamap.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ class DllExport MAPFAM : public TXTFAM {
4141
virtual int SkipRecord(PGLOBAL g, bool header);
4242
virtual bool OpenTableFile(PGLOBAL g);
4343
virtual bool DeferReading(void) {return false;}
44-
virtual int ReadBuffer(PGLOBAL g);
44+
virtual int GetNext(PGLOBAL g) {return RC_EF;}
45+
virtual int ReadBuffer(PGLOBAL g);
4546
virtual int WriteBuffer(PGLOBAL g);
4647
virtual int DeleteRecords(PGLOBAL g, int irc);
4748
virtual void CloseTableFile(PGLOBAL g, bool abort);

0 commit comments

Comments
 (0)