129
129
#include " odbccat.h"
130
130
#endif // ODBC_SUPPORT
131
131
#if defined(JDBC_SUPPORT)
132
- #include " jdbccat.h"
132
+ #include " tabjdbc.h"
133
+ #include " jdbconn.h"
133
134
#endif // JDBC_SUPPORT
134
135
#include " xtable.h"
135
136
#include " tabmysql.h"
@@ -5163,7 +5164,6 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
5163
5164
#endif // ODBC_SUPPORT
5164
5165
#if defined(JDBC_SUPPORT)
5165
5166
PJPARM sjp= NULL ;
5166
- char *jpath= NULL ;
5167
5167
char *driver= NULL ;
5168
5168
char *url= NULL ;
5169
5169
char *tabtyp = NULL ;
@@ -5230,9 +5230,8 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
5230
5230
cnc= (!*ucnc || *ucnc == ' y' || *ucnc == ' Y' || atoi (ucnc) != 0 );
5231
5231
#endif
5232
5232
#if defined(JDBC_SUPPORT)
5233
- jpath= GetListOption (g, " Jpath" , topt->oplist , NULL );
5234
5233
driver= GetListOption (g, " Driver" , topt->oplist , NULL );
5235
- url= GetListOption (g, " URL" , topt->oplist , NULL );
5234
+ // url= GetListOption(g, "URL", topt->oplist, NULL);
5236
5235
tabtyp = GetListOption (g, " Tabtype" , topt->oplist , NULL );
5237
5236
#endif // JDBC_SUPPORT
5238
5237
mxe= atoi (GetListOption (g," maxerr" , topt->oplist , " 0" ));
@@ -5333,18 +5332,31 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
5333
5332
case TAB_JDBC:
5334
5333
if (fnc & FNC_DRIVER) {
5335
5334
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" );
5338
5337
} 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 );
5340
5343
sjp= (PJPARM)PlugSubAlloc (g, NULL , sizeof (JDBCPARM));
5341
5344
sjp->Driver = driver;
5342
- sjp->Url = url;
5343
- sjp->User = (char *)user;
5344
- sjp->Pwd = (char *)pwd;
5345
5345
sjp->Fsize = 0 ;
5346
5346
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
+
5348
5360
} // endif's
5349
5361
5350
5362
supfnc |= (FNC_DRIVER | FNC_TABLE);
@@ -5496,7 +5508,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
5496
5508
5497
5509
break ;
5498
5510
case FNC_TABLE:
5499
- qrp= ODBCTables (g, dsn, shm, tab, mxr, true , sop);
5511
+ qrp= ODBCTables (g, dsn, shm, tab, NULL , mxr, true , sop);
5500
5512
break ;
5501
5513
case FNC_DSN:
5502
5514
qrp= ODBCDataSources (g, mxr, true );
@@ -5517,23 +5529,22 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
5517
5529
case FNC_NO:
5518
5530
case FNC_COL:
5519
5531
if (src) {
5520
- qrp= JDBCSrcCols (g, jpath, (char *)src, sjp);
5532
+ qrp= JDBCSrcCols (g, (char *)src, sjp);
5521
5533
src= NULL ; // for next tests
5522
5534
} 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);
5525
5536
5526
5537
break ;
5527
5538
case FNC_TABLE:
5528
- qrp= JDBCTables (g, dsn, shm, tab, tabtyp, mxr, true , sjp);
5539
+ qrp= JDBCTables (g, shm, tab, tabtyp, mxr, true , sjp);
5529
5540
break ;
5530
5541
#if 0
5531
5542
case FNC_DSN:
5532
5543
qrp= JDBCDataSources(g, mxr, true);
5533
5544
break;
5534
5545
#endif // 0
5535
5546
case FNC_DRIVER:
5536
- qrp= JDBCDrivers (g, jpath, mxr, true );
5547
+ qrp= JDBCDrivers (g, mxr, true );
5537
5548
break ;
5538
5549
default :
5539
5550
sprintf (g->Message , " invalid catfunc %s" , fncn);
@@ -5784,12 +5795,10 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
5784
5795
5785
5796
switch (typ) {
5786
5797
case TYPE_DOUBLE:
5798
+ case TYPE_DECIM:
5787
5799
// Some data sources do not count dec in length (prec)
5788
5800
prec += (dec + 2 ); // To be safe
5789
5801
break ;
5790
- case TYPE_DECIM:
5791
- prec= len;
5792
- break ;
5793
5802
default :
5794
5803
dec= 0 ;
5795
5804
} // endswitch typ
0 commit comments