1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00

- Remove warning on not used tabtyp variable in connect_assisted_discovery

modified:   storage/connect/ha_connect.cc

- Fix a bug causing CONNECT to loop when expanding a JSON column
  when the expanded column value is null or void array.
- Adding the FullArray option to JSON tables.
- Skipping expanded JSON lines when the expanded column value is null.
  modified:   storage/connect/connect.cc
  modified:   storage/connect/tabdos.h
  modified:   storage/connect/tabjson.cpp
  modified:   storage/connect/tabjson.h

- Fix MDEV-13353 No file privilege for ODBC, JDBC, MONGO, MAC, WMI file types.
  modified:   storage/connect/ha_connect.cc

- Make some Json UDFs  to accept a non JSON item as 1st parameter.
  modified:   storage/connect/json.cpp
  modified:   storage/connect/json.h
  modified:   storage/connect/jsonudf.cpp
  modified:   storage/connect/jsonudf.h

- Update Json UDF tests to cope with above changes.
  modified:   storage/connect/mysql-test/connect/r/json_udf.result
  modified:   storage/connect/mysql-test/connect/r/json_udf_bin.result
  modified:   storage/connect/mysql-test/connect/r/vcol.result
  modified:   storage/connect/mysql-test/connect/t/json_udf.test
  modified:   storage/connect/mysql-test/connect/t/vcol.test

- Fix some compiler warning treated as error
  PlugSubAlloc no more exported because it does throw.
  modified:   storage/connect/global.h
  modified:   storage/connect/ha_connect.cc
  modified:   storage/connect/jsonudf.cpp
  modified:   storage/connect/tabjson.cpp
  modified:   storage/connect/tabjson.h

- Other files modified (?) when going back to wrong merge
  modified:   storage/connect/CMakeLists.txt
  modified:   storage/connect/array.cpp
  modified:   storage/connect/colblk.cpp
  modified:   storage/connect/connect.cc
  modified:   storage/connect/csort.cpp
  modified:   storage/connect/domdoc.cpp
  modified:   storage/connect/filamap.cpp
  modified:   storage/connect/filamgz.cpp
  modified:   storage/connect/filamtxt.cpp
  modified:   storage/connect/filamzip.cpp
  modified:   storage/connect/filter.cpp
  modified:   storage/connect/fmdlex.c
  modified:   storage/connect/jdbconn.cpp
  modified:   storage/connect/macutil.cpp
  modified:   storage/connect/myconn.cpp
  modified:   storage/connect/odbconn.cpp
  modified:   storage/connect/plgdbutl.cpp
  modified:   storage/connect/plugutil.cpp
  modified:   storage/connect/preparse.h
  modified:   storage/connect/rcmsg.c
  modified:   storage/connect/rcmsg.h
  modified:   storage/connect/reldef.cpp
  modified:   storage/connect/tabdos.cpp
  modified:   storage/connect/tabfmt.cpp
  modified:   storage/connect/tabmac.cpp
  modified:   storage/connect/tabmul.cpp
  modified:   storage/connect/tabmysql.cpp
  modified:   storage/connect/tabmysql.h
  modified:   storage/connect/tabodbc.cpp
  modified:   storage/connect/tabtbl.cpp
  modified:   storage/connect/tabxml.cpp
  modified:   storage/connect/value.cpp
  modified:   storage/connect/xobject.cpp
This commit is contained in:
Olivier Bertrand
2018-02-25 14:31:28 +01:00
parent 273233119c
commit 175ce0e7f5
46 changed files with 899 additions and 504 deletions

View File

@@ -45,34 +45,17 @@ add_definitions( -DHUGE_SUPPORT -DGZ_SUPPORT )
# OS specific C flags, definitions and source files.
#
IF(UNIX)
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
# Bar: -Wfatal-errors removed (does not present in gcc on solaris10)
if(WITH_WARNINGS)
add_definitions(-Wall -Wextra -Wmissing-declarations)
#message(STATUS "CONNECT: GCC: All warnings enabled")
else()
add_definitions(-Wall -Wmissing-declarations)
add_definitions(-Wno-write-strings)
add_definitions(-Wno-unused-variable)
# Bar: -Wno-unused-but-set-variables commented (does not present on sol10)
# add_definitions(-Wno-unused-but-set-variable)
add_definitions(-Wno-unused-value)
add_definitions(-Wno-unused-function)
add_definitions(-Wno-parentheses)
#add_definitions(-Wno-missing-declarations)
# Bar: -Wno-int-to-pointer-cast commended (does not present in gcc on sol10)
# add_definitions(-Wno-int-to-pointer-cast)
# Bar: -Wno-narrowing commented (does not present in gcc on solaris10)
# add_definitions(-Wno-narrowing)
# This switch is for pure C only:
# add_definitions(-Wno-implicit-function-declaration)
# These switches are for C++ only
# add_definitions(-Wno-reorder)
#message(STATUS "CONNECT: GCC: Some warnings disabled")
endif(WITH_WARNINGS)
endif()
MY_CHECK_AND_SET_COMPILER_FLAG("-Wall -Wmissing-declarations")
if(NOT WITH_WARNINGS)
MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-unused-function")
MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-unused-variable")
MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-unused-value")
MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-parentheses")
MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-strict-aliasing")
MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-misleading-indentation")
MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-format-truncation")
MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-implicit-fallthrough")
endif(NOT WITH_WARNINGS)
add_definitions( -DUNIX -DLINUX -DUBUNTU )
@@ -302,7 +285,7 @@ IF(CONNECT_WITH_MONGO)
C:/mongo-c-driver/lib
D:/mongo-c-driver/lib)
ENDIF(WIN32)
FIND_PACKAGE(libmongoc-1.0 1.7)
FIND_PACKAGE(libmongoc-1.0 1.7 QUIET)
IF (libmongoc-1.0_FOUND)
INCLUDE_DIRECTORIES(${MONGOC_INCLUDE_DIRS})
SET(MONGOC_LIBRARY ${MONGOC_LIBRARIES})
@@ -363,6 +346,23 @@ IF(WIN32)
DESTINATION ${INSTALL_PLUGINDIR} COMPONENT connect-engine)
ENDIF(WIN32)
IF(NOT TARGET connect)
RETURN()
ENDIF()
# Install some extra files that belong to connect engine
IF(WIN32)
# install ha_connect.lib
GET_TARGET_PROPERTY(CONNECT_LOCATION connect LOCATION)
STRING(REPLACE "dll" "lib" CONNECT_LIB ${CONNECT_LOCATION})
IF(CMAKE_CONFIGURATION_TYPES)
STRING(REPLACE "${CMAKE_CFG_INTDIR}" "\${CMAKE_INSTALL_CONFIG_NAME}"
CONNECT_LIB ${CONNECT_LIB})
ENDIF()
INSTALL(FILES ${CONNECT_LIB}
DESTINATION ${INSTALL_PLUGINDIR} COMPONENT connect-engine)
ENDIF(WIN32)
IF(CONNECT_WITH_JDBC AND JAVA_FOUND AND JNI_FOUND)
# TODO: Find how to compile and install the java wrapper classes
# Find required libraries and include directories
@@ -373,4 +373,3 @@ IF(CONNECT_WITH_JDBC AND JAVA_FOUND AND JNI_FOUND)
${CMAKE_CURRENT_BINARY_DIR}/JdbcInterface.jar
DESTINATION ${INSTALL_PLUGINDIR} COMPONENT connect-engine)
ENDIF()

View File

@@ -520,7 +520,7 @@ bool ARRAY::FilTest(PGLOBAL g, PVAL valp, OPVAL opc, int opm)
} else if (opc != OP_EXIST) {
sprintf(g->Message, MSG(MISSING_ARG), opc);
throw (int)TYPE_ARRAY;
throw (int)TYPE_ARRAY;
} else // OP_EXIST
return Nval > 0;

View File

@@ -412,4 +412,3 @@ void SIDBLK::ReadColumn(PGLOBAL)
// } // endif Sname
} // end of ReadColumn

View File

@@ -1,4 +1,5 @@
/* Copyright (C) MariaDB Corporation Ab
/* Copyright (C) Olivier Bertrand 2004 - 2017
Copyright (C) MariaDB Corporation Ab
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@@ -351,7 +351,7 @@ void CSORT::Qstx(int *base, int *max)
zlo = zhi = cnm = 0; // Avoid warning message
lo = max - base; // Number of elements as longs
lo = (int)(max - base); // Number of elements as longs
if (Dup)
cnm = Cmpnum(lo);
@@ -472,7 +472,7 @@ void CSORT::Qstx(int *base, int *max)
i = him + 1;
if (Pof)
Pof[him - Pex] = Pof[mid - Pex] = i - j;
Pof[him - Pex] = Pof[mid - Pex] = (int)(i - j);
/*******************************************************************/
/* Look at sizes of the two partitions, do the smaller one first */
@@ -481,8 +481,8 @@ void CSORT::Qstx(int *base, int *max)
/* But only repeat (recursively or by branching) if the partition */
/* is of at least size THRESH. */
/*******************************************************************/
lo = j - base;
hi = max - i;
lo = (int)(j - base);
hi = (int)(max - i);
if (Dup) { // Update progress information
zlo = Cmpnum(lo);
@@ -726,7 +726,7 @@ void CSORT::Qstc(int *base, int *max)
zlo = zhi = cnm = 0; // Avoid warning message
lo = max - base; // Number of elements as longs
lo = (int)(max - base); // Number of elements as longs
if (Dup)
cnm = Cmpnum(lo);
@@ -853,7 +853,7 @@ void CSORT::Qstc(int *base, int *max)
/* the offset array values indicating break point and block size. */
/*******************************************************************/
if (Pof)
Pof[lt - Pex] = Pof[(jj - 1) - Pex] = jj - lt;
Pof[lt - Pex] = Pof[(jj - 1) - Pex] = (int)(jj - lt);
/*******************************************************************/
/* Look at sizes of the two partitions, do the smaller one first */
@@ -862,8 +862,8 @@ void CSORT::Qstc(int *base, int *max)
/* But only repeat (recursively or by branching) if the partition */
/* is of at least size THRESH. */
/*******************************************************************/
lo = lt - base;
hi = gt - Swix;
lo = (int)(lt - base);
hi = (int)(gt - Swix);
if (Dup) { // Update progress information
zlo = Cmpnum(lo);

View File

@@ -13,6 +13,7 @@
#elif defined(MSX4)
#import "msxml4.dll" //Causes error C2872: DOMNodeType: ambiguous symbol ??
#elif defined(MSX6)
#pragma warning(suppress : 4192)
#import "msxml6.dll" //Causes error C2872: DOMNodeType: ambiguous symbol ??
#else // MSX4
#error MSX? is not defined
@@ -540,7 +541,7 @@ PXNODE DOMNODE::AddChildNode(PGLOBAL g, PCSZ name, PXNODE np)
// If name has the format m[n] only m is taken as node name
if ((p = strchr(name, '[')))
pn = BufAlloc(g, name, p - name);
pn = BufAlloc(g, name, (int)(p - name));
else
pn = name;

View File

@@ -247,7 +247,7 @@ int MAPFAM::GetRowID(void)
/***********************************************************************/
int MAPFAM::GetPos(void)
{
return Fpos - Memory;
return (int)(Fpos - Memory);
} // end of GetPos
/***********************************************************************/
@@ -255,7 +255,7 @@ int MAPFAM::GetPos(void)
/***********************************************************************/
int MAPFAM::GetNextPos(void)
{
return Mempos - Memory;
return (int)(Mempos - Memory);
} // end of GetNextPos
/***********************************************************************/
@@ -368,7 +368,7 @@ int MAPFAM::ReadBuffer(PGLOBAL g)
} // endif Mempos
// Set caller line buffer
len = (Mempos - Fpos) - n;
len = (int)(Mempos - Fpos) - n;
// Don't rely on ENDING setting
if (len > 0 && *(Mempos - 2) == '\r')
@@ -428,7 +428,7 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc)
/* not required here, just setting of future Spos and Tpos. */
/*******************************************************************/
Tpos = Spos = Fpos;
} else if ((n = Fpos - Spos) > 0) {
} else if ((n = (int)(Fpos - Spos)) > 0) {
/*******************************************************************/
/* Non consecutive line to delete. Move intermediate lines. */
/*******************************************************************/
@@ -461,7 +461,7 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc)
/*****************************************************************/
/* Remove extra records. */
/*****************************************************************/
n = Tpos - Memory;
n = (int)(Tpos - Memory);
#if defined(__WIN__)
DWORD drc = SetFilePointer(fp->Handle, n, NULL, FILE_BEGIN);
@@ -627,7 +627,7 @@ int MBKFAM::ReadBuffer(PGLOBAL g)
break;
// Set caller line buffer
len = (Mempos - Fpos) - Ending;
len = (int)(Mempos - Fpos) - Ending;
memcpy(Tdbp->GetLine(), Fpos, len);
Tdbp->GetLine()[len] = '\0';
return RC_OK;

View File

@@ -537,7 +537,7 @@ int ZBKFAM::ReadBuffer(PGLOBAL g)
while (*NxtLine++ != '\n') ;
// Set caller line buffer
n = NxtLine - CurLine - Ending;
n = (int)(NxtLine - CurLine - Ending);
memcpy(Tdbp->GetLine(), CurLine, n);
Tdbp->GetLine()[n] = '\0';
return RC_OK;
@@ -588,7 +588,7 @@ int ZBKFAM::ReadBuffer(PGLOBAL g)
for (NxtLine = CurLine; *NxtLine++ != '\n';) ;
// Set caller line buffer
n = NxtLine - CurLine - Ending;
n = (int)(NxtLine - CurLine - Ending);
memcpy(Tdbp->GetLine(), CurLine, n);
Tdbp->GetLine()[n] = '\0';
Rbuf = (CurBlk == Block - 1) ? Last : Nrec;
@@ -1087,7 +1087,7 @@ bool ZLBFAM::SetPos(PGLOBAL g, int pos __attribute__((unused)))
/***********************************************************************/
int ZLBFAM::ReadBuffer(PGLOBAL g)
{
int n;
size_t n;
void *rdbuf;
/*********************************************************************/
@@ -1299,7 +1299,7 @@ int ZLBFAM::WriteBuffer(PGLOBAL g)
else
NxtLine = CurLine + Lrecl;
BlkLen = NxtLine - To_Buf;
BlkLen = (int)(NxtLine - To_Buf);
if (WriteCompressedBuffer(g)) {
Closing = TRUE; // To tell CloseDB about a Write error

View File

@@ -1351,7 +1351,7 @@ int BLKFAM::GetPos(void)
/***********************************************************************/
int BLKFAM::GetNextPos(void)
{
return Fpos + NxtLine - CurLine;
return (int)(Fpos + NxtLine - CurLine);
} // end of GetNextPos
/***********************************************************************/
@@ -1396,7 +1396,8 @@ int BLKFAM::SkipRecord(PGLOBAL, bool header)
/***********************************************************************/
int BLKFAM::ReadBuffer(PGLOBAL g)
{
int i, n, rc = RC_OK;
int i, rc = RC_OK;
size_t n;
/*********************************************************************/
/* Sequential reading when Placed is not true. */
@@ -1458,7 +1459,7 @@ int BLKFAM::ReadBuffer(PGLOBAL g)
// Read the entire next block
n = fread(To_Buf, 1, (size_t)BlkLen, Stream);
if (n == BlkLen) {
if ((size_t) n == (size_t) BlkLen) {
// ReadBlks++;
num_read++;
Rbuf = (CurBlk == Block - 1) ? Last : Nrec;
@@ -1497,7 +1498,7 @@ int BLKFAM::ReadBuffer(PGLOBAL g)
fin:
// Store the current record file position for Delete and Update
Fpos = BlkPos[CurBlk] + CurLine - To_Buf;
Fpos = (int)(BlkPos[CurBlk] + CurLine - To_Buf);
return rc;
} // end of ReadBuffer
@@ -1524,7 +1525,7 @@ int BLKFAM::WriteBuffer(PGLOBAL g)
// Now start the writing process.
NxtLine = CurLine + strlen(CurLine);
BlkLen = NxtLine - To_Buf;
BlkLen = (int)(NxtLine - To_Buf);
if (fwrite(To_Buf, 1, BlkLen, Stream) != (size_t)BlkLen) {
sprintf(g->Message, MSG(FWRITE_ERROR), strerror(errno));

View File

@@ -748,7 +748,7 @@ UNZFAM::UNZFAM(PUNZFAM txfp) : MAPFAM(txfp)
/***********************************************************************/
int UNZFAM::GetFileLength(PGLOBAL g)
{
int len = (zutp && zutp->entryopen) ? Top - Memory
int len = (zutp && zutp->entryopen) ? (int)(Top - Memory)
: TXTFAM::GetFileLength(g) * 3;
if (trace(1))
@@ -1088,7 +1088,7 @@ int ZIPFAM::WriteBuffer(PGLOBAL g)
// Prepare to write the new line
strcat(strcpy(To_Buf, Tdbp->GetLine()), (Bin) ? CrLf : "\n");
len = strchr(To_Buf, '\n') - To_Buf + 1;
len = (int)(strchr(To_Buf, '\n') - To_Buf + 1);
return zutp->writeEntry(g, To_Buf, len);
} // end of WriteBuffer

View File

@@ -84,7 +84,7 @@ BYTE OpBmp(PGLOBAL g, OPVAL opc)
case OP_EXIST: bt = 0x00; break;
default:
sprintf(g->Message, MSG(BAD_FILTER_OP), opc);
throw (int)TYPE_ARRAY;
throw (int)TYPE_FILTER;
} // endswitch opc
return bt;
@@ -1707,7 +1707,7 @@ PFIL PrepareFilter(PGLOBAL g, PFIL fp, bool having)
break; // Remove eventual ending separator(s)
// if (fp->Convert(g, having))
// (int)throw TYPE_ARRAY;
// throw (int)TYPE_FILTER;
filp = fp;
fp = fp->Next;

View File

@@ -283,7 +283,7 @@ static void yy_fatal_error YY_PROTO(( const char msg[] ));
*/
#define YY_DO_BEFORE_ACTION \
yytext_ptr = yy_bp; \
yyleng = yy_cp - yy_bp; \
yyleng = (int)(yy_cp - yy_bp); \
yy_hold_char = *yy_cp; \
*yy_cp = '\0'; \
yy_c_buf_p = yy_cp;
@@ -417,10 +417,10 @@ static PDTP pp;
static void MakeParm(int n);
static void MakeMMDD(int n);
static void MakeAMPM(int n);
static void MakeIn(char *);
static void MakeOut(char *);
static void Quotin(char *);
static void Quotout(char *);
static void MakeIn(const char *);
static void MakeOut(const char *);
static void Quotin(const char *);
static void Quotout(const char *);
/* Macros after this point can all be overridden by user definitions in
* section 1.
@@ -529,7 +529,7 @@ YY_DECL
pp->Num = 0;
if (pp->InFmt) {*pp->InFmt = '\0'; pp->InFmt[pp->Outsize -1] = '\0'; }
if (pp->OutFmt) {*pp->OutFmt = '\0'; pp->OutFmt[pp->Outsize -1] = '\0'; }
pp->Curp = pp->Format;
pp->Curp = (char*) pp->Format;
yy_init = 1; /* This is a new input */
@@ -695,7 +695,7 @@ case YY_STATE_EOF(dqt):
case YY_END_OF_BUFFER:
{
/* Amount of text matched not including the EOB char. */
int yy_amount_of_matched_text = yy_cp - yytext_ptr - 1;
int yy_amount_of_matched_text = (int)(yy_cp - yytext_ptr - 1);
/* Undo the effects of YY_DO_BEFORE_ACTION. */
*yy_cp = yy_hold_char;
@@ -862,7 +862,7 @@ static int yy_get_next_buffer()
/* Try to read more data. */
/* First move last chars to start of buffer. */
number_to_move = yy_c_buf_p - yytext_ptr;
number_to_move = (int)(yy_c_buf_p - yytext_ptr);
for ( i = 0; i < number_to_move; ++i )
*(dest++) = *(source++);
@@ -888,7 +888,7 @@ static int yy_get_next_buffer()
/* just a shorter name for the current buffer */
YY_BUFFER_STATE b = yy_current_buffer;
int yy_c_buf_p_offset = yy_c_buf_p - b->yy_ch_buf;
int yy_c_buf_p_offset = (int)(yy_c_buf_p - b->yy_ch_buf);
b->yy_buf_size *= 2;
b->yy_ch_buf = (char *)
@@ -1492,7 +1492,7 @@ void MakeAMPM(int n)
} /* end of MakeAMPM */
void MakeIn(char *text)
void MakeIn(const char *text)
{
if (!pp->InFmt)
return;
@@ -1500,14 +1500,14 @@ void MakeIn(char *text)
strncat(pp->InFmt, text, (pp->Outsize - 1) - strlen(pp->InFmt));
} /* end of MakeIn */
void MakeOut(char *text)
void MakeOut(const char *text)
{
if (!pp->OutFmt) return;
strncat(pp->OutFmt, text, (pp->Outsize - 1) - strlen(pp->OutFmt));
} /* end of MakeOut */
void Quotin(char *text)
void Quotin(const char *text)
{
if (!pp->InFmt)
return;
@@ -1516,7 +1516,7 @@ void Quotin(char *text)
pp->InFmt[strlen(pp->InFmt)-1] = '\0';
} /* end of Quotin */
void Quotout(char *text)
void Quotout(const char *text)
{
if (!pp->OutFmt)
return;

View File

@@ -220,7 +220,7 @@ DllExport BOOL PlugIsAbsolutePath(LPCSTR path);
DllExport bool AllocSarea(PGLOBAL, uint);
DllExport void FreeSarea(PGLOBAL);
DllExport BOOL PlugSubSet(PGLOBAL, void *, uint);
DllExport void *PlugSubAlloc(PGLOBAL, void *, size_t);
void *PlugSubAlloc(PGLOBAL, void *, size_t); // Does throw
DllExport char *PlugDup(PGLOBAL g, const char *str);
DllExport void *MakePtr(void *, OFFSET);
DllExport void htrc(char const *fmt, ...);

View File

@@ -98,8 +98,8 @@
rnd_next signals that it has reached the end of its data. Calls to
ha_connect::extra() are hints as to what will be occuring to the request.
Author Olivier Bertrand
*/
Author Olivier Bertrand
*/
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
@@ -425,7 +425,7 @@ handlerton *connect_hton= NULL;
/* Function to export session variable values to other source files. */
/***********************************************************************/
uint GetTraceValue(void)
{return connect_hton ? THDVAR(current_thd, xtrace) : 0;}
{return (uint)(connect_hton ? THDVAR(current_thd, xtrace) : 0);}
bool ExactInfo(void) {return THDVAR(current_thd, exact_info);}
USETEMP UseTemp(void) {return (USETEMP)THDVAR(current_thd, use_tempfile);}
int GetConvSize(void) {return THDVAR(current_thd, conv_size);}
@@ -1107,55 +1107,55 @@ PCSZ GetListOption(PGLOBAL g, PCSZ opname, PCSZ oplist, PCSZ def)
if (!oplist)
return (char*)def;
char key[16], val[256];
char *pv, *pn, *pk= (char*)oplist;
PCSZ opval= def;
int n;
char key[16], val[256];
char *pv, *pn, *pk = (char*)oplist;
PCSZ opval = def;
int n;
while (*pk == ' ')
pk++;
for (; pk; pk= pn) {
pn= strchr(pk, ',');
pv= strchr(pk, '=');
for (; pk; pk = pn) {
pn = strchr(pk, ',');
pv = strchr(pk, '=');
if (pv && (!pn || pv < pn)) {
if (pv && (!pn || pv < pn)) {
n = MY_MIN(static_cast<size_t>(pv - pk), sizeof(key) - 1);
memcpy(key, pk, n);
while (n && key[n - 1] == ' ')
n--;
key[n]= 0;
key[n] = 0;
while(*(++pv) == ' ') ;
while (*(++pv) == ' ');
n= MY_MIN((pn ? pn - pv : strlen(pv)), sizeof(val) - 1);
memcpy(val, pv, n);
n = MY_MIN((pn ? pn - pv : strlen(pv)), sizeof(val) - 1);
memcpy(val, pv, n);
while (n && val[n - 1] == ' ')
n--;
val[n]= 0;
} else {
n= MY_MIN((pn ? pn - pk : strlen(pk)), sizeof(key) - 1);
memcpy(key, pk, n);
val[n] = 0;
} else {
n = MY_MIN((pn ? pn - pk : strlen(pk)), sizeof(key) - 1);
memcpy(key, pk, n);
while (n && key[n - 1] == ' ')
n--;
key[n]= 0;
val[0]= 0;
} // endif pv
key[n] = 0;
val[0] = 0;
} // endif pv
if (!stricmp(opname, key)) {
opval= PlugDup(g, val);
break;
} else if (!pn)
break;
if (!stricmp(opname, key)) {
opval = PlugDup(g, val);
break;
} else if (!pn)
break;
while (*(++pn) == ' ') ;
} // endfor pk
while (*(++pn) == ' ');
} // endfor pk
return opval;
} // end of GetListOption
@@ -4391,53 +4391,59 @@ bool ha_connect::check_privileges(THD *thd, PTOS options, char *dbn, bool quick)
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--secure-file-priv");
return true;
} // endif path
}
} // endif !quick
} else
return false;
/* Fall through to check FILE_ACL */
case TAB_ODBC:
case TAB_JDBC:
// Fall through
case TAB_MYSQL:
case TAB_MONGO:
case TAB_DIR:
case TAB_MAC:
case TAB_WMI:
case TAB_ZIP:
case TAB_OEM:
#ifdef NO_EMBEDDED_ACCESS_CHECKS
return false;
#endif
/*
If table or table->mdl_ticket is NULL - it's a DLL, e.g. CREATE TABLE.
if the table has an MDL_EXCLUSIVE lock - it's a DDL too, e.g. the
insert step of CREATE ... SELECT.
return false;
#endif
Otherwise it's a DML, the table was normally opened, locked,
privilege were already checked, and table->grant.privilege is set.
With SQL SECURITY DEFINER, table->grant.privilege has definer's privileges.
/*
Check FILE_ACL
If table or table->mdl_ticket is NULL - it's a DLL, e.g. CREATE TABLE.
if the table has an MDL_EXCLUSIVE lock - it's a DDL too, e.g. the
insert step of CREATE ... SELECT.
Otherwise it's a DML, the table was normally opened, locked,
privilege were already checked, and table->grant.privilege is set.
With SQL SECURITY DEFINER, table->grant.privilege has definer's privileges.
Unless we're in prelocking mode, in this case table->grant.privilege
is only checked in start_stmt(), not in external_lock().
*/
if (!table || !table->mdl_ticket || table->mdl_ticket->get_type() == MDL_EXCLUSIVE)
return check_access(thd, FILE_ACL, db, NULL, NULL, 0, 0);
Unless we're in prelocking mode, in this case table->grant.privilege
is only checked in start_stmt(), not in external_lock().
*/
if (!table || !table->mdl_ticket || table->mdl_ticket->get_type() == MDL_EXCLUSIVE)
return check_access(thd, FILE_ACL, db, NULL, NULL, 0, 0);
if ((!quick && thd->lex->requires_prelocking()) || table->grant.privilege & FILE_ACL)
return false;
status_var_increment(thd->status_var.access_denied_errors);
my_error(access_denied_error_code(thd->password), MYF(0),
thd->security_ctx->priv_user, thd->security_ctx->priv_host,
(thd->password ? ER(ER_YES) : ER(ER_NO)));
return true;
if ((!quick && thd->lex->requires_prelocking()) || table->grant.privilege & FILE_ACL)
return false;
// This is temporary until a solution is found
status_var_increment(thd->status_var.access_denied_errors);
my_error(access_denied_error_code(thd->password), MYF(0),
thd->security_ctx->priv_user, thd->security_ctx->priv_host,
(thd->password ? ER(ER_YES) : ER(ER_NO)));
return true;
case TAB_ODBC:
case TAB_JDBC:
case TAB_MONGO:
case TAB_MAC:
case TAB_WMI:
return false;
case TAB_TBL:
case TAB_XCL:
case TAB_PRX:
case TAB_OCCUR:
case TAB_PIVOT:
case TAB_VIR:
return false;
// This is temporary until a solution is found
return false;
} // endswitch type
my_printf_error(ER_UNKNOWN_ERROR, "check_privileges failed", MYF(0));
@@ -5629,7 +5635,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
#endif // JAVA_SUPPORT
case TAB_DBF:
dbf = true;
// Passthru
// fall through
case TAB_CSV:
if (!fn && fnc != FNC_NO)
sprintf(g->Message, "Missing %s file name", topt->type);

View File

@@ -154,38 +154,38 @@ int TranslateJDBCType(int stp, char *tn, int prec, int& len, char& v)
case 91: // DATE, YEAR
type = TYPE_DATE;
if (!tn || toupper(tn[0]) != 'Y') {
len = 10;
v = 'D';
} else {
len = 4;
v = 'Y';
} // endif len
if (!tn || toupper(tn[0]) != 'Y') {
len = 10;
v = 'D';
} else {
len = 4;
v = 'Y';
} // endif len
break;
case 92: // TIME
type = TYPE_DATE;
len = 8 + ((prec) ? (prec+1) : 0);
v = 'T';
break;
case -5: // BIGINT
type = TYPE_BIGINT;
break;
case 0: // NULL
case -2: // BINARY
case -4: // LONGVARBINARY
case 70: // DATALINK
case 2000: // JAVA_OBJECT
case 2001: // DISTINCT
case 2002: // STRUCT
case 2003: // ARRAY
case 2004: // BLOB
case 2005: // CLOB
case 2006: // REF
case 2009: // SQLXML
case 2011: // NCLOB
default:
type = TYPE_ERROR;
break;
case 92: // TIME
type = TYPE_DATE;
len = 8 + ((prec) ? (prec + 1) : 0);
v = 'T';
break;
case -5: // BIGINT
type = TYPE_BIGINT;
break;
case 0: // NULL
case -2: // BINARY
case -4: // LONGVARBINARY
case 70: // DATALINK
case 2000: // JAVA_OBJECT
case 2001: // DISTINCT
case 2002: // STRUCT
case 2003: // ARRAY
case 2004: // BLOB
case 2005: // CLOB
case 2006: // REF
case 2009: // SQLXML
case 2011: // NCLOB
default:
type = TYPE_ERROR;
len = 0;
} // endswitch type

View File

@@ -165,7 +165,7 @@ PJSON ParseJson(PGLOBAL g, char *s, int len, int *ptyp, bool *comma)
}; // endswitch s[i]
if (!jsp)
sprintf(g->Message, "Invalid Json string '%.*s'", 50, s);
sprintf(g->Message, "Invalid Json string '%.*s'", MY_MIN(len, 50), s);
else if (ptyp && pretty == 3) {
*ptyp = 3; // Not recognized pretty
@@ -1015,6 +1015,20 @@ PJAR JOBJECT::GetKeyList(PGLOBAL g)
return jarp;
} // end of GetKeyList
/***********************************************************************/
/* Return all values as an array. */
/***********************************************************************/
PJAR JOBJECT::GetValList(PGLOBAL g)
{
PJAR jarp = new(g) JARRAY();
for (PJPR jpp = First; jpp; jpp = jpp->Next)
jarp->AddValue(g, jpp->GetVal());
jarp->InitArray(g);
return jarp;
} // end of GetValList
/***********************************************************************/
/* Get the value corresponding to the given key. */
/***********************************************************************/
@@ -1224,6 +1238,7 @@ PJVAL JARRAY::AddValue(PGLOBAL g, PJVAL jvp, int *x)
Last->Next = jvp;
Last = jvp;
Last->Next = NULL;
} // endif x
return jvp;
@@ -1318,6 +1333,24 @@ bool JARRAY::IsNull(void)
/* -------------------------- Class JVALUE- -------------------------- */
/***********************************************************************/
/* Constructor for a JSON. */
/***********************************************************************/
JVALUE::JVALUE(PJSON jsp) : JSON()
{
if (jsp->GetType() == TYPE_JVAL) {
Jsp = jsp->GetJsp();
Value = jsp->GetValue();
} else {
Jsp = jsp;
Value = NULL;
} // endif Type
Next = NULL;
Del = false;
Size = 1;
} // end of JVALUE constructor
/***********************************************************************/
/* Constructor for a Value with a given string or numeric value. */
/***********************************************************************/

View File

@@ -20,7 +20,8 @@ enum JTYP {TYPE_NULL = TYPE_VOID,
TYPE_BINT = TYPE_BIGINT,
TYPE_DTM = TYPE_DATE,
TYPE_INTG = TYPE_INT,
TYPE_JSON = 12,
TYPE_VAL = 12,
TYPE_JSON,
TYPE_JAR,
TYPE_JOB,
TYPE_JVAL};
@@ -157,6 +158,7 @@ class JSON : public BLOCK {
//virtual PJVAL AddValue(PGLOBAL g, PJVAL jvp = NULL, int *x = NULL) {X return NULL;}
virtual PJPR AddPair(PGLOBAL g, PCSZ key) {X return NULL;}
virtual PJAR GetKeyList(PGLOBAL g) {X return NULL;}
virtual PJAR GetValList(PGLOBAL g) {X return NULL;}
virtual PJVAL GetValue(const char *key) {X return NULL;}
virtual PJOB GetObject(void) {return NULL;}
virtual PJAR GetArray(void) {return NULL;}
@@ -205,6 +207,7 @@ class JOBJECT : public JSON {
virtual PJOB GetObject(void) {return this;}
virtual PJVAL GetValue(const char* key);
virtual PJAR GetKeyList(PGLOBAL g);
virtual PJAR GetValList(PGLOBAL g);
virtual PSZ GetText(PGLOBAL g, PSZ text);
virtual bool Merge(PGLOBAL g, PJSON jsp);
virtual void SetValue(PGLOBAL g, PJVAL jvp, PCSZ key);
@@ -258,8 +261,7 @@ class JVALUE : public JSON {
friend bool SerializeValue(JOUT *, PJVAL);
public:
JVALUE(void) : JSON() {Clear();}
JVALUE(PJSON jsp) : JSON()
{Jsp = jsp; Value = NULL; Next = NULL; Del = false; Size = 1;}
JVALUE(PJSON jsp);
JVALUE(PGLOBAL g, PVAL valp);
JVALUE(PGLOBAL g, PCSZ strp);

File diff suppressed because it is too large Load Diff

View File

@@ -89,6 +89,10 @@ extern "C" {
DllExport char *json_object_list(UDF_EXEC_ARGS);
DllExport void json_object_list_deinit(UDF_INIT*);
DllExport my_bool json_object_values_init(UDF_INIT*, UDF_ARGS*, char*);
DllExport char *json_object_values(UDF_EXEC_ARGS);
DllExport void json_object_values_deinit(UDF_INIT*);
DllExport my_bool jsonset_grp_size_init(UDF_INIT*, UDF_ARGS*, char*);
DllExport long long jsonset_grp_size(UDF_INIT*, UDF_ARGS*, char*, char*);

View File

@@ -230,13 +230,13 @@ bool MACINFO::GetOneInfo(PGLOBAL g, int flag, void *v, int lv)
case 11: // Description
if ((p = strstr(Curp->Description, " - Packet Scheduler Miniport"))) {
strncpy(buf, Curp->Description, p - Curp->Description);
i = p - Curp->Description;
i = (int)(p - Curp->Description);
strncpy(buf, Curp->Description, i);
buf[i] = 0;
p = buf;
} else if ((p = strstr(Curp->Description,
" - Miniport d'ordonnancement de paquets"))) {
i = p - Curp->Description;
i = (int)(p - Curp->Description);
strncpy(buf, Curp->Description, i);
buf[i] = 0;
p = buf;

View File

@@ -248,7 +248,7 @@ PQRYRES MyColumns(PGLOBAL g, THD *thd, const char *host, const char *db,
while (true) {
p2 = strchr(p1, '\'');
len = MY_MAX(len, p2 - p1);
len = MY_MAX(len, (int)(p2 - p1));
if (*++p2 != ',') break;
p1 = p2 + 2;
} // endwhile
@@ -933,8 +933,9 @@ PQRYRES MYSQLC::GetResult(PGLOBAL g, bool pdb)
crp->Prec = (crp->Type == TYPE_DOUBLE || crp->Type == TYPE_DECIM)
? fld->decimals : 0;
crp->Length = MY_MAX(fld->length, fld->max_length);
crp->Clen = GetTypeSize(crp->Type, crp->Length);
CHARSET_INFO *cs= get_charset(fld->charsetnr, MYF(0));
crp->Clen = GetTypeSize(crp->Type, fld->length);
crp->Length = fld->length / (cs ? cs->mbmaxlen : 1);
uns = (fld->flags & (UNSIGNED_FLAG | ZEROFILL_FLAG)) ? true : false;
if (!(crp->Kdata = AllocValBlock(g, NULL, crp->Type, m_Rows,

View File

@@ -50,17 +50,19 @@ SELECT Json_Array_Add(Json_Make_Array(56, 3.1416, 'foo', NULL), 'One more') Arra
Array
[56,3.141600,"foo",null,"One more"]
SELECT Json_Array_Add(JsonValue('one value'), 'One more');
ERROR HY000: Can't initialize function 'json_array_add'; First argument must be a json item
Json_Array_Add(JsonValue('one value'), 'One more')
["\"one value\"","One more"]
SELECT Json_Array_Add('one value', 'One more');
ERROR HY000: Can't initialize function 'json_array_add'; First argument must be a json item
Json_Array_Add('one value', 'One more')
["one value","One more"]
SELECT Json_Array_Add('one value' json_, 'One more');
Json_Array_Add('one value' json_, 'One more')
one value
Warnings:
Warning 1105 Error 2 opening one value
Warning 1105 First argument target is not an array
SELECT Json_Array_Add(5 json_, 'One more');
ERROR HY000: Can't initialize function 'json_array_add'; First argument must be a json item
Json_Array_Add(5 json_, 'One more')
[5,"One more"]
SELECT Json_Array_Add('[5,3,8,7,9]' json_, 4, 0);
Json_Array_Add('[5,3,8,7,9]' json_, 4, 0)
[4,5,3,8,7,9]

View File

@@ -272,10 +272,9 @@ Json_Serialize(Jbin_Array('a','b','c'))
["a","b","c"]
SELECT Json_Serialize(Jbin_Array_Add(Jbin_File('not_exist.json'), 'd'));
Json_Serialize(Jbin_Array_Add(Jbin_File('not_exist.json'), 'd'))
Null json tree
[null,"d"]
Warnings:
Warning 1105 Open(map) error 2 on not_exist.json
Warning 1105 First argument is not an array
# This does not modify the file
SELECT Json_Serialize(Jbin_Array_Add(Jbin_File('bt1.json'), 'd'));
Json_Serialize(Jbin_Array_Add(Jbin_File('bt1.json'), 'd'))

View File

@@ -0,0 +1,29 @@
create table t1 (
#linenum int(6) not null default 0 special=rowid,
name char(12) not null,
city char(11) not null,
birth date not null date_format='DD/MM/YYYY',
hired date not null date_format='DD/MM/YYYY' flag=36,
agehired int(3) as (floor(datediff(hired,birth)/365.25))
)
engine=CONNECT table_type=FIX file_name='boys.txt' mapped=YES lrecl=47 ending=1;
select * from t1;
name city birth hired agehired
John Boston 1986-01-25 2010-06-02 24
Henry Boston 1987-06-07 2008-04-01 20
George San Jose 1981-08-10 2010-06-02 28
Sam Chicago 1979-11-22 2007-10-10 27
James Dallas 1992-05-13 2009-12-14 17
Bill Boston 1986-09-11 2008-02-10 21
drop table t1;
create table t1 (
#linenum int(6) not null default 0 special=rowid,
name char(12) not null,
city char(11) not null,
birth date not null date_format='DD/MM/YYYY',
hired date not null date_format='DD/MM/YYYY' flag=36,
agehired int(3) as (floor(datediff(hired,birth)/365.25)),
index (agehired)
)
engine=CONNECT table_type=FIX file_name='boys.txt' mapped=YES lrecl=47 ending=1;
ERROR 42000: Table handler doesn't support NULL in given index. Please change column 'agehired' to be NOT NULL or use another handler

View File

@@ -29,12 +29,12 @@ SELECT Json_Make_Array(Json_Make_Array(56, 3.1416, 'foo'), TRUE);
--error ER_CANT_INITIALIZE_UDF
SELECT Json_Array_Add(Json_Make_Array(56, 3.1416, 'foo', NULL)) Array;
SELECT Json_Array_Add(Json_Make_Array(56, 3.1416, 'foo', NULL), 'One more') Array;
--error ER_CANT_INITIALIZE_UDF
#--error ER_CANT_INITIALIZE_UDF
SELECT Json_Array_Add(JsonValue('one value'), 'One more');
--error ER_CANT_INITIALIZE_UDF
#--error ER_CANT_INITIALIZE_UDF
SELECT Json_Array_Add('one value', 'One more');
SELECT Json_Array_Add('one value' json_, 'One more');
--error ER_CANT_INITIALIZE_UDF
#--error ER_CANT_INITIALIZE_UDF
SELECT Json_Array_Add(5 json_, 'One more');
SELECT Json_Array_Add('[5,3,8,7,9]' json_, 4, 0);
SELECT Json_Array_Add('[5,3,8,7,9]' json_, 4, 2) Array;

View File

@@ -0,0 +1,31 @@
let datadir= `select @@datadir`;
--copy_file $MTR_SUITE_DIR/std_data/boys.txt $datadir/test/boys.txt
create table t1 (
#linenum int(6) not null default 0 special=rowid,
name char(12) not null,
city char(11) not null,
birth date not null date_format='DD/MM/YYYY',
hired date not null date_format='DD/MM/YYYY' flag=36,
agehired int(3) as (floor(datediff(hired,birth)/365.25))
)
engine=CONNECT table_type=FIX file_name='boys.txt' mapped=YES lrecl=47 ending=1;
select * from t1;
drop table t1;
--error ER_NULL_COLUMN_IN_INDEX
create table t1 (
#linenum int(6) not null default 0 special=rowid,
name char(12) not null,
city char(11) not null,
birth date not null date_format='DD/MM/YYYY',
hired date not null date_format='DD/MM/YYYY' flag=36,
agehired int(3) as (floor(datediff(hired,birth)/365.25)),
index (agehired)
)
engine=CONNECT table_type=FIX file_name='boys.txt' mapped=YES lrecl=47 ending=1;
#
# Clean up
#
--remove_file $datadir/test/boys.txt

View File

@@ -2261,10 +2261,10 @@ public:
return (SQLCHAR *) (m_part[i].length ? m_part[i].str : NULL);
} // end of ptr
size_t length(uint i)
SQLSMALLINT length(uint i)
{
DBUG_ASSERT(i < max_parts);
return m_part[i].length;
return (SQLSMALLINT)m_part[i].length;
} // end of length
}; // end of class SQLQualifiedName
@@ -2438,7 +2438,7 @@ int ODBConn::GetCatInfo(CATPARM *cap)
else if (vlen[n] == SQL_NULL_DATA)
pval[n]->SetNull(true);
else if (crp->Type == TYPE_STRING/* && vlen[n] != SQL_NULL_DATA*/)
pval[n]->SetValue_char(pbuf[n], vlen[n]);
pval[n]->SetValue_char(pbuf[n], (int)vlen[n]);
else
pval[n]->SetNull(false);

View File

@@ -519,7 +519,7 @@ bool EvalLikePattern(LPCSTR sp, LPCSTR tp)
{
LPSTR p;
char c;
int n;
ssize_t n;
bool b, t = false;
if (trace(2))

View File

@@ -162,7 +162,7 @@ PGLOBAL PlugInit(LPCSTR Language, uint worksize)
/*******************************************************************/
if (worksize && AllocSarea(g, worksize)) {
char errmsg[MAX_STR];
sprintf(errmsg, MSG(WORK_AREA), g->Message);
snprintf(errmsg, sizeof(errmsg) - 1, MSG(WORK_AREA), g->Message);
strcpy(g->Message, errmsg);
} // endif Sarea
@@ -559,7 +559,7 @@ void *PlugSubAlloc(PGLOBAL g, void *memp, size_t size)
if (trace(1))
htrc("PlugSubAlloc: %s\n", g->Message);
throw 1234;
throw 1234;
} /* endif size OS32 code */
/*********************************************************************/

View File

@@ -8,7 +8,7 @@
/***********************************************************************/
typedef struct _datpar {
const char *Format; // Points to format to decode
char *Curp; // Points to current parsing position
const char *Curp; // Points to current parsing position
char *InFmt; // Start of input format
char *OutFmt; // Start of output format
int Index[8]; // Indexes of date values

View File

@@ -27,9 +27,9 @@
char *msglang(void);
char *GetMsgid(int id)
const char *GetMsgid(int id)
{
char *p = NULL;
const char *p = NULL;
// This conditional until a real fix is found for MDEV-7304
#if defined(FRENCH)
@@ -55,7 +55,8 @@ char *GetMsgid(int id)
int GetRcString(int id, char *buf, int bufsize)
{
char *p = NULL, msg[32];
const char *p = NULL;
char msg[32];
if (!(p = GetMsgid(id))) {
sprintf(msg, "ID=%d unknown", id);

View File

@@ -5,7 +5,7 @@
extern "C" {
#endif
char *GetMsgid(int id);
const char *GetMsgid(int id);
int GetRcString(int id, char *buf, int bufsize);
#ifdef __cplusplus

View File

@@ -547,14 +547,12 @@ PTABDEF OEMDEF::GetXdef(PGLOBAL g)
} // endif dladdr
#endif // 0
// Is the library already loaded?
if (!Hdll && !(Hdll = dlopen(soname, RTLD_NOLOAD)))
// Load the desired shared library
if (!(Hdll = dlopen(soname, RTLD_LAZY))) {
error = dlerror();
sprintf(g->Message, MSG(SHARED_LIB_ERR), soname, SVP(error));
return NULL;
} // endif Hdll
// Load the desired shared library
if (!Hdll && !(Hdll = dlopen(soname, RTLD_LAZY))) {
error = dlerror();
sprintf(g->Message, MSG(SHARED_LIB_ERR), soname, SVP(error));
return NULL;
} // endif Hdll
// The exported name is always in uppercase
for (int i = 0; ; i++) {

View File

@@ -1647,8 +1647,8 @@ int TDBDOS::TestBlock(PGLOBAL g)
/***********************************************************************/
int TDBDOS::MakeIndex(PGLOBAL g, PIXDEF pxdf, bool add)
{
int k, n, rc = RC_OK;
bool fixed, doit, sep, b = (pxdf != NULL);
int k, n, rc = RC_OK;
bool fixed, doit, sep, b = (pxdf != NULL);
PCOL *keycols, colp;
PIXDEF xdp, sxp = NULL;
PKPDEF kdp;
@@ -1694,8 +1694,8 @@ int TDBDOS::MakeIndex(PGLOBAL g, PIXDEF pxdf, bool add)
try {
// Allocate all columns that will be used by indexes.
// This must be done before opening the table so specific
// column initialization can be done (in particular by TDBVCT)
// This must be done before opening the table so specific
// column initialization can be done (in particular by TDBVCT)
for (n = 0, xdp = pxdf; xdp; xdp = xdp->GetNext())
for (kdp = xdp->GetToKeyParts(); kdp; kdp = kdp->GetNext()) {
if (!(colp = ColDB(g, kdp->GetName(), 0))) {
@@ -2881,4 +2881,3 @@ bool DOSCOL::AddDistinctValue(PGLOBAL g)
} // end of AddDistinctValue
/* ------------------------------------------------------------------- */

View File

@@ -934,7 +934,7 @@ int TDBCSV::ReadBuffer(PGLOBAL g)
if (p) {
//len = p++ - p2;
len = p - p2 - 1;;
len = (int)(p - p2 - 1);
// if (Sep != ' ')
// for (; *p == ' '; p++) ; // Skip blanks
@@ -978,7 +978,7 @@ int TDBCSV::ReadBuffer(PGLOBAL g)
return RC_NF;
} else if ((p = strchr(p2, Sep)))
len = p - p2;
len = (int)(p - p2);
else if (i == Fields - 1)
len = strlen(p2);
else if (Accept && Maxerr == 0) {
@@ -996,7 +996,7 @@ int TDBCSV::ReadBuffer(PGLOBAL g)
} else
len = 0;
Offset[i] = p2 - To_Line;
Offset[i] = (int)(p2 - To_Line);
if (Mode != MODE_UPDATE)
Fldlen[i] = len;

View File

@@ -94,7 +94,7 @@ PQRYRES JSONColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt, bool info)
return NULL;
} // endif Multiple
pjdc = new(g) JSONDISC(g, (int*)length);
pjdc = new(g) JSONDISC(g, length);
if (!(n = pjdc->GetColumns(g, db, dsn, topt)))
return NULL;
@@ -157,7 +157,7 @@ PQRYRES JSONColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt, bool info)
/***********************************************************************/
/* Class used to get the columns of a JSON table. */
/***********************************************************************/
JSONDISC::JSONDISC(PGLOBAL g, int *lg)
JSONDISC::JSONDISC(PGLOBAL g, uint *lg)
{
length = lg;
jcp = fjcp = pjcp = NULL;

View File

@@ -47,7 +47,7 @@ typedef struct _jncol {
class JSONDISC : public BLOCK {
public:
// Constructor
JSONDISC(PGLOBAL g, int *lg);
JSONDISC(PGLOBAL g, uint *lg);
// Functions
int GetColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt);
@@ -66,7 +66,7 @@ public:
PJOB row;
PCSZ sep;
char colname[65], fmt[129], buf[16];
int *length;
uint *length;
int i, n, bf, ncol, lvl;
bool all;
}; // end of JSONDISC

View File

@@ -367,13 +367,13 @@ void MACCOL::ReadColumn(PGLOBAL g)
case 11: // Description
if ((p = strstr(adp->Description, " - Packet Scheduler Miniport"))) {
strncpy(buf, adp->Description, p - adp->Description);
i = p - adp->Description;
i = (int)(p - adp->Description);
strncpy(buf, adp->Description, i);
buf[i] = 0;
p = buf;
} else if ((p = strstr(adp->Description,
" - Miniport d'ordonnancement de paquets"))) {
i = p - adp->Description;
i = (int)(p - adp->Description);
strncpy(buf, adp->Description, i);
buf[i] = 0;
p = buf;

View File

@@ -203,12 +203,12 @@ bool TDBMUL::InitFileNames(PGLOBAL g)
// Data files can be imported from Windows (having CRLF)
if (*p == '\n' || *p == '\r') {
// is this enough for Unix ???
*p--; // Eliminate ending CR or LF character
p--; // Eliminate ending CR or LF character
if (p >= filename)
// is this enough for Unix ???
if (*p == '\n' || *p == '\r')
*p--; // Eliminate ending CR or LF character
p--; // Eliminate ending CR or LF character
} // endif p

View File

@@ -124,8 +124,8 @@ bool MYSQLDEF::GetServerInfo(PGLOBAL g, const char *server_name)
DBUG_RETURN(true);
} // endif server
DBUG_PRINT("info", ("get_server_by_name returned server at %lx",
(size_t) server));
DBUG_PRINT("info", ("get_server_by_name returned server at %p",
server));
// TODO: We need to examine which of these can really be NULL
Hostname = PlugDup(g, server->host);
@@ -681,7 +681,7 @@ bool TDBMYSQL::MakeCommand(PGLOBAL g)
strlwr(strcpy(name, Name)); // Not a keyword
if ((p = strstr(qrystr, name))) {
Query->Set(Qrystr, p - qrystr);
Query->Set(Qrystr, (uint)(p - qrystr));
if (qtd && *(p-1) == ' ') {
Query->Append('`');

View File

@@ -135,7 +135,7 @@ class TDBMYSQL : public TDBEXT {
int m_Rc; // Return code from command
//int AftRows; // The number of affected rows
int N; // The current table index
int Port; // MySQL port number (0 = default)
unsigned Port; // MySQL port number (0 = default)
//int Nparm; // The number of statement parameters
//int Quoted; // The identifier quoting level
}; // end of class TDBMYSQL

View File

@@ -289,7 +289,7 @@ void TDBODBC::SetFile(PGLOBAL g, PCSZ fn)
sprintf(Connect, MulConn, fn);
} // endif MultConn
DBQ = (PSZ)fn;
DBQ = PlugDup(g, fn);
} // end of SetFile
/***********************************************************************/

View File

@@ -656,7 +656,7 @@ bool TDBTBM::IsLocal(PTABLE tbp)
return ((!stricmp(tdbp->Host, "localhost") ||
!strcmp(tdbp->Host, "127.0.0.1")) &&
tdbp->Port == (int)GetDefaultPort());
(int) tdbp->Port == (int)GetDefaultPort());
} // end of IsLocal
/***********************************************************************/

View File

@@ -1319,7 +1319,7 @@ void TDBXML::CloseDB(PGLOBAL g)
Docp->CloseDoc(g, To_Xb);
// This causes a crash in Diagnostics_area::set_error_status
// throw (int)TYPE_AM_XML;
// throw (int)TYPE_AM_XML;
} // endif DumpDoc
} // endif Changed

View File

@@ -1374,7 +1374,7 @@ bool TYPVAL<PSZ>::SetValue_char(const char *cp, int n)
} else if (cp != Strp) {
const char *p = cp + n - 1;
for (p; p >= cp; p--, n--)
for (; p >= cp; p--, n--)
if (*p && *p != ' ')
break;
@@ -1747,7 +1747,7 @@ DECVAL::DECVAL(PSZ s) : TYPVAL<PSZ>(s)
if (s) {
char *p = strchr(Strp, '.');
Prec = (p) ? Len - (p - Strp) : 0;
Prec = (p) ? (int)(Len - (p - Strp)) : 0;
} // endif s
Type = TYPE_DECIM;
@@ -2656,7 +2656,7 @@ bool DTVAL::SetValue_char(const char *p, int n)
// Trim trailing blanks
for (p2 = p + n -1; p < p2 && *p2 == ' '; p2--);
if ((rc = (n = p2 - p + 1) > Len))
if ((rc = (n = (int)(p2 - p + 1)) > Len))
n = Len;
memcpy(Sdate, p, n);

View File

@@ -204,7 +204,7 @@ STRING::STRING(PGLOBAL g, uint n, PCSZ str)
*Strp = 0;
Next = GetNext();
Size = Next - Strp;
Size = (int)(Next - Strp);
Trc = false;
} else {
// This should normally never happen
@@ -239,7 +239,7 @@ char *STRING::Realloc(uint len)
p = Strp;
Next = GetNext();
Size = Next - p;
Size = (int)(Next - p);
return p;
} // end of Realloc
@@ -439,4 +439,3 @@ bool STRING::Resize(uint newsize)
return newsize > Size;
} // end of Resize