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;
|
return false;
|
||||||
} // end of BooleanField
|
} // end of BooleanField
|
||||||
|
|
||||||
public Date DateField(int n, String name) {
|
public int DateField(int n, String name) {
|
||||||
if (rs == null) {
|
if (rs == null) {
|
||||||
System.out.println("No result set");
|
System.out.println("No result set");
|
||||||
} else try {
|
} 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) {
|
} catch (SQLException se) {
|
||||||
SetErrmsg(se);
|
SetErrmsg(se);
|
||||||
} //end try/catch
|
} //end try/catch
|
||||||
|
|
||||||
return null;
|
return 0;
|
||||||
} // end of DateField
|
} // end of DateField
|
||||||
|
|
||||||
public Time TimeField(int n, String name) {
|
public int TimeField(int n, String name) {
|
||||||
if (rs == null) {
|
if (rs == null) {
|
||||||
System.out.println("No result set");
|
System.out.println("No result set");
|
||||||
} else try {
|
} 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) {
|
} catch (SQLException se) {
|
||||||
SetErrmsg(se);
|
SetErrmsg(se);
|
||||||
} //end try/catch
|
} //end try/catch
|
||||||
|
|
||||||
return null;
|
return 0;
|
||||||
} // end of TimeField
|
} // end of TimeField
|
||||||
|
|
||||||
public Timestamp TimestampField(int n, String name) {
|
public int TimestampField(int n, String name) {
|
||||||
if (rs == null) {
|
if (rs == null) {
|
||||||
System.out.println("No result set");
|
System.out.println("No result set");
|
||||||
} else try {
|
} 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) {
|
} catch (SQLException se) {
|
||||||
SetErrmsg(se);
|
SetErrmsg(se);
|
||||||
} //end try/catch
|
} //end try/catch
|
||||||
|
|
||||||
return null;
|
return 0;
|
||||||
} // end of TimestampField
|
} // end of TimestampField
|
||||||
|
|
||||||
public String ObjectField(int n, String name) {
|
public String ObjectField(int n, String name) {
|
||||||
|
@@ -171,9 +171,9 @@
|
|||||||
#define JSONMAX 10 // JSON Default max grp size
|
#define JSONMAX 10 // JSON Default max grp size
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
char version[]= "Version 1.04.0006 May 08, 2016";
|
char version[]= "Version 1.04.0008 August 10, 2016";
|
||||||
#if defined(__WIN__)
|
#if defined(__WIN__)
|
||||||
char compver[]= "Version 1.04.0006 " __DATE__ " " __TIME__;
|
char compver[]= "Version 1.04.0008 " __DATE__ " " __TIME__;
|
||||||
char slash= '\\';
|
char slash= '\\';
|
||||||
#else // !__WIN__
|
#else // !__WIN__
|
||||||
char slash= '/';
|
char slash= '/';
|
||||||
@@ -6935,7 +6935,7 @@ maria_declare_plugin(connect)
|
|||||||
0x0104, /* version number (1.04) */
|
0x0104, /* version number (1.04) */
|
||||||
NULL, /* status variables */
|
NULL, /* status variables */
|
||||||
connect_system_variables, /* system variables */
|
connect_system_variables, /* system variables */
|
||||||
"1.04.0006", /* string version */
|
"1.04.0008", /* string version */
|
||||||
MariaDB_PLUGIN_MATURITY_GAMMA /* maturity */
|
MariaDB_PLUGIN_MATURITY_GAMMA /* maturity */
|
||||||
}
|
}
|
||||||
maria_declare_plugin_end;
|
maria_declare_plugin_end;
|
||||||
|
@@ -59,6 +59,7 @@ extern "C" HINSTANCE s_hModule; // Saved module handle
|
|||||||
#define nullptr 0
|
#define nullptr 0
|
||||||
#endif // !__WIN__
|
#endif // !__WIN__
|
||||||
|
|
||||||
|
TYPCONV GetTypeConv();
|
||||||
int GetConvSize();
|
int GetConvSize();
|
||||||
extern char *JvmPath; // The connect_jvm_path global variable value
|
extern char *JvmPath; // The connect_jvm_path global variable value
|
||||||
extern char *ClassPath; // The connect_class_path global variable value
|
extern char *ClassPath; // The connect_class_path global variable value
|
||||||
@@ -121,7 +122,10 @@ int TranslateJDBCType(int stp, char *tn, int prec, int& len, char& v)
|
|||||||
|
|
||||||
switch (stp) {
|
switch (stp) {
|
||||||
case -1: // LONGVARCHAR
|
case -1: // LONGVARCHAR
|
||||||
len = MY_MIN(abs(len), GetConvSize());
|
if (GetTypeConv() != TPC_YES)
|
||||||
|
return TYPE_ERROR;
|
||||||
|
else
|
||||||
|
len = MY_MIN(abs(len), GetConvSize());
|
||||||
case 12: // VARCHAR
|
case 12: // VARCHAR
|
||||||
v = 'V';
|
v = 'V';
|
||||||
case 1: // CHAR
|
case 1: // CHAR
|
||||||
|
@@ -53,6 +53,7 @@
|
|||||||
extern "C" HINSTANCE s_hModule; // Saved module handle
|
extern "C" HINSTANCE s_hModule; // Saved module handle
|
||||||
#endif // __WIN__
|
#endif // __WIN__
|
||||||
|
|
||||||
|
TYPCONV GetTypeConv();
|
||||||
int GetConvSize();
|
int GetConvSize();
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@@ -135,9 +136,13 @@ int TranslateSQLType(int stp, int prec, int& len, char& v, bool& w)
|
|||||||
case SQL_WLONGVARCHAR: // (-10)
|
case SQL_WLONGVARCHAR: // (-10)
|
||||||
w = true;
|
w = true;
|
||||||
case SQL_LONGVARCHAR: // (-1)
|
case SQL_LONGVARCHAR: // (-1)
|
||||||
v = 'V';
|
if (GetTypeConv() == TPC_YES) {
|
||||||
type = TYPE_STRING;
|
v = 'V';
|
||||||
len = MY_MIN(abs(len), GetConvSize());
|
type = TYPE_STRING;
|
||||||
|
len = MY_MIN(abs(len), GetConvSize());
|
||||||
|
} else
|
||||||
|
type = TYPE_ERROR;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case SQL_NUMERIC: // 2
|
case SQL_NUMERIC: // 2
|
||||||
case SQL_DECIMAL: // 3
|
case SQL_DECIMAL: // 3
|
||||||
|
@@ -522,9 +522,10 @@ bool TDBJDBC::MakeSQL(PGLOBAL g, bool cnt)
|
|||||||
if (Catalog && *Catalog)
|
if (Catalog && *Catalog)
|
||||||
catp = Catalog;
|
catp = Catalog;
|
||||||
|
|
||||||
if (tablep->GetSchema())
|
//if (tablep->GetSchema())
|
||||||
schmp = (char*)tablep->GetSchema();
|
// schmp = (char*)tablep->GetSchema();
|
||||||
else if (Schema && *Schema)
|
//else
|
||||||
|
if (Schema && *Schema)
|
||||||
schmp = Schema;
|
schmp = Schema;
|
||||||
|
|
||||||
if (catp) {
|
if (catp) {
|
||||||
@@ -606,9 +607,10 @@ bool TDBJDBC::MakeInsert(PGLOBAL g)
|
|||||||
if (catp)
|
if (catp)
|
||||||
len += strlen(catp) + 1;
|
len += strlen(catp) + 1;
|
||||||
|
|
||||||
if (tablep->GetSchema())
|
//if (tablep->GetSchema())
|
||||||
schmp = (char*)tablep->GetSchema();
|
// schmp = (char*)tablep->GetSchema();
|
||||||
else if (Schema && *Schema)
|
//else
|
||||||
|
if (Schema && *Schema)
|
||||||
schmp = Schema;
|
schmp = Schema;
|
||||||
|
|
||||||
if (schmp)
|
if (schmp)
|
||||||
|
@@ -458,9 +458,14 @@ bool TDBODBC::MakeSQL(PGLOBAL g, bool cnt)
|
|||||||
if (Catalog && *Catalog)
|
if (Catalog && *Catalog)
|
||||||
catp = Catalog;
|
catp = Catalog;
|
||||||
|
|
||||||
if (tablep->GetSchema())
|
// Following lines are commented because of MSDEV-10520
|
||||||
schmp = (char*)tablep->GetSchema();
|
// Indeed the schema in the tablep is the local table database and
|
||||||
else if (Schema && *Schema)
|
// 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;
|
schmp = Schema;
|
||||||
|
|
||||||
if (catp) {
|
if (catp) {
|
||||||
@@ -541,9 +546,10 @@ bool TDBODBC::MakeInsert(PGLOBAL g)
|
|||||||
if (catp)
|
if (catp)
|
||||||
len += strlen(catp) + 1;
|
len += strlen(catp) + 1;
|
||||||
|
|
||||||
if (tablep->GetSchema())
|
//if (tablep->GetSchema())
|
||||||
schmp = (char*)tablep->GetSchema();
|
// schmp = (char*)tablep->GetSchema();
|
||||||
else if (Schema && *Schema)
|
//else
|
||||||
|
if (Schema && *Schema)
|
||||||
schmp = Schema;
|
schmp = Schema;
|
||||||
|
|
||||||
if (schmp)
|
if (schmp)
|
||||||
|
@@ -1198,7 +1198,7 @@ bool XINDEX::MapInit(PGLOBAL g)
|
|||||||
const char *ftype;
|
const char *ftype;
|
||||||
BYTE *mbase;
|
BYTE *mbase;
|
||||||
char fn[_MAX_PATH];
|
char fn[_MAX_PATH];
|
||||||
int *nv, k, n, id = -1;
|
int *nv, nv0, k, n, id = -1;
|
||||||
bool estim;
|
bool estim;
|
||||||
PCOL colp;
|
PCOL colp;
|
||||||
PXCOL prev = NULL, kcp = NULL;
|
PXCOL prev = NULL, kcp = NULL;
|
||||||
@@ -1288,25 +1288,26 @@ bool XINDEX::MapInit(PGLOBAL g)
|
|||||||
if (nv[0] >= MAX_INDX) {
|
if (nv[0] >= MAX_INDX) {
|
||||||
// New index format
|
// New index format
|
||||||
Srtd = nv[7] != 0;
|
Srtd = nv[7] != 0;
|
||||||
nv[0] -= MAX_INDX;
|
nv0 = nv[0] - MAX_INDX;
|
||||||
mbase += NZ * sizeof(int);
|
mbase += NZ * sizeof(int);
|
||||||
} else {
|
} else {
|
||||||
Srtd = false;
|
Srtd = false;
|
||||||
mbase += (NZ - 1) * sizeof(int);
|
mbase += (NZ - 1) * sizeof(int);
|
||||||
|
nv0 = nv[0];
|
||||||
} // endif nv
|
} // endif nv
|
||||||
|
|
||||||
if (trace)
|
if (trace)
|
||||||
htrc("nv=%d %d %d %d %d %d %d %d\n",
|
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
|
// The test on ID was suppressed because MariaDB can change an index ID
|
||||||
// when other indexes are added or deleted
|
// when other indexes are added or deleted
|
||||||
if (/*nv[0] != ID ||*/ nv[1] != Nk) {
|
if (/*nv0 != ID ||*/ nv[1] != Nk) {
|
||||||
// Not this index
|
// Not this index
|
||||||
sprintf(g->Message, MSG(BAD_INDEX_FILE), fn);
|
sprintf(g->Message, MSG(BAD_INDEX_FILE), fn);
|
||||||
|
|
||||||
if (trace)
|
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;
|
goto err;
|
||||||
} // endif nv
|
} // endif nv
|
||||||
|
Reference in New Issue
Block a user