Commit 2195f5dc authored by Olivier Bertrand's avatar Olivier Bertrand

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
parent 9d6677b5
......@@ -58,13 +58,15 @@ void CloseXMLFile(PGLOBAL g, PFBLOCK fp, bool all)
if (xp && xp->Count > 1 && !all) {
xp->Count--;
} else if (xp && xp->Count > 0) {
try {
try {
if (xp->Docp)
xp->Docp->Release();
} catch(_com_error e) {
sprintf(g->Message, "%s %s", MSG(COM_ERROR), e.Description());
} catch(...) {}
} catch(_com_error e) {
char *p = _com_util::ConvertBSTRToString(e.Description());
sprintf(g->Message, "%s %s", MSG(COM_ERROR), p);
delete[] p;
} catch(...) {}
CoUninitialize();
xp->Count = 0;
......
......@@ -59,7 +59,7 @@
#define NO_IVAL -95684275 /* Used by GetIntegerOption */
#define VMLANG 370 /* Size of olf VM lang blocks */
#define MAX_JUMP 24 /* Maximum jump level number */
#define MAX_STR 1024 /* Maximum string length */
#define MAX_STR 4160 /* Maximum message length */
#define STR_SIZE 501 /* Length of char strings. */
#define STD_INPUT 0 /* Standard language input */
#define STD_OUTPUT 1 /* Standard language output */
......
......@@ -4655,7 +4655,9 @@ int ha_connect::external_lock(THD *thd, int lock_type)
push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
0, g->Message);
rc= 0;
} // endif MakeIndex
//my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
//rc= HA_ERR_INTERNAL_ERROR;
} // endif MakeIndex
} else if (tdbp->GetDef()->Indexable() == 3) {
if (CheckVirtualIndex(NULL)) {
......@@ -4676,9 +4678,12 @@ int ha_connect::external_lock(THD *thd, int lock_type)
// Make it a warning to avoid crash
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
rc= 0;
} // endif Close
//my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
//rc = HA_ERR_INTERNAL_ERROR;
} // endif Close
locked= 0;
// m_lock_type= lock_type;
xmod= MODE_ANY; // For info commands
DBUG_RETURN(rc);
} // endif MODE_ANY
......
......@@ -1455,7 +1455,7 @@ static my_bool CheckMemory(PGLOBAL g, UDF_INIT *initid, UDF_ARGS *args, uint n,
free(g->Sarea);
if (!(g->Sarea = PlugAllocMem(g, ml))) {
char errmsg[256];
char errmsg[MAX_STR];
sprintf(errmsg, MSG(WORK_AREA), g->Message);
strcpy(g->Message, errmsg);
......
......@@ -1188,7 +1188,7 @@ void ODBConn::AllocConnect(DWORD Options)
#if defined(_DEBUG)
if (Options & traceSQL) {
SQLSetConnectOption(m_hdbc, SQL_OPT_TRACEFILE, (DWORD)"xodbc.out");
SQLSetConnectOption(m_hdbc, SQL_OPT_TRACEFILE, (SQLULEN)"xodbc.out");
SQLSetConnectOption(m_hdbc, SQL_OPT_TRACE, 1);
} // endif
#endif // _DEBUG
......@@ -1211,7 +1211,7 @@ void ODBConn::AllocConnect(DWORD Options)
// Turn on cursor lib support
if (Options & useCursorLib)
rc = SQLSetConnectOption(m_hdbc, SQL_ODBC_CURSORS, SQL_CUR_USE_ODBC);
rc = SQLSetConnectOption(m_hdbc, SQL_ODBC_CURSORS, SQL_CUR_USE_DRIVER);
return;
} // end of AllocConnect
......
......@@ -445,7 +445,7 @@ char *ExtractFromPath(PGLOBAL g, char *pBuff, char *FileName, OPVAL op)
static bool PlugCheckPattern(PGLOBAL g, LPCSTR string, LPCSTR pat)
{
if (pat && strlen(pat)) {
// This leaves 512 bytes (MAX_STR / 2) for each components
// This leaves 2048 bytes (MAX_STR / 2) for each components
LPSTR name = g->Message + MAX_STR / 2;
strlwr(strcpy(name, string));
......@@ -1253,7 +1253,7 @@ void *PlgDBalloc(PGLOBAL g, void *area, MBLOCK& mp)
// in the area, do allocate from virtual storage.
#if defined(__WIN__)
if (mp.Size >= BIGMEM)
mp.Memp = VirtualAlloc(NULL, mp.Size, MEM_COMMIT, PAGE_READWRITE);
mp.Memp = VirtualAlloc(NULL, mp.Size, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
else
#endif
mp.Memp = malloc(mp.Size);
......
......@@ -164,7 +164,7 @@ PGLOBAL PlugInit(LPCSTR Language, uint worksize)
/* Allocate the main work segment. */
/*******************************************************************/
if (worksize && !(g->Sarea = PlugAllocMem(g, worksize))) {
char errmsg[256];
char errmsg[MAX_STR];
sprintf(errmsg, MSG(WORK_AREA), g->Message);
strcpy(g->Message, errmsg);
g->Sarea_Size = 0;
......
......@@ -125,7 +125,7 @@ bool MYSQLDEF::GetServerInfo(PGLOBAL g, const char *server_name)
} // endif server
DBUG_PRINT("info", ("get_server_by_name returned server at %lx",
(long unsigned int) server));
(size_t) server));
// TODO: We need to examine which of these can really be NULL
Hostname = PlugDup(g, server->host);
......
......@@ -742,7 +742,14 @@ void PRXCOL::ReadColumn(PGLOBAL g)
if (Nullable)
Value->SetNull(Value->IsNull());
} // endif Colp
} else {
Value->Reset();
// Set null when applicable
if (Nullable)
Value->SetNull(true);
} // endif Colp
} // end of ReadColumn
......
......@@ -174,7 +174,7 @@ bool VCTDEF::Erase(char *filename)
/***********************************************************************/
int VCTDEF::MakeFnPattern(char *fpat)
{
char pat[8];
char pat[16];
#if defined(__WIN__)
char drive[_MAX_DRIVE];
#else
......
......@@ -3032,7 +3032,7 @@ bool KXYCOL::Init(PGLOBAL g, PCOL colp, int n, bool sm, int kln)
return true;
Klen = Valp->GetClen();
Keys.Size = n * Klen;
Keys.Size = (size_t)n * (size_t)Klen;
if (!PlgDBalloc(g, NULL, Keys)) {
sprintf(g->Message, MSG(KEY_ALLOC_ERROR), Klen, n);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment