diff options
author | Olivier Bertrand <bertrandop@gmail.com> | 2017-05-11 21:57:21 +0200 |
---|---|---|
committer | Olivier Bertrand <bertrandop@gmail.com> | 2017-05-11 21:57:21 +0200 |
commit | 1c88b9a8d3200bdf554ece09316cacf2146877ee (patch) | |
tree | 9e19a4dcc5079412870b83bf7473b0cb8bf1670f /storage/connect/jdbconn.cpp | |
parent | 531698e0da307943dff5ee6830a241d6829345cd (diff) | |
download | mariadb-git-1c88b9a8d3200bdf554ece09316cacf2146877ee.tar.gz |
Fix wrong value of JSON column
When null and the column is NOT NULL the value was not reset.
modified: storage/connect/tabjson.cpp
Fix converting bstr_t string to set error message
modified: storage/connect/domdoc.cpp
Fix MDEV-12768: -Wformat-overflow compile warnings
modified: storage/connect/global.h
modified: storage/connect/jsonudf.cpp
modified: storage/connect/plugutil.cpp
modified: storage/connect/tabvct.cpp
Typo (in external_lock)
modified: storage/connect/ha_connect.cc
Remove some warnings
modified: storage/connect/odbconn.cpp
modified: storage/connect/tabmysql.cpp
Add MEM_RESERVE flag to virtualAlloc
modified: storage/connect/plgdbutl.cpp
Fix MDEV-12573:
Accept=1 may show incorrect value for NULL column in CONNECT TBL
modified: storage/connect/tabutil.cpp
Fix wrong setting of key size when greater than 2G
modified: storage/connect/xindex.cpp
Fixing MDEV-12149: compile errors on Windows with /Zc:strictStrings
Introduce typedef PCSZ and replace PSZ by it where it matters
All done on CONNECT but compile still fails because of an included system file
modified: storage/connect/array.cpp
modified: storage/connect/catalog.h
modified: storage/connect/colblk.cpp
modified: storage/connect/colblk.h
modified: storage/connect/connect.cc
modified: storage/connect/domdoc.cpp
modified: storage/connect/domdoc.h
modified: storage/connect/filamdbf.cpp
modified: storage/connect/filamdbf.h
modified: storage/connect/filamfix.cpp
modified: storage/connect/filamgz.cpp
modified: storage/connect/filamtxt.h
modified: storage/connect/filamvct.cpp
modified: storage/connect/filamvct.h
modified: storage/connect/filamzip.cpp
modified: storage/connect/filamzip.h
modified: storage/connect/ha_connect.cc
modified: storage/connect/ha_connect.h
modified: storage/connect/jdbccat.h
modified: storage/connect/jdbconn.cpp
modified: storage/connect/jdbconn.h
modified: storage/connect/json.cpp
modified: storage/connect/json.h
modified: storage/connect/jsonudf.cpp
modified: storage/connect/jsonudf.h
modified: storage/connect/libdoc.cpp
modified: storage/connect/macutil.cpp
modified: storage/connect/myconn.cpp
modified: storage/connect/myutil.cpp
modified: storage/connect/myutil.h
modified: storage/connect/odbccat.h
modified: storage/connect/odbconn.cpp
modified: storage/connect/odbconn.h
modified: storage/connect/os.h
modified: storage/connect/plgdbsem.h
modified: storage/connect/plgdbutl.cpp
modified: storage/connect/plgxml.cpp
modified: storage/connect/plgxml.h
modified: storage/connect/plugutil.cpp
modified: storage/connect/preparse.h
modified: storage/connect/reldef.cpp
modified: storage/connect/reldef.h
modified: storage/connect/tabdos.cpp
modified: storage/connect/tabdos.h
modified: storage/connect/tabext.cpp
modified: storage/connect/tabext.h
modified: storage/connect/tabfix.cpp
modified: storage/connect/tabfix.h
modified: storage/connect/tabfmt.cpp
modified: storage/connect/tabfmt.h
modified: storage/connect/tabjdbc.cpp
modified: storage/connect/tabjdbc.h
modified: storage/connect/tabjson.cpp
modified: storage/connect/tabjson.h
modified: storage/connect/table.cpp
modified: storage/connect/tabmac.cpp
modified: storage/connect/tabmul.cpp
modified: storage/connect/tabmul.h
modified: storage/connect/tabmysql.cpp
modified: storage/connect/tabmysql.h
modified: storage/connect/tabodbc.cpp
modified: storage/connect/tabodbc.h
modified: storage/connect/tabpivot.cpp
modified: storage/connect/tabpivot.h
modified: storage/connect/tabsys.cpp
modified: storage/connect/tabsys.h
modified: storage/connect/tabutil.cpp
modified: storage/connect/tabutil.h
modified: storage/connect/tabvir.cpp
modified: storage/connect/tabvir.h
modified: storage/connect/tabwmi.cpp
modified: storage/connect/tabwmi.h
modified: storage/connect/tabxml.cpp
modified: storage/connect/tabxml.h
modified: storage/connect/tabzip.cpp
modified: storage/connect/tabzip.h
modified: storage/connect/valblk.cpp
modified: storage/connect/valblk.h
modified: storage/connect/value.cpp
modified: storage/connect/value.h
modified: storage/connect/xindex.cpp
modified: storage/connect/xobject.cpp
modified: storage/connect/xobject.h
modified: storage/connect/xtable.h
Fix MDEV-12603 Insert replaces values in ZIP file
modified: storage/connect/filamzip.cpp
modified: storage/connect/filamzip.h
Fix MDEV-12686 Handle null in json
Fix MDEV-12688 Insert does not handle type TINYINT
modified: storage/connect/json.cpp
modified: storage/connect/tabjson.cpp
Fix MDEV-12653 Cannot add index for ZIP CONNECT table
modified: storage/connect/filamzip.cpp
modified: storage/connect/ha_connect.cc
modified: storage/connect/tabdos.cpp
modified: storage/connect/tabfmt.cpp
modified: storage/connect/tabjson.cpp
modified: storage/connect/xindex.cpp
Diffstat (limited to 'storage/connect/jdbconn.cpp')
-rw-r--r-- | storage/connect/jdbconn.cpp | 42 |
1 files changed, 15 insertions, 27 deletions
diff --git a/storage/connect/jdbconn.cpp b/storage/connect/jdbconn.cpp index e8a260c8be9..f162a7ae645 100644 --- a/storage/connect/jdbconn.cpp +++ b/storage/connect/jdbconn.cpp @@ -189,8 +189,8 @@ int TranslateJDBCType(int stp, char *tn, int prec, int& len, char& v) /***********************************************************************/ /* Allocate the structure used to refer to the result set. */ /***********************************************************************/ -static JCATPARM *AllocCatInfo(PGLOBAL g, JCATINFO fid, char *db, - char *tab, PQRYRES qrp) +static JCATPARM *AllocCatInfo(PGLOBAL g, JCATINFO fid, PCSZ db, + PCSZ tab, PQRYRES qrp) { JCATPARM *cap; @@ -213,7 +213,7 @@ static JCATPARM *AllocCatInfo(PGLOBAL g, JCATINFO fid, char *db, /* JDBCColumns: constructs the result blocks containing all columns */ /* of a JDBC table that will be retrieved by GetData commands. */ /***********************************************************************/ -PQRYRES JDBCColumns(PGLOBAL g, char *db, char *table, char *colpat, +PQRYRES JDBCColumns(PGLOBAL g, PCSZ db, PCSZ table, PCSZ colpat, int maxres, bool info, PJPARM sjp) { int buftyp[] = {TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_STRING, @@ -316,7 +316,7 @@ PQRYRES JDBCColumns(PGLOBAL g, char *db, char *table, char *colpat, /* JDBCSrcCols: constructs the result blocks containing the */ /* description of all the columns of a Srcdef option. */ /**************************************************************************/ -PQRYRES JDBCSrcCols(PGLOBAL g, char *src, PJPARM sjp) +PQRYRES JDBCSrcCols(PGLOBAL g, PCSZ src, PJPARM sjp) { char *sqry; PQRYRES qrp; @@ -330,7 +330,7 @@ PQRYRES JDBCSrcCols(PGLOBAL g, char *src, PJPARM sjp) sqry = (char*)PlugSubAlloc(g, NULL, strlen(src) + 2); sprintf(sqry, src, "1=1"); // dummy where clause } else - sqry = src; + sqry = (char*)src; qrp = jcp->GetMetaData(g, sqry); jcp->Close(); @@ -341,7 +341,7 @@ PQRYRES JDBCSrcCols(PGLOBAL g, char *src, PJPARM sjp) /* JDBCTables: constructs the result blocks containing all tables in */ /* an JDBC database that will be retrieved by GetData commands. */ /**************************************************************************/ -PQRYRES JDBCTables(PGLOBAL g, char *db, char *tabpat, char *tabtyp, +PQRYRES JDBCTables(PGLOBAL g, PCSZ db, PCSZ tabpat, PCSZ tabtyp, int maxres, bool info, PJPARM sjp) { int buftyp[] = {TYPE_STRING, TYPE_STRING, TYPE_STRING, @@ -1059,7 +1059,7 @@ int JDBConn::Open(PJPARM sop) /***********************************************************************/ /* Execute an SQL command. */ /***********************************************************************/ -int JDBConn::ExecSQLcommand(char *sql) +int JDBConn::ExecSQLcommand(PCSZ sql) { int rc; jint n; @@ -1142,7 +1142,7 @@ int JDBConn::Fetch(int pos) /***********************************************************************/ /* Restart from beginning of result set */ /***********************************************************************/ -int JDBConn::Rewind(char *sql) +int JDBConn::Rewind(PCSZ sql) { int rbuf = -1; @@ -1200,11 +1200,7 @@ void JDBConn::SetColumnValue(int rank, PSZ name, PVAL val) if (rank == 0) if (!name || (jn = env->NewStringUTF(name)) == nullptr) { sprintf(g->Message, "Fail to allocate jstring %s", SVP(name)); -#if defined(USE_TRY) throw TYPE_AM_JDBC; -#else // !USE_TRY - longjmp(g->jumper[g->jump_level], TYPE_AM_JDBC); -#endif // !USE_TRY } // endif name // Returns 666 is case of error @@ -1212,11 +1208,7 @@ void JDBConn::SetColumnValue(int rank, PSZ name, PVAL val) if (Check((ctyp == 666) ? -1 : 1)) { sprintf(g->Message, "Getting ctyp: %s", Msg); -#if defined(USE_TRY) throw TYPE_AM_JDBC; -#else // !USE_TRY - longjmp(g->jumper[g->jump_level], TYPE_AM_JDBC); -#endif // !USE_TRY } // endif Check if (val->GetNullable()) @@ -1235,7 +1227,7 @@ void JDBConn::SetColumnValue(int rank, PSZ name, PVAL val) case 12: // VARCHAR case -1: // LONGVARCHAR case 1: // CHAR - case 3: // DECIMAL + case 3: // DECIMAL if (jb && ctyp != 3) cn = (jstring)jb; else if (!gmID(g, chrfldid, "StringField", "(ILjava/lang/String;)Ljava/lang/String;")) @@ -1323,11 +1315,7 @@ void JDBConn::SetColumnValue(int rank, PSZ name, PVAL val) env->DeleteLocalRef(jn); sprintf(g->Message, "SetColumnValue: %s rank=%d ctyp=%d", Msg, rank, (int)ctyp); -#if defined(USE_TRY) throw TYPE_AM_JDBC; -#else // !USE_TRY - longjmp(g->jumper[g->jump_level], TYPE_AM_JDBC); -#endif // !USE_TRY } // endif Check if (rank == 0) @@ -1338,7 +1326,7 @@ void JDBConn::SetColumnValue(int rank, PSZ name, PVAL val) /***********************************************************************/ /* Prepare an SQL statement for insert. */ /***********************************************************************/ -bool JDBConn::PrepareSQL(char *sql) +bool JDBConn::PrepareSQL(PCSZ sql) { bool b = true; PGLOBAL& g = m_G; @@ -1361,7 +1349,7 @@ bool JDBConn::PrepareSQL(char *sql) /***********************************************************************/ /* Execute an SQL query that returns a result set. */ /***********************************************************************/ -int JDBConn::ExecuteQuery(char *sql) +int JDBConn::ExecuteQuery(PCSZ sql) { int rc = RC_FX; jint ncol; @@ -1389,7 +1377,7 @@ int JDBConn::ExecuteQuery(char *sql) /***********************************************************************/ /* Execute an SQL query and get the affected rows. */ /***********************************************************************/ -int JDBConn::ExecuteUpdate(char *sql) +int JDBConn::ExecuteUpdate(PCSZ sql) { int rc = RC_FX; jint n; @@ -1417,7 +1405,7 @@ int JDBConn::ExecuteUpdate(char *sql) /***********************************************************************/ /* Get the number of lines of the result set. */ /***********************************************************************/ -int JDBConn::GetResultSize(char *sql, JDBCCOL *colp) +int JDBConn::GetResultSize(PCSZ sql, JDBCCOL *colp) { int rc, n = 0; @@ -1655,7 +1643,7 @@ bool JDBConn::SetParam(JDBCCOL *colp) /* GetMetaData: constructs the result blocks containing the */ /* description of all the columns of an SQL command. */ /**************************************************************************/ - PQRYRES JDBConn::GetMetaData(PGLOBAL g, char *src) + PQRYRES JDBConn::GetMetaData(PGLOBAL g, PCSZ src) { static int buftyp[] = {TYPE_STRING, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT}; @@ -1857,7 +1845,7 @@ bool JDBConn::SetParam(JDBCCOL *colp) PGLOBAL& g = m_G; // void *buffer; int i, ncol; - PSZ fnc = "Unknown"; + PCSZ fnc = "Unknown"; uint n; short len, tp; int crow = 0; |