mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
- JdbcInterface: change return type of ...Field function
modified: storage/connect/JdbcInterface.java - Change Version number and date modified: storage/connect/ha_connect.cc - Implement the test on connect_type_conv YES/NO modified: storage/connect/jdbconn.cpp modified: storage/connect/odbconn.cpp - Fix MDEV-10520. Local schema was confused with remote schema modified: storage/connect/tabjdbc.cpp modified: storage/connect/tabodbc.cpp - Fix crash when using mapped indices. Was trying to write in a mapped file declared as read only. modified: storage/connect/xindex.cpp
This commit is contained in:
@@ -641,40 +641,43 @@ public class JdbcInterface {
|
||||
return false;
|
||||
} // end of BooleanField
|
||||
|
||||
public Date DateField(int n, String name) {
|
||||
public int DateField(int n, String name) {
|
||||
if (rs == null) {
|
||||
System.out.println("No result set");
|
||||
} else try {
|
||||
return (n > 0) ? rs.getDate(n) : rs.getDate(name);
|
||||
Date d = (n > 0) ? rs.getDate(n) : rs.getDate(name);
|
||||
return (d != null) ? (int)(d.getTime() / 1000) : 0;
|
||||
} catch (SQLException se) {
|
||||
SetErrmsg(se);
|
||||
} //end try/catch
|
||||
|
||||
return null;
|
||||
return 0;
|
||||
} // end of DateField
|
||||
|
||||
public Time TimeField(int n, String name) {
|
||||
public int TimeField(int n, String name) {
|
||||
if (rs == null) {
|
||||
System.out.println("No result set");
|
||||
} else try {
|
||||
return (n > 0) ? rs.getTime(n) : rs.getTime(name);
|
||||
Time t = (n > 0) ? rs.getTime(n) : rs.getTime(name);
|
||||
return (t != null) ? (int)(t.getTime() / 1000) : 0;
|
||||
} catch (SQLException se) {
|
||||
SetErrmsg(se);
|
||||
} //end try/catch
|
||||
|
||||
return null;
|
||||
return 0;
|
||||
} // end of TimeField
|
||||
|
||||
public Timestamp TimestampField(int n, String name) {
|
||||
public int TimestampField(int n, String name) {
|
||||
if (rs == null) {
|
||||
System.out.println("No result set");
|
||||
} else try {
|
||||
return (n > 0) ? rs.getTimestamp(n) : rs.getTimestamp(name);
|
||||
Timestamp ts = (n > 0) ? rs.getTimestamp(n) : rs.getTimestamp(name);
|
||||
return (ts != null) ? (int)(ts.getTime() / 1000) : 0;
|
||||
} catch (SQLException se) {
|
||||
SetErrmsg(se);
|
||||
} //end try/catch
|
||||
|
||||
return null;
|
||||
return 0;
|
||||
} // end of TimestampField
|
||||
|
||||
public String ObjectField(int n, String name) {
|
||||
|
@@ -171,9 +171,9 @@
|
||||
#define JSONMAX 10 // JSON Default max grp size
|
||||
|
||||
extern "C" {
|
||||
char version[]= "Version 1.04.0006 May 08, 2016";
|
||||
char version[]= "Version 1.04.0008 August 10, 2016";
|
||||
#if defined(__WIN__)
|
||||
char compver[]= "Version 1.04.0006 " __DATE__ " " __TIME__;
|
||||
char compver[]= "Version 1.04.0008 " __DATE__ " " __TIME__;
|
||||
char slash= '\\';
|
||||
#else // !__WIN__
|
||||
char slash= '/';
|
||||
@@ -6935,7 +6935,7 @@ maria_declare_plugin(connect)
|
||||
0x0104, /* version number (1.04) */
|
||||
NULL, /* status variables */
|
||||
connect_system_variables, /* system variables */
|
||||
"1.04.0006", /* string version */
|
||||
"1.04.0008", /* string version */
|
||||
MariaDB_PLUGIN_MATURITY_GAMMA /* maturity */
|
||||
}
|
||||
maria_declare_plugin_end;
|
||||
|
@@ -59,6 +59,7 @@ extern "C" HINSTANCE s_hModule; // Saved module handle
|
||||
#define nullptr 0
|
||||
#endif // !__WIN__
|
||||
|
||||
TYPCONV GetTypeConv();
|
||||
int GetConvSize();
|
||||
extern char *JvmPath; // The connect_jvm_path global variable value
|
||||
extern char *ClassPath; // The connect_class_path global variable value
|
||||
@@ -121,6 +122,9 @@ int TranslateJDBCType(int stp, char *tn, int prec, int& len, char& v)
|
||||
|
||||
switch (stp) {
|
||||
case -1: // LONGVARCHAR
|
||||
if (GetTypeConv() != TPC_YES)
|
||||
return TYPE_ERROR;
|
||||
else
|
||||
len = MY_MIN(abs(len), GetConvSize());
|
||||
case 12: // VARCHAR
|
||||
v = 'V';
|
||||
|
@@ -53,6 +53,7 @@
|
||||
extern "C" HINSTANCE s_hModule; // Saved module handle
|
||||
#endif // __WIN__
|
||||
|
||||
TYPCONV GetTypeConv();
|
||||
int GetConvSize();
|
||||
|
||||
/***********************************************************************/
|
||||
@@ -135,9 +136,13 @@ int TranslateSQLType(int stp, int prec, int& len, char& v, bool& w)
|
||||
case SQL_WLONGVARCHAR: // (-10)
|
||||
w = true;
|
||||
case SQL_LONGVARCHAR: // (-1)
|
||||
if (GetTypeConv() == TPC_YES) {
|
||||
v = 'V';
|
||||
type = TYPE_STRING;
|
||||
len = MY_MIN(abs(len), GetConvSize());
|
||||
} else
|
||||
type = TYPE_ERROR;
|
||||
|
||||
break;
|
||||
case SQL_NUMERIC: // 2
|
||||
case SQL_DECIMAL: // 3
|
||||
|
@@ -522,9 +522,10 @@ bool TDBJDBC::MakeSQL(PGLOBAL g, bool cnt)
|
||||
if (Catalog && *Catalog)
|
||||
catp = Catalog;
|
||||
|
||||
if (tablep->GetSchema())
|
||||
schmp = (char*)tablep->GetSchema();
|
||||
else if (Schema && *Schema)
|
||||
//if (tablep->GetSchema())
|
||||
// schmp = (char*)tablep->GetSchema();
|
||||
//else
|
||||
if (Schema && *Schema)
|
||||
schmp = Schema;
|
||||
|
||||
if (catp) {
|
||||
@@ -606,9 +607,10 @@ bool TDBJDBC::MakeInsert(PGLOBAL g)
|
||||
if (catp)
|
||||
len += strlen(catp) + 1;
|
||||
|
||||
if (tablep->GetSchema())
|
||||
schmp = (char*)tablep->GetSchema();
|
||||
else if (Schema && *Schema)
|
||||
//if (tablep->GetSchema())
|
||||
// schmp = (char*)tablep->GetSchema();
|
||||
//else
|
||||
if (Schema && *Schema)
|
||||
schmp = Schema;
|
||||
|
||||
if (schmp)
|
||||
|
@@ -458,9 +458,14 @@ bool TDBODBC::MakeSQL(PGLOBAL g, bool cnt)
|
||||
if (Catalog && *Catalog)
|
||||
catp = Catalog;
|
||||
|
||||
if (tablep->GetSchema())
|
||||
schmp = (char*)tablep->GetSchema();
|
||||
else if (Schema && *Schema)
|
||||
// Following lines are commented because of MSDEV-10520
|
||||
// Indeed the schema in the tablep is the local table database and
|
||||
// is normally not related to the remote table database.
|
||||
// TODO: Try to remember why this was done and if it was useful in some case.
|
||||
//if (tablep->GetSchema())
|
||||
// schmp = (char*)tablep->GetSchema();
|
||||
//else
|
||||
if (Schema && *Schema)
|
||||
schmp = Schema;
|
||||
|
||||
if (catp) {
|
||||
@@ -541,9 +546,10 @@ bool TDBODBC::MakeInsert(PGLOBAL g)
|
||||
if (catp)
|
||||
len += strlen(catp) + 1;
|
||||
|
||||
if (tablep->GetSchema())
|
||||
schmp = (char*)tablep->GetSchema();
|
||||
else if (Schema && *Schema)
|
||||
//if (tablep->GetSchema())
|
||||
// schmp = (char*)tablep->GetSchema();
|
||||
//else
|
||||
if (Schema && *Schema)
|
||||
schmp = Schema;
|
||||
|
||||
if (schmp)
|
||||
|
@@ -1198,7 +1198,7 @@ bool XINDEX::MapInit(PGLOBAL g)
|
||||
const char *ftype;
|
||||
BYTE *mbase;
|
||||
char fn[_MAX_PATH];
|
||||
int *nv, k, n, id = -1;
|
||||
int *nv, nv0, k, n, id = -1;
|
||||
bool estim;
|
||||
PCOL colp;
|
||||
PXCOL prev = NULL, kcp = NULL;
|
||||
@@ -1288,25 +1288,26 @@ bool XINDEX::MapInit(PGLOBAL g)
|
||||
if (nv[0] >= MAX_INDX) {
|
||||
// New index format
|
||||
Srtd = nv[7] != 0;
|
||||
nv[0] -= MAX_INDX;
|
||||
nv0 = nv[0] - MAX_INDX;
|
||||
mbase += NZ * sizeof(int);
|
||||
} else {
|
||||
Srtd = false;
|
||||
mbase += (NZ - 1) * sizeof(int);
|
||||
nv0 = nv[0];
|
||||
} // endif nv
|
||||
|
||||
if (trace)
|
||||
htrc("nv=%d %d %d %d %d %d %d %d\n",
|
||||
nv[0], nv[1], nv[2], nv[3], nv[4], nv[5], nv[6], Srtd);
|
||||
nv0, nv[1], nv[2], nv[3], nv[4], nv[5], nv[6], Srtd);
|
||||
|
||||
// The test on ID was suppressed because MariaDB can change an index ID
|
||||
// when other indexes are added or deleted
|
||||
if (/*nv[0] != ID ||*/ nv[1] != Nk) {
|
||||
if (/*nv0 != ID ||*/ nv[1] != Nk) {
|
||||
// Not this index
|
||||
sprintf(g->Message, MSG(BAD_INDEX_FILE), fn);
|
||||
|
||||
if (trace)
|
||||
htrc("nv[0]=%d ID=%d nv[1]=%d Nk=%d\n", nv[0], ID, nv[1], Nk);
|
||||
htrc("nv0=%d ID=%d nv[1]=%d Nk=%d\n", nv0, ID, nv[1], Nk);
|
||||
|
||||
goto err;
|
||||
} // endif nv
|
||||
|
Reference in New Issue
Block a user