diff options
author | Olivier Bertrand <bertrandop@gmail.com> | 2016-08-10 18:27:31 +0200 |
---|---|---|
committer | Olivier Bertrand <bertrandop@gmail.com> | 2016-08-10 18:27:31 +0200 |
commit | a2934d2710d24c20ec205007bdad2495a492ad83 (patch) | |
tree | 4b9a211f0bdfb8a79b747f760d5d34e9e2c765a0 /storage | |
parent | ec725089cfde2886d74c7939c64ad6e2266dc853 (diff) | |
download | mariadb-git-a2934d2710d24c20ec205007bdad2495a492ad83.tar.gz |
- 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
Diffstat (limited to 'storage')
-rw-r--r-- | storage/connect/JdbcInterface.java | 21 | ||||
-rw-r--r-- | storage/connect/ha_connect.cc | 6 | ||||
-rw-r--r-- | storage/connect/jdbconn.cpp | 6 | ||||
-rw-r--r-- | storage/connect/odbconn.cpp | 11 | ||||
-rw-r--r-- | storage/connect/tabjdbc.cpp | 14 | ||||
-rw-r--r-- | storage/connect/tabodbc.cpp | 18 | ||||
-rwxr-xr-x | storage/connect/xindex.cpp | 11 |
7 files changed, 54 insertions, 33 deletions
diff --git a/storage/connect/JdbcInterface.java b/storage/connect/JdbcInterface.java index 793d29936c8..f765052915d 100644 --- a/storage/connect/JdbcInterface.java +++ b/storage/connect/JdbcInterface.java @@ -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) { diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc index 85380860652..ea6fb1b08c1 100644 --- a/storage/connect/ha_connect.cc +++ b/storage/connect/ha_connect.cc @@ -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; diff --git a/storage/connect/jdbconn.cpp b/storage/connect/jdbconn.cpp index d3e573e692c..3b8de3e975b 100644 --- a/storage/connect/jdbconn.cpp +++ b/storage/connect/jdbconn.cpp @@ -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,7 +122,10 @@ int TranslateJDBCType(int stp, char *tn, int prec, int& len, char& v) switch (stp) { 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 v = 'V'; case 1: // CHAR diff --git a/storage/connect/odbconn.cpp b/storage/connect/odbconn.cpp index 863d3320f7f..7320f4cc1d9 100644 --- a/storage/connect/odbconn.cpp +++ b/storage/connect/odbconn.cpp @@ -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) - v = 'V'; - type = TYPE_STRING; - len = MY_MIN(abs(len), GetConvSize()); + 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 diff --git a/storage/connect/tabjdbc.cpp b/storage/connect/tabjdbc.cpp index 06a2c025827..86fd831b262 100644 --- a/storage/connect/tabjdbc.cpp +++ b/storage/connect/tabjdbc.cpp @@ -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) diff --git a/storage/connect/tabodbc.cpp b/storage/connect/tabodbc.cpp index e76d9c46bd3..f3ffc99ac15 100644 --- a/storage/connect/tabodbc.cpp +++ b/storage/connect/tabodbc.cpp @@ -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) diff --git a/storage/connect/xindex.cpp b/storage/connect/xindex.cpp index 69aa7e2c20e..56312630278 100755 --- a/storage/connect/xindex.cpp +++ b/storage/connect/xindex.cpp @@ -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 |