Skip to content

Commit

Permalink
Merge branch 'connect/10.1' into 10.1
Browse files Browse the repository at this point in the history
  • Loading branch information
vuvova committed Jun 28, 2016
2 parents 62e0a45 + 7e64b07 commit 736f821
Show file tree
Hide file tree
Showing 14 changed files with 844 additions and 630 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*.cpp text
*.h text
*.test text
*.java text

# These files should be checked out as is
*.result -text -whitespace
Expand All @@ -23,9 +24,11 @@ pcre/testdata/greppatN4 -text
*.frm binary
*.MYD binary
*.MYI binary
*.class binary

*.c diff=cpp
*.h diff=cpp
*.cc diff=cpp
*.ic diff=cpp
*.cpp diff=cpp
*.java diff=cpp
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result
*.exp
*.dep
*.idb
*.res
*.tlog

# Precompiled Headers
*.gch
Expand Down
Binary file modified storage/connect/JdbcInterface.class
Binary file not shown.
2 changes: 1 addition & 1 deletion storage/connect/JdbcInterface.java
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ public int GetMaxValue(int n) {
} // end of GetMaxValue

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

try {
if (rs != null) rs.close();
Expand Down
49 changes: 29 additions & 20 deletions storage/connect/ha_connect.cc
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@
#include "odbccat.h"
#endif // ODBC_SUPPORT
#if defined(JDBC_SUPPORT)
#include "jdbccat.h"
#include "tabjdbc.h"
#include "jdbconn.h"
#endif // JDBC_SUPPORT
#include "xtable.h"
#include "tabmysql.h"
Expand Down Expand Up @@ -5163,7 +5164,6 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
#endif // ODBC_SUPPORT
#if defined(JDBC_SUPPORT)
PJPARM sjp= NULL;
char *jpath= NULL;
char *driver= NULL;
char *url= NULL;
char *tabtyp = NULL;
Expand Down Expand Up @@ -5230,9 +5230,8 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
cnc= (!*ucnc || *ucnc == 'y' || *ucnc == 'Y' || atoi(ucnc) != 0);
#endif
#if defined(JDBC_SUPPORT)
jpath= GetListOption(g, "Jpath", topt->oplist, NULL);
driver= GetListOption(g, "Driver", topt->oplist, NULL);
url= GetListOption(g, "URL", topt->oplist, NULL);
// url= GetListOption(g, "URL", topt->oplist, NULL);
tabtyp = GetListOption(g, "Tabtype", topt->oplist, NULL);
#endif // JDBC_SUPPORT
mxe= atoi(GetListOption(g,"maxerr", topt->oplist, "0"));
Expand Down Expand Up @@ -5333,18 +5332,31 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
case TAB_JDBC:
if (fnc & FNC_DRIVER) {
ok= true;
} else if (!url) {
strcpy(g->Message, "Missing URL");
} else if (!(url= strz(g, create_info->connect_string))) {
strcpy(g->Message, "Missing URL");
} else {
// Store ODBC additional parameters
// Store JDBC additional parameters
int rc;
PJDBCDEF jdef= new(g) JDBCDEF();

jdef->SetName(create_info->alias);
sjp= (PJPARM)PlugSubAlloc(g, NULL, sizeof(JDBCPARM));
sjp->Driver= driver;
sjp->Url= url;
sjp->User= (char*)user;
sjp->Pwd= (char*)pwd;
sjp->Fsize= 0;
sjp->Scrollable= false;
ok= true;

if ((rc = jdef->ParseURL(g, url, false)) == RC_OK) {
sjp->Url= url;
sjp->User= (char*)user;
sjp->Pwd= (char*)pwd;
ok= true;
} else if (rc == RC_NF) {
if (jdef->GetTabname())
tab= jdef->GetTabname();

ok= jdef->SetParms(sjp);
} // endif rc

} // endif's

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

break;
case FNC_TABLE:
qrp= ODBCTables(g, dsn, shm, tab, mxr, true, sop);
qrp= ODBCTables(g, dsn, shm, tab, NULL, mxr, true, sop);
break;
case FNC_DSN:
qrp= ODBCDataSources(g, mxr, true);
Expand All @@ -5517,23 +5529,22 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
case FNC_NO:
case FNC_COL:
if (src) {
qrp= JDBCSrcCols(g, jpath, (char*)src, sjp);
qrp= JDBCSrcCols(g, (char*)src, sjp);
src= NULL; // for next tests
} else
qrp= JDBCColumns(g, jpath, shm, tab, NULL,
mxr, fnc == FNC_COL, sjp);
qrp= JDBCColumns(g, shm, tab, NULL, mxr, fnc == FNC_COL, sjp);

break;
case FNC_TABLE:
qrp= JDBCTables(g, dsn, shm, tab, tabtyp, mxr, true, sjp);
qrp= JDBCTables(g, shm, tab, tabtyp, mxr, true, sjp);
break;
#if 0
case FNC_DSN:
qrp= JDBCDataSources(g, mxr, true);
break;
#endif // 0
case FNC_DRIVER:
qrp= JDBCDrivers(g, jpath, mxr, true);
qrp= JDBCDrivers(g, mxr, true);
break;
default:
sprintf(g->Message, "invalid catfunc %s", fncn);
Expand Down Expand Up @@ -5784,12 +5795,10 @@ static int connect_assisted_discovery(handlerton *, THD* thd,

switch (typ) {
case TYPE_DOUBLE:
case TYPE_DECIM:
// Some data sources do not count dec in length (prec)
prec += (dec + 2); // To be safe
break;
case TYPE_DECIM:
prec= len;
break;
default:
dec= 0;
} // endswitch typ
Expand Down
8 changes: 4 additions & 4 deletions storage/connect/jdbccat.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ typedef struct jdbc_parms {
char *JDBCCheckConnection(PGLOBAL g, char *dsn, int cop);
#endif // PROMPT_OK
//PQRYRES JDBCDataSources(PGLOBAL g, int maxres, bool info);
PQRYRES JDBCColumns(PGLOBAL g, char *jpath, char *db, char *table,
PQRYRES JDBCColumns(PGLOBAL g, char *db, char *table,
char *colpat, int maxres, bool info, PJPARM sop);
PQRYRES JDBCSrcCols(PGLOBAL g, char *jpath, char *src, PJPARM sop);
PQRYRES JDBCTables(PGLOBAL g, char *jpath, char *db, char *tabpat,
PQRYRES JDBCSrcCols(PGLOBAL g, char *src, PJPARM sop);
PQRYRES JDBCTables(PGLOBAL g, char *db, char *tabpat,
char *tabtyp, int maxres, bool info, PJPARM sop);
PQRYRES JDBCDrivers(PGLOBAL g, char *jpath, int maxres, bool info);
PQRYRES JDBCDrivers(PGLOBAL g, int maxres, bool info);
Loading

0 comments on commit 736f821

Please sign in to comment.