Skip to content

Commit 736f821

Browse files
committed
Merge branch 'connect/10.1' into 10.1
2 parents 62e0a45 + 7e64b07 commit 736f821

File tree

14 files changed

+844
-630
lines changed

14 files changed

+844
-630
lines changed

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*.cpp text
1010
*.h text
1111
*.test text
12+
*.java text
1213

1314
# These files should be checked out as is
1415
*.result -text -whitespace
@@ -23,9 +24,11 @@ pcre/testdata/greppatN4 -text
2324
*.frm binary
2425
*.MYD binary
2526
*.MYI binary
27+
*.class binary
2628

2729
*.c diff=cpp
2830
*.h diff=cpp
2931
*.cc diff=cpp
3032
*.ic diff=cpp
3133
*.cpp diff=cpp
34+
*.java diff=cpp

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,8 @@ storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result
244244
*.exp
245245
*.dep
246246
*.idb
247+
*.res
248+
*.tlog
247249

248250
# Precompiled Headers
249251
*.gch

storage/connect/JdbcInterface.class

0 Bytes
Binary file not shown.

storage/connect/JdbcInterface.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ public int GetMaxValue(int n) {
307307
} // end of GetMaxValue
308308

309309
public int GetColumns(String[] parms) {
310-
int ncol = 0;
310+
int ncol = -1;
311311

312312
try {
313313
if (rs != null) rs.close();

storage/connect/ha_connect.cc

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@
129129
#include "odbccat.h"
130130
#endif // ODBC_SUPPORT
131131
#if defined(JDBC_SUPPORT)
132-
#include "jdbccat.h"
132+
#include "tabjdbc.h"
133+
#include "jdbconn.h"
133134
#endif // JDBC_SUPPORT
134135
#include "xtable.h"
135136
#include "tabmysql.h"
@@ -5163,7 +5164,6 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
51635164
#endif // ODBC_SUPPORT
51645165
#if defined(JDBC_SUPPORT)
51655166
PJPARM sjp= NULL;
5166-
char *jpath= NULL;
51675167
char *driver= NULL;
51685168
char *url= NULL;
51695169
char *tabtyp = NULL;
@@ -5230,9 +5230,8 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
52305230
cnc= (!*ucnc || *ucnc == 'y' || *ucnc == 'Y' || atoi(ucnc) != 0);
52315231
#endif
52325232
#if defined(JDBC_SUPPORT)
5233-
jpath= GetListOption(g, "Jpath", topt->oplist, NULL);
52345233
driver= GetListOption(g, "Driver", topt->oplist, NULL);
5235-
url= GetListOption(g, "URL", topt->oplist, NULL);
5234+
// url= GetListOption(g, "URL", topt->oplist, NULL);
52365235
tabtyp = GetListOption(g, "Tabtype", topt->oplist, NULL);
52375236
#endif // JDBC_SUPPORT
52385237
mxe= atoi(GetListOption(g,"maxerr", topt->oplist, "0"));
@@ -5333,18 +5332,31 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
53335332
case TAB_JDBC:
53345333
if (fnc & FNC_DRIVER) {
53355334
ok= true;
5336-
} else if (!url) {
5337-
strcpy(g->Message, "Missing URL");
5335+
} else if (!(url= strz(g, create_info->connect_string))) {
5336+
strcpy(g->Message, "Missing URL");
53385337
} else {
5339-
// Store ODBC additional parameters
5338+
// Store JDBC additional parameters
5339+
int rc;
5340+
PJDBCDEF jdef= new(g) JDBCDEF();
5341+
5342+
jdef->SetName(create_info->alias);
53405343
sjp= (PJPARM)PlugSubAlloc(g, NULL, sizeof(JDBCPARM));
53415344
sjp->Driver= driver;
5342-
sjp->Url= url;
5343-
sjp->User= (char*)user;
5344-
sjp->Pwd= (char*)pwd;
53455345
sjp->Fsize= 0;
53465346
sjp->Scrollable= false;
5347-
ok= true;
5347+
5348+
if ((rc = jdef->ParseURL(g, url, false)) == RC_OK) {
5349+
sjp->Url= url;
5350+
sjp->User= (char*)user;
5351+
sjp->Pwd= (char*)pwd;
5352+
ok= true;
5353+
} else if (rc == RC_NF) {
5354+
if (jdef->GetTabname())
5355+
tab= jdef->GetTabname();
5356+
5357+
ok= jdef->SetParms(sjp);
5358+
} // endif rc
5359+
53485360
} // endif's
53495361

53505362
supfnc |= (FNC_DRIVER | FNC_TABLE);
@@ -5496,7 +5508,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
54965508

54975509
break;
54985510
case FNC_TABLE:
5499-
qrp= ODBCTables(g, dsn, shm, tab, mxr, true, sop);
5511+
qrp= ODBCTables(g, dsn, shm, tab, NULL, mxr, true, sop);
55005512
break;
55015513
case FNC_DSN:
55025514
qrp= ODBCDataSources(g, mxr, true);
@@ -5517,23 +5529,22 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
55175529
case FNC_NO:
55185530
case FNC_COL:
55195531
if (src) {
5520-
qrp= JDBCSrcCols(g, jpath, (char*)src, sjp);
5532+
qrp= JDBCSrcCols(g, (char*)src, sjp);
55215533
src= NULL; // for next tests
55225534
} else
5523-
qrp= JDBCColumns(g, jpath, shm, tab, NULL,
5524-
mxr, fnc == FNC_COL, sjp);
5535+
qrp= JDBCColumns(g, shm, tab, NULL, mxr, fnc == FNC_COL, sjp);
55255536

55265537
break;
55275538
case FNC_TABLE:
5528-
qrp= JDBCTables(g, dsn, shm, tab, tabtyp, mxr, true, sjp);
5539+
qrp= JDBCTables(g, shm, tab, tabtyp, mxr, true, sjp);
55295540
break;
55305541
#if 0
55315542
case FNC_DSN:
55325543
qrp= JDBCDataSources(g, mxr, true);
55335544
break;
55345545
#endif // 0
55355546
case FNC_DRIVER:
5536-
qrp= JDBCDrivers(g, jpath, mxr, true);
5547+
qrp= JDBCDrivers(g, mxr, true);
55375548
break;
55385549
default:
55395550
sprintf(g->Message, "invalid catfunc %s", fncn);
@@ -5784,12 +5795,10 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
57845795

57855796
switch (typ) {
57865797
case TYPE_DOUBLE:
5798+
case TYPE_DECIM:
57875799
// Some data sources do not count dec in length (prec)
57885800
prec += (dec + 2); // To be safe
57895801
break;
5790-
case TYPE_DECIM:
5791-
prec= len;
5792-
break;
57935802
default:
57945803
dec= 0;
57955804
} // endswitch typ

storage/connect/jdbccat.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ typedef struct jdbc_parms {
2121
char *JDBCCheckConnection(PGLOBAL g, char *dsn, int cop);
2222
#endif // PROMPT_OK
2323
//PQRYRES JDBCDataSources(PGLOBAL g, int maxres, bool info);
24-
PQRYRES JDBCColumns(PGLOBAL g, char *jpath, char *db, char *table,
24+
PQRYRES JDBCColumns(PGLOBAL g, char *db, char *table,
2525
char *colpat, int maxres, bool info, PJPARM sop);
26-
PQRYRES JDBCSrcCols(PGLOBAL g, char *jpath, char *src, PJPARM sop);
27-
PQRYRES JDBCTables(PGLOBAL g, char *jpath, char *db, char *tabpat,
26+
PQRYRES JDBCSrcCols(PGLOBAL g, char *src, PJPARM sop);
27+
PQRYRES JDBCTables(PGLOBAL g, char *db, char *tabpat,
2828
char *tabtyp, int maxres, bool info, PJPARM sop);
29-
PQRYRES JDBCDrivers(PGLOBAL g, char *jpath, int maxres, bool info);
29+
PQRYRES JDBCDrivers(PGLOBAL g, int maxres, bool info);

0 commit comments

Comments
 (0)