mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Merge 10.1 into 10.2
This commit is contained in:
@@ -3061,7 +3061,6 @@ static int com_server_help(String *buffer __attribute__((unused)),
|
|||||||
{
|
{
|
||||||
unsigned int num_fields= mysql_num_fields(result);
|
unsigned int num_fields= mysql_num_fields(result);
|
||||||
my_ulonglong num_rows= mysql_num_rows(result);
|
my_ulonglong num_rows= mysql_num_rows(result);
|
||||||
mysql_fetch_fields(result);
|
|
||||||
if (num_fields==3 && num_rows==1)
|
if (num_fields==3 && num_rows==1)
|
||||||
{
|
{
|
||||||
if (!(cur= mysql_fetch_row(result)))
|
if (!(cur= mysql_fetch_row(result)))
|
||||||
|
@@ -1130,7 +1130,7 @@ static int check_version_match(void)
|
|||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
char self_name[FN_REFLEN];
|
char self_name[FN_REFLEN + 1];
|
||||||
|
|
||||||
MY_INIT(argv[0]);
|
MY_INIT(argv[0]);
|
||||||
|
|
||||||
@@ -1138,7 +1138,7 @@ int main(int argc, char **argv)
|
|||||||
if (GetModuleFileName(NULL, self_name, FN_REFLEN) == 0)
|
if (GetModuleFileName(NULL, self_name, FN_REFLEN) == 0)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
strncpy(self_name, argv[0], FN_REFLEN);
|
strmake_buf(self_name, argv[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (init_dynamic_string(&ds_args, "", 512, 256) ||
|
if (init_dynamic_string(&ds_args, "", 512, 256) ||
|
||||||
|
@@ -616,6 +616,7 @@ static my_bool sql_connect(MYSQL *mysql, uint wait)
|
|||||||
|
|
||||||
static int execute_commands(MYSQL *mysql,int argc, char **argv)
|
static int execute_commands(MYSQL *mysql,int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
int ret = 0;
|
||||||
const char *status;
|
const char *status;
|
||||||
/*
|
/*
|
||||||
MySQL documentation relies on the fact that mysqladmin will
|
MySQL documentation relies on the fact that mysqladmin will
|
||||||
@@ -1106,7 +1107,8 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
|
|||||||
if (strcmp(typed_password, verified) != 0)
|
if (strcmp(typed_password, verified) != 0)
|
||||||
{
|
{
|
||||||
my_printf_error(0,"Passwords don't match",MYF(ME_BELL));
|
my_printf_error(0,"Passwords don't match",MYF(ME_BELL));
|
||||||
return -1;
|
ret = -1;
|
||||||
|
goto password_done;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1133,7 +1135,8 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
|
|||||||
{
|
{
|
||||||
my_printf_error(0, "Could not determine old_passwords setting from server; error: '%s'",
|
my_printf_error(0, "Could not determine old_passwords setting from server; error: '%s'",
|
||||||
error_flags, mysql_error(mysql));
|
error_flags, mysql_error(mysql));
|
||||||
return -1;
|
ret = -1;
|
||||||
|
goto password_done;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1144,7 +1147,8 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
|
|||||||
"Could not get old_passwords setting from "
|
"Could not get old_passwords setting from "
|
||||||
"server; error: '%s'",
|
"server; error: '%s'",
|
||||||
error_flags, mysql_error(mysql));
|
error_flags, mysql_error(mysql));
|
||||||
return -1;
|
ret = -1;
|
||||||
|
goto password_done;
|
||||||
}
|
}
|
||||||
if (!mysql_num_rows(res))
|
if (!mysql_num_rows(res))
|
||||||
old= 1;
|
old= 1;
|
||||||
@@ -1169,15 +1173,15 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
|
|||||||
{
|
{
|
||||||
my_printf_error(0, "Can't turn off logging; error: '%s'",
|
my_printf_error(0, "Can't turn off logging; error: '%s'",
|
||||||
error_flags, mysql_error(mysql));
|
error_flags, mysql_error(mysql));
|
||||||
return -1;
|
ret = -1;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if (mysql_query(mysql,buff))
|
if (mysql_query(mysql,buff))
|
||||||
{
|
{
|
||||||
if (mysql_errno(mysql)!=1290)
|
if (mysql_errno(mysql)!=1290)
|
||||||
{
|
{
|
||||||
my_printf_error(0,"unable to change password; error: '%s'",
|
my_printf_error(0,"unable to change password; error: '%s'",
|
||||||
error_flags, mysql_error(mysql));
|
error_flags, mysql_error(mysql));
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1191,9 +1195,10 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
|
|||||||
" --skip-grant-tables).\n"
|
" --skip-grant-tables).\n"
|
||||||
"Use: \"mysqladmin flush-privileges password '*'\""
|
"Use: \"mysqladmin flush-privileges password '*'\""
|
||||||
" instead", error_flags);
|
" instead", error_flags);
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
ret = -1;
|
||||||
}
|
}
|
||||||
|
password_done:
|
||||||
/* free up memory from prompted password */
|
/* free up memory from prompted password */
|
||||||
if (typed_password != argv[1])
|
if (typed_password != argv[1])
|
||||||
{
|
{
|
||||||
@@ -1300,7 +1305,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -2480,7 +2480,7 @@ static Exit_status dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info,
|
|||||||
int2store(buf + BIN_LOG_HEADER_SIZE, binlog_flags);
|
int2store(buf + BIN_LOG_HEADER_SIZE, binlog_flags);
|
||||||
|
|
||||||
size_t tlen = strlen(logname);
|
size_t tlen = strlen(logname);
|
||||||
if (tlen > UINT_MAX)
|
if (tlen > sizeof(buf) - 10)
|
||||||
{
|
{
|
||||||
error("Log name too long.");
|
error("Log name too long.");
|
||||||
DBUG_RETURN(ERROR_STOP);
|
DBUG_RETURN(ERROR_STOP);
|
||||||
|
@@ -2851,6 +2851,8 @@ static uint get_table_structure(char *table, char *db, char *table_type,
|
|||||||
|
|
||||||
my_free(scv_buff);
|
my_free(scv_buff);
|
||||||
|
|
||||||
|
if (path)
|
||||||
|
my_fclose(sql_file, MYF(MY_WME));
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -5941,8 +5943,7 @@ static my_bool get_view_structure(char *table, char* db)
|
|||||||
dynstr_free(&ds_view);
|
dynstr_free(&ds_view);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (switch_character_set_results(mysql, default_charset))
|
switch_character_set_results(mysql, default_charset);
|
||||||
DBUG_RETURN(1);
|
|
||||||
|
|
||||||
/* If a separate .sql file was opened, close it now */
|
/* If a separate .sql file was opened, close it now */
|
||||||
if (sql_file != md_result_file)
|
if (sql_file != md_result_file)
|
||||||
|
@@ -1720,13 +1720,12 @@ void log_msg(const char *fmt, ...)
|
|||||||
int cat_file(DYNAMIC_STRING* ds, const char* filename)
|
int cat_file(DYNAMIC_STRING* ds, const char* filename)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
size_t len;
|
int len;
|
||||||
char buff[16384];
|
char buff[16384];
|
||||||
|
|
||||||
if ((fd= my_open(filename, O_RDONLY, MYF(0))) < 0)
|
if ((fd= my_open(filename, O_RDONLY, MYF(0))) < 0)
|
||||||
return 1;
|
return 1;
|
||||||
while((len= my_read(fd, (uchar*)&buff,
|
while((len= (int)my_read(fd, (uchar*)&buff, sizeof(buff)-1, MYF(0))) > 0)
|
||||||
sizeof(buff)-1, MYF(0))) > 0)
|
|
||||||
{
|
{
|
||||||
char *p= buff, *start= buff,*end=buff+len;
|
char *p= buff, *start= buff,*end=buff+len;
|
||||||
while (p < end)
|
while (p < end)
|
||||||
|
@@ -576,21 +576,4 @@
|
|||||||
#define __STDC_FORMAT_MACROS
|
#define __STDC_FORMAT_MACROS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
|
||||||
stat structure (from <sys/stat.h>) is conditionally defined
|
|
||||||
to have different layout and size depending on the defined macros.
|
|
||||||
The correct macro is defined in my_config.h, which means it MUST be
|
|
||||||
included first (or at least before <features.h> - so, practically,
|
|
||||||
before including any system headers).
|
|
||||||
|
|
||||||
Check the include order by looking at __GLIBC__ (defined in <features.h>)
|
|
||||||
|
|
||||||
But we cannot force all third-party clients/connectors to include
|
|
||||||
my_config.h first. So, their crashes are their responsibility,
|
|
||||||
we enable this check only for MariaDB sources (SAFE_MUTEX check).
|
|
||||||
*/
|
|
||||||
#if defined(__GLIBC__) && defined(SAFE_MUTEX)
|
|
||||||
#error <my_config.h> MUST be included first!
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -27,101 +27,6 @@ IF(NOT WIN32)
|
|||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
IF(WITH_LIBARCHIVE STREQUAL "STATIC")
|
|
||||||
SET(CMAKE_FIND_LIBRARY_SUFFIXES .a .lib)
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
FIND_PACKAGE(LibArchive)
|
|
||||||
|
|
||||||
IF(NOT DEFINED WITH_LIBARCHIVE)
|
|
||||||
IF(LibArchive_FOUND)
|
|
||||||
SET(WITH_LIBARCHIVE_DEFAULT ON)
|
|
||||||
ELSE()
|
|
||||||
SET(WITH_LIBARCHIVE_DEFAULT OFF)
|
|
||||||
ENDIF()
|
|
||||||
SET(WITH_LIBARCHIVE ${WITH_LIBARCHIVE_DEFAULT} CACHE STRING "Use libarchive for streaming features (ON, OFF or STATIC)" )
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
IF(NOT WITH_LIBARCHIVE MATCHES "^(ON|OFF|STATIC)$")
|
|
||||||
MESSAGE(FATAL_ERROR "Invalid value for WITH_LIBARCHIVE: '${WITH_LIBARCHIVE}'. Use one of ON, OFF or STATIC")
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
IF(UNIX)
|
|
||||||
SET(PIC_FLAG -fPIC)
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
IF((NOT WITH_LIBARCHIVE STREQUAL "OFF") AND (NOT LibArchive_FOUND))
|
|
||||||
IF(CMAKE_VERSION VERSION_LESS "2.8.12")
|
|
||||||
MESSAGE("libarchive can't be built, old cmake")
|
|
||||||
ELSE()
|
|
||||||
# Build a local version
|
|
||||||
INCLUDE(ExternalProject)
|
|
||||||
SET(LIBARCHIVE_DIR ${CMAKE_CURRENT_BINARY_DIR}/libarchive)
|
|
||||||
SET(libarchive_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/libarchive)
|
|
||||||
SET(libarchive_CMAKE_ARGS
|
|
||||||
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
|
|
||||||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
|
||||||
-DENABLE_ICONV=OFF
|
|
||||||
-DENABLE_TAR=ON
|
|
||||||
-DENABLE_OPENSSL=OFF
|
|
||||||
-DENABLE_TEST=OFF
|
|
||||||
"-DCMAKE_C_FLAGS_DEBUG=${CMAKE_C_FLAGS_DEBUG} ${PIC_FLAG}"
|
|
||||||
"-DCMAKE_C_FLAGS_RELWITHDEBINFO=${CMAKE_C_FLAGS_RELWITHDEBINFO} ${PIC_FLAG}"
|
|
||||||
"-DCMAKE_C_FLAGS_RELEASE=${CMAKE_C_FLAGS_RELEASE} ${PIC_FLAG}"
|
|
||||||
"-DCMAKE_C_FLAGS_MINSIZEREL=${CMAKE_C_FLAGS_MINSIZEREL} ${PIC_FLAG}"
|
|
||||||
)
|
|
||||||
IF(WIN32)
|
|
||||||
SET(libarchive_CMAKE_ARGS ${libarchive_CMAKE_ARGS} -DWINDOWS_VERSION=WIN7 -DCMAKE_DEBUG_POSTFIX=d)
|
|
||||||
SET(LIBARCHIVE_RELEASE_LIB ${LIBARCHIVE_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}archive_static${CMAKE_STATIC_LIBRARY_SUFFIX})
|
|
||||||
SET(LIBARCHIVE_DEBUG_LIB ${LIBARCHIVE_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}archive_staticd${CMAKE_STATIC_LIBRARY_SUFFIX})
|
|
||||||
SET(byproducts ${LIBARCHIVE_RELEASE_LIB} ${LIBARCHIVE_DEBUG_LIB})
|
|
||||||
ELSE()
|
|
||||||
SET(LIBARCHIVE_LIB ${LIBARCHIVE_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}archive${CMAKE_STATIC_LIBRARY_SUFFIX})
|
|
||||||
SET(byproducts ${LIBARCHIVE_LIB})
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
IF(CMAKE_VERSION VERSION_GREATER "3.1")
|
|
||||||
SET(byproducts BUILD_BYPRODUCTS ${byproducts})
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
ExternalProject_Add(libarchive
|
|
||||||
PREFIX ${libarchive_PREFIX}
|
|
||||||
DOWNLOAD_DIR ${LIBARCHIVE_DIR}
|
|
||||||
URL http://www.libarchive.org/downloads/libarchive-3.2.2.tar.gz
|
|
||||||
INSTALL_DIR ${LIBARCHIVE_DIR}
|
|
||||||
CMAKE_ARGS ${libarchive_CMAKE_ARGS}
|
|
||||||
${byproducts}
|
|
||||||
)
|
|
||||||
ADD_LIBRARY(archive_static STATIC IMPORTED)
|
|
||||||
ADD_DEPENDENCIES(archive_static libarchive)
|
|
||||||
IF(WIN32)
|
|
||||||
SET_PROPERTY(TARGET archive_static PROPERTY IMPORTED_LOCATION_RELWITHDEBINFO ${LIBARCHIVE_RELEASE_LIB})
|
|
||||||
SET_PROPERTY(TARGET archive_static PROPERTY IMPORTED_LOCATION_RELEASE ${LIBARCHIVE_RELEASE_LIB})
|
|
||||||
SET_PROPERTY(TARGET archive_static PROPERTY IMPORTED_LOCATION_DEBUG ${LIBARCHIVE_DEBUG_LIB})
|
|
||||||
SET_PROPERTY(TARGET archive_static PROPERTY IMPORTED_LOCATION_MINSIZEREL ${LIBARCHIVE_RELEASE_LIB})
|
|
||||||
ELSE()
|
|
||||||
SET_PROPERTY(TARGET archive_static PROPERTY IMPORTED_LOCATION ${LIBARCHIVE_LIB})
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
SET(LibArchive_FOUND ON )
|
|
||||||
SET(LibArchive_INCLUDE_DIRS ${LIBARCHIVE_DIR}/include )
|
|
||||||
SET(LibArchive_LIBRARIES archive_static)
|
|
||||||
IF(WIN32)
|
|
||||||
SET(LIBARCHIVE_STATIC 1)
|
|
||||||
ENDIF()
|
|
||||||
ENDIF()
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
|
|
||||||
IF(WITH_LIBARCHIVE AND LibArchive_FOUND)
|
|
||||||
ADD_DEFINITIONS(-DHAVE_LIBARCHIVE)
|
|
||||||
IF(LIBARCHIVE_STATIC)
|
|
||||||
ADD_DEFINITIONS(-DLIBARCHIVE_STATIC)
|
|
||||||
ENDIF()
|
|
||||||
INCLUDE_DIRECTORIES(${LibArchive_INCLUDE_DIRS})
|
|
||||||
LINK_LIBRARIES(${LibArchive_LIBRARIES})
|
|
||||||
SET(DS_ARCHIVE_SOURCE ds_archive.c)
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES(
|
INCLUDE_DIRECTORIES(
|
||||||
${CMAKE_SOURCE_DIR}/include
|
${CMAKE_SOURCE_DIR}/include
|
||||||
@@ -154,7 +59,6 @@ MYSQL_ADD_EXECUTABLE(mariabackup
|
|||||||
innobackupex.cc
|
innobackupex.cc
|
||||||
changed_page_bitmap.cc
|
changed_page_bitmap.cc
|
||||||
datasink.c
|
datasink.c
|
||||||
${DS_ARCHIVE_SOURCE}
|
|
||||||
ds_buffer.c
|
ds_buffer.c
|
||||||
ds_compress.c
|
ds_compress.c
|
||||||
ds_local.c
|
ds_local.c
|
||||||
|
@@ -450,7 +450,7 @@ datadir_iter_free(datadir_iter_t *it)
|
|||||||
/************************************************************************
|
/************************************************************************
|
||||||
Holds the state needed to copy single data file. */
|
Holds the state needed to copy single data file. */
|
||||||
struct datafile_cur_t {
|
struct datafile_cur_t {
|
||||||
os_file_t file;
|
pfs_os_file_t file;
|
||||||
char rel_path[FN_REFLEN];
|
char rel_path[FN_REFLEN];
|
||||||
char abs_path[FN_REFLEN];
|
char abs_path[FN_REFLEN];
|
||||||
MY_STAT statinfo;
|
MY_STAT statinfo;
|
||||||
|
@@ -35,7 +35,7 @@ Remove these on the first opportunity, i.e. single-binary XtraBackup. */
|
|||||||
/** Single bitmap file information */
|
/** Single bitmap file information */
|
||||||
struct log_online_bitmap_file_t {
|
struct log_online_bitmap_file_t {
|
||||||
char name[FN_REFLEN]; /*!< Name with full path */
|
char name[FN_REFLEN]; /*!< Name with full path */
|
||||||
os_file_t file; /*!< Handle to opened file */
|
pfs_os_file_t file; /*!< Handle to opened file */
|
||||||
ib_uint64_t size; /*!< Size of the file */
|
ib_uint64_t size; /*!< Size of the file */
|
||||||
ib_uint64_t offset; /*!< Offset of the next read,
|
ib_uint64_t offset; /*!< Offset of the next read,
|
||||||
or count of already-read bytes
|
or count of already-read bytes
|
||||||
|
@@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software
|
|||||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
|
||||||
*******************************************************/
|
*******************************************************/
|
||||||
|
#include "my_config.h"
|
||||||
#include "crc_glue.h"
|
#include "crc_glue.h"
|
||||||
#include "crc-intel-pclmul.h"
|
#include "crc-intel-pclmul.h"
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
@@ -29,7 +29,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|||||||
#include "read_filt.h"
|
#include "read_filt.h"
|
||||||
|
|
||||||
struct xb_fil_cur_t {
|
struct xb_fil_cur_t {
|
||||||
os_file_t file; /*!< source file handle */
|
pfs_os_file_t file; /*!< source file handle */
|
||||||
fil_node_t* node; /*!< source tablespace node */
|
fil_node_t* node; /*!< source tablespace node */
|
||||||
char rel_path[FN_REFLEN];
|
char rel_path[FN_REFLEN];
|
||||||
/*!< normalized file path */
|
/*!< normalized file path */
|
||||||
|
@@ -848,9 +848,7 @@ ibx_get_one_option(int optid,
|
|||||||
opt_ibx_decrypt = true;
|
opt_ibx_decrypt = true;
|
||||||
break;
|
break;
|
||||||
case OPT_STREAM:
|
case OPT_STREAM:
|
||||||
if (!strcasecmp(argument, "tar"))
|
if (!strcasecmp(argument, "xbstream"))
|
||||||
xtrabackup_stream_fmt = XB_STREAM_FMT_TAR;
|
|
||||||
else if (!strcasecmp(argument, "xbstream"))
|
|
||||||
xtrabackup_stream_fmt = XB_STREAM_FMT_XBSTREAM;
|
xtrabackup_stream_fmt = XB_STREAM_FMT_XBSTREAM;
|
||||||
else {
|
else {
|
||||||
ibx_msg("Invalid --stream argument: %s\n", argument);
|
ibx_msg("Invalid --stream argument: %s\n", argument);
|
||||||
|
@@ -23,7 +23,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|||||||
|
|
||||||
|
|
||||||
extern void os_io_init_simple(void);
|
extern void os_io_init_simple(void);
|
||||||
extern os_file_t files[1000];
|
extern pfs_os_file_t files[1000];
|
||||||
extern const char *innodb_checksum_algorithm_names[];
|
extern const char *innodb_checksum_algorithm_names[];
|
||||||
extern TYPELIB innodb_checksum_algorithm_typelib;
|
extern TYPELIB innodb_checksum_algorithm_typelib;
|
||||||
extern dberr_t open_or_create_data_files(
|
extern dberr_t open_or_create_data_files(
|
||||||
|
@@ -42,7 +42,6 @@ typedef struct xb_wstream_file_struct xb_wstream_file_t;
|
|||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
XB_STREAM_FMT_NONE,
|
XB_STREAM_FMT_NONE,
|
||||||
XB_STREAM_FMT_TAR,
|
|
||||||
XB_STREAM_FMT_XBSTREAM
|
XB_STREAM_FMT_XBSTREAM
|
||||||
} xb_stream_fmt_t;
|
} xb_stream_fmt_t;
|
||||||
|
|
||||||
|
@@ -704,11 +704,7 @@ struct my_option xb_client_options[] =
|
|||||||
|
|
||||||
{"stream", OPT_XTRA_STREAM, "Stream all backup files to the standard output "
|
{"stream", OPT_XTRA_STREAM, "Stream all backup files to the standard output "
|
||||||
"in the specified format."
|
"in the specified format."
|
||||||
#ifdef HAVE_LIBARCHIVE
|
|
||||||
"Supported formats are 'tar' and 'xbstream'."
|
|
||||||
#else
|
|
||||||
"Supported format is 'xbstream'."
|
"Supported format is 'xbstream'."
|
||||||
#endif
|
|
||||||
,
|
,
|
||||||
(G_PTR*) &xtrabackup_stream_str, (G_PTR*) &xtrabackup_stream_str, 0, GET_STR,
|
(G_PTR*) &xtrabackup_stream_str, (G_PTR*) &xtrabackup_stream_str, 0, GET_STR,
|
||||||
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
@@ -1453,9 +1449,7 @@ xb_get_one_option(int optid,
|
|||||||
xtrabackup_target_dir= xtrabackup_real_target_dir;
|
xtrabackup_target_dir= xtrabackup_real_target_dir;
|
||||||
break;
|
break;
|
||||||
case OPT_XTRA_STREAM:
|
case OPT_XTRA_STREAM:
|
||||||
if (!strcasecmp(argument, "tar"))
|
if (!strcasecmp(argument, "xbstream"))
|
||||||
xtrabackup_stream_fmt = XB_STREAM_FMT_TAR;
|
|
||||||
else if (!strcasecmp(argument, "xbstream"))
|
|
||||||
xtrabackup_stream_fmt = XB_STREAM_FMT_XBSTREAM;
|
xtrabackup_stream_fmt = XB_STREAM_FMT_XBSTREAM;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2412,7 +2406,7 @@ check_if_skip_table(
|
|||||||
Reads the space flags from a given data file and returns the compressed
|
Reads the space flags from a given data file and returns the compressed
|
||||||
page size, or 0 if the space is not compressed. */
|
page size, or 0 if the space is not compressed. */
|
||||||
ulint
|
ulint
|
||||||
xb_get_zip_size(os_file_t file)
|
xb_get_zip_size(pfs_os_file_t file)
|
||||||
{
|
{
|
||||||
byte *buf;
|
byte *buf;
|
||||||
byte *page;
|
byte *page;
|
||||||
@@ -3106,14 +3100,6 @@ files first, and then streams them in a serialized way when closed. */
|
|||||||
static void
|
static void
|
||||||
xtrabackup_init_datasinks(void)
|
xtrabackup_init_datasinks(void)
|
||||||
{
|
{
|
||||||
if (xtrabackup_parallel > 1 && xtrabackup_stream &&
|
|
||||||
xtrabackup_stream_fmt == XB_STREAM_FMT_TAR) {
|
|
||||||
msg("xtrabackup: warning: the --parallel option does not have "
|
|
||||||
"any effect when streaming in the 'tar' format. "
|
|
||||||
"You can use the 'xbstream' format instead.\n");
|
|
||||||
xtrabackup_parallel = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Start building out the pipelines from the terminus back */
|
/* Start building out the pipelines from the terminus back */
|
||||||
if (xtrabackup_stream) {
|
if (xtrabackup_stream) {
|
||||||
/* All streaming goes to stdout */
|
/* All streaming goes to stdout */
|
||||||
@@ -3131,31 +3117,18 @@ xtrabackup_init_datasinks(void)
|
|||||||
/* Stream formatting */
|
/* Stream formatting */
|
||||||
if (xtrabackup_stream) {
|
if (xtrabackup_stream) {
|
||||||
ds_ctxt_t *ds;
|
ds_ctxt_t *ds;
|
||||||
if (xtrabackup_stream_fmt == XB_STREAM_FMT_TAR) {
|
|
||||||
ds = ds_create(xtrabackup_target_dir, DS_TYPE_ARCHIVE);
|
ut_a(xtrabackup_stream_fmt == XB_STREAM_FMT_XBSTREAM);
|
||||||
} else if (xtrabackup_stream_fmt == XB_STREAM_FMT_XBSTREAM) {
|
|
||||||
ds = ds_create(xtrabackup_target_dir, DS_TYPE_XBSTREAM);
|
ds = ds_create(xtrabackup_target_dir, DS_TYPE_XBSTREAM);
|
||||||
} else {
|
|
||||||
/* bad juju... */
|
|
||||||
ds = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
xtrabackup_add_datasink(ds);
|
xtrabackup_add_datasink(ds);
|
||||||
|
|
||||||
ds_set_pipe(ds, ds_data);
|
ds_set_pipe(ds, ds_data);
|
||||||
ds_data = ds;
|
ds_data = ds;
|
||||||
|
|
||||||
if (xtrabackup_stream_fmt != XB_STREAM_FMT_XBSTREAM) {
|
|
||||||
|
|
||||||
/* 'tar' does not allow parallel streams */
|
|
||||||
ds_redo = ds_meta = ds_create(xtrabackup_target_dir,
|
|
||||||
DS_TYPE_TMPFILE);
|
|
||||||
xtrabackup_add_datasink(ds_meta);
|
|
||||||
ds_set_pipe(ds_meta, ds);
|
|
||||||
} else {
|
|
||||||
ds_redo = ds_meta = ds_data;
|
ds_redo = ds_meta = ds_data;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* Encryption */
|
/* Encryption */
|
||||||
if (xtrabackup_encrypt) {
|
if (xtrabackup_encrypt) {
|
||||||
@@ -4856,7 +4829,7 @@ end:
|
|||||||
static my_bool
|
static my_bool
|
||||||
xtrabackup_init_temp_log(void)
|
xtrabackup_init_temp_log(void)
|
||||||
{
|
{
|
||||||
os_file_t src_file = XB_FILE_UNDEFINED;
|
pfs_os_file_t src_file;
|
||||||
char src_path[FN_REFLEN];
|
char src_path[FN_REFLEN];
|
||||||
char dst_path[FN_REFLEN];
|
char dst_path[FN_REFLEN];
|
||||||
ibool success;
|
ibool success;
|
||||||
@@ -5183,7 +5156,7 @@ xb_space_create_file(
|
|||||||
ulint space_id, /*!<in: space id */
|
ulint space_id, /*!<in: space id */
|
||||||
ulint flags __attribute__((unused)),/*!<in: tablespace
|
ulint flags __attribute__((unused)),/*!<in: tablespace
|
||||||
flags */
|
flags */
|
||||||
os_file_t* file) /*!<out: file handle */
|
pfs_os_file_t* file) /*!<out: file handle */
|
||||||
{
|
{
|
||||||
ibool ret;
|
ibool ret;
|
||||||
byte* buf;
|
byte* buf;
|
||||||
@@ -5262,7 +5235,7 @@ mismatching ID, renames it to xtrabackup_tmp_#ID.ibd. If there was no
|
|||||||
matching file, creates a new tablespace.
|
matching file, creates a new tablespace.
|
||||||
@return file handle of matched or created file */
|
@return file handle of matched or created file */
|
||||||
static
|
static
|
||||||
os_file_t
|
pfs_os_file_t
|
||||||
xb_delta_open_matching_space(
|
xb_delta_open_matching_space(
|
||||||
const char* dbname, /* in: path to destination database dir */
|
const char* dbname, /* in: path to destination database dir */
|
||||||
const char* name, /* in: name of delta file (without .delta) */
|
const char* name, /* in: name of delta file (without .delta) */
|
||||||
@@ -5276,7 +5249,7 @@ xb_delta_open_matching_space(
|
|||||||
char dest_space_name[FN_REFLEN];
|
char dest_space_name[FN_REFLEN];
|
||||||
ibool ok;
|
ibool ok;
|
||||||
fil_space_t* fil_space;
|
fil_space_t* fil_space;
|
||||||
os_file_t file = 0;
|
pfs_os_file_t file;
|
||||||
ulint tablespace_flags;
|
ulint tablespace_flags;
|
||||||
xb_filter_entry_t* table;
|
xb_filter_entry_t* table;
|
||||||
|
|
||||||
@@ -5440,8 +5413,8 @@ xtrabackup_apply_delta(
|
|||||||
including the .delta extension */
|
including the .delta extension */
|
||||||
void* /*data*/)
|
void* /*data*/)
|
||||||
{
|
{
|
||||||
os_file_t src_file = XB_FILE_UNDEFINED;
|
pfs_os_file_t src_file;
|
||||||
os_file_t dst_file = XB_FILE_UNDEFINED;
|
pfs_os_file_t dst_file;
|
||||||
char src_path[FN_REFLEN];
|
char src_path[FN_REFLEN];
|
||||||
char dst_path[FN_REFLEN];
|
char dst_path[FN_REFLEN];
|
||||||
char meta_path[FN_REFLEN];
|
char meta_path[FN_REFLEN];
|
||||||
@@ -5815,7 +5788,7 @@ xtrabackup_apply_deltas()
|
|||||||
static my_bool
|
static my_bool
|
||||||
xtrabackup_close_temp_log(my_bool clear_flag)
|
xtrabackup_close_temp_log(my_bool clear_flag)
|
||||||
{
|
{
|
||||||
os_file_t src_file = XB_FILE_UNDEFINED;
|
pfs_os_file_t src_file;
|
||||||
char src_path[FN_REFLEN];
|
char src_path[FN_REFLEN];
|
||||||
char dst_path[FN_REFLEN];
|
char dst_path[FN_REFLEN];
|
||||||
ibool success;
|
ibool success;
|
||||||
@@ -6597,7 +6570,7 @@ skip_check:
|
|||||||
|
|
||||||
if (xtrabackup_export) {
|
if (xtrabackup_export) {
|
||||||
msg("xtrabackup: export option is specified.\n");
|
msg("xtrabackup: export option is specified.\n");
|
||||||
os_file_t info_file = XB_FILE_UNDEFINED;
|
pfs_os_file_t info_file;
|
||||||
char info_file_path[FN_REFLEN];
|
char info_file_path[FN_REFLEN];
|
||||||
ibool success;
|
ibool success;
|
||||||
char table_name[FN_REFLEN];
|
char table_name[FN_REFLEN];
|
||||||
@@ -7406,22 +7379,6 @@ int main(int argc, char **argv)
|
|||||||
innobase_file_per_table = TRUE;
|
innobase_file_per_table = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xtrabackup_incremental && xtrabackup_stream &&
|
|
||||||
xtrabackup_stream_fmt == XB_STREAM_FMT_TAR) {
|
|
||||||
msg("xtrabackup: error: "
|
|
||||||
"streaming incremental backups are incompatible with the \n"
|
|
||||||
"'tar' streaming format. Use --stream=xbstream instead.\n");
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((xtrabackup_compress || xtrabackup_encrypt) && xtrabackup_stream &&
|
|
||||||
xtrabackup_stream_fmt == XB_STREAM_FMT_TAR) {
|
|
||||||
msg("xtrabackup: error: "
|
|
||||||
"compressed and encrypted backups are incompatible with the \n"
|
|
||||||
"'tar' streaming format. Use --stream=xbstream instead.\n");
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!xtrabackup_prepare &&
|
if (!xtrabackup_prepare &&
|
||||||
(innobase_log_arch_dir || xtrabackup_archived_to_lsn)) {
|
(innobase_log_arch_dir || xtrabackup_archived_to_lsn)) {
|
||||||
|
|
||||||
|
@@ -27,7 +27,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|||||||
#include "changed_page_bitmap.h"
|
#include "changed_page_bitmap.h"
|
||||||
|
|
||||||
#ifdef __WIN__
|
#ifdef __WIN__
|
||||||
#define XB_FILE_UNDEFINED NULL
|
#define XB_FILE_UNDEFINED INVALID_HANDLE_VALUE
|
||||||
#else
|
#else
|
||||||
#define XB_FILE_UNDEFINED (-1)
|
#define XB_FILE_UNDEFINED (-1)
|
||||||
#endif
|
#endif
|
||||||
@@ -194,7 +194,7 @@ void xb_data_files_close(void);
|
|||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
Reads the space flags from a given data file and returns the compressed
|
Reads the space flags from a given data file and returns the compressed
|
||||||
page size, or 0 if the space is not compressed. */
|
page size, or 0 if the space is not compressed. */
|
||||||
ulint xb_get_zip_size(os_file_t file);
|
ulint xb_get_zip_size(pfs_os_file_t file);
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
Checks if a table specified as a name in the form "database/name" (InnoDB 5.6)
|
Checks if a table specified as a name in the form "database/name" (InnoDB 5.6)
|
||||||
|
@@ -613,22 +613,24 @@ ANALYZE
|
|||||||
},
|
},
|
||||||
"block-nl-join": {
|
"block-nl-join": {
|
||||||
"table": {
|
"table": {
|
||||||
"table_name": "<subquery2>",
|
"table_name": "t2",
|
||||||
"access_type": "ALL",
|
"access_type": "ALL",
|
||||||
"possible_keys": ["distinct_key"],
|
|
||||||
"r_loops": 1,
|
"r_loops": 1,
|
||||||
"rows": 2,
|
"rows": 2,
|
||||||
"r_rows": 2,
|
"r_rows": 2,
|
||||||
"r_total_time_ms": "REPLACED",
|
"r_total_time_ms": "REPLACED",
|
||||||
"filtered": 100,
|
"filtered": 100,
|
||||||
"r_filtered": 100
|
"r_filtered": 0,
|
||||||
|
"attached_condition": "<in_optimizer>(t2.b,t2.b in (subquery#2))"
|
||||||
},
|
},
|
||||||
"buffer_type": "flat",
|
"buffer_type": "flat",
|
||||||
"buffer_size": "256Kb",
|
"buffer_size": "256Kb",
|
||||||
"join_type": "BNL",
|
"join_type": "BNL",
|
||||||
"r_filtered": 100,
|
"attached_condition": "<in_optimizer>(t2.b,t2.b in (subquery#2))",
|
||||||
"materialized": {
|
"r_filtered": null
|
||||||
"unique": 1,
|
},
|
||||||
|
"subqueries": [
|
||||||
|
{
|
||||||
"query_block": {
|
"query_block": {
|
||||||
"select_id": 2,
|
"select_id": 2,
|
||||||
"r_loops": 1,
|
"r_loops": 1,
|
||||||
@@ -645,24 +647,7 @@ ANALYZE
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
]
|
||||||
"block-nl-join": {
|
|
||||||
"table": {
|
|
||||||
"table_name": "t2",
|
|
||||||
"access_type": "ALL",
|
|
||||||
"r_loops": 1,
|
|
||||||
"rows": 2,
|
|
||||||
"r_rows": 2,
|
|
||||||
"r_total_time_ms": "REPLACED",
|
|
||||||
"filtered": 100,
|
|
||||||
"r_filtered": 100
|
|
||||||
},
|
|
||||||
"buffer_type": "incremental",
|
|
||||||
"buffer_size": "256Kb",
|
|
||||||
"join_type": "BNL",
|
|
||||||
"attached_condition": "t2.b = `<subquery2>`.a",
|
|
||||||
"r_filtered": 0
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
|
@@ -507,6 +507,7 @@ select t.a, count(*) from t1,t where t1.a=t.a group by t.a;
|
|||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary; Using filesort
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary; Using filesort
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
|
||||||
|
1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 35 func 1
|
||||||
3 MATERIALIZED t2 ALL NULL NULL NULL NULL 4 Using where
|
3 MATERIALIZED t2 ALL NULL NULL NULL NULL 4 Using where
|
||||||
3 MATERIALIZED t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
|
3 MATERIALIZED t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
|
||||||
explain
|
explain
|
||||||
@@ -522,6 +523,7 @@ where t1.a=t.a group by t.a;
|
|||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary; Using filesort
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary; Using filesort
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
|
||||||
|
1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 35 func 1
|
||||||
3 MATERIALIZED t2 ALL NULL NULL NULL NULL 4 Using where
|
3 MATERIALIZED t2 ALL NULL NULL NULL NULL 4 Using where
|
||||||
3 MATERIALIZED t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
|
3 MATERIALIZED t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
|
||||||
# with clause in the specification of a derived table
|
# with clause in the specification of a derived table
|
||||||
|
@@ -2916,5 +2916,64 @@ Handler_read_rnd_deleted 0
|
|||||||
Handler_read_rnd_next 27
|
Handler_read_rnd_next 27
|
||||||
deallocate prepare stmt1;
|
deallocate prepare stmt1;
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
|
#
|
||||||
|
# Bug mdev-12670: mergeable derived / view with subqueries
|
||||||
|
# subject to semi-join optimizations
|
||||||
|
# (actually this is a 5.3 bug.)
|
||||||
|
#
|
||||||
|
create table t1 (a int) engine=myisam;
|
||||||
|
insert into t1 values (5),(3),(2),(7),(2),(5),(1);
|
||||||
|
create table t2 (b int, index idx(b)) engine=myisam;
|
||||||
|
insert into t2 values (2),(3),(2),(1),(3),(4);
|
||||||
|
insert into t2 select b+10 from t2;
|
||||||
|
insert into t2 select b+10 from t2;
|
||||||
|
insert into t2 select b+10 from t2;
|
||||||
|
insert into t2 select b+10 from t2;
|
||||||
|
insert into t2 select b+10 from t2;
|
||||||
|
insert into t2 select b+10 from t2;
|
||||||
|
insert into t2 select b+10 from t2;
|
||||||
|
insert into t2 select b+10 from t2;
|
||||||
|
insert into t2 select b+10 from t2;
|
||||||
|
insert into t2 select b+10 from t2;
|
||||||
|
analyze table t1,t2;
|
||||||
|
Table Op Msg_type Msg_text
|
||||||
|
test.t1 analyze status OK
|
||||||
|
test.t2 analyze status OK
|
||||||
|
explain select a from t1 where a in (select b from t2);
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 7 Using where
|
||||||
|
1 PRIMARY t2 ref idx idx 5 test.t1.a 140 Using index; FirstMatch(t1)
|
||||||
|
explain select * from (select a from t1 where a in (select b from t2)) t;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 7 Using where
|
||||||
|
1 PRIMARY t2 ref idx idx 5 test.t1.a 140 Using index; FirstMatch(t1)
|
||||||
|
create view v1 as select a from t1 where a in (select b from t2);
|
||||||
|
explain select * from v1;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 7 Using where
|
||||||
|
1 PRIMARY t2 ref idx idx 5 test.t1.a 140 Using index; FirstMatch(t1)
|
||||||
|
drop view v1;
|
||||||
|
drop table t1,t2;
|
||||||
|
#
|
||||||
|
# Bug mdev-12812: mergeable derived / view with subqueries
|
||||||
|
# NOT subject to semi-join optimizations
|
||||||
|
#
|
||||||
|
CREATE TABLE t1 (c1 varchar(3)) ENGINE=MyISAM;
|
||||||
|
INSERT INTO t1 VALUES ('foo'),('foo');
|
||||||
|
CREATE TABLE t2 (c2 varchar(3)) ENGINE=MyISAM;
|
||||||
|
INSERT INTO t2 VALUES ('bar'),('qux'),('foo');
|
||||||
|
SELECT STRAIGHT_JOIN *
|
||||||
|
FROM ( SELECT * FROM t1 WHERE c1 IN ( SELECT c2 FROM t2 ) ) AS sq;
|
||||||
|
c1
|
||||||
|
foo
|
||||||
|
foo
|
||||||
|
EXPLAIN EXTENDED SELECT STRAIGHT_JOIN *
|
||||||
|
FROM ( SELECT * FROM t1 WHERE c1 IN ( SELECT c2 FROM t2 ) ) AS sq;
|
||||||
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
|
3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select straight_join `test`.`t1`.`c1` AS `c1` from `test`.`t1` where <in_optimizer>(`test`.`t1`.`c1`,<exists>(select `test`.`t2`.`c2` from `test`.`t2` where <cache>(`test`.`t1`.`c1`) = `test`.`t2`.`c2`))
|
||||||
|
DROP TABLE t1, t2;
|
||||||
set optimizer_switch=@exit_optimizer_switch;
|
set optimizer_switch=@exit_optimizer_switch;
|
||||||
set join_cache_level=@exit_join_cache_level;
|
set join_cache_level=@exit_join_cache_level;
|
||||||
|
@@ -425,7 +425,7 @@ c1
|
|||||||
bb
|
bb
|
||||||
cc
|
cc
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1931 Query execution was interrupted. The query examined at least 18 rows, which exceeds LIMIT ROWS EXAMINED (16). The query result may be incomplete
|
Warning 1931 Query execution was interrupted. The query examined at least 17 rows, which exceeds LIMIT ROWS EXAMINED (16). The query result may be incomplete
|
||||||
select * from v1 LIMIT ROWS EXAMINED 11;
|
select * from v1 LIMIT ROWS EXAMINED 11;
|
||||||
c1
|
c1
|
||||||
bb
|
bb
|
||||||
@@ -438,7 +438,8 @@ from (select * from t1
|
|||||||
where c1 IN (select * from t2 where c2 > ' ' LIMIT ROWS EXAMINED 0)) as tmp
|
where c1 IN (select * from t2 where c2 > ' ' LIMIT ROWS EXAMINED 0)) as tmp
|
||||||
LIMIT ROWS EXAMINED 11;
|
LIMIT ROWS EXAMINED 11;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 4
|
||||||
|
1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 2 func 1
|
||||||
3 MATERIALIZED t2 ALL NULL NULL NULL NULL 4 Using where
|
3 MATERIALIZED t2 ALL NULL NULL NULL NULL 4 Using where
|
||||||
select *
|
select *
|
||||||
from (select * from t1
|
from (select * from t1
|
||||||
|
@@ -379,6 +379,7 @@ drop table t3, t4, t5;
|
|||||||
#
|
#
|
||||||
# LP BUG#858038 The result of a query with NOT IN subquery depends on the state of the optimizer switch
|
# LP BUG#858038 The result of a query with NOT IN subquery depends on the state of the optimizer switch
|
||||||
#
|
#
|
||||||
|
set @optimizer_switch_save= @@optimizer_switch;
|
||||||
create table t1 (c1 char(2) not null, c2 char(2));
|
create table t1 (c1 char(2) not null, c2 char(2));
|
||||||
create table t2 (c3 char(2), c4 char(2));
|
create table t2 (c3 char(2), c4 char(2));
|
||||||
insert into t1 values ('a1', 'b1');
|
insert into t1 values ('a1', 'b1');
|
||||||
@@ -400,6 +401,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
select * from t1 where c1 = 'a2' and (c1, c2) not in (select * from t2);
|
select * from t1 where c1 = 'a2' and (c1, c2) not in (select * from t2);
|
||||||
c1 c2
|
c1 c2
|
||||||
drop table t1, t2;
|
drop table t1, t2;
|
||||||
|
set optimizer_switch= @optimizer_switch_save;
|
||||||
#
|
#
|
||||||
# MDEV-12673: cost-based choice between materialization and in-to-exists
|
# MDEV-12673: cost-based choice between materialization and in-to-exists
|
||||||
#
|
#
|
||||||
@@ -442,3 +444,44 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
2 DEPENDENT SUBQUERY t3 const PRIMARY PRIMARY 4 const 1
|
2 DEPENDENT SUBQUERY t3 const PRIMARY PRIMARY 4 const 1
|
||||||
2 DEPENDENT SUBQUERY t2 index NULL i2 11 NULL 2 Using where; Using index
|
2 DEPENDENT SUBQUERY t2 index NULL i2 11 NULL 2 Using where; Using index
|
||||||
DROP TABLE t1,t2,t3;
|
DROP TABLE t1,t2,t3;
|
||||||
|
#
|
||||||
|
# MDEV-7599: in-to-exists chosen after min/max optimization
|
||||||
|
#
|
||||||
|
set @optimizer_switch_save= @@optimizer_switch;
|
||||||
|
CREATE TABLE t1 (a INT, KEY(a)) ENGINE=MyISAM;
|
||||||
|
INSERT INTO t1 VALUES (1),(2);
|
||||||
|
CREATE TABLE t2 (b INT, c INT) ENGINE=MyISAM;
|
||||||
|
INSERT INTO t2 VALUES (1,6),(2,4), (8,9);
|
||||||
|
SELECT * FROM t2 WHERE b != ALL (SELECT MIN(a) FROM t1, t2 WHERE t2.c = t2.b);
|
||||||
|
b c
|
||||||
|
EXPLAIN EXTENDED SELECT * FROM t2 WHERE b != ALL (SELECT MIN(a) FROM t1, t2 WHERE t2.c = t2.b);
|
||||||
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
|
1 PRIMARY t2 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||||
|
2 MATERIALIZED t1 index NULL a 5 NULL 2 100.00 Using index
|
||||||
|
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where !<expr_cache><`test`.`t2`.`b`>(<in_optimizer>(`test`.`t2`.`b`,`test`.`t2`.`b` in ( <materialize> (select min(`test`.`t1`.`a`) from `test`.`t1` join `test`.`t2` where `test`.`t2`.`c` = `test`.`t2`.`b` ), <primary_index_lookup>(`test`.`t2`.`b` in <temporary table> on distinct_key where `test`.`t2`.`b` = `<subquery2>`.`MIN(a)`))))
|
||||||
|
set optimizer_switch= 'materialization=off';
|
||||||
|
SELECT * FROM t2 WHERE b != ALL (SELECT MIN(a) FROM t1, t2 WHERE t2.c = t2.b);
|
||||||
|
b c
|
||||||
|
EXPLAIN EXTENDED SELECT * FROM t2 WHERE b != ALL (SELECT MIN(a) FROM t1, t2 WHERE t2.c = t2.b);
|
||||||
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
|
1 PRIMARY t2 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||||
|
2 DEPENDENT SUBQUERY t1 index NULL a 5 NULL 2 100.00 Using index
|
||||||
|
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where !<expr_cache><`test`.`t2`.`b`>(<in_optimizer>(`test`.`t2`.`b`,<exists>(select min(`test`.`t1`.`a`) from `test`.`t1` join `test`.`t2` where `test`.`t2`.`c` = `test`.`t2`.`b` having trigcond(<cache>(`test`.`t2`.`b`) = <ref_null_helper>(min(`test`.`t1`.`a`))))))
|
||||||
|
set optimizer_switch= @optimizer_switch_save;
|
||||||
|
DROP TABLE t1,t2;
|
||||||
|
CREATE TABLE t1 (f1 varchar(10)) ENGINE=MyISAM;
|
||||||
|
INSERT INTO t1 VALUES ('foo'),('bar');
|
||||||
|
CREATE TABLE t2 (f2 varchar(10), key(f2)) ENGINE=MyISAM;
|
||||||
|
INSERT INTO t2 VALUES ('baz'),('qux');
|
||||||
|
CREATE TABLE t3 (f3 varchar(10)) ENGINE=MyISAM;
|
||||||
|
INSERT INTO t3 VALUES ('abc'),('def');
|
||||||
|
SELECT * FROM t1
|
||||||
|
WHERE f1 = ALL( SELECT MAX(t2a.f2)
|
||||||
|
FROM t2 AS t2a INNER JOIN t2 t2b INNER JOIN t3
|
||||||
|
ON (f3 = t2b.f2) );
|
||||||
|
f1
|
||||||
|
DROP TABLE t1,t2,t3;
|
||||||
|
@@ -1652,9 +1652,9 @@ CREATE VIEW v1 AS SELECT 1;
|
|||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM t1 INNER JOIN t2 ON t2.a != 0 AND t2.a IN (SELECT * FROM v1);
|
SELECT * FROM t1 INNER JOIN t2 ON t2.a != 0 AND t2.a IN (SELECT * FROM v1);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 PRIMARY <derived3> system NULL NULL NULL NULL 1
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
|
||||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
|
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
|
||||||
2 MATERIALIZED <derived3> system NULL NULL NULL NULL 1
|
|
||||||
3 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used
|
3 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
SELECT * FROM t1 INNER JOIN t2 ON t2.a != 0 AND t2.a IN (SELECT * FROM v1);
|
SELECT * FROM t1 INNER JOIN t2 ON t2.a != 0 AND t2.a IN (SELECT * FROM v1);
|
||||||
a a
|
a a
|
||||||
@@ -3072,4 +3072,97 @@ project_number
|
|||||||
aaa
|
aaa
|
||||||
drop table t1, t2, t3;
|
drop table t1, t2, t3;
|
||||||
set optimizer_switch= @tmp_mdev6859;
|
set optimizer_switch= @tmp_mdev6859;
|
||||||
|
#
|
||||||
|
# MDEV-12675: subquery subject to semi-join optimizations
|
||||||
|
# in ON expression of INNER JOIN
|
||||||
|
#
|
||||||
|
set @tmp_mdev12675=@@optimizer_switch;
|
||||||
|
set optimizer_switch=default;
|
||||||
|
create table t1 (a int) engine=myisam;
|
||||||
|
insert into t1 values (5),(3),(2),(7),(2),(5),(1);
|
||||||
|
create table t2 (b int, index idx(b)) engine=myisam;
|
||||||
|
insert into t2 values (2),(3),(2),(1),(3),(4);
|
||||||
|
insert into t2 select b+10 from t2;
|
||||||
|
insert into t2 select b+10 from t2;
|
||||||
|
insert into t2 select b+10 from t2;
|
||||||
|
insert into t2 select b+10 from t2;
|
||||||
|
insert into t2 select b+10 from t2;
|
||||||
|
insert into t2 select b+10 from t2;
|
||||||
|
insert into t2 select b+10 from t2;
|
||||||
|
insert into t2 select b+10 from t2;
|
||||||
|
insert into t2 select b+10 from t2;
|
||||||
|
insert into t2 select b+10 from t2;
|
||||||
|
insert into t2 select b+10 from t2;
|
||||||
|
analyze table t1,t2;
|
||||||
|
Table Op Msg_type Msg_text
|
||||||
|
test.t1 analyze status OK
|
||||||
|
test.t2 analyze status OK
|
||||||
|
explain
|
||||||
|
select a from t1, t2 where b between 1 and 2 and a in (select b from t2);
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 7 Using where
|
||||||
|
1 PRIMARY t2 ref idx idx 5 test.t1.a 256 Using index; FirstMatch(t1)
|
||||||
|
1 PRIMARY t2 range idx idx 5 NULL 2 Using where; Using index; Using join buffer (flat, BNL join)
|
||||||
|
explain
|
||||||
|
select a from t1 join t2 on b between 1 and 2 and a in (select b from t2);
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 7 Using where
|
||||||
|
1 PRIMARY t2 ref idx idx 5 test.t1.a 256 Using index; FirstMatch(t1)
|
||||||
|
1 PRIMARY t2 range idx idx 5 NULL 2 Using where; Using index; Using join buffer (flat, BNL join)
|
||||||
|
drop table t1,t2;
|
||||||
|
set optimizer_switch= @tmp_mdev12675;
|
||||||
|
#
|
||||||
|
# MDEV-12817: subquery NOT subject to semi-join optimizations
|
||||||
|
# in ON expression of INNER JOIN
|
||||||
|
#
|
||||||
|
CREATE TABLE t1 (c1 int) ENGINE=MyISAM;
|
||||||
|
INSERT INTO t1 VALUES (1),(2);
|
||||||
|
CREATE TABLE t2 (c2 int) ENGINE=MyISAM;
|
||||||
|
INSERT INTO t2 VALUES (3),(4);
|
||||||
|
CREATE TABLE t3 (c3 int) ENGINE=MyISAM;
|
||||||
|
INSERT INTO t3 VALUES (5),(6);
|
||||||
|
CREATE TABLE t4 (c4 int) ENGINE=MyISAM;
|
||||||
|
INSERT INTO t4 VALUES (7),(8);
|
||||||
|
SELECT c1
|
||||||
|
FROM t1
|
||||||
|
LEFT JOIN
|
||||||
|
( t2 INNER JOIN t3 ON ( 1 IN ( SELECT c4 FROM t4 ) ) )
|
||||||
|
ON (c1 = c3);
|
||||||
|
c1
|
||||||
|
1
|
||||||
|
2
|
||||||
|
EXPLAIN EXTENDED SELECT c1
|
||||||
|
FROM t1
|
||||||
|
LEFT JOIN
|
||||||
|
( t2 INNER JOIN t3 ON ( 1 IN ( SELECT c4 FROM t4 ) ) )
|
||||||
|
ON (c1 = c3);
|
||||||
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
|
||||||
|
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
|
1 PRIMARY t3 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
|
2 SUBQUERY t4 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(`test`.`t3`.`c3` = `test`.`t1`.`c1` and <cache>(<in_optimizer>(1,<exists>(select `test`.`t4`.`c4` from `test`.`t4` where 1 = `test`.`t4`.`c4`)))) where 1
|
||||||
|
# mdev-12820
|
||||||
|
SELECT *
|
||||||
|
FROM t1
|
||||||
|
LEFT JOIN
|
||||||
|
( ( SELECT * FROM t2 WHERE c2 IN ( SELECT c3 FROM t3 ) ) AS sq INNER JOIN t4 )
|
||||||
|
ON (c1 = c2);
|
||||||
|
c1 c2 c4
|
||||||
|
1 NULL NULL
|
||||||
|
2 NULL NULL
|
||||||
|
EXPLAIN EXTENDED SELECT *
|
||||||
|
FROM t1
|
||||||
|
LEFT JOIN
|
||||||
|
( ( SELECT * FROM t2 WHERE c2 IN ( SELECT c3 FROM t3 ) ) AS sq INNER JOIN t4 )
|
||||||
|
ON (c1 = c2);
|
||||||
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
|
||||||
|
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
|
1 PRIMARY t4 ALL NULL NULL NULL NULL 2 100.00
|
||||||
|
3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select `test`.`t1`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2`,`test`.`t4`.`c4` AS `c4` from `test`.`t1` left join (`test`.`t2` join `test`.`t4`) on(`test`.`t2`.`c2` = `test`.`t1`.`c1` and <in_optimizer>(`test`.`t1`.`c1`,<exists>(select `test`.`t3`.`c3` from `test`.`t3` where <cache>(`test`.`t2`.`c2`) = `test`.`t3`.`c3`))) where 1
|
||||||
|
DROP TABLE t1,t2,t3,t4;
|
||||||
set optimizer_switch=@subselect_sj_tmp;
|
set optimizer_switch=@subselect_sj_tmp;
|
||||||
|
@@ -1625,3 +1625,26 @@ i1
|
|||||||
DROP TABLE t1,t2,t3;
|
DROP TABLE t1,t2,t3;
|
||||||
set join_cache_level= @save_join_cache_level;
|
set join_cache_level= @save_join_cache_level;
|
||||||
set optimizer_switch=@save_optimizer_switch;
|
set optimizer_switch=@save_optimizer_switch;
|
||||||
|
#
|
||||||
|
# mdev-7791: materialization of a semi-join subquery +
|
||||||
|
# RAND() in WHERE
|
||||||
|
# (materialized table is accessed last)
|
||||||
|
#
|
||||||
|
set @save_optimizer_switch=@@optimizer_switch;
|
||||||
|
set optimizer_switch='materialization=on';
|
||||||
|
create table t1(i int);
|
||||||
|
insert into t1 values (1), (2), (3), (7), (9), (10);
|
||||||
|
create table t2(i int);
|
||||||
|
insert into t2 values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
|
||||||
|
select * from t1 where (rand() < 0) and i in (select i from t2);
|
||||||
|
i
|
||||||
|
explain extended
|
||||||
|
select * from t1 where (rand() < 0) and i in (select i from t2);
|
||||||
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 Using where
|
||||||
|
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00
|
||||||
|
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 10 100.00
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select `test`.`t1`.`i` AS `i` from `test`.`t1` semi join (`test`.`t2`) where rand() < 0
|
||||||
|
drop table t1,t2;
|
||||||
|
set optimizer_switch=@save_optimizer_switch;
|
||||||
|
@@ -1665,9 +1665,9 @@ CREATE VIEW v1 AS SELECT 1;
|
|||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT * FROM t1 INNER JOIN t2 ON t2.a != 0 AND t2.a IN (SELECT * FROM v1);
|
SELECT * FROM t1 INNER JOIN t2 ON t2.a != 0 AND t2.a IN (SELECT * FROM v1);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 PRIMARY <derived3> system NULL NULL NULL NULL 1
|
||||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
|
||||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
|
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
|
||||||
2 MATERIALIZED <derived3> system NULL NULL NULL NULL 1
|
|
||||||
3 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used
|
3 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
SELECT * FROM t1 INNER JOIN t2 ON t2.a != 0 AND t2.a IN (SELECT * FROM v1);
|
SELECT * FROM t1 INNER JOIN t2 ON t2.a != 0 AND t2.a IN (SELECT * FROM v1);
|
||||||
a a
|
a a
|
||||||
@@ -3086,6 +3086,99 @@ project_number
|
|||||||
aaa
|
aaa
|
||||||
drop table t1, t2, t3;
|
drop table t1, t2, t3;
|
||||||
set optimizer_switch= @tmp_mdev6859;
|
set optimizer_switch= @tmp_mdev6859;
|
||||||
|
#
|
||||||
|
# MDEV-12675: subquery subject to semi-join optimizations
|
||||||
|
# in ON expression of INNER JOIN
|
||||||
|
#
|
||||||
|
set @tmp_mdev12675=@@optimizer_switch;
|
||||||
|
set optimizer_switch=default;
|
||||||
|
create table t1 (a int) engine=myisam;
|
||||||
|
insert into t1 values (5),(3),(2),(7),(2),(5),(1);
|
||||||
|
create table t2 (b int, index idx(b)) engine=myisam;
|
||||||
|
insert into t2 values (2),(3),(2),(1),(3),(4);
|
||||||
|
insert into t2 select b+10 from t2;
|
||||||
|
insert into t2 select b+10 from t2;
|
||||||
|
insert into t2 select b+10 from t2;
|
||||||
|
insert into t2 select b+10 from t2;
|
||||||
|
insert into t2 select b+10 from t2;
|
||||||
|
insert into t2 select b+10 from t2;
|
||||||
|
insert into t2 select b+10 from t2;
|
||||||
|
insert into t2 select b+10 from t2;
|
||||||
|
insert into t2 select b+10 from t2;
|
||||||
|
insert into t2 select b+10 from t2;
|
||||||
|
insert into t2 select b+10 from t2;
|
||||||
|
analyze table t1,t2;
|
||||||
|
Table Op Msg_type Msg_text
|
||||||
|
test.t1 analyze status OK
|
||||||
|
test.t2 analyze status OK
|
||||||
|
explain
|
||||||
|
select a from t1, t2 where b between 1 and 2 and a in (select b from t2);
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 7 Using where
|
||||||
|
1 PRIMARY t2 ref idx idx 5 test.t1.a 256 Using index; FirstMatch(t1)
|
||||||
|
1 PRIMARY t2 range idx idx 5 NULL 2 Using where; Using index; Using join buffer (flat, BNL join)
|
||||||
|
explain
|
||||||
|
select a from t1 join t2 on b between 1 and 2 and a in (select b from t2);
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 7 Using where
|
||||||
|
1 PRIMARY t2 ref idx idx 5 test.t1.a 256 Using index; FirstMatch(t1)
|
||||||
|
1 PRIMARY t2 range idx idx 5 NULL 2 Using where; Using index; Using join buffer (flat, BNL join)
|
||||||
|
drop table t1,t2;
|
||||||
|
set optimizer_switch= @tmp_mdev12675;
|
||||||
|
#
|
||||||
|
# MDEV-12817: subquery NOT subject to semi-join optimizations
|
||||||
|
# in ON expression of INNER JOIN
|
||||||
|
#
|
||||||
|
CREATE TABLE t1 (c1 int) ENGINE=MyISAM;
|
||||||
|
INSERT INTO t1 VALUES (1),(2);
|
||||||
|
CREATE TABLE t2 (c2 int) ENGINE=MyISAM;
|
||||||
|
INSERT INTO t2 VALUES (3),(4);
|
||||||
|
CREATE TABLE t3 (c3 int) ENGINE=MyISAM;
|
||||||
|
INSERT INTO t3 VALUES (5),(6);
|
||||||
|
CREATE TABLE t4 (c4 int) ENGINE=MyISAM;
|
||||||
|
INSERT INTO t4 VALUES (7),(8);
|
||||||
|
SELECT c1
|
||||||
|
FROM t1
|
||||||
|
LEFT JOIN
|
||||||
|
( t2 INNER JOIN t3 ON ( 1 IN ( SELECT c4 FROM t4 ) ) )
|
||||||
|
ON (c1 = c3);
|
||||||
|
c1
|
||||||
|
1
|
||||||
|
2
|
||||||
|
EXPLAIN EXTENDED SELECT c1
|
||||||
|
FROM t1
|
||||||
|
LEFT JOIN
|
||||||
|
( t2 INNER JOIN t3 ON ( 1 IN ( SELECT c4 FROM t4 ) ) )
|
||||||
|
ON (c1 = c3);
|
||||||
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
|
||||||
|
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
|
||||||
|
1 PRIMARY t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join)
|
||||||
|
2 SUBQUERY t4 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(`test`.`t3`.`c3` = `test`.`t1`.`c1` and <cache>(<in_optimizer>(1,<exists>(select `test`.`t4`.`c4` from `test`.`t4` where 1 = `test`.`t4`.`c4`)))) where 1
|
||||||
|
# mdev-12820
|
||||||
|
SELECT *
|
||||||
|
FROM t1
|
||||||
|
LEFT JOIN
|
||||||
|
( ( SELECT * FROM t2 WHERE c2 IN ( SELECT c3 FROM t3 ) ) AS sq INNER JOIN t4 )
|
||||||
|
ON (c1 = c2);
|
||||||
|
c1 c2 c4
|
||||||
|
1 NULL NULL
|
||||||
|
2 NULL NULL
|
||||||
|
EXPLAIN EXTENDED SELECT *
|
||||||
|
FROM t1
|
||||||
|
LEFT JOIN
|
||||||
|
( ( SELECT * FROM t2 WHERE c2 IN ( SELECT c3 FROM t3 ) ) AS sq INNER JOIN t4 )
|
||||||
|
ON (c1 = c2);
|
||||||
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
|
||||||
|
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
|
||||||
|
1 PRIMARY t4 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (incremental, BNL join)
|
||||||
|
3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select `test`.`t1`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2`,`test`.`t4`.`c4` AS `c4` from `test`.`t1` left join (`test`.`t2` join `test`.`t4`) on(`test`.`t2`.`c2` = `test`.`t1`.`c1` and <in_optimizer>(`test`.`t1`.`c1`,<exists>(select `test`.`t3`.`c3` from `test`.`t3` where <cache>(`test`.`t2`.`c2`) = `test`.`t3`.`c3`))) where 1
|
||||||
|
DROP TABLE t1,t2,t3,t4;
|
||||||
set optimizer_switch=@subselect_sj_tmp;
|
set optimizer_switch=@subselect_sj_tmp;
|
||||||
#
|
#
|
||||||
# BUG#49129: Wrong result with IN-subquery with join_cache_level=6 and firstmatch=off
|
# BUG#49129: Wrong result with IN-subquery with join_cache_level=6 and firstmatch=off
|
||||||
|
@@ -2183,7 +2183,6 @@ HAVING i = 10;
|
|||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
2 UNION NULL NULL NULL NULL NULL NULL NULL NULL Impossible HAVING noticed after reading const tables
|
2 UNION NULL NULL NULL NULL NULL NULL NULL NULL Impossible HAVING noticed after reading const tables
|
||||||
4 DEPENDENT SUBQUERY t2 unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index
|
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select 1 AS `1`,2 AS `2` union all select 1 AS `i`,count(0) AS `COUNT(*)` from dual where <in_optimizer>(1,<exists>(<primary_index_lookup>(<cache>(1) in t2 on PRIMARY))) group by 1 having 0
|
Note 1003 select 1 AS `1`,2 AS `2` union all select 1 AS `i`,count(0) AS `COUNT(*)` from `test`.`t2` where 1 group by 1 having 0
|
||||||
DROP TABLE t1,t2;
|
DROP TABLE t1,t2;
|
||||||
|
@@ -62,5 +62,4 @@ FOUND 1 /public/ in t7.ibd
|
|||||||
FOUND 1 /public/ in t8.ibd
|
FOUND 1 /public/ in t8.ibd
|
||||||
# t9 page compressed expecting NOT FOUND
|
# t9 page compressed expecting NOT FOUND
|
||||||
NOT FOUND /public/ in t9.ibd
|
NOT FOUND /public/ in t9.ibd
|
||||||
use test;
|
|
||||||
drop database enctests;
|
drop database enctests;
|
||||||
|
@@ -8,9 +8,6 @@ SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_
|
|||||||
|
|
||||||
--disable_query_log
|
--disable_query_log
|
||||||
--disable_warnings
|
--disable_warnings
|
||||||
let $innodb_compression_algorithm_orig=`SELECT @@innodb_compression_algorithm`;
|
|
||||||
let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
|
|
||||||
let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
|
|
||||||
let $encryption = `SELECT @@innodb_encrypt_tables`;
|
let $encryption = `SELECT @@innodb_encrypt_tables`;
|
||||||
SET GLOBAL innodb_file_format = `Barracuda`;
|
SET GLOBAL innodb_file_format = `Barracuda`;
|
||||||
SET GLOBAL innodb_file_per_table = ON;
|
SET GLOBAL innodb_file_per_table = ON;
|
||||||
@@ -88,15 +85,4 @@ SET GLOBAL innodb_encrypt_tables=ON;
|
|||||||
|
|
||||||
-- source include/start_mysqld.inc
|
-- source include/start_mysqld.inc
|
||||||
|
|
||||||
use test;
|
|
||||||
drop database enctests;
|
drop database enctests;
|
||||||
# reset system
|
|
||||||
|
|
||||||
--disable_query_log
|
|
||||||
--disable_warnings
|
|
||||||
EVAL SET GLOBAL innodb_compression_algorithm = $innodb_compression_algorithm_orig;
|
|
||||||
EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
|
|
||||||
EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
|
|
||||||
set global innodb_compression_algorithm = DEFAULT;
|
|
||||||
--enable_warnings
|
|
||||||
--enable_query_log
|
|
||||||
|
@@ -1,430 +1,92 @@
|
|||||||
call mtr.add_suppression("InnoDB: Compression failed for space.*");
|
call mtr.add_suppression("InnoDB: Compression failed for space [0-9]+ name test/innodb_page_compressed[0-9] len [0-9]+ err 2 write_size [0-9]+.");
|
||||||
set global innodb_compression_algorithm = 6;
|
set global innodb_compression_algorithm = snappy;
|
||||||
create table innodb_compressed(c1 int, b char(200)) engine=innodb row_format=compressed key_block_size=8;
|
set global innodb_file_format = `Barracuda`;
|
||||||
show warnings;
|
set global innodb_file_per_table = on;
|
||||||
Level Code Message
|
create table innodb_normal (c1 int not null auto_increment primary key, b char(200)) engine=innodb;
|
||||||
create table innodb_normal (c1 int, b char(200)) engine=innodb;
|
create table innodb_page_compressed1 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=1;
|
||||||
show warnings;
|
create table innodb_page_compressed2 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=2;
|
||||||
Level Code Message
|
create table innodb_page_compressed3 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=3;
|
||||||
create table innodb_page_compressed1 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=1;
|
create table innodb_page_compressed4 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=4;
|
||||||
show warnings;
|
create table innodb_page_compressed5 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=5;
|
||||||
Level Code Message
|
create table innodb_page_compressed6 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=6;
|
||||||
show create table innodb_page_compressed1;
|
create table innodb_page_compressed7 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=7;
|
||||||
Table Create Table
|
create table innodb_page_compressed8 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=8;
|
||||||
innodb_page_compressed1 CREATE TABLE `innodb_page_compressed1` (
|
create table innodb_page_compressed9 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=9;
|
||||||
`c1` int(11) DEFAULT NULL,
|
|
||||||
`b` char(200) DEFAULT NULL
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=1
|
|
||||||
create table innodb_page_compressed2 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=2;
|
|
||||||
show warnings;
|
|
||||||
Level Code Message
|
|
||||||
show create table innodb_page_compressed2;
|
|
||||||
Table Create Table
|
|
||||||
innodb_page_compressed2 CREATE TABLE `innodb_page_compressed2` (
|
|
||||||
`c1` int(11) DEFAULT NULL,
|
|
||||||
`b` char(200) DEFAULT NULL
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=2
|
|
||||||
create table innodb_page_compressed3 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=3;
|
|
||||||
show warnings;
|
|
||||||
Level Code Message
|
|
||||||
show create table innodb_page_compressed3;
|
|
||||||
Table Create Table
|
|
||||||
innodb_page_compressed3 CREATE TABLE `innodb_page_compressed3` (
|
|
||||||
`c1` int(11) DEFAULT NULL,
|
|
||||||
`b` char(200) DEFAULT NULL
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=3
|
|
||||||
create table innodb_page_compressed4 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=4;
|
|
||||||
show warnings;
|
|
||||||
Level Code Message
|
|
||||||
show create table innodb_page_compressed4;
|
|
||||||
Table Create Table
|
|
||||||
innodb_page_compressed4 CREATE TABLE `innodb_page_compressed4` (
|
|
||||||
`c1` int(11) DEFAULT NULL,
|
|
||||||
`b` char(200) DEFAULT NULL
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=4
|
|
||||||
create table innodb_page_compressed5 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=5;
|
|
||||||
show warnings;
|
|
||||||
Level Code Message
|
|
||||||
show create table innodb_page_compressed5;
|
|
||||||
Table Create Table
|
|
||||||
innodb_page_compressed5 CREATE TABLE `innodb_page_compressed5` (
|
|
||||||
`c1` int(11) DEFAULT NULL,
|
|
||||||
`b` char(200) DEFAULT NULL
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=5
|
|
||||||
create table innodb_page_compressed6 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=6;
|
|
||||||
show warnings;
|
|
||||||
Level Code Message
|
|
||||||
show create table innodb_page_compressed6;
|
|
||||||
Table Create Table
|
|
||||||
innodb_page_compressed6 CREATE TABLE `innodb_page_compressed6` (
|
|
||||||
`c1` int(11) DEFAULT NULL,
|
|
||||||
`b` char(200) DEFAULT NULL
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=6
|
|
||||||
create table innodb_page_compressed7 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=7;
|
|
||||||
show warnings;
|
|
||||||
Level Code Message
|
|
||||||
show create table innodb_page_compressed7;
|
|
||||||
Table Create Table
|
|
||||||
innodb_page_compressed7 CREATE TABLE `innodb_page_compressed7` (
|
|
||||||
`c1` int(11) DEFAULT NULL,
|
|
||||||
`b` char(200) DEFAULT NULL
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=7
|
|
||||||
create table innodb_page_compressed8 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=8;
|
|
||||||
show warnings;
|
|
||||||
Level Code Message
|
|
||||||
show create table innodb_page_compressed8;
|
|
||||||
Table Create Table
|
|
||||||
innodb_page_compressed8 CREATE TABLE `innodb_page_compressed8` (
|
|
||||||
`c1` int(11) DEFAULT NULL,
|
|
||||||
`b` char(200) DEFAULT NULL
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=8
|
|
||||||
create table innodb_page_compressed9 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=9;
|
|
||||||
show warnings;
|
|
||||||
Level Code Message
|
|
||||||
show create table innodb_page_compressed9;
|
|
||||||
Table Create Table
|
|
||||||
innodb_page_compressed9 CREATE TABLE `innodb_page_compressed9` (
|
|
||||||
`c1` int(11) DEFAULT NULL,
|
|
||||||
`b` char(200) DEFAULT NULL
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=9
|
|
||||||
create procedure innodb_insert_proc (repeat_count int)
|
|
||||||
begin
|
|
||||||
declare current_num int;
|
|
||||||
set current_num = 0;
|
|
||||||
while current_num < repeat_count do
|
|
||||||
insert into innodb_normal values(current_num,'aaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbccccccccccccccccccccccc');
|
|
||||||
set current_num = current_num + 1;
|
|
||||||
end while;
|
|
||||||
end//
|
|
||||||
commit;
|
|
||||||
set autocommit=0;
|
|
||||||
call innodb_insert_proc(5000);
|
|
||||||
commit;
|
|
||||||
set autocommit=1;
|
|
||||||
select count(*) from innodb_normal;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
insert into innodb_compressed select * from innodb_normal;
|
|
||||||
insert into innodb_page_compressed1 select * from innodb_normal;
|
|
||||||
insert into innodb_page_compressed2 select * from innodb_normal;
|
|
||||||
insert into innodb_page_compressed3 select * from innodb_normal;
|
|
||||||
insert into innodb_page_compressed4 select * from innodb_normal;
|
|
||||||
insert into innodb_page_compressed5 select * from innodb_normal;
|
|
||||||
insert into innodb_page_compressed6 select * from innodb_normal;
|
|
||||||
insert into innodb_page_compressed7 select * from innodb_normal;
|
|
||||||
insert into innodb_page_compressed8 select * from innodb_normal;
|
|
||||||
insert into innodb_page_compressed9 select * from innodb_normal;
|
|
||||||
commit;
|
|
||||||
select count(*) from innodb_compressed;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
select count(*) from innodb_page_compressed1;
|
select count(*) from innodb_page_compressed1;
|
||||||
count(*)
|
count(*)
|
||||||
5000
|
10000
|
||||||
select count(*) from innodb_page_compressed1 where c1 < 500000;
|
select count(*) from innodb_page_compressed3;
|
||||||
count(*)
|
count(*)
|
||||||
5000
|
10000
|
||||||
select count(*) from innodb_page_compressed2 where c1 < 500000;
|
select count(*) from innodb_page_compressed4;
|
||||||
count(*)
|
count(*)
|
||||||
5000
|
10000
|
||||||
select count(*) from innodb_page_compressed3 where c1 < 500000;
|
select count(*) from innodb_page_compressed5;
|
||||||
count(*)
|
count(*)
|
||||||
5000
|
10000
|
||||||
select count(*) from innodb_page_compressed4 where c1 < 500000;
|
select count(*) from innodb_page_compressed6;
|
||||||
count(*)
|
count(*)
|
||||||
5000
|
10000
|
||||||
select count(*) from innodb_page_compressed5 where c1 < 500000;
|
select count(*) from innodb_page_compressed6;
|
||||||
count(*)
|
count(*)
|
||||||
5000
|
10000
|
||||||
select count(*) from innodb_page_compressed6 where c1 < 500000;
|
select count(*) from innodb_page_compressed7;
|
||||||
count(*)
|
count(*)
|
||||||
5000
|
10000
|
||||||
select count(*) from innodb_page_compressed7 where c1 < 500000;
|
select count(*) from innodb_page_compressed8;
|
||||||
count(*)
|
count(*)
|
||||||
5000
|
10000
|
||||||
select count(*) from innodb_page_compressed8 where c1 < 500000;
|
select count(*) from innodb_page_compressed9;
|
||||||
count(*)
|
count(*)
|
||||||
5000
|
10000
|
||||||
select count(*) from innodb_page_compressed9 where c1 < 500000;
|
# innodb_normal expected FOUND
|
||||||
count(*)
|
FOUND 24084 /AaAaAaAa/ in innodb_normal.ibd
|
||||||
5000
|
# innodb_page_compressed1 page compressed expected NOT FOUND
|
||||||
alter table innodb_normal page_compressed=1 page_compression_level=8;
|
NOT FOUND /AaAaAaAa/ in innodb_page_compressed1.ibd
|
||||||
show warnings;
|
# innodb_page_compressed2 page compressed expected NOT FOUND
|
||||||
Level Code Message
|
NOT FOUND /AaAaAaAa/ in innodb_page_compressed2.ibd
|
||||||
show create table innodb_normal;
|
# innodb_page_compressed3 page compressed expected NOT FOUND
|
||||||
Table Create Table
|
NOT FOUND /AaAaAaAa/ in innodb_page_compressed3.ibd
|
||||||
innodb_normal CREATE TABLE `innodb_normal` (
|
# innodb_page_compressed4 page compressed expected NOT FOUND
|
||||||
`c1` int(11) DEFAULT NULL,
|
NOT FOUND /AaAaAaAa/ in innodb_page_compressed4.ibd
|
||||||
`b` char(200) DEFAULT NULL
|
# innodb_page_compressed5 page compressed expected NOT FOUND
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=8
|
NOT FOUND /AaAaAaAa/ in innodb_page_compressed5.ibd
|
||||||
alter table innodb_compressed row_format=default page_compressed=1 page_compression_level=8 key_block_size=0;
|
# innodb_page_compressed6 page compressed expected NOT FOUND
|
||||||
show warnings;
|
NOT FOUND /AaAaAaAa/ in innodb_page_compressed6.ibd
|
||||||
Level Code Message
|
# innodb_page_compressed7 page compressed expected NOT FOUND
|
||||||
show create table innodb_compressed;
|
NOT FOUND /AaAaAaAa/ in innodb_page_compressed7.ibd
|
||||||
Table Create Table
|
# innodb_page_compressed8 page compressed expected NOT FOUND
|
||||||
innodb_compressed CREATE TABLE `innodb_compressed` (
|
NOT FOUND /AaAaAaAa/ in innodb_page_compressed8.ibd
|
||||||
`c1` int(11) DEFAULT NULL,
|
# innodb_page_compressed9 page compressed expected NOT FOUND
|
||||||
`b` char(200) DEFAULT NULL
|
NOT FOUND /AaAaAaAa/ in innodb_page_compressed9.ibd
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=8
|
|
||||||
update innodb_page_compressed1 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed2 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed3 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed4 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed5 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed6 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed7 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed8 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed9 set c1 = c1 + 1;
|
|
||||||
select count(*) from innodb_compressed;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
select count(*) from innodb_page_compressed1;
|
select count(*) from innodb_page_compressed1;
|
||||||
count(*)
|
count(*)
|
||||||
5000
|
10000
|
||||||
select count(*) from innodb_page_compressed1 where c1 < 500000;
|
select count(*) from innodb_page_compressed3;
|
||||||
count(*)
|
count(*)
|
||||||
5000
|
10000
|
||||||
select count(*) from innodb_page_compressed2 where c1 < 500000;
|
select count(*) from innodb_page_compressed4;
|
||||||
count(*)
|
count(*)
|
||||||
5000
|
10000
|
||||||
select count(*) from innodb_page_compressed3 where c1 < 500000;
|
select count(*) from innodb_page_compressed5;
|
||||||
count(*)
|
count(*)
|
||||||
5000
|
10000
|
||||||
select count(*) from innodb_page_compressed4 where c1 < 500000;
|
select count(*) from innodb_page_compressed6;
|
||||||
count(*)
|
count(*)
|
||||||
5000
|
10000
|
||||||
select count(*) from innodb_page_compressed5 where c1 < 500000;
|
select count(*) from innodb_page_compressed6;
|
||||||
count(*)
|
count(*)
|
||||||
5000
|
10000
|
||||||
select count(*) from innodb_page_compressed6 where c1 < 500000;
|
select count(*) from innodb_page_compressed7;
|
||||||
count(*)
|
count(*)
|
||||||
5000
|
10000
|
||||||
select count(*) from innodb_page_compressed7 where c1 < 500000;
|
select count(*) from innodb_page_compressed8;
|
||||||
count(*)
|
count(*)
|
||||||
5000
|
10000
|
||||||
select count(*) from innodb_page_compressed8 where c1 < 500000;
|
select count(*) from innodb_page_compressed9;
|
||||||
count(*)
|
count(*)
|
||||||
5000
|
10000
|
||||||
select count(*) from innodb_page_compressed9 where c1 < 500000;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
update innodb_page_compressed1 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed2 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed3 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed4 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed5 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed6 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed7 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed8 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed9 set c1 = c1 + 1;
|
|
||||||
select count(*) from innodb_compressed;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
select count(*) from innodb_page_compressed1;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
select count(*) from innodb_page_compressed1 where c1 < 500000;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
select count(*) from innodb_page_compressed2 where c1 < 500000;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
select count(*) from innodb_page_compressed3 where c1 < 500000;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
select count(*) from innodb_page_compressed4 where c1 < 500000;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
select count(*) from innodb_page_compressed5 where c1 < 500000;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
select count(*) from innodb_page_compressed6 where c1 < 500000;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
select count(*) from innodb_page_compressed7 where c1 < 500000;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
select count(*) from innodb_page_compressed8 where c1 < 500000;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
select count(*) from innodb_page_compressed9 where c1 < 500000;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
set global innodb_compression_algorithm = 1;
|
|
||||||
update innodb_page_compressed1 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed2 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed3 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed4 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed5 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed6 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed7 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed8 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed9 set c1 = c1 + 1;
|
|
||||||
commit;
|
|
||||||
select count(*) from innodb_compressed;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
select count(*) from innodb_page_compressed1;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
select count(*) from innodb_page_compressed1 where c1 < 500000;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
select count(*) from innodb_page_compressed2 where c1 < 500000;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
select count(*) from innodb_page_compressed3 where c1 < 500000;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
select count(*) from innodb_page_compressed4 where c1 < 500000;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
select count(*) from innodb_page_compressed5 where c1 < 500000;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
select count(*) from innodb_page_compressed6 where c1 < 500000;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
select count(*) from innodb_page_compressed7 where c1 < 500000;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
select count(*) from innodb_page_compressed8 where c1 < 500000;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
select count(*) from innodb_page_compressed9 where c1 < 500000;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
update innodb_page_compressed1 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed2 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed3 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed4 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed5 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed6 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed7 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed8 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed9 set c1 = c1 + 1;
|
|
||||||
select count(*) from innodb_compressed;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
select count(*) from innodb_page_compressed1;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
select count(*) from innodb_page_compressed1 where c1 < 500000;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
select count(*) from innodb_page_compressed2 where c1 < 500000;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
select count(*) from innodb_page_compressed3 where c1 < 500000;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
select count(*) from innodb_page_compressed4 where c1 < 500000;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
select count(*) from innodb_page_compressed5 where c1 < 500000;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
select count(*) from innodb_page_compressed6 where c1 < 500000;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
select count(*) from innodb_page_compressed7 where c1 < 500000;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
select count(*) from innodb_page_compressed8 where c1 < 500000;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
select count(*) from innodb_page_compressed9 where c1 < 500000;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
set global innodb_compression_algorithm = 0;
|
|
||||||
update innodb_page_compressed1 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed2 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed3 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed4 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed5 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed6 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed7 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed8 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed9 set c1 = c1 + 1;
|
|
||||||
commit;
|
|
||||||
select count(*) from innodb_compressed;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
select count(*) from innodb_page_compressed1;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
select count(*) from innodb_page_compressed1 where c1 < 500000;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
select count(*) from innodb_page_compressed2 where c1 < 500000;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
select count(*) from innodb_page_compressed3 where c1 < 500000;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
select count(*) from innodb_page_compressed4 where c1 < 500000;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
select count(*) from innodb_page_compressed5 where c1 < 500000;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
select count(*) from innodb_page_compressed6 where c1 < 500000;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
select count(*) from innodb_page_compressed7 where c1 < 500000;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
select count(*) from innodb_page_compressed8 where c1 < 500000;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
select count(*) from innodb_page_compressed9 where c1 < 500000;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
update innodb_page_compressed1 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed2 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed3 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed4 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed5 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed6 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed7 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed8 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed9 set c1 = c1 + 1;
|
|
||||||
select count(*) from innodb_compressed;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
select count(*) from innodb_page_compressed1;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
select count(*) from innodb_page_compressed1 where c1 < 500000;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
select count(*) from innodb_page_compressed2 where c1 < 500000;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
select count(*) from innodb_page_compressed3 where c1 < 500000;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
select count(*) from innodb_page_compressed4 where c1 < 500000;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
select count(*) from innodb_page_compressed5 where c1 < 500000;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
select count(*) from innodb_page_compressed6 where c1 < 500000;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
select count(*) from innodb_page_compressed7 where c1 < 500000;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
select count(*) from innodb_page_compressed8 where c1 < 500000;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
select count(*) from innodb_page_compressed9 where c1 < 500000;
|
|
||||||
count(*)
|
|
||||||
5000
|
|
||||||
drop procedure innodb_insert_proc;
|
|
||||||
drop table innodb_normal;
|
drop table innodb_normal;
|
||||||
drop table innodb_compressed;
|
|
||||||
drop table innodb_page_compressed1;
|
drop table innodb_page_compressed1;
|
||||||
drop table innodb_page_compressed2;
|
drop table innodb_page_compressed2;
|
||||||
drop table innodb_page_compressed3;
|
drop table innodb_page_compressed3;
|
||||||
@@ -434,3 +96,4 @@ drop table innodb_page_compressed6;
|
|||||||
drop table innodb_page_compressed7;
|
drop table innodb_page_compressed7;
|
||||||
drop table innodb_page_compressed8;
|
drop table innodb_page_compressed8;
|
||||||
drop table innodb_page_compressed9;
|
drop table innodb_page_compressed9;
|
||||||
|
#done
|
||||||
|
@@ -1,244 +1,13 @@
|
|||||||
-- source include/have_innodb.inc
|
-- source include/have_innodb.inc
|
||||||
-- source include/have_innodb_snappy.inc
|
-- source include/have_innodb_snappy.inc
|
||||||
|
--source include/not_embedded.inc
|
||||||
|
|
||||||
call mtr.add_suppression("InnoDB: Compression failed for space.*");
|
call mtr.add_suppression("InnoDB: Compression failed for space [0-9]+ name test/innodb_page_compressed[0-9] len [0-9]+ err 2 write_size [0-9]+.");
|
||||||
|
|
||||||
let $innodb_compression_algorithm_orig=`select @@innodb_compression_algorithm`;
|
|
||||||
|
|
||||||
# snappy
|
# snappy
|
||||||
set global innodb_compression_algorithm = 6;
|
set global innodb_compression_algorithm = snappy;
|
||||||
|
|
||||||
create table innodb_compressed(c1 int, b char(200)) engine=innodb row_format=compressed key_block_size=8;
|
# All page compression test use the same
|
||||||
show warnings;
|
--source include/innodb-page-compression.inc
|
||||||
create table innodb_normal (c1 int, b char(200)) engine=innodb;
|
|
||||||
show warnings;
|
|
||||||
create table innodb_page_compressed1 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=1;
|
|
||||||
show warnings;
|
|
||||||
show create table innodb_page_compressed1;
|
|
||||||
create table innodb_page_compressed2 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=2;
|
|
||||||
show warnings;
|
|
||||||
show create table innodb_page_compressed2;
|
|
||||||
create table innodb_page_compressed3 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=3;
|
|
||||||
show warnings;
|
|
||||||
show create table innodb_page_compressed3;
|
|
||||||
create table innodb_page_compressed4 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=4;
|
|
||||||
show warnings;
|
|
||||||
show create table innodb_page_compressed4;
|
|
||||||
create table innodb_page_compressed5 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=5;
|
|
||||||
show warnings;
|
|
||||||
show create table innodb_page_compressed5;
|
|
||||||
create table innodb_page_compressed6 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=6;
|
|
||||||
show warnings;
|
|
||||||
show create table innodb_page_compressed6;
|
|
||||||
create table innodb_page_compressed7 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=7;
|
|
||||||
show warnings;
|
|
||||||
show create table innodb_page_compressed7;
|
|
||||||
create table innodb_page_compressed8 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=8;
|
|
||||||
show warnings;
|
|
||||||
show create table innodb_page_compressed8;
|
|
||||||
create table innodb_page_compressed9 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=9;
|
|
||||||
show warnings;
|
|
||||||
show create table innodb_page_compressed9;
|
|
||||||
delimiter //;
|
|
||||||
create procedure innodb_insert_proc (repeat_count int)
|
|
||||||
begin
|
|
||||||
declare current_num int;
|
|
||||||
set current_num = 0;
|
|
||||||
while current_num < repeat_count do
|
|
||||||
insert into innodb_normal values(current_num,'aaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbccccccccccccccccccccccc');
|
|
||||||
set current_num = current_num + 1;
|
|
||||||
end while;
|
|
||||||
end//
|
|
||||||
delimiter ;//
|
|
||||||
commit;
|
|
||||||
|
|
||||||
set autocommit=0;
|
-- echo #done
|
||||||
call innodb_insert_proc(5000);
|
|
||||||
commit;
|
|
||||||
set autocommit=1;
|
|
||||||
select count(*) from innodb_normal;
|
|
||||||
insert into innodb_compressed select * from innodb_normal;
|
|
||||||
insert into innodb_page_compressed1 select * from innodb_normal;
|
|
||||||
insert into innodb_page_compressed2 select * from innodb_normal;
|
|
||||||
insert into innodb_page_compressed3 select * from innodb_normal;
|
|
||||||
insert into innodb_page_compressed4 select * from innodb_normal;
|
|
||||||
insert into innodb_page_compressed5 select * from innodb_normal;
|
|
||||||
insert into innodb_page_compressed6 select * from innodb_normal;
|
|
||||||
insert into innodb_page_compressed7 select * from innodb_normal;
|
|
||||||
insert into innodb_page_compressed8 select * from innodb_normal;
|
|
||||||
insert into innodb_page_compressed9 select * from innodb_normal;
|
|
||||||
commit;
|
|
||||||
select count(*) from innodb_compressed;
|
|
||||||
select count(*) from innodb_page_compressed1;
|
|
||||||
select count(*) from innodb_page_compressed1 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed2 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed3 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed4 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed5 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed6 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed7 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed8 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed9 where c1 < 500000;
|
|
||||||
|
|
||||||
alter table innodb_normal page_compressed=1 page_compression_level=8;
|
|
||||||
show warnings;
|
|
||||||
show create table innodb_normal;
|
|
||||||
alter table innodb_compressed row_format=default page_compressed=1 page_compression_level=8 key_block_size=0;
|
|
||||||
show warnings;
|
|
||||||
show create table innodb_compressed;
|
|
||||||
|
|
||||||
update innodb_page_compressed1 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed2 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed3 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed4 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed5 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed6 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed7 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed8 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed9 set c1 = c1 + 1;
|
|
||||||
select count(*) from innodb_compressed;
|
|
||||||
select count(*) from innodb_page_compressed1;
|
|
||||||
select count(*) from innodb_page_compressed1 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed2 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed3 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed4 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed5 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed6 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed7 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed8 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed9 where c1 < 500000;
|
|
||||||
|
|
||||||
--source include/restart_mysqld.inc
|
|
||||||
|
|
||||||
update innodb_page_compressed1 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed2 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed3 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed4 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed5 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed6 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed7 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed8 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed9 set c1 = c1 + 1;
|
|
||||||
select count(*) from innodb_compressed;
|
|
||||||
select count(*) from innodb_page_compressed1;
|
|
||||||
select count(*) from innodb_page_compressed1 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed2 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed3 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed4 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed5 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed6 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed7 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed8 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed9 where c1 < 500000;
|
|
||||||
|
|
||||||
# zlib
|
|
||||||
set global innodb_compression_algorithm = 1;
|
|
||||||
update innodb_page_compressed1 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed2 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed3 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed4 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed5 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed6 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed7 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed8 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed9 set c1 = c1 + 1;
|
|
||||||
commit;
|
|
||||||
select count(*) from innodb_compressed;
|
|
||||||
select count(*) from innodb_page_compressed1;
|
|
||||||
select count(*) from innodb_page_compressed1 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed2 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed3 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed4 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed5 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed6 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed7 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed8 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed9 where c1 < 500000;
|
|
||||||
|
|
||||||
--source include/restart_mysqld.inc
|
|
||||||
|
|
||||||
update innodb_page_compressed1 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed2 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed3 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed4 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed5 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed6 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed7 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed8 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed9 set c1 = c1 + 1;
|
|
||||||
select count(*) from innodb_compressed;
|
|
||||||
select count(*) from innodb_page_compressed1;
|
|
||||||
select count(*) from innodb_page_compressed1 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed2 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed3 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed4 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed5 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed6 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed7 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed8 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed9 where c1 < 500000;
|
|
||||||
|
|
||||||
# none
|
|
||||||
set global innodb_compression_algorithm = 0;
|
|
||||||
update innodb_page_compressed1 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed2 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed3 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed4 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed5 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed6 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed7 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed8 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed9 set c1 = c1 + 1;
|
|
||||||
commit;
|
|
||||||
select count(*) from innodb_compressed;
|
|
||||||
select count(*) from innodb_page_compressed1;
|
|
||||||
select count(*) from innodb_page_compressed1 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed2 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed3 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed4 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed5 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed6 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed7 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed8 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed9 where c1 < 500000;
|
|
||||||
|
|
||||||
--source include/restart_mysqld.inc
|
|
||||||
|
|
||||||
update innodb_page_compressed1 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed2 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed3 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed4 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed5 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed6 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed7 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed8 set c1 = c1 + 1;
|
|
||||||
update innodb_page_compressed9 set c1 = c1 + 1;
|
|
||||||
select count(*) from innodb_compressed;
|
|
||||||
select count(*) from innodb_page_compressed1;
|
|
||||||
select count(*) from innodb_page_compressed1 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed2 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed3 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed4 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed5 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed6 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed7 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed8 where c1 < 500000;
|
|
||||||
select count(*) from innodb_page_compressed9 where c1 < 500000;
|
|
||||||
|
|
||||||
drop procedure innodb_insert_proc;
|
|
||||||
drop table innodb_normal;
|
|
||||||
drop table innodb_compressed;
|
|
||||||
drop table innodb_page_compressed1;
|
|
||||||
drop table innodb_page_compressed2;
|
|
||||||
drop table innodb_page_compressed3;
|
|
||||||
drop table innodb_page_compressed4;
|
|
||||||
drop table innodb_page_compressed5;
|
|
||||||
drop table innodb_page_compressed6;
|
|
||||||
drop table innodb_page_compressed7;
|
|
||||||
drop table innodb_page_compressed8;
|
|
||||||
drop table innodb_page_compressed9;
|
|
||||||
|
|
||||||
# reset system
|
|
||||||
--disable_query_log
|
|
||||||
EVAL SET GLOBAL innodb_compression_algorithm = $innodb_compression_algorithm_orig;
|
|
||||||
--enable_query_log
|
|
||||||
|
@@ -21,11 +21,6 @@ $ENV{XBSTREAM}= ::mtr_exe_maybe_exists(
|
|||||||
"$::bindir/extra/mariabackup/$::opt_vs_config/mbstream",
|
"$::bindir/extra/mariabackup/$::opt_vs_config/mbstream",
|
||||||
"$::path_client_bindir/mbstream");
|
"$::path_client_bindir/mbstream");
|
||||||
|
|
||||||
my $tar_version = `tar --version 2>&1`;
|
|
||||||
$ENV{HAVE_TAR} = $! ? 0: 1;
|
|
||||||
my $mariabackup_help=`$mariabackup_exe --help 2>&1`;
|
|
||||||
$ENV{HAVE_XTRABACKUP_TAR_SUPPORT} = (index($mariabackup_help,"'tar'") == -1) ? 0 : 1;
|
|
||||||
|
|
||||||
$ENV{INNOBACKUPEX}= "$mariabackup_exe --innobackupex";
|
$ENV{INNOBACKUPEX}= "$mariabackup_exe --innobackupex";
|
||||||
|
|
||||||
sub skip_combinations {
|
sub skip_combinations {
|
||||||
|
@@ -1,12 +0,0 @@
|
|||||||
CREATE TABLE t(i INT) ENGINE INNODB;
|
|
||||||
INSERT INTO t VALUES(1);
|
|
||||||
# xtrabackup backup
|
|
||||||
# xtrabackup prepare
|
|
||||||
# shutdown server
|
|
||||||
# remove datadir
|
|
||||||
# xtrabackup move back
|
|
||||||
# restart server
|
|
||||||
SELECT * FROM t;
|
|
||||||
i
|
|
||||||
1
|
|
||||||
DROP TABLE t;
|
|
@@ -1,30 +0,0 @@
|
|||||||
if (`select $HAVE_TAR = 0`)
|
|
||||||
{
|
|
||||||
--skip No tar
|
|
||||||
}
|
|
||||||
if (`select $HAVE_XTRABACKUP_TAR_SUPPORT = 0`)
|
|
||||||
{
|
|
||||||
--skip Compiled without libarchive
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE t(i INT) ENGINE INNODB;
|
|
||||||
INSERT INTO t VALUES(1);
|
|
||||||
|
|
||||||
echo # xtrabackup backup;
|
|
||||||
let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
|
|
||||||
let $streamfile=$MYSQLTEST_VARDIR/tmp/backup.tar;
|
|
||||||
mkdir $targetdir;
|
|
||||||
|
|
||||||
|
|
||||||
exec $XTRABACKUP "--defaults-file=$MYSQLTEST_VARDIR/my.cnf" --backup --stream=tar > $streamfile 2>$targetdir/backup_stream.log;
|
|
||||||
--disable_result_log
|
|
||||||
exec tar -C $targetdir -x < $streamfile;
|
|
||||||
echo # xtrabackup prepare;
|
|
||||||
exec $XTRABACKUP --prepare --target-dir=$targetdir;
|
|
||||||
|
|
||||||
-- source include/restart_and_restore.inc
|
|
||||||
--enable_result_log
|
|
||||||
SELECT * FROM t;
|
|
||||||
DROP TABLE t;
|
|
||||||
rmdir $targetdir;
|
|
@@ -9,7 +9,7 @@ echo # xtrabackup backup to stream;
|
|||||||
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --stream=xbstream > $streamfile 2>$targetdir/backup_stream.log;
|
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --stream=xbstream > $streamfile 2>$targetdir/backup_stream.log;
|
||||||
echo # xbstream extract;
|
echo # xbstream extract;
|
||||||
--disable_result_log
|
--disable_result_log
|
||||||
exec $XBSTREAM -x -C $targetdir --parallel=16 < $streamfile;
|
exec $XBSTREAM -x -C $targetdir < $streamfile;
|
||||||
|
|
||||||
echo # xtrabackup prepare;
|
echo # xtrabackup prepare;
|
||||||
exec $XTRABACKUP --prepare --target-dir=$targetdir;
|
exec $XTRABACKUP --prepare --target-dir=$targetdir;
|
||||||
|
@@ -0,0 +1,7 @@
|
|||||||
|
SELECT "Digest table has a size 1 and is full already." as use_case;
|
||||||
|
use_case
|
||||||
|
Digest table has a size 1 and is full already.
|
||||||
|
select SCHEMA_NAME, DIGEST, DIGEST_TEXT
|
||||||
|
from performance_schema.events_statements_summary_by_digest;
|
||||||
|
SCHEMA_NAME DIGEST DIGEST_TEXT
|
||||||
|
NULL NULL NULL
|
@@ -0,0 +1 @@
|
|||||||
|
--performance-schema-digests-size=1
|
15
mysql-test/suite/perfschema/t/start_server_1_digest.test
Normal file
15
mysql-test/suite/perfschema/t/start_server_1_digest.test
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
# -----------------------------------------------------------------------
|
||||||
|
# Tests for the performance schema statement Digests.
|
||||||
|
# -----------------------------------------------------------------------
|
||||||
|
|
||||||
|
--source include/not_embedded.inc
|
||||||
|
--source include/have_perfschema.inc
|
||||||
|
--source include/no_protocol.inc
|
||||||
|
|
||||||
|
SELECT "Digest table has a size 1 and is full already." as use_case;
|
||||||
|
|
||||||
|
select SCHEMA_NAME, DIGEST, DIGEST_TEXT
|
||||||
|
from performance_schema.events_statements_summary_by_digest;
|
||||||
|
|
||||||
|
|
||||||
|
|
21
mysql-test/suite/rpl/r/rpl_mdev-11092.result
Normal file
21
mysql-test/suite/rpl/r/rpl_mdev-11092.result
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
include/master-slave.inc
|
||||||
|
[connection master]
|
||||||
|
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
|
||||||
|
call mtr.add_suppression("Slave SQL: The incident LOST_EVENTS occured on the master. .*");
|
||||||
|
SET GLOBAL max_binlog_cache_size = 4096;
|
||||||
|
SET GLOBAL binlog_cache_size = 4096;
|
||||||
|
SET GLOBAL max_binlog_stmt_cache_size = 4096;
|
||||||
|
SET GLOBAL binlog_stmt_cache_size = 4096;
|
||||||
|
disconnect master;
|
||||||
|
connect master,127.0.0.1,root,,test,$MASTER_MYPORT,;
|
||||||
|
CREATE TABLE t1(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=MYISAM;
|
||||||
|
connection master;
|
||||||
|
ERROR HY000: Writing one row to the row-based binary log failed
|
||||||
|
include/wait_for_slave_sql_error_and_skip.inc [errno=1590]
|
||||||
|
connection master;
|
||||||
|
SET GLOBAL max_binlog_cache_size= ORIGINAL_VALUE;
|
||||||
|
SET GLOBAL binlog_cache_size= ORIGINAL_VALUE;
|
||||||
|
SET GLOBAL max_binlog_stmt_cache_size= ORIGINAL_VALUE;
|
||||||
|
SET GLOBAL binlog_stmt_cache_size= ORIGINAL_VALUE;
|
||||||
|
DROP TABLE t1;
|
||||||
|
include/rpl_end.inc
|
1
mysql-test/suite/rpl/t/rpl_mdev-11092.opt
Normal file
1
mysql-test/suite/rpl/t/rpl_mdev-11092.opt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
--binlog_checksum=1 --binlog-annotate-row-events=1
|
53
mysql-test/suite/rpl/t/rpl_mdev-11092.test
Normal file
53
mysql-test/suite/rpl/t/rpl_mdev-11092.test
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
--source include/have_innodb.inc
|
||||||
|
--source include/master-slave.inc
|
||||||
|
--source include/not_embedded.inc
|
||||||
|
--source include/not_windows.inc
|
||||||
|
--source include/have_binlog_format_row.inc
|
||||||
|
|
||||||
|
########################################################################################
|
||||||
|
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
|
||||||
|
call mtr.add_suppression("Slave SQL: The incident LOST_EVENTS occured on the master. .*");
|
||||||
|
|
||||||
|
let $old_max_binlog_cache_size= query_get_value(SHOW VARIABLES LIKE "max_binlog_cache_size", Value, 1);
|
||||||
|
let $old_binlog_cache_size= query_get_value(SHOW VARIABLES LIKE "binlog_cache_size", Value, 1);
|
||||||
|
let $old_max_binlog_stmt_cache_size= query_get_value(SHOW VARIABLES LIKE "max_binlog_stmt_cache_size", Value, 1);
|
||||||
|
let $old_binlog_stmt_cache_size= query_get_value(SHOW VARIABLES LIKE "binlog_stmt_cache_size", Value, 1);
|
||||||
|
|
||||||
|
SET GLOBAL max_binlog_cache_size = 4096;
|
||||||
|
SET GLOBAL binlog_cache_size = 4096;
|
||||||
|
SET GLOBAL max_binlog_stmt_cache_size = 4096;
|
||||||
|
SET GLOBAL binlog_stmt_cache_size = 4096;
|
||||||
|
disconnect master;
|
||||||
|
connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,);
|
||||||
|
|
||||||
|
CREATE TABLE t1(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=MYISAM;
|
||||||
|
|
||||||
|
let $data = `select concat('"', repeat('a',2000), '"')`;
|
||||||
|
|
||||||
|
connection master;
|
||||||
|
|
||||||
|
--disable_query_log
|
||||||
|
--error ER_BINLOG_ROW_LOGGING_FAILED
|
||||||
|
eval INSERT INTO t1 (a, data) VALUES (2,
|
||||||
|
CONCAT($data, $data, $data, $data, $data, $data));
|
||||||
|
--enable_query_log
|
||||||
|
|
||||||
|
# Incident event
|
||||||
|
# 1590=ER_SLAVE_INCIDENT
|
||||||
|
--let $slave_sql_errno= 1590
|
||||||
|
--source include/wait_for_slave_sql_error_and_skip.inc
|
||||||
|
|
||||||
|
connection master;
|
||||||
|
|
||||||
|
--replace_result $old_max_binlog_cache_size ORIGINAL_VALUE
|
||||||
|
--eval SET GLOBAL max_binlog_cache_size= $old_max_binlog_cache_size
|
||||||
|
--replace_result $old_binlog_cache_size ORIGINAL_VALUE
|
||||||
|
--eval SET GLOBAL binlog_cache_size= $old_binlog_cache_size
|
||||||
|
--replace_result $old_max_binlog_stmt_cache_size ORIGINAL_VALUE
|
||||||
|
--eval SET GLOBAL max_binlog_stmt_cache_size= $old_max_binlog_stmt_cache_size
|
||||||
|
--replace_result $old_binlog_stmt_cache_size ORIGINAL_VALUE
|
||||||
|
--eval SET GLOBAL binlog_stmt_cache_size= $old_binlog_stmt_cache_size
|
||||||
|
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
--source include/rpl_end.inc
|
@@ -1218,8 +1218,8 @@
|
|||||||
COMMAND_LINE_ARGUMENT OPTIONAL
|
COMMAND_LINE_ARGUMENT OPTIONAL
|
||||||
VARIABLE_NAME INNODB_VERSION
|
VARIABLE_NAME INNODB_VERSION
|
||||||
SESSION_VALUE NULL
|
SESSION_VALUE NULL
|
||||||
-GLOBAL_VALUE 5.6.35
|
-GLOBAL_VALUE 5.6.36
|
||||||
+GLOBAL_VALUE 5.6.35-80.0
|
+GLOBAL_VALUE 5.6.36-82.0
|
||||||
GLOBAL_VALUE_ORIGIN COMPILE-TIME
|
GLOBAL_VALUE_ORIGIN COMPILE-TIME
|
||||||
DEFAULT_VALUE NULL
|
DEFAULT_VALUE NULL
|
||||||
VARIABLE_SCOPE GLOBAL
|
VARIABLE_SCOPE GLOBAL
|
||||||
|
@@ -661,8 +661,8 @@
|
|||||||
COMMAND_LINE_ARGUMENT OPTIONAL
|
COMMAND_LINE_ARGUMENT OPTIONAL
|
||||||
VARIABLE_NAME INNODB_VERSION
|
VARIABLE_NAME INNODB_VERSION
|
||||||
SESSION_VALUE NULL
|
SESSION_VALUE NULL
|
||||||
-GLOBAL_VALUE 5.6.35
|
-GLOBAL_VALUE 5.6.36
|
||||||
+GLOBAL_VALUE 5.6.35-80.0
|
+GLOBAL_VALUE 5.6.36-82.0
|
||||||
GLOBAL_VALUE_ORIGIN COMPILE-TIME
|
GLOBAL_VALUE_ORIGIN COMPILE-TIME
|
||||||
DEFAULT_VALUE NULL
|
DEFAULT_VALUE NULL
|
||||||
VARIABLE_SCOPE GLOBAL
|
VARIABLE_SCOPE GLOBAL
|
||||||
|
@@ -3074,7 +3074,7 @@ READ_ONLY NO
|
|||||||
COMMAND_LINE_ARGUMENT OPTIONAL
|
COMMAND_LINE_ARGUMENT OPTIONAL
|
||||||
VARIABLE_NAME INNODB_VERSION
|
VARIABLE_NAME INNODB_VERSION
|
||||||
SESSION_VALUE NULL
|
SESSION_VALUE NULL
|
||||||
GLOBAL_VALUE 5.7.14
|
GLOBAL_VALUE 5.7.18
|
||||||
GLOBAL_VALUE_ORIGIN COMPILE-TIME
|
GLOBAL_VALUE_ORIGIN COMPILE-TIME
|
||||||
DEFAULT_VALUE NULL
|
DEFAULT_VALUE NULL
|
||||||
VARIABLE_SCOPE GLOBAL
|
VARIABLE_SCOPE GLOBAL
|
||||||
|
@@ -1899,6 +1899,56 @@ deallocate prepare stmt1;
|
|||||||
|
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # Bug mdev-12670: mergeable derived / view with subqueries
|
||||||
|
--echo # subject to semi-join optimizations
|
||||||
|
--echo # (actually this is a 5.3 bug.)
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
create table t1 (a int) engine=myisam;
|
||||||
|
insert into t1 values (5),(3),(2),(7),(2),(5),(1);
|
||||||
|
create table t2 (b int, index idx(b)) engine=myisam;
|
||||||
|
insert into t2 values (2),(3),(2),(1),(3),(4);
|
||||||
|
insert into t2 select b+10 from t2;
|
||||||
|
insert into t2 select b+10 from t2;
|
||||||
|
insert into t2 select b+10 from t2;
|
||||||
|
insert into t2 select b+10 from t2;
|
||||||
|
insert into t2 select b+10 from t2;
|
||||||
|
insert into t2 select b+10 from t2;
|
||||||
|
insert into t2 select b+10 from t2;
|
||||||
|
insert into t2 select b+10 from t2;
|
||||||
|
insert into t2 select b+10 from t2;
|
||||||
|
insert into t2 select b+10 from t2;
|
||||||
|
analyze table t1,t2;
|
||||||
|
|
||||||
|
explain select a from t1 where a in (select b from t2);
|
||||||
|
explain select * from (select a from t1 where a in (select b from t2)) t;
|
||||||
|
create view v1 as select a from t1 where a in (select b from t2);
|
||||||
|
explain select * from v1;
|
||||||
|
|
||||||
|
drop view v1;
|
||||||
|
drop table t1,t2;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # Bug mdev-12812: mergeable derived / view with subqueries
|
||||||
|
--echo # NOT subject to semi-join optimizations
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
CREATE TABLE t1 (c1 varchar(3)) ENGINE=MyISAM;
|
||||||
|
INSERT INTO t1 VALUES ('foo'),('foo');
|
||||||
|
|
||||||
|
CREATE TABLE t2 (c2 varchar(3)) ENGINE=MyISAM;
|
||||||
|
INSERT INTO t2 VALUES ('bar'),('qux'),('foo');
|
||||||
|
|
||||||
|
let $q=
|
||||||
|
SELECT STRAIGHT_JOIN *
|
||||||
|
FROM ( SELECT * FROM t1 WHERE c1 IN ( SELECT c2 FROM t2 ) ) AS sq;
|
||||||
|
|
||||||
|
eval $q;
|
||||||
|
eval EXPLAIN EXTENDED $q;
|
||||||
|
|
||||||
|
DROP TABLE t1, t2;
|
||||||
|
|
||||||
# The following command must be the last one the file
|
# The following command must be the last one the file
|
||||||
set optimizer_switch=@exit_optimizer_switch;
|
set optimizer_switch=@exit_optimizer_switch;
|
||||||
set join_cache_level=@exit_join_cache_level;
|
set join_cache_level=@exit_join_cache_level;
|
||||||
|
@@ -406,6 +406,8 @@ drop table t3, t4, t5;
|
|||||||
--echo # LP BUG#858038 The result of a query with NOT IN subquery depends on the state of the optimizer switch
|
--echo # LP BUG#858038 The result of a query with NOT IN subquery depends on the state of the optimizer switch
|
||||||
--echo #
|
--echo #
|
||||||
|
|
||||||
|
set @optimizer_switch_save= @@optimizer_switch;
|
||||||
|
|
||||||
create table t1 (c1 char(2) not null, c2 char(2));
|
create table t1 (c1 char(2) not null, c2 char(2));
|
||||||
create table t2 (c3 char(2), c4 char(2));
|
create table t2 (c3 char(2), c4 char(2));
|
||||||
|
|
||||||
@@ -425,6 +427,8 @@ select * from t1 where c1 = 'a2' and (c1, c2) not in (select * from t2);
|
|||||||
|
|
||||||
drop table t1, t2;
|
drop table t1, t2;
|
||||||
|
|
||||||
|
set optimizer_switch= @optimizer_switch_save;
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
--echo # MDEV-12673: cost-based choice between materialization and in-to-exists
|
--echo # MDEV-12673: cost-based choice between materialization and in-to-exists
|
||||||
--echo #
|
--echo #
|
||||||
@@ -463,3 +467,43 @@ SELECT * FROM t1 WHERE i1 NOT IN (
|
|||||||
);
|
);
|
||||||
|
|
||||||
DROP TABLE t1,t2,t3;
|
DROP TABLE t1,t2,t3;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-7599: in-to-exists chosen after min/max optimization
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
set @optimizer_switch_save= @@optimizer_switch;
|
||||||
|
|
||||||
|
CREATE TABLE t1 (a INT, KEY(a)) ENGINE=MyISAM;
|
||||||
|
INSERT INTO t1 VALUES (1),(2);
|
||||||
|
|
||||||
|
CREATE TABLE t2 (b INT, c INT) ENGINE=MyISAM;
|
||||||
|
INSERT INTO t2 VALUES (1,6),(2,4), (8,9);
|
||||||
|
|
||||||
|
let $q=
|
||||||
|
SELECT * FROM t2 WHERE b != ALL (SELECT MIN(a) FROM t1, t2 WHERE t2.c = t2.b);
|
||||||
|
|
||||||
|
eval $q;
|
||||||
|
eval EXPLAIN EXTENDED $q;
|
||||||
|
set optimizer_switch= 'materialization=off';
|
||||||
|
eval $q;
|
||||||
|
eval EXPLAIN EXTENDED $q;
|
||||||
|
set optimizer_switch= @optimizer_switch_save;
|
||||||
|
|
||||||
|
DROP TABLE t1,t2;
|
||||||
|
|
||||||
|
CREATE TABLE t1 (f1 varchar(10)) ENGINE=MyISAM;
|
||||||
|
INSERT INTO t1 VALUES ('foo'),('bar');
|
||||||
|
|
||||||
|
CREATE TABLE t2 (f2 varchar(10), key(f2)) ENGINE=MyISAM;
|
||||||
|
INSERT INTO t2 VALUES ('baz'),('qux');
|
||||||
|
|
||||||
|
CREATE TABLE t3 (f3 varchar(10)) ENGINE=MyISAM;
|
||||||
|
INSERT INTO t3 VALUES ('abc'),('def');
|
||||||
|
|
||||||
|
SELECT * FROM t1
|
||||||
|
WHERE f1 = ALL( SELECT MAX(t2a.f2)
|
||||||
|
FROM t2 AS t2a INNER JOIN t2 t2b INNER JOIN t3
|
||||||
|
ON (f3 = t2b.f2) );
|
||||||
|
|
||||||
|
DROP TABLE t1,t2,t3;
|
||||||
|
@@ -2773,5 +2773,77 @@ WHERE ( SELECT z.country
|
|||||||
drop table t1, t2, t3;
|
drop table t1, t2, t3;
|
||||||
set optimizer_switch= @tmp_mdev6859;
|
set optimizer_switch= @tmp_mdev6859;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-12675: subquery subject to semi-join optimizations
|
||||||
|
--echo # in ON expression of INNER JOIN
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
set @tmp_mdev12675=@@optimizer_switch;
|
||||||
|
set optimizer_switch=default;
|
||||||
|
create table t1 (a int) engine=myisam;
|
||||||
|
insert into t1 values (5),(3),(2),(7),(2),(5),(1);
|
||||||
|
create table t2 (b int, index idx(b)) engine=myisam;
|
||||||
|
insert into t2 values (2),(3),(2),(1),(3),(4);
|
||||||
|
insert into t2 select b+10 from t2;
|
||||||
|
insert into t2 select b+10 from t2;
|
||||||
|
insert into t2 select b+10 from t2;
|
||||||
|
insert into t2 select b+10 from t2;
|
||||||
|
insert into t2 select b+10 from t2;
|
||||||
|
insert into t2 select b+10 from t2;
|
||||||
|
insert into t2 select b+10 from t2;
|
||||||
|
insert into t2 select b+10 from t2;
|
||||||
|
insert into t2 select b+10 from t2;
|
||||||
|
insert into t2 select b+10 from t2;
|
||||||
|
insert into t2 select b+10 from t2;
|
||||||
|
analyze table t1,t2;
|
||||||
|
|
||||||
|
explain
|
||||||
|
select a from t1, t2 where b between 1 and 2 and a in (select b from t2);
|
||||||
|
explain
|
||||||
|
select a from t1 join t2 on b between 1 and 2 and a in (select b from t2);
|
||||||
|
|
||||||
|
drop table t1,t2;
|
||||||
|
set optimizer_switch= @tmp_mdev12675;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-12817: subquery NOT subject to semi-join optimizations
|
||||||
|
--echo # in ON expression of INNER JOIN
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
CREATE TABLE t1 (c1 int) ENGINE=MyISAM;
|
||||||
|
INSERT INTO t1 VALUES (1),(2);
|
||||||
|
|
||||||
|
CREATE TABLE t2 (c2 int) ENGINE=MyISAM;
|
||||||
|
INSERT INTO t2 VALUES (3),(4);
|
||||||
|
|
||||||
|
CREATE TABLE t3 (c3 int) ENGINE=MyISAM;
|
||||||
|
INSERT INTO t3 VALUES (5),(6);
|
||||||
|
|
||||||
|
CREATE TABLE t4 (c4 int) ENGINE=MyISAM;
|
||||||
|
INSERT INTO t4 VALUES (7),(8);
|
||||||
|
|
||||||
|
let $q1=
|
||||||
|
SELECT c1
|
||||||
|
FROM t1
|
||||||
|
LEFT JOIN
|
||||||
|
( t2 INNER JOIN t3 ON ( 1 IN ( SELECT c4 FROM t4 ) ) )
|
||||||
|
ON (c1 = c3);
|
||||||
|
|
||||||
|
eval $q1;
|
||||||
|
eval EXPLAIN EXTENDED $q1;
|
||||||
|
|
||||||
|
let $q2=
|
||||||
|
SELECT *
|
||||||
|
FROM t1
|
||||||
|
LEFT JOIN
|
||||||
|
( ( SELECT * FROM t2 WHERE c2 IN ( SELECT c3 FROM t3 ) ) AS sq INNER JOIN t4 )
|
||||||
|
ON (c1 = c2);
|
||||||
|
|
||||||
|
--echo # mdev-12820
|
||||||
|
eval $q2;
|
||||||
|
eval EXPLAIN EXTENDED $q2;
|
||||||
|
|
||||||
|
DROP TABLE t1,t2,t3,t4;
|
||||||
|
|
||||||
# The following command must be the last one the file
|
# The following command must be the last one the file
|
||||||
set optimizer_switch=@subselect_sj_tmp;
|
set optimizer_switch=@subselect_sj_tmp;
|
||||||
|
@@ -263,3 +263,23 @@ DROP TABLE t1,t2,t3;
|
|||||||
set join_cache_level= @save_join_cache_level;
|
set join_cache_level= @save_join_cache_level;
|
||||||
set optimizer_switch=@save_optimizer_switch;
|
set optimizer_switch=@save_optimizer_switch;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # mdev-7791: materialization of a semi-join subquery +
|
||||||
|
--echo # RAND() in WHERE
|
||||||
|
--echo # (materialized table is accessed last)
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
set @save_optimizer_switch=@@optimizer_switch;
|
||||||
|
set optimizer_switch='materialization=on';
|
||||||
|
|
||||||
|
create table t1(i int);
|
||||||
|
insert into t1 values (1), (2), (3), (7), (9), (10);
|
||||||
|
create table t2(i int);
|
||||||
|
insert into t2 values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
|
||||||
|
|
||||||
|
select * from t1 where (rand() < 0) and i in (select i from t2);
|
||||||
|
explain extended
|
||||||
|
select * from t1 where (rand() < 0) and i in (select i from t2);
|
||||||
|
|
||||||
|
drop table t1,t2;
|
||||||
|
set optimizer_switch=@save_optimizer_switch;
|
||||||
|
@@ -550,7 +550,10 @@ static int initialize_bucket(LF_HASH *hash, LF_SLIST * volatile *node,
|
|||||||
return -1;
|
return -1;
|
||||||
if (*el == NULL && bucket &&
|
if (*el == NULL && bucket &&
|
||||||
unlikely(initialize_bucket(hash, el, parent, pins)))
|
unlikely(initialize_bucket(hash, el, parent, pins)))
|
||||||
|
{
|
||||||
|
my_free(dummy);
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
dummy->hashnr= my_reverse_bits(bucket) | 0; /* dummy node */
|
dummy->hashnr= my_reverse_bits(bucket) | 0; /* dummy node */
|
||||||
dummy->key= dummy_key;
|
dummy->key= dummy_key;
|
||||||
dummy->keylen= 0;
|
dummy->keylen= 0;
|
||||||
|
@@ -4038,6 +4038,8 @@ mariadb_dyncol_val_double(double *dbl, DYNAMIC_COLUMN_VALUE *val)
|
|||||||
*dbl= strtod(str, &end);
|
*dbl= strtod(str, &end);
|
||||||
if (*end != '\0')
|
if (*end != '\0')
|
||||||
rc= ER_DYNCOL_TRUNCATED;
|
rc= ER_DYNCOL_TRUNCATED;
|
||||||
|
free(str);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
case DYN_COL_DECIMAL:
|
case DYN_COL_DECIMAL:
|
||||||
if (decimal2double(&val->x.decimal.value, dbl) != E_DEC_OK)
|
if (decimal2double(&val->x.decimal.value, dbl) != E_DEC_OK)
|
||||||
|
@@ -556,7 +556,7 @@ my_bool wt_resource_id_memcmp(const void *a, const void *b)
|
|||||||
{
|
{
|
||||||
/* we use the fact that there's no padding in the middle of WT_RESOURCE_ID */
|
/* we use the fact that there's no padding in the middle of WT_RESOURCE_ID */
|
||||||
compile_time_assert(offsetof(WT_RESOURCE_ID, type) == sizeof(ulonglong));
|
compile_time_assert(offsetof(WT_RESOURCE_ID, type) == sizeof(ulonglong));
|
||||||
return memcmp(a, b, sizeof_WT_RESOURCE_ID);
|
return MY_TEST(memcmp(a, b, sizeof_WT_RESOURCE_ID));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -162,6 +162,7 @@ static int pam_auth(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info)
|
|||||||
if (new_username && strcmp(new_username, info->user_name))
|
if (new_username && strcmp(new_username, info->user_name))
|
||||||
strncpy(info->authenticated_as, new_username,
|
strncpy(info->authenticated_as, new_username,
|
||||||
sizeof(info->authenticated_as));
|
sizeof(info->authenticated_as));
|
||||||
|
info->authenticated_as[sizeof(info->authenticated_as)-1]= 0;
|
||||||
|
|
||||||
end:
|
end:
|
||||||
pam_end(pamh, status);
|
pam_end(pamh, status);
|
||||||
|
@@ -621,6 +621,6 @@ maria_declare_plugin(aws_key_management)
|
|||||||
NULL,
|
NULL,
|
||||||
settings,
|
settings,
|
||||||
"1.0",
|
"1.0",
|
||||||
MariaDB_PLUGIN_MATURITY_BETA
|
MariaDB_PLUGIN_MATURITY_STABLE
|
||||||
}
|
}
|
||||||
maria_declare_plugin_end;
|
maria_declare_plugin_end;
|
||||||
|
@@ -204,7 +204,7 @@ static void send_report(const char *when)
|
|||||||
/*
|
/*
|
||||||
otherwise, prepare the THD and TABLE_LIST,
|
otherwise, prepare the THD and TABLE_LIST,
|
||||||
create and fill the temporary table with data just like
|
create and fill the temporary table with data just like
|
||||||
SELECT * FROM INFORMATION_SCHEMA.feedback is doing,
|
SELECT * FROM INFORMATION_SCHEMA.FEEDBACK is doing,
|
||||||
read and concatenate table data into a String.
|
read and concatenate table data into a String.
|
||||||
*/
|
*/
|
||||||
if (!(thd= new THD(thd_thread_id)))
|
if (!(thd= new THD(thd_thread_id)))
|
||||||
|
@@ -1041,6 +1041,7 @@ static int start_logging()
|
|||||||
error_header();
|
error_header();
|
||||||
fprintf(stderr, "logging started to the file %s.\n", alt_fname);
|
fprintf(stderr, "logging started to the file %s.\n", alt_fname);
|
||||||
strncpy(current_log_buf, alt_fname, sizeof(current_log_buf));
|
strncpy(current_log_buf, alt_fname, sizeof(current_log_buf));
|
||||||
|
current_log_buf[sizeof(current_log_buf)-1]= 0;
|
||||||
}
|
}
|
||||||
else if (output_type == OUTPUT_SYSLOG)
|
else if (output_type == OUTPUT_SYSLOG)
|
||||||
{
|
{
|
||||||
@@ -2570,6 +2571,7 @@ static void update_file_path(MYSQL_THD thd,
|
|||||||
}
|
}
|
||||||
|
|
||||||
strncpy(path_buffer, new_name, sizeof(path_buffer));
|
strncpy(path_buffer, new_name, sizeof(path_buffer));
|
||||||
|
path_buffer[sizeof(path_buffer)-1]= 0;
|
||||||
file_path= path_buffer;
|
file_path= path_buffer;
|
||||||
exit_func:
|
exit_func:
|
||||||
internal_stop_logging= 0;
|
internal_stop_logging= 0;
|
||||||
@@ -2622,6 +2624,7 @@ static void update_incl_users(MYSQL_THD thd,
|
|||||||
flogger_mutex_lock(&lock_operations);
|
flogger_mutex_lock(&lock_operations);
|
||||||
mark_always_logged(thd);
|
mark_always_logged(thd);
|
||||||
strncpy(incl_user_buffer, new_users, sizeof(incl_user_buffer));
|
strncpy(incl_user_buffer, new_users, sizeof(incl_user_buffer));
|
||||||
|
incl_user_buffer[sizeof(incl_user_buffer)-1]= 0;
|
||||||
incl_users= incl_user_buffer;
|
incl_users= incl_user_buffer;
|
||||||
user_coll_fill(&incl_user_coll, incl_users, &excl_user_coll, 1);
|
user_coll_fill(&incl_user_coll, incl_users, &excl_user_coll, 1);
|
||||||
error_header();
|
error_header();
|
||||||
@@ -2640,6 +2643,7 @@ static void update_excl_users(MYSQL_THD thd __attribute__((unused)),
|
|||||||
flogger_mutex_lock(&lock_operations);
|
flogger_mutex_lock(&lock_operations);
|
||||||
mark_always_logged(thd);
|
mark_always_logged(thd);
|
||||||
strncpy(excl_user_buffer, new_users, sizeof(excl_user_buffer));
|
strncpy(excl_user_buffer, new_users, sizeof(excl_user_buffer));
|
||||||
|
excl_user_buffer[sizeof(excl_user_buffer)-1]= 0;
|
||||||
excl_users= excl_user_buffer;
|
excl_users= excl_user_buffer;
|
||||||
user_coll_fill(&excl_user_coll, excl_users, &incl_user_coll, 0);
|
user_coll_fill(&excl_user_coll, excl_users, &incl_user_coll, 0);
|
||||||
error_header();
|
error_header();
|
||||||
@@ -2771,6 +2775,7 @@ static void update_syslog_ident(MYSQL_THD thd __attribute__((unused)),
|
|||||||
{
|
{
|
||||||
char *new_ident= (*(char **) save) ? *(char **) save : empty_str;
|
char *new_ident= (*(char **) save) ? *(char **) save : empty_str;
|
||||||
strncpy(syslog_ident_buffer, new_ident, sizeof(syslog_ident_buffer));
|
strncpy(syslog_ident_buffer, new_ident, sizeof(syslog_ident_buffer));
|
||||||
|
syslog_ident_buffer[sizeof(syslog_ident_buffer)-1]= 0;
|
||||||
syslog_ident= syslog_ident_buffer;
|
syslog_ident= syslog_ident_buffer;
|
||||||
error_header();
|
error_header();
|
||||||
fprintf(stderr, "SYSYLOG ident was changed to '%s'\n", syslog_ident);
|
fprintf(stderr, "SYSYLOG ident was changed to '%s'\n", syslog_ident);
|
||||||
|
@@ -375,8 +375,7 @@ mysql_load_plugin_v(MYSQL *mysql, const char *name, int type,
|
|||||||
if (!(sym= dlsym(dlhandle, plugin_declarations_sym)))
|
if (!(sym= dlsym(dlhandle, plugin_declarations_sym)))
|
||||||
{
|
{
|
||||||
errmsg= "not a plugin";
|
errmsg= "not a plugin";
|
||||||
(void)dlclose(dlhandle);
|
goto errc;
|
||||||
goto err;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
plugin= (struct st_mysql_client_plugin*)sym;
|
plugin= (struct st_mysql_client_plugin*)sym;
|
||||||
@@ -384,19 +383,19 @@ mysql_load_plugin_v(MYSQL *mysql, const char *name, int type,
|
|||||||
if (type >=0 && type != plugin->type)
|
if (type >=0 && type != plugin->type)
|
||||||
{
|
{
|
||||||
errmsg= "type mismatch";
|
errmsg= "type mismatch";
|
||||||
goto err;
|
goto errc;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(name, plugin->name))
|
if (strcmp(name, plugin->name))
|
||||||
{
|
{
|
||||||
errmsg= "name mismatch";
|
errmsg= "name mismatch";
|
||||||
goto err;
|
goto errc;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type < 0 && find_plugin(name, plugin->type))
|
if (type < 0 && find_plugin(name, plugin->type))
|
||||||
{
|
{
|
||||||
errmsg= "it is already loaded";
|
errmsg= "it is already loaded";
|
||||||
goto err;
|
goto errc;
|
||||||
}
|
}
|
||||||
|
|
||||||
plugin= add_plugin(mysql, plugin, dlhandle, argc, args);
|
plugin= add_plugin(mysql, plugin, dlhandle, argc, args);
|
||||||
@@ -406,6 +405,8 @@ mysql_load_plugin_v(MYSQL *mysql, const char *name, int type,
|
|||||||
DBUG_PRINT ("leave", ("plugin loaded ok"));
|
DBUG_PRINT ("leave", ("plugin loaded ok"));
|
||||||
DBUG_RETURN (plugin);
|
DBUG_RETURN (plugin);
|
||||||
|
|
||||||
|
errc:
|
||||||
|
dlclose(dlhandle);
|
||||||
err:
|
err:
|
||||||
mysql_mutex_unlock(&LOCK_load_client_plugin);
|
mysql_mutex_unlock(&LOCK_load_client_plugin);
|
||||||
DBUG_PRINT ("leave", ("plugin load error : %s", errmsg));
|
DBUG_PRINT ("leave", ("plugin load error : %s", errmsg));
|
||||||
|
@@ -89,7 +89,6 @@ int readfrm(const char *name, const uchar **frmdata, size_t *len)
|
|||||||
error= 0;
|
error= 0;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
if (file > 0)
|
|
||||||
(void) mysql_file_close(file, MYF(MY_WME));
|
(void) mysql_file_close(file, MYF(MY_WME));
|
||||||
|
|
||||||
err_end: /* Here when no file */
|
err_end: /* Here when no file */
|
||||||
|
@@ -951,6 +951,7 @@ write_keys(Sort_param *param, SORT_INFO *fs_info, uint count,
|
|||||||
/* check we won't have more buffpeks than we can possibly keep in memory */
|
/* check we won't have more buffpeks than we can possibly keep in memory */
|
||||||
if (my_b_tell(buffpek_pointers) + sizeof(BUFFPEK) > (ulonglong)UINT_MAX)
|
if (my_b_tell(buffpek_pointers) + sizeof(BUFFPEK) > (ulonglong)UINT_MAX)
|
||||||
goto err;
|
goto err;
|
||||||
|
bzero(&buffpek, sizeof(buffpek));
|
||||||
buffpek.file_pos= my_b_tell(tempfile);
|
buffpek.file_pos= my_b_tell(tempfile);
|
||||||
if ((ha_rows) count > param->max_rows)
|
if ((ha_rows) count > param->max_rows)
|
||||||
count=(uint) param->max_rows; /* purecov: inspected */
|
count=(uint) param->max_rows; /* purecov: inspected */
|
||||||
|
@@ -1440,8 +1440,9 @@ Item_in_subselect::Item_in_subselect(THD *thd, Item * left_exp,
|
|||||||
st_select_lex *select_lex):
|
st_select_lex *select_lex):
|
||||||
Item_exists_subselect(thd), left_expr_cache(0), first_execution(TRUE),
|
Item_exists_subselect(thd), left_expr_cache(0), first_execution(TRUE),
|
||||||
in_strategy(SUBS_NOT_TRANSFORMED),
|
in_strategy(SUBS_NOT_TRANSFORMED),
|
||||||
pushed_cond_guards(NULL), is_jtbm_merged(FALSE), is_jtbm_const_tab(FALSE),
|
pushed_cond_guards(NULL), do_not_convert_to_sj(FALSE), is_jtbm_merged(FALSE),
|
||||||
is_flattenable_semijoin(FALSE), is_registered_semijoin(FALSE),
|
is_jtbm_const_tab(FALSE), is_flattenable_semijoin(FALSE),
|
||||||
|
is_registered_semijoin(FALSE),
|
||||||
upper_item(0)
|
upper_item(0)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("Item_in_subselect::Item_in_subselect");
|
DBUG_ENTER("Item_in_subselect::Item_in_subselect");
|
||||||
@@ -2599,6 +2600,27 @@ bool Item_in_subselect::inject_in_to_exists_cond(JOIN *join_arg)
|
|||||||
DBUG_ENTER("Item_in_subselect::inject_in_to_exists_cond");
|
DBUG_ENTER("Item_in_subselect::inject_in_to_exists_cond");
|
||||||
DBUG_ASSERT(thd == join_arg->thd);
|
DBUG_ASSERT(thd == join_arg->thd);
|
||||||
|
|
||||||
|
if (select_lex->min_max_opt_list.elements)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
MIN/MAX optimizations have been applied to Item_sum objects
|
||||||
|
of the subquery this subquery predicate in opt_sum_query().
|
||||||
|
Injection of new condition invalidates this optimizations.
|
||||||
|
Thus those optimizations must be rolled back.
|
||||||
|
*/
|
||||||
|
List_iterator_fast<Item_sum> it(select_lex->min_max_opt_list);
|
||||||
|
Item_sum *item;
|
||||||
|
while ((item= it++))
|
||||||
|
{
|
||||||
|
item->clear();
|
||||||
|
item->reset_forced_const();
|
||||||
|
}
|
||||||
|
if (where_item)
|
||||||
|
where_item->update_used_tables();
|
||||||
|
if (having_item)
|
||||||
|
having_item->update_used_tables();
|
||||||
|
}
|
||||||
|
|
||||||
if (where_item)
|
if (where_item)
|
||||||
{
|
{
|
||||||
List<Item> *and_args= NULL;
|
List<Item> *and_args= NULL;
|
||||||
|
@@ -508,6 +508,8 @@ public:
|
|||||||
Item *left_expr_orig;
|
Item *left_expr_orig;
|
||||||
/* Priority of this predicate in the convert-to-semi-join-nest process. */
|
/* Priority of this predicate in the convert-to-semi-join-nest process. */
|
||||||
int sj_convert_priority;
|
int sj_convert_priority;
|
||||||
|
/* May be TRUE only for the candidates to semi-join conversion */
|
||||||
|
bool do_not_convert_to_sj;
|
||||||
/*
|
/*
|
||||||
Types of left_expr and subquery's select list allow to perform subquery
|
Types of left_expr and subquery's select list allow to perform subquery
|
||||||
materialization. Currently, we set this to FALSE when it as well could
|
materialization. Currently, we set this to FALSE when it as well could
|
||||||
@@ -598,8 +600,8 @@ public:
|
|||||||
Item_in_subselect(THD *thd_arg):
|
Item_in_subselect(THD *thd_arg):
|
||||||
Item_exists_subselect(thd_arg), left_expr_cache(0), first_execution(TRUE),
|
Item_exists_subselect(thd_arg), left_expr_cache(0), first_execution(TRUE),
|
||||||
in_strategy(SUBS_NOT_TRANSFORMED),
|
in_strategy(SUBS_NOT_TRANSFORMED),
|
||||||
pushed_cond_guards(NULL), func(NULL), is_jtbm_merged(FALSE),
|
pushed_cond_guards(NULL), func(NULL), do_not_convert_to_sj(FALSE),
|
||||||
is_jtbm_const_tab(FALSE), upper_item(0) {}
|
is_jtbm_merged(FALSE), is_jtbm_const_tab(FALSE), upper_item(0) {}
|
||||||
void cleanup();
|
void cleanup();
|
||||||
subs_type substype() { return IN_SUBS; }
|
subs_type substype() { return IN_SUBS; }
|
||||||
void reset()
|
void reset()
|
||||||
@@ -654,6 +656,8 @@ public:
|
|||||||
*/
|
*/
|
||||||
int get_identifier();
|
int get_identifier();
|
||||||
|
|
||||||
|
void block_conversion_to_sj () { do_not_convert_to_sj= TRUE; }
|
||||||
|
|
||||||
bool test_strategy(uchar strategy)
|
bool test_strategy(uchar strategy)
|
||||||
{ return MY_TEST(in_strategy & strategy); }
|
{ return MY_TEST(in_strategy & strategy); }
|
||||||
|
|
||||||
|
@@ -486,6 +486,7 @@ public:
|
|||||||
used_tables_cache= 0;
|
used_tables_cache= 0;
|
||||||
const_item_cache= true;
|
const_item_cache= true;
|
||||||
}
|
}
|
||||||
|
void reset_forced_const() { const_item_cache= false; }
|
||||||
virtual bool const_during_execution() const { return false; }
|
virtual bool const_during_execution() const { return false; }
|
||||||
virtual void print(String *str, enum_query_type query_type);
|
virtual void print(String *str, enum_query_type query_type);
|
||||||
void fix_num_length_and_dec();
|
void fix_num_length_and_dec();
|
||||||
|
@@ -5636,14 +5636,21 @@ int THD::binlog_write_table_map(TABLE *table, bool is_transactional,
|
|||||||
IO_CACHE *file=
|
IO_CACHE *file=
|
||||||
cache_mngr->get_binlog_cache_log(use_trans_cache(this, is_transactional));
|
cache_mngr->get_binlog_cache_log(use_trans_cache(this, is_transactional));
|
||||||
Log_event_writer writer(file);
|
Log_event_writer writer(file);
|
||||||
|
binlog_cache_data *cache_data=
|
||||||
|
cache_mngr->get_binlog_cache_data(use_trans_cache(this, is_transactional));
|
||||||
|
|
||||||
if (with_annotate && *with_annotate)
|
if (with_annotate && *with_annotate)
|
||||||
{
|
{
|
||||||
Annotate_rows_log_event anno(table->in_use, is_transactional, false);
|
Annotate_rows_log_event anno(table->in_use, is_transactional, false);
|
||||||
/* Annotate event should be written not more than once */
|
/* Annotate event should be written not more than once */
|
||||||
*with_annotate= 0;
|
*with_annotate= 0;
|
||||||
if ((error= writer.write(&anno)))
|
if ((error= writer.write(&anno)))
|
||||||
|
{
|
||||||
|
if (my_errno == EFBIG)
|
||||||
|
cache_data->set_incident();
|
||||||
DBUG_RETURN(error);
|
DBUG_RETURN(error);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if ((error= writer.write(&the_event)))
|
if ((error= writer.write(&the_event)))
|
||||||
DBUG_RETURN(error);
|
DBUG_RETURN(error);
|
||||||
|
|
||||||
|
@@ -8249,7 +8249,7 @@ static int show_default_keycache(THD *thd, SHOW_VAR *var, char *buff,
|
|||||||
{
|
{
|
||||||
struct st_data {
|
struct st_data {
|
||||||
KEY_CACHE_STATISTICS stats;
|
KEY_CACHE_STATISTICS stats;
|
||||||
SHOW_VAR var[8];
|
SHOW_VAR var[9];
|
||||||
} *data;
|
} *data;
|
||||||
SHOW_VAR *v;
|
SHOW_VAR *v;
|
||||||
|
|
||||||
|
@@ -133,7 +133,7 @@ extern ulong slave_retried_transactions;
|
|||||||
extern ulong slave_run_triggers_for_rbr;
|
extern ulong slave_run_triggers_for_rbr;
|
||||||
extern ulonglong slave_type_conversions_options;
|
extern ulonglong slave_type_conversions_options;
|
||||||
extern my_bool read_only, opt_readonly;
|
extern my_bool read_only, opt_readonly;
|
||||||
extern my_bool lower_case_file_system;
|
extern MYSQL_PLUGIN_IMPORT my_bool lower_case_file_system;
|
||||||
extern my_bool opt_enable_named_pipe, opt_sync_frm, opt_allow_suspicious_udfs;
|
extern my_bool opt_enable_named_pipe, opt_sync_frm, opt_allow_suspicious_udfs;
|
||||||
extern my_bool opt_secure_auth;
|
extern my_bool opt_secure_auth;
|
||||||
extern const char *current_dbug_option;
|
extern const char *current_dbug_option;
|
||||||
|
@@ -6955,8 +6955,11 @@ QUICK_SELECT_I *TRP_ROR_UNION::make_quick(PARAM *param,
|
|||||||
{
|
{
|
||||||
if (!(quick= (*scan)->make_quick(param, FALSE, &quick_roru->alloc)) ||
|
if (!(quick= (*scan)->make_quick(param, FALSE, &quick_roru->alloc)) ||
|
||||||
quick_roru->push_quick_back(quick))
|
quick_roru->push_quick_back(quick))
|
||||||
|
{
|
||||||
|
delete quick_roru;
|
||||||
DBUG_RETURN(NULL);
|
DBUG_RETURN(NULL);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
quick_roru->records= records;
|
quick_roru->records= records;
|
||||||
quick_roru->read_time= read_cost;
|
quick_roru->read_time= read_cost;
|
||||||
}
|
}
|
||||||
@@ -10773,9 +10776,7 @@ QUICK_RANGE_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table,
|
|||||||
*/
|
*/
|
||||||
thd->mem_root= old_root;
|
thd->mem_root= old_root;
|
||||||
|
|
||||||
if (!quick || create_err)
|
if (!quick || create_err || quick->init())
|
||||||
return 0; /* no ranges found */
|
|
||||||
if (quick->init())
|
|
||||||
goto err;
|
goto err;
|
||||||
quick->records= records;
|
quick->records= records;
|
||||||
|
|
||||||
|
@@ -1005,6 +1005,25 @@ bool check_for_outer_joins(List<TABLE_LIST> *join_list)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void find_and_block_conversion_to_sj(Item *to_find,
|
||||||
|
List_iterator_fast<Item_in_subselect> &li)
|
||||||
|
{
|
||||||
|
if (to_find->type() != Item::SUBSELECT_ITEM ||
|
||||||
|
((Item_subselect *) to_find)->substype() != Item_subselect::IN_SUBS)
|
||||||
|
return;
|
||||||
|
Item_in_subselect *in_subq;
|
||||||
|
li.rewind();
|
||||||
|
while ((in_subq= li++))
|
||||||
|
{
|
||||||
|
if (in_subq == to_find)
|
||||||
|
{
|
||||||
|
in_subq->block_conversion_to_sj();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Convert semi-join subquery predicates into semi-join join nests
|
Convert semi-join subquery predicates into semi-join join nests
|
||||||
|
|
||||||
@@ -1057,7 +1076,6 @@ bool convert_join_subqueries_to_semijoins(JOIN *join)
|
|||||||
Query_arena *arena, backup;
|
Query_arena *arena, backup;
|
||||||
Item_in_subselect *in_subq;
|
Item_in_subselect *in_subq;
|
||||||
THD *thd= join->thd;
|
THD *thd= join->thd;
|
||||||
List_iterator<TABLE_LIST> ti(join->select_lex->leaf_tables);
|
|
||||||
DBUG_ENTER("convert_join_subqueries_to_semijoins");
|
DBUG_ENTER("convert_join_subqueries_to_semijoins");
|
||||||
|
|
||||||
if (join->select_lex->sj_subselects.is_empty())
|
if (join->select_lex->sj_subselects.is_empty())
|
||||||
@@ -1075,6 +1093,89 @@ bool convert_join_subqueries_to_semijoins(JOIN *join)
|
|||||||
subq_sel->update_used_tables();
|
subq_sel->update_used_tables();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Check all candidates to semi-join conversion that occur
|
||||||
|
in ON expressions of outer join. Set the flag blocking
|
||||||
|
this conversion for them.
|
||||||
|
*/
|
||||||
|
TABLE_LIST *tbl;
|
||||||
|
List_iterator<TABLE_LIST> ti(join->select_lex->leaf_tables);
|
||||||
|
while ((tbl= ti++))
|
||||||
|
{
|
||||||
|
TABLE_LIST *embedded;
|
||||||
|
TABLE_LIST *embedding= tbl;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
embedded= embedding;
|
||||||
|
bool block_conversion_to_sj= false;
|
||||||
|
if (embedded->on_expr)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
Conversion of an IN subquery predicate into semi-join
|
||||||
|
is blocked now if the predicate occurs:
|
||||||
|
- in the ON expression of an outer join
|
||||||
|
- in the ON expression of an inner join embedded directly
|
||||||
|
or indirectly in the inner nest of an outer join
|
||||||
|
*/
|
||||||
|
for (TABLE_LIST *tl= embedded; tl; tl= tl->embedding)
|
||||||
|
{
|
||||||
|
if (tl->outer_join)
|
||||||
|
{
|
||||||
|
block_conversion_to_sj= true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (block_conversion_to_sj)
|
||||||
|
{
|
||||||
|
Item *cond= embedded->on_expr;
|
||||||
|
if (!cond)
|
||||||
|
;
|
||||||
|
else if (cond->type() != Item::COND_ITEM)
|
||||||
|
find_and_block_conversion_to_sj(cond, li);
|
||||||
|
else if (((Item_cond*) cond)->functype() ==
|
||||||
|
Item_func::COND_AND_FUNC)
|
||||||
|
{
|
||||||
|
Item *item;
|
||||||
|
List_iterator<Item> it(*(((Item_cond*) cond)->argument_list()));
|
||||||
|
while ((item= it++))
|
||||||
|
{
|
||||||
|
find_and_block_conversion_to_sj(item, li);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
embedding= embedded->embedding;
|
||||||
|
}
|
||||||
|
while (embedding &&
|
||||||
|
embedding->nested_join->join_list.head() == embedded);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Block conversion to semi-joins for those candidates that
|
||||||
|
are encountered in the WHERE condition of the multi-table view
|
||||||
|
with CHECK OPTION if this view is used in UPDATE/DELETE.
|
||||||
|
(This limitation can be, probably, easily lifted.)
|
||||||
|
*/
|
||||||
|
li.rewind();
|
||||||
|
while ((in_subq= li++))
|
||||||
|
{
|
||||||
|
if (in_subq->emb_on_expr_nest != NO_JOIN_NEST &&
|
||||||
|
in_subq->emb_on_expr_nest->effective_with_check)
|
||||||
|
{
|
||||||
|
in_subq->block_conversion_to_sj();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (join->select_options & SELECT_STRAIGHT_JOIN)
|
||||||
|
{
|
||||||
|
/* Block conversion to semijoins for all candidates */
|
||||||
|
li.rewind();
|
||||||
|
while ((in_subq= li++))
|
||||||
|
{
|
||||||
|
in_subq->block_conversion_to_sj();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
li.rewind();
|
li.rewind();
|
||||||
/* First, convert child join's subqueries. We proceed bottom-up here */
|
/* First, convert child join's subqueries. We proceed bottom-up here */
|
||||||
while ((in_subq= li++))
|
while ((in_subq= li++))
|
||||||
@@ -1093,8 +1194,10 @@ bool convert_join_subqueries_to_semijoins(JOIN *join)
|
|||||||
|
|
||||||
if (convert_join_subqueries_to_semijoins(child_join))
|
if (convert_join_subqueries_to_semijoins(child_join))
|
||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
|
|
||||||
|
|
||||||
in_subq->sj_convert_priority=
|
in_subq->sj_convert_priority=
|
||||||
MY_TEST(in_subq->emb_on_expr_nest != NO_JOIN_NEST) * MAX_TABLES * 2 +
|
MY_TEST(in_subq->do_not_convert_to_sj) * MAX_TABLES * 2 +
|
||||||
in_subq->is_correlated * MAX_TABLES + child_join->outer_tables;
|
in_subq->is_correlated * MAX_TABLES + child_join->outer_tables;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1127,7 +1230,7 @@ bool convert_join_subqueries_to_semijoins(JOIN *join)
|
|||||||
bool remove_item= TRUE;
|
bool remove_item= TRUE;
|
||||||
|
|
||||||
/* Stop processing if we've reached a subquery that's attached to the ON clause */
|
/* Stop processing if we've reached a subquery that's attached to the ON clause */
|
||||||
if (in_subq->emb_on_expr_nest != NO_JOIN_NEST)
|
if (in_subq->do_not_convert_to_sj)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (in_subq->is_flattenable_semijoin)
|
if (in_subq->is_flattenable_semijoin)
|
||||||
|
@@ -254,6 +254,8 @@ int opt_sum_query(THD *thd,
|
|||||||
int error= 0;
|
int error= 0;
|
||||||
DBUG_ENTER("opt_sum_query");
|
DBUG_ENTER("opt_sum_query");
|
||||||
|
|
||||||
|
thd->lex->current_select->min_max_opt_list.empty();
|
||||||
|
|
||||||
if (conds)
|
if (conds)
|
||||||
where_tables= conds->used_tables();
|
where_tables= conds->used_tables();
|
||||||
|
|
||||||
@@ -447,7 +449,14 @@ int opt_sum_query(THD *thd,
|
|||||||
item_sum->aggregator_clear();
|
item_sum->aggregator_clear();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
item_sum->reset_and_add();
|
item_sum->reset_and_add();
|
||||||
|
/*
|
||||||
|
Save a reference to the item for possible rollback
|
||||||
|
of the min/max optimizations for this select
|
||||||
|
*/
|
||||||
|
thd->lex->current_select->min_max_opt_list.push_back(item_sum);
|
||||||
|
}
|
||||||
item_sum->make_const();
|
item_sum->make_const();
|
||||||
recalc_const_item= 1;
|
recalc_const_item= 1;
|
||||||
break;
|
break;
|
||||||
|
@@ -664,7 +664,7 @@ file '%s')", fname);
|
|||||||
mi->connect_retry= (uint) connect_retry;
|
mi->connect_retry= (uint) connect_retry;
|
||||||
mi->ssl= (my_bool) ssl;
|
mi->ssl= (my_bool) ssl;
|
||||||
mi->ssl_verify_server_cert= ssl_verify_server_cert;
|
mi->ssl_verify_server_cert= ssl_verify_server_cert;
|
||||||
mi->heartbeat_period= master_heartbeat_period;
|
mi->heartbeat_period= MY_MIN(SLAVE_MAX_HEARTBEAT_PERIOD, master_heartbeat_period);
|
||||||
}
|
}
|
||||||
DBUG_PRINT("master_info",("log_file_name: %s position: %ld",
|
DBUG_PRINT("master_info",("log_file_name: %s position: %ld",
|
||||||
mi->master_log_name,
|
mi->master_log_name,
|
||||||
@@ -799,8 +799,8 @@ int flush_master_info(Master_info* mi,
|
|||||||
contents of file). But because of number of lines in the first line
|
contents of file). But because of number of lines in the first line
|
||||||
of file we don't care about this garbage.
|
of file we don't care about this garbage.
|
||||||
*/
|
*/
|
||||||
char heartbeat_buf[sizeof(mi->heartbeat_period) * 4]; // buffer to suffice always
|
char heartbeat_buf[FLOATING_POINT_BUFFER];
|
||||||
sprintf(heartbeat_buf, "%.3f", mi->heartbeat_period);
|
my_fcvt(mi->heartbeat_period, 3, heartbeat_buf, NULL);
|
||||||
my_b_seek(file, 0L);
|
my_b_seek(file, 0L);
|
||||||
my_b_printf(file,
|
my_b_printf(file,
|
||||||
"%u\n%s\n%s\n%s\n%s\n%s\n%d\n%d\n%d\n%s\n%s\n%s\n%s\n%s\n%d\n%s\n%s\n%s\n%s\n%d\n%s\n%s\n"
|
"%u\n%s\n%s\n%s\n%s\n%s\n%d\n%d\n%d\n%s\n%s\n%s\n%s\n%s\n%d\n%s\n%s\n%s\n%s\n%d\n%s\n%s\n"
|
||||||
|
@@ -2097,6 +2097,7 @@ void st_select_lex::init_query()
|
|||||||
leaf_tables_prep.empty();
|
leaf_tables_prep.empty();
|
||||||
leaf_tables.empty();
|
leaf_tables.empty();
|
||||||
item_list.empty();
|
item_list.empty();
|
||||||
|
min_max_opt_list.empty();
|
||||||
join= 0;
|
join= 0;
|
||||||
having= prep_having= where= prep_where= 0;
|
having= prep_having= where= prep_where= 0;
|
||||||
cond_pushed_into_where= cond_pushed_into_having= 0;
|
cond_pushed_into_where= cond_pushed_into_having= 0;
|
||||||
|
@@ -789,6 +789,11 @@ public:
|
|||||||
*/
|
*/
|
||||||
List<Item_func_match> *ftfunc_list;
|
List<Item_func_match> *ftfunc_list;
|
||||||
List<Item_func_match> ftfunc_list_alloc;
|
List<Item_func_match> ftfunc_list_alloc;
|
||||||
|
/*
|
||||||
|
The list of items to which MIN/MAX optimizations of opt_sum_query()
|
||||||
|
have been applied. Used to rollback those optimizations if it's needed.
|
||||||
|
*/
|
||||||
|
List<Item_sum> min_max_opt_list;
|
||||||
JOIN *join; /* after JOIN::prepare it is pointer to corresponding JOIN */
|
JOIN *join; /* after JOIN::prepare it is pointer to corresponding JOIN */
|
||||||
List<TABLE_LIST> top_join_list; /* join list of the top level */
|
List<TABLE_LIST> top_join_list; /* join list of the top level */
|
||||||
List<TABLE_LIST> *join_list; /* list for the currently parsed join */
|
List<TABLE_LIST> *join_list; /* list for the currently parsed join */
|
||||||
|
@@ -3436,7 +3436,7 @@ void mysql_stmt_get_longdata(THD *thd, char *packet, ulong packet_length)
|
|||||||
{
|
{
|
||||||
stmt->state= Query_arena::STMT_ERROR;
|
stmt->state= Query_arena::STMT_ERROR;
|
||||||
stmt->last_errno= thd->get_stmt_da()->sql_errno();
|
stmt->last_errno= thd->get_stmt_da()->sql_errno();
|
||||||
strncpy(stmt->last_error, thd->get_stmt_da()->message(), MYSQL_ERRMSG_SIZE);
|
strmake_buf(stmt->last_error, thd->get_stmt_da()->message());
|
||||||
}
|
}
|
||||||
thd->set_stmt_da(save_stmt_da);
|
thd->set_stmt_da(save_stmt_da);
|
||||||
|
|
||||||
|
@@ -3913,9 +3913,6 @@ bool mysql_show_binlog_events(THD* thd)
|
|||||||
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
|
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
|
||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
|
|
||||||
Format_description_log_event *description_event= new
|
|
||||||
Format_description_log_event(3); /* MySQL 4.0 by default */
|
|
||||||
|
|
||||||
DBUG_ASSERT(thd->lex->sql_command == SQLCOM_SHOW_BINLOG_EVENTS ||
|
DBUG_ASSERT(thd->lex->sql_command == SQLCOM_SHOW_BINLOG_EVENTS ||
|
||||||
thd->lex->sql_command == SQLCOM_SHOW_RELAYLOG_EVENTS);
|
thd->lex->sql_command == SQLCOM_SHOW_RELAYLOG_EVENTS);
|
||||||
|
|
||||||
@@ -3936,6 +3933,9 @@ bool mysql_show_binlog_events(THD* thd)
|
|||||||
binary_log= &(mi->rli.relay_log);
|
binary_log= &(mi->rli.relay_log);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Format_description_log_event *description_event= new
|
||||||
|
Format_description_log_event(3); /* MySQL 4.0 by default */
|
||||||
|
|
||||||
if (binary_log->is_open())
|
if (binary_log->is_open())
|
||||||
{
|
{
|
||||||
SELECT_LEX_UNIT *unit= &thd->lex->unit;
|
SELECT_LEX_UNIT *unit= &thd->lex->unit;
|
||||||
|
@@ -9720,12 +9720,20 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
|
|||||||
/*
|
/*
|
||||||
Step #2: Extract WHERE/ON parts
|
Step #2: Extract WHERE/ON parts
|
||||||
*/
|
*/
|
||||||
|
uint i;
|
||||||
|
for (i= join->top_join_tab_count - 1; i >= join->const_tables; i--)
|
||||||
|
{
|
||||||
|
if (!join->join_tab[i].bush_children)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
uint last_top_base_tab_idx= i;
|
||||||
|
|
||||||
table_map save_used_tables= 0;
|
table_map save_used_tables= 0;
|
||||||
used_tables=((select->const_tables=join->const_table_map) |
|
used_tables=((select->const_tables=join->const_table_map) |
|
||||||
OUTER_REF_TABLE_BIT | RAND_TABLE_BIT);
|
OUTER_REF_TABLE_BIT | RAND_TABLE_BIT);
|
||||||
JOIN_TAB *tab;
|
JOIN_TAB *tab;
|
||||||
table_map current_map;
|
table_map current_map;
|
||||||
uint i= join->const_tables;
|
i= join->const_tables;
|
||||||
for (tab= first_depth_first_tab(join); tab;
|
for (tab= first_depth_first_tab(join); tab;
|
||||||
tab= next_depth_first_tab(join, tab), i++)
|
tab= next_depth_first_tab(join, tab), i++)
|
||||||
{
|
{
|
||||||
@@ -9764,7 +9772,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
|
|||||||
Following force including random expression in last table condition.
|
Following force including random expression in last table condition.
|
||||||
It solve problem with select like SELECT * FROM t1 WHERE rand() > 0.5
|
It solve problem with select like SELECT * FROM t1 WHERE rand() > 0.5
|
||||||
*/
|
*/
|
||||||
if (tab == join->join_tab + join->top_join_tab_count - 1)
|
if (tab == join->join_tab + last_top_base_tab_idx)
|
||||||
current_map|= RAND_TABLE_BIT;
|
current_map|= RAND_TABLE_BIT;
|
||||||
used_tables|=current_map;
|
used_tables|=current_map;
|
||||||
|
|
||||||
|
@@ -1740,7 +1740,10 @@ Sys_var_gtid_binlog_state::do_check(THD *thd, set_var *var)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (res->length() == 0)
|
if (res->length() == 0)
|
||||||
|
{
|
||||||
list= NULL;
|
list= NULL;
|
||||||
|
list_len= 0;
|
||||||
|
}
|
||||||
else if (!(list= gtid_parse_string_to_list(res->ptr(), res->length(),
|
else if (!(list= gtid_parse_string_to_list(res->ptr(), res->length(),
|
||||||
&list_len)))
|
&list_len)))
|
||||||
{
|
{
|
||||||
|
@@ -18,10 +18,10 @@ SET(CONNECT_PLUGIN_DYNAMIC "connect")
|
|||||||
|
|
||||||
SET(CONNECT_SOURCES
|
SET(CONNECT_SOURCES
|
||||||
ha_connect.cc connect.cc user_connect.cc mycat.cc
|
ha_connect.cc connect.cc user_connect.cc mycat.cc
|
||||||
fmdlex.c osutil.c plugutil.c rcmsg.c rcmsg.h
|
fmdlex.c osutil.c rcmsg.c rcmsg.h
|
||||||
array.cpp blkfil.cpp colblk.cpp csort.cpp
|
array.cpp blkfil.cpp colblk.cpp csort.cpp
|
||||||
filamap.cpp filamdbf.cpp filamfix.cpp filamgz.cpp filamtxt.cpp
|
filamap.cpp filamdbf.cpp filamfix.cpp filamgz.cpp filamtxt.cpp filter.cpp
|
||||||
filter.cpp json.cpp jsonudf.cpp maputil.cpp myconn.cpp myutil.cpp plgdbutl.cpp
|
json.cpp jsonudf.cpp maputil.cpp myconn.cpp myutil.cpp plgdbutl.cpp plugutil.cpp
|
||||||
reldef.cpp tabcol.cpp tabdos.cpp tabext.cpp tabfix.cpp tabfmt.cpp tabjson.cpp
|
reldef.cpp tabcol.cpp tabdos.cpp tabext.cpp tabfix.cpp tabfmt.cpp tabjson.cpp
|
||||||
table.cpp tabmul.cpp tabmysql.cpp taboccur.cpp tabpivot.cpp tabsys.cpp tabtbl.cpp
|
table.cpp tabmul.cpp tabmysql.cpp taboccur.cpp tabpivot.cpp tabsys.cpp tabtbl.cpp
|
||||||
tabutil.cpp tabvir.cpp tabxcl.cpp valblk.cpp value.cpp xindex.cpp xobject.cpp
|
tabutil.cpp tabvir.cpp tabxcl.cpp valblk.cpp value.cpp xindex.cpp xobject.cpp
|
||||||
@@ -38,7 +38,7 @@ user_connect.h valblk.h value.h xindex.h xobject.h xtable.h)
|
|||||||
# Definitions that are shared for all OSes
|
# Definitions that are shared for all OSes
|
||||||
#
|
#
|
||||||
add_definitions( -DMARIADB -DFORCE_INIT_OF_VARS -Dconnect_EXPORTS)
|
add_definitions( -DMARIADB -DFORCE_INIT_OF_VARS -Dconnect_EXPORTS)
|
||||||
add_definitions( -DHUGE_SUPPORT -DGZ_SUPPORT -DPIVOT_SUPPORT )
|
add_definitions( -DHUGE_SUPPORT -DGZ_SUPPORT -DPIVOT_SUPPORT -DUSE_TRY )
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@@ -520,7 +520,7 @@ bool ARRAY::FilTest(PGLOBAL g, PVAL valp, OPVAL opc, int opm)
|
|||||||
|
|
||||||
} else if (opc != OP_EXIST) {
|
} else if (opc != OP_EXIST) {
|
||||||
sprintf(g->Message, MSG(MISSING_ARG), opc);
|
sprintf(g->Message, MSG(MISSING_ARG), opc);
|
||||||
longjmp(g->jumper[g->jump_level], TYPE_ARRAY);
|
throw TYPE_ARRAY;
|
||||||
} else // OP_EXIST
|
} else // OP_EXIST
|
||||||
return Nval > 0;
|
return Nval > 0;
|
||||||
|
|
||||||
@@ -683,14 +683,14 @@ void ARRAY::SetPrecision(PGLOBAL g, int p)
|
|||||||
{
|
{
|
||||||
if (Vblp == NULL) {
|
if (Vblp == NULL) {
|
||||||
strcpy(g->Message, MSG(PREC_VBLP_NULL));
|
strcpy(g->Message, MSG(PREC_VBLP_NULL));
|
||||||
longjmp(g->jumper[g->jump_level], TYPE_ARRAY);
|
throw TYPE_ARRAY;
|
||||||
} // endif Vblp
|
} // endif Vblp
|
||||||
|
|
||||||
bool was = Vblp->IsCi();
|
bool was = Vblp->IsCi();
|
||||||
|
|
||||||
if (was && !p) {
|
if (was && !p) {
|
||||||
strcpy(g->Message, MSG(BAD_SET_CASE));
|
strcpy(g->Message, MSG(BAD_SET_CASE));
|
||||||
longjmp(g->jumper[g->jump_level], TYPE_ARRAY);
|
throw TYPE_ARRAY;
|
||||||
} // endif Vblp
|
} // endif Vblp
|
||||||
|
|
||||||
if (was || !p)
|
if (was || !p)
|
||||||
@@ -701,7 +701,7 @@ void ARRAY::SetPrecision(PGLOBAL g, int p)
|
|||||||
if (!was && Type == TYPE_STRING)
|
if (!was && Type == TYPE_STRING)
|
||||||
// Must be resorted to eliminate duplicate strings
|
// Must be resorted to eliminate duplicate strings
|
||||||
if (Sort(g))
|
if (Sort(g))
|
||||||
longjmp(g->jumper[g->jump_level], TYPE_ARRAY);
|
throw TYPE_ARRAY;
|
||||||
|
|
||||||
} // end of SetPrecision
|
} // end of SetPrecision
|
||||||
|
|
||||||
@@ -979,14 +979,14 @@ PSZ ARRAY::MakeArrayList(PGLOBAL g)
|
|||||||
size_t z, len = 2;
|
size_t z, len = 2;
|
||||||
|
|
||||||
if (Type == TYPE_LIST)
|
if (Type == TYPE_LIST)
|
||||||
return "(?" "?" "?)"; // To be implemented
|
return (PSZ)("(?" "?" "?)"); // To be implemented
|
||||||
|
|
||||||
z = MY_MAX(24, GetTypeSize(Type, Len) + 4);
|
z = MY_MAX(24, GetTypeSize(Type, Len) + 4);
|
||||||
tp = (char*)PlugSubAlloc(g, NULL, z);
|
tp = (char*)PlugSubAlloc(g, NULL, z);
|
||||||
|
|
||||||
for (i = 0; i < Nval; i++) {
|
for (i = 0; i < Nval; i++) {
|
||||||
Value->SetValue_pvblk(Vblp, i);
|
Value->SetValue_pvblk(Vblp, i);
|
||||||
Value->Print(g, tp, z);
|
Value->Prints(g, tp, z);
|
||||||
len += strlen(tp);
|
len += strlen(tp);
|
||||||
} // enfor i
|
} // enfor i
|
||||||
|
|
||||||
@@ -998,7 +998,7 @@ PSZ ARRAY::MakeArrayList(PGLOBAL g)
|
|||||||
|
|
||||||
for (i = 0; i < Nval;) {
|
for (i = 0; i < Nval;) {
|
||||||
Value->SetValue_pvblk(Vblp, i);
|
Value->SetValue_pvblk(Vblp, i);
|
||||||
Value->Print(g, tp, z);
|
Value->Prints(g, tp, z);
|
||||||
strcat(p, tp);
|
strcat(p, tp);
|
||||||
strcat(p, (++i == Nval) ? ")" : ",");
|
strcat(p, (++i == Nval) ? ")" : ",");
|
||||||
} // enfor i
|
} // enfor i
|
||||||
@@ -1012,7 +1012,7 @@ PSZ ARRAY::MakeArrayList(PGLOBAL g)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Make file output of ARRAY contents. */
|
/* Make file output of ARRAY contents. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
void ARRAY::Print(PGLOBAL g, FILE *f, uint n)
|
void ARRAY::Printf(PGLOBAL g, FILE *f, uint n)
|
||||||
{
|
{
|
||||||
char m[64];
|
char m[64];
|
||||||
int lim = MY_MIN(Nval,10);
|
int lim = MY_MIN(Nval,10);
|
||||||
@@ -1029,7 +1029,7 @@ void ARRAY::Print(PGLOBAL g, FILE *f, uint n)
|
|||||||
if (Vblp)
|
if (Vblp)
|
||||||
for (int i = 0; i < lim; i++) {
|
for (int i = 0; i < lim; i++) {
|
||||||
Value->SetValue_pvblk(Vblp, i);
|
Value->SetValue_pvblk(Vblp, i);
|
||||||
Value->Print(g, f, n+4);
|
Value->Printf(g, f, n+4);
|
||||||
} // endfor i
|
} // endfor i
|
||||||
|
|
||||||
} else
|
} else
|
||||||
@@ -1040,7 +1040,7 @@ void ARRAY::Print(PGLOBAL g, FILE *f, uint n)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Make string output of ARRAY contents. */
|
/* Make string output of ARRAY contents. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
void ARRAY::Print(PGLOBAL, char *ps, uint z)
|
void ARRAY::Prints(PGLOBAL, char *ps, uint z)
|
||||||
{
|
{
|
||||||
if (z < 16)
|
if (z < 16)
|
||||||
return;
|
return;
|
||||||
|
@@ -56,8 +56,8 @@ class DllExport ARRAY : public XOBJECT, public CSORT { // Array descblock
|
|||||||
virtual bool Compare(PXOB) {assert(false); return false;}
|
virtual bool Compare(PXOB) {assert(false); return false;}
|
||||||
virtual bool SetFormat(PGLOBAL, FORMAT&) {assert(false); return false;}
|
virtual bool SetFormat(PGLOBAL, FORMAT&) {assert(false); return false;}
|
||||||
//virtual int CheckSpcCol(PTDB, int) {return 0;}
|
//virtual int CheckSpcCol(PTDB, int) {return 0;}
|
||||||
virtual void Print(PGLOBAL g, FILE *f, uint n);
|
virtual void Printf(PGLOBAL g, FILE *f, uint n);
|
||||||
virtual void Print(PGLOBAL g, char *ps, uint z);
|
virtual void Prints(PGLOBAL g, char *ps, uint z);
|
||||||
// void Empty(void);
|
// void Empty(void);
|
||||||
void SetPrecision(PGLOBAL g, int p);
|
void SetPrecision(PGLOBAL g, int p);
|
||||||
bool AddValue(PGLOBAL g, PSZ sp);
|
bool AddValue(PGLOBAL g, PSZ sp);
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
/************* BlkFil C++ Program Source Code File (.CPP) **************/
|
/************* BlkFil C++ Program Source Code File (.CPP) **************/
|
||||||
/* PROGRAM NAME: BLKFIL */
|
/* PROGRAM NAME: BLKFIL */
|
||||||
/* ------------- */
|
/* ------------- */
|
||||||
/* Version 2.5 */
|
/* Version 2.6 */
|
||||||
/* */
|
/* */
|
||||||
/* COPYRIGHT: */
|
/* COPYRIGHT: */
|
||||||
/* ---------- */
|
/* ---------- */
|
||||||
/* (C) Copyright to the author Olivier BERTRAND 2004-2015 */
|
/* (C) Copyright to the author Olivier BERTRAND 2004-2017 */
|
||||||
/* */
|
/* */
|
||||||
/* WHAT THIS PROGRAM DOES: */
|
/* WHAT THIS PROGRAM DOES: */
|
||||||
/* ----------------------- */
|
/* ----------------------- */
|
||||||
@@ -56,7 +56,7 @@ BLOCKFILTER::BLOCKFILTER(PTDBDOS tdbp, int op)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Make file output of BLOCKFILTER contents. */
|
/* Make file output of BLOCKFILTER contents. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
void BLOCKFILTER::Print(PGLOBAL, FILE *f, uint n)
|
void BLOCKFILTER::Printf(PGLOBAL, FILE *f, uint n)
|
||||||
{
|
{
|
||||||
char m[64];
|
char m[64];
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ void BLOCKFILTER::Print(PGLOBAL, FILE *f, uint n)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Make string output of BLOCKFILTER contents. */
|
/* Make string output of BLOCKFILTER contents. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
void BLOCKFILTER::Print(PGLOBAL, char *ps, uint z)
|
void BLOCKFILTER::Prints(PGLOBAL, char *ps, uint z)
|
||||||
{
|
{
|
||||||
strncat(ps, "BlockFilter(s)", z);
|
strncat(ps, "BlockFilter(s)", z);
|
||||||
} // end of Print
|
} // end of Print
|
||||||
@@ -595,7 +595,7 @@ BLKFILIN::BLKFILIN(PGLOBAL g, PTDBDOS tdbp, int op, int opm, PXOB *xp)
|
|||||||
|
|
||||||
if (Colp->GetResultType() != Type) {
|
if (Colp->GetResultType() != Type) {
|
||||||
sprintf(g->Message, "BLKFILIN: %s", MSG(VALTYPE_NOMATCH));
|
sprintf(g->Message, "BLKFILIN: %s", MSG(VALTYPE_NOMATCH));
|
||||||
longjmp(g->jumper[g->jump_level], 99);
|
throw g->Message;
|
||||||
} else if (Colp->GetValue()->IsCi())
|
} else if (Colp->GetValue()->IsCi())
|
||||||
Arap->SetPrecision(g, 1); // Case insensitive
|
Arap->SetPrecision(g, 1); // Case insensitive
|
||||||
|
|
||||||
@@ -995,7 +995,7 @@ int BLOCKINDEX::BlockEval(PGLOBAL g)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Make file output of BLOCKINDEX contents. */
|
/* Make file output of BLOCKINDEX contents. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
void BLOCKINDEX::Print(PGLOBAL g, FILE *f, UINT n)
|
void BLOCKINDEX::Printf(PGLOBAL g, FILE *f, UINT n)
|
||||||
{
|
{
|
||||||
char m[64];
|
char m[64];
|
||||||
|
|
||||||
@@ -1013,7 +1013,7 @@ void BLOCKINDEX::Print(PGLOBAL g, FILE *f, UINT n)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Make string output of BLOCKINDEX contents. */
|
/* Make string output of BLOCKINDEX contents. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
void BLOCKINDEX::Print(PGLOBAL g, char *ps, UINT z)
|
void BLOCKINDEX::Prints(PGLOBAL g, char *ps, UINT z)
|
||||||
{
|
{
|
||||||
strncat(ps, "BlockIndex(es)", z);
|
strncat(ps, "BlockIndex(es)", z);
|
||||||
} // end of Print
|
} // end of Print
|
||||||
|
@@ -27,8 +27,8 @@ class DllExport BLOCKFILTER : public BLOCK { /* Block Filter */
|
|||||||
// Methods
|
// Methods
|
||||||
virtual void Reset(PGLOBAL) = 0;
|
virtual void Reset(PGLOBAL) = 0;
|
||||||
virtual int BlockEval(PGLOBAL) = 0;
|
virtual int BlockEval(PGLOBAL) = 0;
|
||||||
virtual void Print(PGLOBAL g, FILE *f, uint n);
|
virtual void Printf(PGLOBAL g, FILE *f, uint n);
|
||||||
virtual void Print(PGLOBAL g, char *ps, uint z);
|
virtual void Prints(PGLOBAL g, char *ps, uint z);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
BLOCKFILTER(void) {} // Standard constructor not to be used
|
BLOCKFILTER(void) {} // Standard constructor not to be used
|
||||||
@@ -234,8 +234,8 @@ class DllExport BLOCKINDEX : public BLOCK { /* Indexing Test Block */
|
|||||||
// Methods
|
// Methods
|
||||||
void Reset(void);
|
void Reset(void);
|
||||||
virtual int BlockEval(PGLOBAL);
|
virtual int BlockEval(PGLOBAL);
|
||||||
virtual void Print(PGLOBAL g, FILE *f, UINT n);
|
virtual void Printf(PGLOBAL g, FILE *f, UINT n);
|
||||||
virtual void Print(PGLOBAL g, char *ps, UINT z);
|
virtual void Prints(PGLOBAL g, char *ps, UINT z);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
BLOCKINDEX(void) {} // Standard constructor not to be used
|
BLOCKINDEX(void) {} // Standard constructor not to be used
|
||||||
|
@@ -44,8 +44,8 @@ class DllExport BLOCK {
|
|||||||
return (PlugSubAlloc(g, p, size));
|
return (PlugSubAlloc(g, p, size));
|
||||||
} // end of new
|
} // end of new
|
||||||
|
|
||||||
virtual void Print(PGLOBAL, FILE *, uint) {} // Produce file desc
|
virtual void Printf(PGLOBAL, FILE *, uint) {} // Produce file desc
|
||||||
virtual void Print(PGLOBAL, char *, uint) {} // Produce string desc
|
virtual void Prints(PGLOBAL, char *, uint) {} // Produce string desc
|
||||||
|
|
||||||
#if !defined(__BORLANDC__)
|
#if !defined(__BORLANDC__)
|
||||||
// Avoid warning C4291 by defining a matching dummy delete operator
|
// Avoid warning C4291 by defining a matching dummy delete operator
|
||||||
|
@@ -36,7 +36,7 @@ typedef struct _curtab {
|
|||||||
/* Defines the structure used to get column catalog info. */
|
/* Defines the structure used to get column catalog info. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
typedef struct _colinfo {
|
typedef struct _colinfo {
|
||||||
char *Name;
|
PCSZ Name;
|
||||||
int Type;
|
int Type;
|
||||||
int Offset;
|
int Offset;
|
||||||
int Length;
|
int Length;
|
||||||
@@ -45,9 +45,9 @@ typedef struct _colinfo {
|
|||||||
int Scale;
|
int Scale;
|
||||||
int Opt;
|
int Opt;
|
||||||
int Freq;
|
int Freq;
|
||||||
char *Remark;
|
PCSZ Remark;
|
||||||
char *Datefmt;
|
PCSZ Datefmt;
|
||||||
char *Fieldfmt;
|
PCSZ Fieldfmt;
|
||||||
ushort Flags; // Used by MariaDB CONNECT handlers
|
ushort Flags; // Used by MariaDB CONNECT handlers
|
||||||
} COLINFO, *PCOLINFO;
|
} COLINFO, *PCOLINFO;
|
||||||
|
|
||||||
@@ -68,11 +68,9 @@ class DllExport CATALOG {
|
|||||||
bool GetDefHuge(void) {return DefHuge;}
|
bool GetDefHuge(void) {return DefHuge;}
|
||||||
void SetDefHuge(bool b) {DefHuge = b;}
|
void SetDefHuge(bool b) {DefHuge = b;}
|
||||||
char *GetCbuf(void) {return Cbuf;}
|
char *GetCbuf(void) {return Cbuf;}
|
||||||
//char *GetDataPath(void) {return (char*)DataPath;}
|
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
virtual void Reset(void) {}
|
virtual void Reset(void) {}
|
||||||
//virtual void SetDataPath(PGLOBAL g, const char *path) {}
|
|
||||||
virtual bool CheckName(PGLOBAL, char*) {return true;}
|
virtual bool CheckName(PGLOBAL, char*) {return true;}
|
||||||
virtual bool ClearName(PGLOBAL, PSZ) {return true;}
|
virtual bool ClearName(PGLOBAL, PSZ) {return true;}
|
||||||
virtual PRELDEF MakeOneTableDesc(PGLOBAL, LPCSTR, LPCSTR) {return NULL;}
|
virtual PRELDEF MakeOneTableDesc(PGLOBAL, LPCSTR, LPCSTR) {return NULL;}
|
||||||
@@ -102,7 +100,6 @@ class DllExport CATALOG {
|
|||||||
int Cblen; /* Length of suballoc. buffer */
|
int Cblen; /* Length of suballoc. buffer */
|
||||||
CURTAB Ctb; /* Used to enumerate tables */
|
CURTAB Ctb; /* Used to enumerate tables */
|
||||||
bool DefHuge; /* true: tables default to huge */
|
bool DefHuge; /* true: tables default to huge */
|
||||||
//LPCSTR DataPath; /* Is the Path of DB data dir */
|
|
||||||
}; // end of class CATALOG
|
}; // end of class CATALOG
|
||||||
|
|
||||||
#endif // __CATALOG__H
|
#endif // __CATALOG__H
|
||||||
|
@@ -195,10 +195,10 @@ int COLBLK::GetLengthEx(void)
|
|||||||
/* corresponding to this column and convert it to buffer type. */
|
/* corresponding to this column and convert it to buffer type. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
void COLBLK::ReadColumn(PGLOBAL g)
|
void COLBLK::ReadColumn(PGLOBAL g)
|
||||||
{
|
{
|
||||||
sprintf(g->Message, MSG(UNDEFINED_AM), "ReadColumn");
|
sprintf(g->Message, MSG(UNDEFINED_AM), "ReadColumn");
|
||||||
longjmp(g->jumper[g->jump_level], TYPE_COLBLK);
|
throw TYPE_COLBLK;
|
||||||
} // end of ReadColumn
|
} // end of ReadColumn
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* WriteColumn: what this routine does is to access the last line */
|
/* WriteColumn: what this routine does is to access the last line */
|
||||||
@@ -206,15 +206,15 @@ void COLBLK::ReadColumn(PGLOBAL g)
|
|||||||
/* corresponding to this column from the column buffer and type. */
|
/* corresponding to this column from the column buffer and type. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
void COLBLK::WriteColumn(PGLOBAL g)
|
void COLBLK::WriteColumn(PGLOBAL g)
|
||||||
{
|
{
|
||||||
sprintf(g->Message, MSG(UNDEFINED_AM), "WriteColumn");
|
sprintf(g->Message, MSG(UNDEFINED_AM), "WriteColumn");
|
||||||
longjmp(g->jumper[g->jump_level], TYPE_COLBLK);
|
throw TYPE_COLBLK;
|
||||||
} // end of WriteColumn
|
} // end of WriteColumn
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Make file output of a column descriptor block. */
|
/* Make file output of a column descriptor block. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
void COLBLK::Print(PGLOBAL, FILE *f, uint n)
|
void COLBLK::Printf(PGLOBAL, FILE *f, uint n)
|
||||||
{
|
{
|
||||||
char m[64];
|
char m[64];
|
||||||
int i;
|
int i;
|
||||||
@@ -237,7 +237,7 @@ void COLBLK::Print(PGLOBAL, FILE *f, uint n)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Make string output of a column descriptor block. */
|
/* Make string output of a column descriptor block. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
void COLBLK::Print(PGLOBAL, char *ps, uint)
|
void COLBLK::Prints(PGLOBAL, char *ps, uint)
|
||||||
{
|
{
|
||||||
sprintf(ps, "R%d.%s", To_Tdb->GetTdb_No(), Name);
|
sprintf(ps, "R%d.%s", To_Tdb->GetTdb_No(), Name);
|
||||||
} // end of Print
|
} // end of Print
|
||||||
@@ -260,10 +260,10 @@ SPCBLK::SPCBLK(PCOLUMN cp)
|
|||||||
/* corresponding to this column from the column buffer and type. */
|
/* corresponding to this column from the column buffer and type. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
void SPCBLK::WriteColumn(PGLOBAL g)
|
void SPCBLK::WriteColumn(PGLOBAL g)
|
||||||
{
|
{
|
||||||
sprintf(g->Message, MSG(SPCOL_READONLY), Name);
|
sprintf(g->Message, MSG(SPCOL_READONLY), Name);
|
||||||
longjmp(g->jumper[g->jump_level], TYPE_COLBLK);
|
throw TYPE_COLBLK;
|
||||||
} // end of WriteColumn
|
} // end of WriteColumn
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* RIDBLK constructor for the ROWID special column. */
|
/* RIDBLK constructor for the ROWID special column. */
|
||||||
@@ -377,7 +377,7 @@ PRTBLK::PRTBLK(PCOLUMN cp) : SPCBLK(cp)
|
|||||||
void PRTBLK::ReadColumn(PGLOBAL g)
|
void PRTBLK::ReadColumn(PGLOBAL g)
|
||||||
{
|
{
|
||||||
if (Pname == NULL) {
|
if (Pname == NULL) {
|
||||||
char *p;
|
const char *p;
|
||||||
|
|
||||||
Pname = To_Tdb->GetDef()->GetStringCatInfo(g, "partname", "?");
|
Pname = To_Tdb->GetDef()->GetStringCatInfo(g, "partname", "?");
|
||||||
p = strrchr(Pname, '#');
|
p = strrchr(Pname, '#');
|
||||||
@@ -407,7 +407,7 @@ SIDBLK::SIDBLK(PCOLUMN cp) : SPCBLK(cp)
|
|||||||
void SIDBLK::ReadColumn(PGLOBAL)
|
void SIDBLK::ReadColumn(PGLOBAL)
|
||||||
{
|
{
|
||||||
//if (Sname == NULL) {
|
//if (Sname == NULL) {
|
||||||
Sname = (char*)To_Tdb->GetServer();
|
Sname = To_Tdb->GetServer();
|
||||||
Value->SetValue_psz(Sname);
|
Value->SetValue_psz(Sname);
|
||||||
// } // endif Sname
|
// } // endif Sname
|
||||||
|
|
||||||
|
@@ -72,8 +72,8 @@ class DllExport COLBLK : public XOBJECT {
|
|||||||
virtual void SetTo_Val(PVAL) {}
|
virtual void SetTo_Val(PVAL) {}
|
||||||
virtual void ReadColumn(PGLOBAL g);
|
virtual void ReadColumn(PGLOBAL g);
|
||||||
virtual void WriteColumn(PGLOBAL g);
|
virtual void WriteColumn(PGLOBAL g);
|
||||||
virtual void Print(PGLOBAL g, FILE *, uint);
|
virtual void Printf(PGLOBAL g, FILE *, uint);
|
||||||
virtual void Print(PGLOBAL g, char *, uint);
|
virtual void Prints(PGLOBAL g, char *, uint);
|
||||||
virtual bool VarSize(void) {return false;}
|
virtual bool VarSize(void) {return false;}
|
||||||
bool InitValue(PGLOBAL g);
|
bool InitValue(PGLOBAL g);
|
||||||
|
|
||||||
@@ -154,7 +154,7 @@ class DllExport FIDBLK : public SPCBLK {
|
|||||||
virtual void ReadColumn(PGLOBAL g);
|
virtual void ReadColumn(PGLOBAL g);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
PSZ Fn; // The current To_File of the table
|
PCSZ Fn; // The current To_File of the table
|
||||||
OPVAL Op; // The file part operator
|
OPVAL Op; // The file part operator
|
||||||
}; // end of class FIDBLK
|
}; // end of class FIDBLK
|
||||||
|
|
||||||
@@ -178,7 +178,7 @@ class DllExport TIDBLK : public SPCBLK {
|
|||||||
TIDBLK(void) {}
|
TIDBLK(void) {}
|
||||||
|
|
||||||
// Members
|
// Members
|
||||||
PSZ Tname; // The current table name
|
PCSZ Tname; // The current table name
|
||||||
}; // end of class TIDBLK
|
}; // end of class TIDBLK
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@@ -201,7 +201,7 @@ class DllExport PRTBLK : public SPCBLK {
|
|||||||
PRTBLK(void) {}
|
PRTBLK(void) {}
|
||||||
|
|
||||||
// Members
|
// Members
|
||||||
PSZ Pname; // The current partition name
|
PCSZ Pname; // The current partition name
|
||||||
}; // end of class PRTBLK
|
}; // end of class PRTBLK
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@@ -224,7 +224,7 @@ class DllExport SIDBLK : public SPCBLK {
|
|||||||
SIDBLK(void) {}
|
SIDBLK(void) {}
|
||||||
|
|
||||||
// Members
|
// Members
|
||||||
PSZ Sname; // The current server name
|
PCSZ Sname; // The current server name
|
||||||
}; // end of class SIDBLK
|
}; // end of class SIDBLK
|
||||||
|
|
||||||
#endif // __COLBLK__H
|
#endif // __COLBLK__H
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) Olivier Bertrand 2004 - 2015
|
/* Copyright (C) Olivier Bertrand 2004 - 2017
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Author Olivier BERTRAND bertrandop@gmail.com 2004-2015 */
|
/* Author Olivier BERTRAND bertrandop@gmail.com 2004-2017 */
|
||||||
/* */
|
/* */
|
||||||
/* WHAT THIS PROGRAM DOES: */
|
/* WHAT THIS PROGRAM DOES: */
|
||||||
/* ----------------------- */
|
/* ----------------------- */
|
||||||
@@ -117,11 +117,10 @@ bool CntCheckDB(PGLOBAL g, PHC handler, const char *pathname)
|
|||||||
handler);
|
handler);
|
||||||
|
|
||||||
// Set the database path for this table
|
// Set the database path for this table
|
||||||
handler->SetDataPath(g, pathname);
|
if (handler->SetDataPath(g, pathname))
|
||||||
|
return true;
|
||||||
|
|
||||||
if (dbuserp->Catalog) {
|
if (dbuserp->Catalog) {
|
||||||
// ((MYCAT *)dbuserp->Catalog)->SetHandler(handler); done later
|
|
||||||
// ((MYCAT *)dbuserp->Catalog)->SetDataPath(g, pathname);
|
|
||||||
return false; // Nothing else to do
|
return false; // Nothing else to do
|
||||||
} // endif Catalog
|
} // endif Catalog
|
||||||
|
|
||||||
@@ -138,9 +137,6 @@ bool CntCheckDB(PGLOBAL g, PHC handler, const char *pathname)
|
|||||||
if (!(dbuserp->Catalog= new MYCAT(handler)))
|
if (!(dbuserp->Catalog= new MYCAT(handler)))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
//((MYCAT *)dbuserp->Catalog)->SetDataPath(g, pathname);
|
|
||||||
//dbuserp->UseTemp= TMP_AUTO;
|
|
||||||
|
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
/* All is correct. */
|
/* All is correct. */
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
@@ -172,7 +168,7 @@ bool CntInfo(PGLOBAL g, PTDB tp, PXF info)
|
|||||||
|
|
||||||
// info->mean_rec_length= tdbp->GetLrecl();
|
// info->mean_rec_length= tdbp->GetLrecl();
|
||||||
info->mean_rec_length= 0;
|
info->mean_rec_length= 0;
|
||||||
info->data_file_name= (b) ? NULL : tdbp->GetFile(g);
|
info->data_file_name= (b) ? NULL : (char*)tdbp->GetFile(g);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
info->data_file_length= 0;
|
info->data_file_length= 0;
|
||||||
@@ -188,12 +184,11 @@ bool CntInfo(PGLOBAL g, PTDB tp, PXF info)
|
|||||||
/* GetTDB: Get the table description block of a CONNECT table. */
|
/* GetTDB: Get the table description block of a CONNECT table. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
PTDB CntGetTDB(PGLOBAL g, LPCSTR name, MODE mode, PHC h)
|
PTDB CntGetTDB(PGLOBAL g, LPCSTR name, MODE mode, PHC h)
|
||||||
{
|
{
|
||||||
int rc;
|
|
||||||
PTDB tdbp;
|
PTDB tdbp;
|
||||||
PTABLE tabp;
|
PTABLE tabp;
|
||||||
PDBUSER dup= PlgGetUser(g);
|
PDBUSER dup = PlgGetUser(g);
|
||||||
volatile PCATLG cat= (dup) ? dup->Catalog : NULL; // Safe over longjmp
|
volatile PCATLG cat = (dup) ? dup->Catalog : NULL; // Safe over longjmp
|
||||||
|
|
||||||
if (trace)
|
if (trace)
|
||||||
printf("CntGetTDB: name=%s mode=%d cat=%p\n", name, mode, cat);
|
printf("CntGetTDB: name=%s mode=%d cat=%p\n", name, mode, cat);
|
||||||
@@ -201,19 +196,9 @@ PTDB CntGetTDB(PGLOBAL g, LPCSTR name, MODE mode, PHC h)
|
|||||||
if (!cat)
|
if (!cat)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
// Save stack and allocation environment and prepare error return
|
try {
|
||||||
if (g->jump_level == MAX_JUMP) {
|
|
||||||
strcpy(g->Message, MSG(TOO_MANY_JUMPS));
|
|
||||||
return NULL;
|
|
||||||
} // endif jump_level
|
|
||||||
|
|
||||||
if ((rc= setjmp(g->jumper[++g->jump_level])) != 0) {
|
|
||||||
tdbp= NULL;
|
|
||||||
goto err;
|
|
||||||
} // endif rc
|
|
||||||
|
|
||||||
// Get table object from the catalog
|
// Get table object from the catalog
|
||||||
tabp= new(g) XTAB(name);
|
tabp = new(g) XTAB(name);
|
||||||
|
|
||||||
if (trace)
|
if (trace)
|
||||||
printf("CntGetTDB: tabp=%p\n", tabp);
|
printf("CntGetTDB: tabp=%p\n", tabp);
|
||||||
@@ -221,16 +206,21 @@ PTDB CntGetTDB(PGLOBAL g, LPCSTR name, MODE mode, PHC h)
|
|||||||
// Perhaps this should be made thread safe
|
// Perhaps this should be made thread safe
|
||||||
((MYCAT*)cat)->SetHandler(h);
|
((MYCAT*)cat)->SetHandler(h);
|
||||||
|
|
||||||
if (!(tdbp= cat->GetTable(g, tabp, mode)))
|
if (!(tdbp = cat->GetTable(g, tabp, mode)))
|
||||||
printf("CntGetTDB: %s\n", g->Message);
|
printf("CntGetTDB: %s\n", g->Message);
|
||||||
|
|
||||||
err:
|
} catch (int n) {
|
||||||
|
if (trace)
|
||||||
|
htrc("Exception %d: %s\n", n, g->Message);
|
||||||
|
} catch (const char *msg) {
|
||||||
|
strcpy(g->Message, msg);
|
||||||
|
} // end catch
|
||||||
|
|
||||||
if (trace)
|
if (trace)
|
||||||
printf("Returning tdbp=%p mode=%d\n", tdbp, mode);
|
printf("Returning tdbp=%p mode=%d\n", tdbp, mode);
|
||||||
|
|
||||||
g->jump_level--;
|
|
||||||
return tdbp;
|
return tdbp;
|
||||||
} // end of CntGetTDB
|
} // end of CntGetTDB
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* OPENTAB: Open a Table. */
|
/* OPENTAB: Open a Table. */
|
||||||
@@ -239,7 +229,7 @@ bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE mode, char *c1, char *c2,
|
|||||||
bool del, PHC)
|
bool del, PHC)
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
int i, n, rc;
|
int i, n;
|
||||||
bool rcop= true;
|
bool rcop= true;
|
||||||
PCOL colp;
|
PCOL colp;
|
||||||
//PCOLUMN cp;
|
//PCOLUMN cp;
|
||||||
@@ -254,79 +244,70 @@ bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE mode, char *c1, char *c2,
|
|||||||
return true;
|
return true;
|
||||||
} // endif tdbp
|
} // endif tdbp
|
||||||
|
|
||||||
// Save stack and allocation environment and prepare error return
|
try {
|
||||||
if (g->jump_level == MAX_JUMP) {
|
|
||||||
strcpy(g->Message, MSG(TOO_MANY_JUMPS));
|
|
||||||
return true;
|
|
||||||
} // endif jump_level
|
|
||||||
|
|
||||||
if ((rc= setjmp(g->jumper[++g->jump_level])) != 0) {
|
|
||||||
goto err;
|
|
||||||
} // endif rc
|
|
||||||
|
|
||||||
if (!c1) {
|
if (!c1) {
|
||||||
if (mode == MODE_INSERT)
|
if (mode == MODE_INSERT)
|
||||||
// Allocate all column blocks for that table
|
// Allocate all column blocks for that table
|
||||||
tdbp->ColDB(g, NULL, 0);
|
tdbp->ColDB(g, NULL, 0);
|
||||||
|
|
||||||
} else for (p= c1; *p; p+= n) {
|
} else for (p = c1; *p; p += n) {
|
||||||
// Allocate only used column blocks
|
// Allocate only used column blocks
|
||||||
if (trace)
|
if (trace)
|
||||||
printf("Allocating column %s\n", p);
|
printf("Allocating column %s\n", p);
|
||||||
|
|
||||||
g->Message[0] = 0; // To check whether ColDB made an error message
|
g->Message[0] = 0; // To check whether ColDB made an error message
|
||||||
colp= tdbp->ColDB(g, p, 0);
|
colp = tdbp->ColDB(g, p, 0);
|
||||||
|
|
||||||
if (!colp && !(mode == MODE_INSERT && tdbp->IsSpecial(p))) {
|
if (!colp && !(mode == MODE_INSERT && tdbp->IsSpecial(p))) {
|
||||||
if (g->Message[0] == 0)
|
if (g->Message[0] == 0)
|
||||||
sprintf(g->Message, MSG(COL_ISNOT_TABLE), p, tdbp->GetName());
|
sprintf(g->Message, MSG(COL_ISNOT_TABLE), p, tdbp->GetName());
|
||||||
|
|
||||||
goto err;
|
throw 1;
|
||||||
} // endif colp
|
} // endif colp
|
||||||
|
|
||||||
n= strlen(p) + 1;
|
n = strlen(p) + 1;
|
||||||
} // endfor p
|
} // endfor p
|
||||||
|
|
||||||
for (i= 0, colp= tdbp->GetColumns(); colp; i++, colp= colp->GetNext()) {
|
for (i = 0, colp = tdbp->GetColumns(); colp; i++, colp = colp->GetNext()) {
|
||||||
if (colp->InitValue(g))
|
if (colp->InitValue(g))
|
||||||
goto err;
|
throw 2;
|
||||||
|
|
||||||
if (mode == MODE_INSERT)
|
if (mode == MODE_INSERT)
|
||||||
// Allow type conversion
|
// Allow type conversion
|
||||||
if (colp->SetBuffer(g, colp->GetValue(), true, false))
|
if (colp->SetBuffer(g, colp->GetValue(), true, false))
|
||||||
goto err;
|
throw 3;
|
||||||
|
|
||||||
colp->AddColUse(U_P); // For PLG tables
|
colp->AddColUse(U_P); // For PLG tables
|
||||||
} // endfor colp
|
} // endfor colp
|
||||||
|
|
||||||
/*********************************************************************/
|
/*******************************************************************/
|
||||||
/* In Update mode, the updated column blocks must be distinct from */
|
/* In Update mode, the updated column blocks must be distinct from */
|
||||||
/* the read column blocks. So make a copy of the TDB and allocate */
|
/* the read column blocks. So make a copy of the TDB and allocate */
|
||||||
/* its column blocks in mode write (required by XML tables). */
|
/* its column blocks in mode write (required by XML tables). */
|
||||||
/*********************************************************************/
|
/*******************************************************************/
|
||||||
if (mode == MODE_UPDATE) {
|
if (mode == MODE_UPDATE) {
|
||||||
PTDBASE utp;
|
PTDBASE utp;
|
||||||
|
|
||||||
if (!(utp= (PTDBASE)tdbp->Duplicate(g))) {
|
if (!(utp = (PTDBASE)tdbp->Duplicate(g))) {
|
||||||
sprintf(g->Message, MSG(INV_UPDT_TABLE), tdbp->GetName());
|
sprintf(g->Message, MSG(INV_UPDT_TABLE), tdbp->GetName());
|
||||||
goto err;
|
throw 4;
|
||||||
} // endif tp
|
} // endif tp
|
||||||
|
|
||||||
if (!c2)
|
if (!c2)
|
||||||
// Allocate all column blocks for that table
|
// Allocate all column blocks for that table
|
||||||
utp->ColDB(g, NULL, 0);
|
utp->ColDB(g, NULL, 0);
|
||||||
else for (p= c2; *p; p+= n) {
|
else for (p = c2; *p; p += n) {
|
||||||
// Allocate only used column blocks
|
// Allocate only used column blocks
|
||||||
colp= utp->ColDB(g, p, 0);
|
colp = utp->ColDB(g, p, 0);
|
||||||
n= strlen(p) + 1;
|
n = strlen(p) + 1;
|
||||||
} // endfor p
|
} // endfor p
|
||||||
|
|
||||||
for (i= 0, colp= utp->GetColumns(); colp; i++, colp= colp->GetNext()) {
|
for (i = 0, colp = utp->GetColumns(); colp; i++, colp = colp->GetNext()) {
|
||||||
if (colp->InitValue(g))
|
if (colp->InitValue(g))
|
||||||
goto err;
|
throw 5;
|
||||||
|
|
||||||
if (colp->SetBuffer(g, colp->GetValue(), true, false))
|
if (colp->SetBuffer(g, colp->GetValue(), true, false))
|
||||||
goto err;
|
throw 6;
|
||||||
|
|
||||||
} // endfor colp
|
} // endfor colp
|
||||||
|
|
||||||
@@ -340,7 +321,7 @@ bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE mode, char *c1, char *c2,
|
|||||||
printf("Opening table %s in mode %d tdbp=%p\n",
|
printf("Opening table %s in mode %d tdbp=%p\n",
|
||||||
tdbp->GetName(), mode, tdbp);
|
tdbp->GetName(), mode, tdbp);
|
||||||
|
|
||||||
//tdbp->SetMode(mode);
|
//tdbp->SetMode(mode);
|
||||||
|
|
||||||
if (del/* && (tdbp->GetFtype() != RECFM_NAF*/) {
|
if (del/* && (tdbp->GetFtype() != RECFM_NAF*/) {
|
||||||
// To avoid erasing the table when doing a partial delete
|
// To avoid erasing the table when doing a partial delete
|
||||||
@@ -358,16 +339,21 @@ bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE mode, char *c1, char *c2,
|
|||||||
if (mode != MODE_ANY && mode != MODE_ALTER) {
|
if (mode != MODE_ANY && mode != MODE_ALTER) {
|
||||||
if (tdbp->OpenDB(g)) {
|
if (tdbp->OpenDB(g)) {
|
||||||
printf("%s\n", g->Message);
|
printf("%s\n", g->Message);
|
||||||
goto err;
|
throw 7;
|
||||||
} else
|
} else
|
||||||
tdbp->SetNext(NULL);
|
tdbp->SetNext(NULL);
|
||||||
|
|
||||||
} // endif mode
|
} // endif mode
|
||||||
|
|
||||||
rcop= false;
|
rcop = false;
|
||||||
|
|
||||||
|
} catch (int n) {
|
||||||
|
if (trace)
|
||||||
|
htrc("Exception %d: %s\n", n, g->Message);
|
||||||
|
} catch (const char *msg) {
|
||||||
|
strcpy(g->Message, msg);
|
||||||
|
} // end catch
|
||||||
|
|
||||||
err:
|
|
||||||
g->jump_level--;
|
|
||||||
return rcop;
|
return rcop;
|
||||||
} // end of CntOpenTable
|
} // end of CntOpenTable
|
||||||
|
|
||||||
@@ -387,50 +373,40 @@ bool CntRewindTable(PGLOBAL g, PTDB tdbp)
|
|||||||
/* Evaluate all columns after a record is read. */
|
/* Evaluate all columns after a record is read. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
RCODE EvalColumns(PGLOBAL g, PTDB tdbp, bool reset, bool mrr)
|
RCODE EvalColumns(PGLOBAL g, PTDB tdbp, bool reset, bool mrr)
|
||||||
{
|
{
|
||||||
RCODE rc= RC_OK;
|
RCODE rc= RC_OK;
|
||||||
PCOL colp;
|
PCOL colp;
|
||||||
|
|
||||||
// Save stack and allocation environment and prepare error return
|
try {
|
||||||
if (g->jump_level == MAX_JUMP) {
|
for (colp = tdbp->GetColumns(); rc == RC_OK && colp;
|
||||||
if (trace) {
|
colp = colp->GetNext()) {
|
||||||
strcpy(g->Message, MSG(TOO_MANY_JUMPS));
|
|
||||||
printf("EvalColumns: %s\n", g->Message);
|
|
||||||
} // endif
|
|
||||||
|
|
||||||
return RC_FX;
|
|
||||||
} // endif jump_level
|
|
||||||
|
|
||||||
if (setjmp(g->jumper[++g->jump_level]) != 0) {
|
|
||||||
if (trace)
|
|
||||||
printf("Error reading columns: %s\n", g->Message);
|
|
||||||
|
|
||||||
rc= RC_FX;
|
|
||||||
goto err;
|
|
||||||
} // endif rc
|
|
||||||
|
|
||||||
for (colp= tdbp->GetColumns(); rc == RC_OK && colp;
|
|
||||||
colp= colp->GetNext()) {
|
|
||||||
if (reset)
|
if (reset)
|
||||||
colp->Reset();
|
colp->Reset();
|
||||||
|
|
||||||
// Virtual columns are computed by MariaDB
|
// Virtual columns are computed by MariaDB
|
||||||
if (!colp->GetColUse(U_VIRTUAL) && (!mrr || colp->GetKcol()))
|
if (!colp->GetColUse(U_VIRTUAL) && (!mrr || colp->GetKcol()))
|
||||||
if (colp->Eval(g))
|
if (colp->Eval(g))
|
||||||
rc= RC_FX;
|
rc = RC_FX;
|
||||||
|
|
||||||
} // endfor colp
|
} // endfor colp
|
||||||
|
|
||||||
err:
|
} catch (int n) {
|
||||||
g->jump_level--;
|
if (trace)
|
||||||
|
printf("Error %d reading columns: %s\n", n, g->Message);
|
||||||
|
|
||||||
|
rc = RC_FX;
|
||||||
|
} catch (const char *msg) {
|
||||||
|
strcpy(g->Message, msg);
|
||||||
|
} // end catch
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
} // end of EvalColumns
|
} // end of EvalColumns
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* ReadNext: Read next record sequentially. */
|
/* ReadNext: Read next record sequentially. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
RCODE CntReadNext(PGLOBAL g, PTDB tdbp)
|
RCODE CntReadNext(PGLOBAL g, PTDB tdbp)
|
||||||
{
|
{
|
||||||
RCODE rc;
|
RCODE rc;
|
||||||
|
|
||||||
if (!tdbp)
|
if (!tdbp)
|
||||||
@@ -445,76 +421,66 @@ RCODE CntReadNext(PGLOBAL g, PTDB tdbp)
|
|||||||
((PTDBASE)tdbp)->ResetKindex(g, NULL);
|
((PTDBASE)tdbp)->ResetKindex(g, NULL);
|
||||||
} // endif index
|
} // endif index
|
||||||
|
|
||||||
// Save stack and allocation environment and prepare error return
|
try {
|
||||||
if (g->jump_level == MAX_JUMP) {
|
|
||||||
strcpy(g->Message, MSG(TOO_MANY_JUMPS));
|
|
||||||
return RC_FX;
|
|
||||||
} // endif jump_level
|
|
||||||
|
|
||||||
if ((setjmp(g->jumper[++g->jump_level])) != 0) {
|
|
||||||
rc= RC_FX;
|
|
||||||
goto err;
|
|
||||||
} // endif rc
|
|
||||||
|
|
||||||
// Do it now to avoid double eval when filtering
|
// Do it now to avoid double eval when filtering
|
||||||
for (PCOL colp= tdbp->GetColumns(); colp; colp= colp->GetNext())
|
for (PCOL colp = tdbp->GetColumns(); colp; colp = colp->GetNext())
|
||||||
colp->Reset();
|
colp->Reset();
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if ((rc= (RCODE)tdbp->ReadDB(g)) == RC_OK)
|
if ((rc = (RCODE)tdbp->ReadDB(g)) == RC_OK)
|
||||||
if (!ApplyFilter(g, tdbp->GetFilter()))
|
if (!ApplyFilter(g, tdbp->GetFilter()))
|
||||||
rc= RC_NF;
|
rc = RC_NF;
|
||||||
|
|
||||||
} while (rc == RC_NF);
|
} while (rc == RC_NF);
|
||||||
|
|
||||||
if (rc == RC_OK)
|
if (rc == RC_OK)
|
||||||
rc= EvalColumns(g, tdbp, false);
|
rc = EvalColumns(g, tdbp, false);
|
||||||
|
|
||||||
|
} catch (int) {
|
||||||
|
rc = RC_FX;
|
||||||
|
} catch (const char *msg) {
|
||||||
|
strcpy(g->Message, msg);
|
||||||
|
rc = RC_FX;
|
||||||
|
} // end catch
|
||||||
|
|
||||||
err:
|
|
||||||
g->jump_level--;
|
|
||||||
return rc;
|
return rc;
|
||||||
} // end of CntReadNext
|
} // end of CntReadNext
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* WriteRow: Insert a new row into a table. */
|
/* WriteRow: Insert a new row into a table. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
RCODE CntWriteRow(PGLOBAL g, PTDB tdbp)
|
RCODE CntWriteRow(PGLOBAL g, PTDB tdbp)
|
||||||
{
|
{
|
||||||
RCODE rc;
|
RCODE rc;
|
||||||
PCOL colp;
|
PCOL colp;
|
||||||
//PTDBASE tp= (PTDBASE)tdbp;
|
//PTDBASE tp= (PTDBASE)tdbp;
|
||||||
|
|
||||||
if (!tdbp)
|
if (!tdbp)
|
||||||
return RC_FX;
|
return RC_FX;
|
||||||
|
|
||||||
// Save stack and allocation environment and prepare error return
|
try {
|
||||||
if (g->jump_level == MAX_JUMP) {
|
|
||||||
strcpy(g->Message, MSG(TOO_MANY_JUMPS));
|
|
||||||
return RC_FX;
|
|
||||||
} // endif jump_level
|
|
||||||
|
|
||||||
if (setjmp(g->jumper[++g->jump_level]) != 0) {
|
|
||||||
printf("%s\n", g->Message);
|
|
||||||
rc= RC_FX;
|
|
||||||
goto err;
|
|
||||||
} // endif rc
|
|
||||||
|
|
||||||
// Store column values in table write buffer(s)
|
// Store column values in table write buffer(s)
|
||||||
for (colp= tdbp->GetSetCols(); colp; colp= colp->GetNext())
|
for (colp = tdbp->GetSetCols(); colp; colp = colp->GetNext())
|
||||||
if (!colp->GetColUse(U_VIRTUAL))
|
if (!colp->GetColUse(U_VIRTUAL))
|
||||||
colp->WriteColumn(g);
|
colp->WriteColumn(g);
|
||||||
|
|
||||||
if (tdbp->IsIndexed())
|
if (tdbp->IsIndexed())
|
||||||
// Index values must be sorted before updating
|
// Index values must be sorted before updating
|
||||||
rc= (RCODE)((PTDBDOS)tdbp)->GetTxfp()->StoreValues(g, true);
|
rc = (RCODE)((PTDBDOS)tdbp)->GetTxfp()->StoreValues(g, true);
|
||||||
else
|
else
|
||||||
// Return result code from write operation
|
// Return result code from write operation
|
||||||
rc= (RCODE)tdbp->WriteDB(g);
|
rc = (RCODE)tdbp->WriteDB(g);
|
||||||
|
|
||||||
|
} catch (int n) {
|
||||||
|
printf("Exception %d: %s\n", n, g->Message);
|
||||||
|
rc = RC_FX;
|
||||||
|
} catch (const char *msg) {
|
||||||
|
strcpy(g->Message, msg);
|
||||||
|
rc = RC_FX;
|
||||||
|
} // end catch
|
||||||
|
|
||||||
err:
|
|
||||||
g->jump_level--;
|
|
||||||
return rc;
|
return rc;
|
||||||
} // end of CntWriteRow
|
} // end of CntWriteRow
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* UpdateRow: Update a row into a table. */
|
/* UpdateRow: Update a row into a table. */
|
||||||
@@ -562,9 +528,9 @@ RCODE CntDeleteRow(PGLOBAL g, PTDB tdbp, bool all)
|
|||||||
/* CLOSETAB: Close a table. */
|
/* CLOSETAB: Close a table. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
int CntCloseTable(PGLOBAL g, PTDB tdbp, bool nox, bool abort)
|
int CntCloseTable(PGLOBAL g, PTDB tdbp, bool nox, bool abort)
|
||||||
{
|
{
|
||||||
int rc= RC_OK;
|
int rc = RC_OK;
|
||||||
//TDBASE *tbxp= (PTDBASE)tdbp;
|
//TDBASE *tbxp= (PTDBASE)tdbp;
|
||||||
|
|
||||||
if (!tdbp)
|
if (!tdbp)
|
||||||
return rc; // Nothing to do
|
return rc; // Nothing to do
|
||||||
@@ -581,52 +547,34 @@ int CntCloseTable(PGLOBAL g, PTDB tdbp, bool nox, bool abort)
|
|||||||
|
|
||||||
if (tdbp->GetMode() == MODE_DELETE && tdbp->GetUse() == USE_OPEN) {
|
if (tdbp->GetMode() == MODE_DELETE && tdbp->GetUse() == USE_OPEN) {
|
||||||
if (tdbp->IsIndexed())
|
if (tdbp->IsIndexed())
|
||||||
rc= ((PTDBDOS)tdbp)->GetTxfp()->DeleteSortedRows(g);
|
rc = ((PTDBDOS)tdbp)->GetTxfp()->DeleteSortedRows(g);
|
||||||
|
|
||||||
if (!rc)
|
if (!rc)
|
||||||
rc= tdbp->DeleteDB(g, RC_EF); // Specific A.M. delete routine
|
rc = tdbp->DeleteDB(g, RC_EF); // Specific A.M. delete routine
|
||||||
|
|
||||||
} else if (tdbp->GetMode() == MODE_UPDATE && tdbp->IsIndexed())
|
} else if (tdbp->GetMode() == MODE_UPDATE && tdbp->IsIndexed())
|
||||||
rc= ((PTDBDOX)tdbp)->Txfp->UpdateSortedRows(g);
|
rc = ((PTDBDOX)tdbp)->Txfp->UpdateSortedRows(g);
|
||||||
|
|
||||||
switch(rc) {
|
switch (rc) {
|
||||||
case RC_FX:
|
case RC_FX:
|
||||||
abort= true;
|
abort = true;
|
||||||
break;
|
break;
|
||||||
case RC_INFO:
|
case RC_INFO:
|
||||||
PushWarning(g, tdbp);
|
PushWarning(g, tdbp);
|
||||||
break;
|
break;
|
||||||
} // endswitch rc
|
} // endswitch rc
|
||||||
|
|
||||||
// Prepare error return
|
try {
|
||||||
if (g->jump_level == MAX_JUMP) {
|
|
||||||
strcpy(g->Message, MSG(TOO_MANY_JUMPS));
|
|
||||||
rc= RC_FX;
|
|
||||||
goto err;
|
|
||||||
} // endif
|
|
||||||
|
|
||||||
if ((rc = setjmp(g->jumper[++g->jump_level])) != 0) {
|
|
||||||
rc= RC_FX;
|
|
||||||
g->jump_level--;
|
|
||||||
goto err;
|
|
||||||
} // endif
|
|
||||||
|
|
||||||
// This will close the table file(s) and also finalize write
|
// This will close the table file(s) and also finalize write
|
||||||
// operations such as Insert, Update, or Delete.
|
// operations such as Insert, Update, or Delete.
|
||||||
tdbp->SetAbort(abort);
|
tdbp->SetAbort(abort);
|
||||||
tdbp->CloseDB(g);
|
tdbp->CloseDB(g);
|
||||||
tdbp->SetAbort(false);
|
tdbp->SetAbort(false);
|
||||||
g->jump_level--;
|
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace > 1)
|
||||||
printf("Table %s closed\n", tdbp->GetName());
|
printf("Table %s closed\n", tdbp->GetName());
|
||||||
|
|
||||||
//if (!((PTDBDOX)tdbp)->GetModified())
|
if (!nox && tdbp->GetMode() != MODE_READ && tdbp->GetMode() != MODE_ANY) {
|
||||||
// return 0;
|
|
||||||
|
|
||||||
if (nox || tdbp->GetMode() == MODE_READ || tdbp->GetMode() == MODE_ANY)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace > 1)
|
||||||
printf("About to reset opt\n");
|
printf("About to reset opt\n");
|
||||||
|
|
||||||
@@ -638,12 +586,20 @@ int CntCloseTable(PGLOBAL g, PTDB tdbp, bool nox, bool abort)
|
|||||||
rc = tbxp->ResetTableOpt(g, true, tbxp->GetDef()->Indexable() == 1);
|
rc = tbxp->ResetTableOpt(g, true, tbxp->GetDef()->Indexable() == 1);
|
||||||
} // endif remote
|
} // endif remote
|
||||||
|
|
||||||
err:
|
} // endif nox
|
||||||
|
|
||||||
|
} catch (int) {
|
||||||
|
rc = RC_FX;
|
||||||
|
} catch (const char *msg) {
|
||||||
|
strcpy(g->Message, msg);
|
||||||
|
rc = RC_FX;
|
||||||
|
} // end catch
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace > 1)
|
||||||
printf("Done rc=%d\n", rc);
|
htrc("Done rc=%d\n", rc);
|
||||||
|
|
||||||
return (rc == RC_OK || rc == RC_INFO) ? 0 : rc;
|
return (rc == RC_OK || rc == RC_INFO) ? 0 : rc;
|
||||||
} // end of CntCloseTable
|
} // end of CntCloseTable
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Load and initialize the use of an index. */
|
/* Load and initialize the use of an index. */
|
||||||
@@ -752,8 +708,9 @@ RCODE CntIndexRead(PGLOBAL g, PTDB ptdb, OPVAL op,
|
|||||||
sprintf(g->Message, MSG(TABLE_NO_INDEX), ptdb->GetName());
|
sprintf(g->Message, MSG(TABLE_NO_INDEX), ptdb->GetName());
|
||||||
return RC_FX;
|
return RC_FX;
|
||||||
} else if (x == 2) {
|
} else if (x == 2) {
|
||||||
// Remote index
|
// Remote index. Only used in read mode
|
||||||
if (op != OP_SAME && ptdb->ReadKey(g, op, kr))
|
if ((ptdb->GetMode() == MODE_READ || ptdb->GetMode() == MODE_READX)
|
||||||
|
&& op != OP_SAME && ptdb->ReadKey(g, op, kr))
|
||||||
return RC_FX;
|
return RC_FX;
|
||||||
|
|
||||||
goto rnd;
|
goto rnd;
|
||||||
|
@@ -49,8 +49,8 @@ class DllExport CSORT {
|
|||||||
public:
|
public:
|
||||||
// Methods
|
// Methods
|
||||||
int Qsort(PGLOBAL g, int n); /* Sort calling routine */
|
int Qsort(PGLOBAL g, int n); /* Sort calling routine */
|
||||||
//virtual void Print(PGLOBAL g, FILE *f, uint n);
|
//virtual void Printf(PGLOBAL g, FILE *f, uint n);
|
||||||
//virtual void Print(PGLOBAL g, char *ps, uint z);
|
//virtual void Prints(PGLOBAL g, char *ps, uint z);
|
||||||
#ifdef DEBTRACE
|
#ifdef DEBTRACE
|
||||||
int GetNcmp(void) {return num_comp;}
|
int GetNcmp(void) {return num_comp;}
|
||||||
#endif
|
#endif
|
||||||
|
@@ -63,7 +63,9 @@ void CloseXMLFile(PGLOBAL g, PFBLOCK fp, bool all)
|
|||||||
xp->Docp->Release();
|
xp->Docp->Release();
|
||||||
|
|
||||||
} catch(_com_error e) {
|
} catch(_com_error e) {
|
||||||
sprintf(g->Message, "%s %s", MSG(COM_ERROR), e.Description());
|
char *p = _com_util::ConvertBSTRToString(e.Description());
|
||||||
|
sprintf(g->Message, "%s %s", MSG(COM_ERROR), p);
|
||||||
|
delete[] p;
|
||||||
} catch(...) {}
|
} catch(...) {}
|
||||||
|
|
||||||
CoUninitialize();
|
CoUninitialize();
|
||||||
@@ -89,7 +91,7 @@ DOMDOC::DOMDOC(char *nsl, char *nsdf, char *enc, PFBLOCK fp)
|
|||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
/* Initialize XML parser and check library compatibility. */
|
/* Initialize XML parser and check library compatibility. */
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
bool DOMDOC::Initialize(PGLOBAL g, char *entry, bool zipped)
|
bool DOMDOC::Initialize(PGLOBAL g, PCSZ entry, bool zipped)
|
||||||
{
|
{
|
||||||
if (zipped && InitZip(g, entry))
|
if (zipped && InitZip(g, entry))
|
||||||
return true;
|
return true;
|
||||||
@@ -155,7 +157,7 @@ PFBLOCK DOMDOC::LinkXblock(PGLOBAL g, MODE m, int rc, char *fn)
|
|||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
/* Create the XML node. */
|
/* Create the XML node. */
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
bool DOMDOC::NewDoc(PGLOBAL g, char *ver)
|
bool DOMDOC::NewDoc(PGLOBAL g, PCSZ ver)
|
||||||
{
|
{
|
||||||
char buf[64];
|
char buf[64];
|
||||||
MSXML2::IXMLDOMProcessingInstructionPtr pip;
|
MSXML2::IXMLDOMProcessingInstructionPtr pip;
|
||||||
@@ -490,9 +492,9 @@ PXATTR DOMNODE::GetAttribute(PGLOBAL g, char *name, PXATTR ap)
|
|||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
/* Add a new element child node to this node and return it. */
|
/* Add a new element child node to this node and return it. */
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
PXNODE DOMNODE::AddChildNode(PGLOBAL g, char *name, PXNODE np)
|
PXNODE DOMNODE::AddChildNode(PGLOBAL g, PCSZ name, PXNODE np)
|
||||||
{
|
{
|
||||||
char *p, *pn;
|
const char *p, *pn;
|
||||||
// char *p, *pn, *epf, *pf = NULL;
|
// char *p, *pn, *epf, *pf = NULL;
|
||||||
MSXML2::IXMLDOMNodePtr ep;
|
MSXML2::IXMLDOMNodePtr ep;
|
||||||
// _bstr_t uri((wchar_t*)NULL);
|
// _bstr_t uri((wchar_t*)NULL);
|
||||||
@@ -585,7 +587,7 @@ PXATTR DOMNODE::AddProperty(PGLOBAL g, char *name, PXATTR ap)
|
|||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
/* Add a new text node to this node. */
|
/* Add a new text node to this node. */
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
void DOMNODE::AddText(PGLOBAL g, char *txtp)
|
void DOMNODE::AddText(PGLOBAL g, PCSZ txtp)
|
||||||
{
|
{
|
||||||
MSXML2::IXMLDOMTextPtr tp= Docp->createTextNode((_bstr_t)txtp);
|
MSXML2::IXMLDOMTextPtr tp= Docp->createTextNode((_bstr_t)txtp);
|
||||||
|
|
||||||
|
@@ -37,9 +37,9 @@ class DOMDOC : public XMLDOCUMENT {
|
|||||||
virtual void SetNofree(bool b) {} // Only libxml2
|
virtual void SetNofree(bool b) {} // Only libxml2
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
virtual bool Initialize(PGLOBAL g, char *entry, bool zipped);
|
virtual bool Initialize(PGLOBAL g, PCSZ entry, bool zipped);
|
||||||
virtual bool ParseFile(PGLOBAL g, char *fn);
|
virtual bool ParseFile(PGLOBAL g, char *fn);
|
||||||
virtual bool NewDoc(PGLOBAL g, char *ver);
|
virtual bool NewDoc(PGLOBAL g, PCSZ ver);
|
||||||
virtual void AddComment(PGLOBAL g, char *com);
|
virtual void AddComment(PGLOBAL g, char *com);
|
||||||
virtual PXNODE GetRoot(PGLOBAL g);
|
virtual PXNODE GetRoot(PGLOBAL g);
|
||||||
virtual PXNODE NewRoot(PGLOBAL g, char *name);
|
virtual PXNODE NewRoot(PGLOBAL g, char *name);
|
||||||
@@ -78,9 +78,9 @@ class DOMNODE : public XMLNODE {
|
|||||||
virtual PXLIST SelectNodes(PGLOBAL g, char *xp, PXLIST lp);
|
virtual PXLIST SelectNodes(PGLOBAL g, char *xp, PXLIST lp);
|
||||||
virtual PXNODE SelectSingleNode(PGLOBAL g, char *xp, PXNODE np);
|
virtual PXNODE SelectSingleNode(PGLOBAL g, char *xp, PXNODE np);
|
||||||
virtual PXATTR GetAttribute(PGLOBAL g, char *name, PXATTR ap);
|
virtual PXATTR GetAttribute(PGLOBAL g, char *name, PXATTR ap);
|
||||||
virtual PXNODE AddChildNode(PGLOBAL g, char *name, PXNODE np);
|
virtual PXNODE AddChildNode(PGLOBAL g, PCSZ name, PXNODE np);
|
||||||
virtual PXATTR AddProperty(PGLOBAL g, char *name, PXATTR ap);
|
virtual PXATTR AddProperty(PGLOBAL g, char *name, PXATTR ap);
|
||||||
virtual void AddText(PGLOBAL g, char *txtp);
|
virtual void AddText(PGLOBAL g, PCSZ txtp);
|
||||||
virtual void DeleteChild(PGLOBAL g, PXNODE dnp);
|
virtual void DeleteChild(PGLOBAL g, PXNODE dnp);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@@ -301,9 +301,8 @@ int MAPFAM::SkipRecord(PGLOBAL g, bool header)
|
|||||||
PDBUSER dup = (PDBUSER)g->Activityp->Aptr;
|
PDBUSER dup = (PDBUSER)g->Activityp->Aptr;
|
||||||
|
|
||||||
// Skip this record
|
// Skip this record
|
||||||
while (*Mempos++ != '\n') ; // What about Unix ???
|
while (*Mempos++ != '\n') // What about Unix ???
|
||||||
|
if (Mempos == Top)
|
||||||
if (Mempos >= Top)
|
|
||||||
return RC_EF;
|
return RC_EF;
|
||||||
|
|
||||||
// Update progress information
|
// Update progress information
|
||||||
@@ -320,7 +319,7 @@ int MAPFAM::SkipRecord(PGLOBAL g, bool header)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
int MAPFAM::ReadBuffer(PGLOBAL g)
|
int MAPFAM::ReadBuffer(PGLOBAL g)
|
||||||
{
|
{
|
||||||
int rc, len;
|
int rc, len, n = 1;
|
||||||
|
|
||||||
// Are we at the end of the memory
|
// Are we at the end of the memory
|
||||||
if (Mempos >= Top) {
|
if (Mempos >= Top) {
|
||||||
@@ -362,10 +361,14 @@ int MAPFAM::ReadBuffer(PGLOBAL g)
|
|||||||
Placed = false;
|
Placed = false;
|
||||||
|
|
||||||
// Immediately calculate next position (Used by DeleteDB)
|
// Immediately calculate next position (Used by DeleteDB)
|
||||||
while (*Mempos++ != '\n') ; // What about Unix ???
|
while (*Mempos++ != '\n') // What about Unix ???
|
||||||
|
if (Mempos == Top) {
|
||||||
|
n = 0;
|
||||||
|
break;
|
||||||
|
} // endif Mempos
|
||||||
|
|
||||||
// Set caller line buffer
|
// Set caller line buffer
|
||||||
len = (Mempos - Fpos) - 1;
|
len = (Mempos - Fpos) - n;
|
||||||
|
|
||||||
// Don't rely on ENDING setting
|
// Don't rely on ENDING setting
|
||||||
if (len > 0 && *(Mempos - 2) == '\r')
|
if (len > 0 && *(Mempos - 2) == '\r')
|
||||||
@@ -619,7 +622,9 @@ int MBKFAM::ReadBuffer(PGLOBAL g)
|
|||||||
} // endif's
|
} // endif's
|
||||||
|
|
||||||
// Immediately calculate next position (Used by DeleteDB)
|
// Immediately calculate next position (Used by DeleteDB)
|
||||||
while (*Mempos++ != '\n') ; // What about Unix ???
|
while (*Mempos++ != '\n') // What about Unix ???
|
||||||
|
if (Mempos == Top)
|
||||||
|
break;
|
||||||
|
|
||||||
// Set caller line buffer
|
// Set caller line buffer
|
||||||
len = (Mempos - Fpos) - Ending;
|
len = (Mempos - Fpos) - Ending;
|
||||||
|
@@ -128,7 +128,7 @@ typedef struct _descriptor {
|
|||||||
/* Moves file pointer to byte 32; fills buffer at buf with */
|
/* Moves file pointer to byte 32; fills buffer at buf with */
|
||||||
/* first 32 bytes of file. */
|
/* first 32 bytes of file. */
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
static int dbfhead(PGLOBAL g, FILE *file, PSZ fn, DBFHEADER *buf)
|
static int dbfhead(PGLOBAL g, FILE *file, PCSZ fn, DBFHEADER *buf)
|
||||||
{
|
{
|
||||||
char endmark[2];
|
char endmark[2];
|
||||||
int dbc = 2, rc = RC_OK;
|
int dbc = 2, rc = RC_OK;
|
||||||
@@ -186,7 +186,7 @@ static int dbfhead(PGLOBAL g, FILE *file, PSZ fn, DBFHEADER *buf)
|
|||||||
/* DBFColumns: constructs the result blocks containing the description */
|
/* DBFColumns: constructs the result blocks containing the description */
|
||||||
/* of all the columns of a DBF file that will be retrieved by #GetData. */
|
/* of all the columns of a DBF file that will be retrieved by #GetData. */
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
PQRYRES DBFColumns(PGLOBAL g, char *dp, const char *fn, bool info)
|
PQRYRES DBFColumns(PGLOBAL g, PCSZ dp, PCSZ fn, bool info)
|
||||||
{
|
{
|
||||||
int buftyp[] = {TYPE_STRING, TYPE_SHORT, TYPE_STRING,
|
int buftyp[] = {TYPE_STRING, TYPE_SHORT, TYPE_STRING,
|
||||||
TYPE_INT, TYPE_INT, TYPE_SHORT};
|
TYPE_INT, TYPE_INT, TYPE_SHORT};
|
||||||
@@ -393,7 +393,7 @@ DBFBASE::DBFBASE(DBFBASE *txfp)
|
|||||||
/* and header length. Set Records, check that Reclen is equal to lrecl and */
|
/* and header length. Set Records, check that Reclen is equal to lrecl and */
|
||||||
/* return the header length or 0 in case of error. */
|
/* return the header length or 0 in case of error. */
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
int DBFBASE::ScanHeader(PGLOBAL g, PSZ fn, int lrecl, int *rln, char *defpath)
|
int DBFBASE::ScanHeader(PGLOBAL g, PCSZ fn, int lrecl, int *rln, PCSZ defpath)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
char filename[_MAX_PATH];
|
char filename[_MAX_PATH];
|
||||||
|
@@ -19,7 +19,7 @@ typedef class DBMFAM *PDBMFAM;
|
|||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/* Functions used externally. */
|
/* Functions used externally. */
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
PQRYRES DBFColumns(PGLOBAL g, char *dp, const char *fn, bool info);
|
PQRYRES DBFColumns(PGLOBAL g, PCSZ dp, PCSZ fn, bool info);
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/* This is the base class for dBASE file access methods. */
|
/* This is the base class for dBASE file access methods. */
|
||||||
@@ -31,7 +31,7 @@ class DllExport DBFBASE {
|
|||||||
DBFBASE(PDBF txfp);
|
DBFBASE(PDBF txfp);
|
||||||
|
|
||||||
// Implementation
|
// Implementation
|
||||||
int ScanHeader(PGLOBAL g, PSZ fname, int lrecl, int *rlen, char *defpath);
|
int ScanHeader(PGLOBAL g, PCSZ fname, int lrecl, int *rlen, PCSZ defpath);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Default constructor, not to be used
|
// Default constructor, not to be used
|
||||||
|
@@ -761,7 +761,8 @@ bool BGXFAM::BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req)
|
|||||||
htrc("after write req=%d brc=%d nbw=%d\n", req, brc, nbw);
|
htrc("after write req=%d brc=%d nbw=%d\n", req, brc, nbw);
|
||||||
|
|
||||||
if (!brc || nbw != len) {
|
if (!brc || nbw != len) {
|
||||||
char buf[256], *fn = (h == Hfile) ? To_File : "Tempfile";
|
char buf[256];
|
||||||
|
PCSZ fn = (h == Hfile) ? To_File : "Tempfile";
|
||||||
|
|
||||||
if (brc)
|
if (brc)
|
||||||
strcpy(buf, MSG(BAD_BYTE_NUM));
|
strcpy(buf, MSG(BAD_BYTE_NUM));
|
||||||
|
@@ -920,7 +920,7 @@ int ZLBFAM::GetFileLength(PGLOBAL g)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
bool ZLBFAM::AllocateBuffer(PGLOBAL g)
|
bool ZLBFAM::AllocateBuffer(PGLOBAL g)
|
||||||
{
|
{
|
||||||
char *msg;
|
PCSZ msg;
|
||||||
int n, zrc;
|
int n, zrc;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
/*********** File AM Txt C++ Program Source Code File (.CPP) ***********/
|
/*********** File AM Txt C++ Program Source Code File (.CPP) ***********/
|
||||||
/* PROGRAM NAME: FILAMTXT */
|
/* PROGRAM NAME: FILAMTXT */
|
||||||
/* ------------- */
|
/* ------------- */
|
||||||
/* Version 1.6 */
|
/* Version 1.7 */
|
||||||
/* */
|
/* */
|
||||||
/* COPYRIGHT: */
|
/* COPYRIGHT: */
|
||||||
/* ---------- */
|
/* ---------- */
|
||||||
/* (C) Copyright to the author Olivier BERTRAND 2005-2015 */
|
/* (C) Copyright to the author Olivier BERTRAND 2005-2017 */
|
||||||
/* */
|
/* */
|
||||||
/* WHAT THIS PROGRAM DOES: */
|
/* WHAT THIS PROGRAM DOES: */
|
||||||
/* ----------------------- */
|
/* ----------------------- */
|
||||||
@@ -71,8 +71,23 @@ TXTFAM::TXTFAM(PDOSDEF tdp)
|
|||||||
{
|
{
|
||||||
Tdbp = NULL;
|
Tdbp = NULL;
|
||||||
To_Fb = NULL;
|
To_Fb = NULL;
|
||||||
|
|
||||||
|
if (tdp) {
|
||||||
To_File = tdp->Fn;
|
To_File = tdp->Fn;
|
||||||
Lrecl = tdp->Lrecl;
|
Lrecl = tdp->Lrecl;
|
||||||
|
Eof = tdp->Eof;
|
||||||
|
Ending = tdp->Ending;
|
||||||
|
} else {
|
||||||
|
To_File = NULL;
|
||||||
|
Lrecl = 0;
|
||||||
|
Eof = false;
|
||||||
|
#if defined(__WIN__)
|
||||||
|
Ending = 2;
|
||||||
|
#else
|
||||||
|
Ending = 1;
|
||||||
|
#endif
|
||||||
|
} // endif tdp
|
||||||
|
|
||||||
Placed = false;
|
Placed = false;
|
||||||
IsRead = true;
|
IsRead = true;
|
||||||
Blocked = false;
|
Blocked = false;
|
||||||
@@ -103,8 +118,6 @@ TXTFAM::TXTFAM(PDOSDEF tdp)
|
|||||||
Blksize = 0;
|
Blksize = 0;
|
||||||
Fpos = Spos = Tpos = 0;
|
Fpos = Spos = Tpos = 0;
|
||||||
Padded = false;
|
Padded = false;
|
||||||
Eof = tdp->Eof;
|
|
||||||
Ending = tdp->Ending;
|
|
||||||
Abort = false;
|
Abort = false;
|
||||||
CrLf = (char*)(Ending == 1 ? "\n" : "\r\n");
|
CrLf = (char*)(Ending == 1 ? "\n" : "\r\n");
|
||||||
} // end of TXTFAM standard constructor
|
} // end of TXTFAM standard constructor
|
||||||
@@ -1162,12 +1175,12 @@ int DOSFAM::RenameTempFile(PGLOBAL g)
|
|||||||
if (rename(filename, filetemp)) { // Save file for security
|
if (rename(filename, filetemp)) { // Save file for security
|
||||||
sprintf(g->Message, MSG(RENAME_ERROR),
|
sprintf(g->Message, MSG(RENAME_ERROR),
|
||||||
filename, filetemp, strerror(errno));
|
filename, filetemp, strerror(errno));
|
||||||
longjmp(g->jumper[g->jump_level], 51);
|
throw 51;
|
||||||
} else if (rename(tempname, filename)) {
|
} else if (rename(tempname, filename)) {
|
||||||
sprintf(g->Message, MSG(RENAME_ERROR),
|
sprintf(g->Message, MSG(RENAME_ERROR),
|
||||||
tempname, filename, strerror(errno));
|
tempname, filename, strerror(errno));
|
||||||
rc = rename(filetemp, filename); // Restore saved file
|
rc = rename(filetemp, filename); // Restore saved file
|
||||||
longjmp(g->jumper[g->jump_level], 52);
|
throw 52;
|
||||||
} else if (remove(filetemp)) {
|
} else if (remove(filetemp)) {
|
||||||
sprintf(g->Message, MSG(REMOVE_ERROR),
|
sprintf(g->Message, MSG(REMOVE_ERROR),
|
||||||
filetemp, strerror(errno));
|
filetemp, strerror(errno));
|
||||||
|
@@ -80,7 +80,7 @@ class DllExport TXTFAM : public BLOCK {
|
|||||||
protected:
|
protected:
|
||||||
// Members
|
// Members
|
||||||
PTDBDOS Tdbp; // To table class
|
PTDBDOS Tdbp; // To table class
|
||||||
PSZ To_File; // Points to table file name
|
PCSZ To_File; // Points to table file name
|
||||||
PFBLOCK To_Fb; // Pointer to file block
|
PFBLOCK To_Fb; // Pointer to file block
|
||||||
PPARM To_Pos; // Pointer to position list
|
PPARM To_Pos; // Pointer to position list
|
||||||
PPARM To_Sos; // Pointer to start position list
|
PPARM To_Sos; // Pointer to start position list
|
||||||
|
@@ -144,7 +144,7 @@ int VCTFAM::GetFileLength(PGLOBAL g)
|
|||||||
if (Split) {
|
if (Split) {
|
||||||
// Get the total file length
|
// Get the total file length
|
||||||
char filename[_MAX_PATH];
|
char filename[_MAX_PATH];
|
||||||
char *savfile = To_File;
|
PCSZ savfile = To_File;
|
||||||
int i, len = 0;
|
int i, len = 0;
|
||||||
|
|
||||||
// Initialize the array of file structures
|
// Initialize the array of file structures
|
||||||
@@ -313,7 +313,7 @@ int VCTFAM::Cardinality(PGLOBAL g)
|
|||||||
// and Last must be set from the file cardinality.
|
// and Last must be set from the file cardinality.
|
||||||
// Only happens when called by sub classes.
|
// Only happens when called by sub classes.
|
||||||
char filename[_MAX_PATH];
|
char filename[_MAX_PATH];
|
||||||
PSZ savfn = To_File;
|
PCSZ savfn = To_File;
|
||||||
int len, clen, card = -1;
|
int len, clen, card = -1;
|
||||||
PCOLDEF cdp = Tdbp->GetDef()->GetCols();
|
PCOLDEF cdp = Tdbp->GetDef()->GetCols();
|
||||||
|
|
||||||
@@ -368,7 +368,7 @@ int VCTFAM::GetRowID(void)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* VCT Create an empty file for Vector formatted tables. */
|
/* VCT Create an empty file for Vector formatted tables. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
bool VCTFAM::MakeEmptyFile(PGLOBAL g, char *fn)
|
bool VCTFAM::MakeEmptyFile(PGLOBAL g, PCSZ fn)
|
||||||
{
|
{
|
||||||
// Vector formatted file: this will create an empty file of the
|
// Vector formatted file: this will create an empty file of the
|
||||||
// required length if it does not exists yet.
|
// required length if it does not exists yet.
|
||||||
@@ -560,41 +560,42 @@ bool VCTFAM::AllocateBuffer(PGLOBAL g)
|
|||||||
/* Do initial action when inserting. */
|
/* Do initial action when inserting. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
bool VCTFAM::InitInsert(PGLOBAL g)
|
bool VCTFAM::InitInsert(PGLOBAL g)
|
||||||
{
|
{
|
||||||
|
bool rc = false;
|
||||||
|
|
||||||
// We come here in MODE_INSERT only
|
// We come here in MODE_INSERT only
|
||||||
if (Last == Nrec) {
|
if (Last == Nrec) {
|
||||||
CurBlk = Block;
|
CurBlk = Block;
|
||||||
CurNum = 0;
|
CurNum = 0;
|
||||||
AddBlock = !MaxBlk;
|
AddBlock = !MaxBlk;
|
||||||
} else {
|
} else {
|
||||||
int rc;
|
|
||||||
PVCTCOL cp = (PVCTCOL)Tdbp->GetColumns();
|
PVCTCOL cp = (PVCTCOL)Tdbp->GetColumns();
|
||||||
|
|
||||||
// The starting point must be at the end of file as for append.
|
// The starting point must be at the end of file as for append.
|
||||||
CurBlk = Block - 1;
|
CurBlk = Block - 1;
|
||||||
CurNum = Last;
|
CurNum = Last;
|
||||||
|
|
||||||
// Prepare error return
|
try {
|
||||||
if (g->jump_level == MAX_JUMP) {
|
|
||||||
strcpy(g->Message, MSG(TOO_MANY_JUMPS));
|
|
||||||
return true;
|
|
||||||
} // endif
|
|
||||||
|
|
||||||
if ((rc = setjmp(g->jumper[++g->jump_level])) != 0) {
|
|
||||||
g->jump_level--;
|
|
||||||
return true;
|
|
||||||
} // endif
|
|
||||||
|
|
||||||
// Last block must be updated by new values
|
// Last block must be updated by new values
|
||||||
for (; cp; cp = (PVCTCOL)cp->Next)
|
for (; cp; cp = (PVCTCOL)cp->Next)
|
||||||
cp->ReadBlock(g);
|
cp->ReadBlock(g);
|
||||||
|
|
||||||
g->jump_level--;
|
} catch (int n) {
|
||||||
|
if (trace)
|
||||||
|
htrc("Exception %d: %s\n", n, g->Message);
|
||||||
|
rc = true;
|
||||||
|
} catch (const char *msg) {
|
||||||
|
strcpy(g->Message, msg);
|
||||||
|
rc = true;
|
||||||
|
} // end catch
|
||||||
|
|
||||||
} // endif Last
|
} // endif Last
|
||||||
|
|
||||||
|
if (!rc)
|
||||||
// We are not currently using a temporary file for Insert
|
// We are not currently using a temporary file for Insert
|
||||||
T_Stream = Stream;
|
T_Stream = Stream;
|
||||||
return false;
|
|
||||||
|
return rc;
|
||||||
} // end of InitInsert
|
} // end of InitInsert
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@@ -879,7 +880,8 @@ int VCTFAM::DeleteRecords(PGLOBAL g, int irc)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
bool VCTFAM::OpenTempFile(PGLOBAL g)
|
bool VCTFAM::OpenTempFile(PGLOBAL g)
|
||||||
{
|
{
|
||||||
char *opmode, tempname[_MAX_PATH];
|
PCSZ opmode;
|
||||||
|
char tempname[_MAX_PATH];
|
||||||
bool rc = false;
|
bool rc = false;
|
||||||
|
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
@@ -1108,7 +1110,7 @@ void VCTFAM::CloseTableFile(PGLOBAL g, bool abort)
|
|||||||
} else if (AddBlock) {
|
} else if (AddBlock) {
|
||||||
// Last block was not written
|
// Last block was not written
|
||||||
rc = ResetTableSize(g, CurBlk, Nrec);
|
rc = ResetTableSize(g, CurBlk, Nrec);
|
||||||
longjmp(g->jumper[g->jump_level], 44);
|
throw 44;
|
||||||
} // endif
|
} // endif
|
||||||
|
|
||||||
} else if (mode == MODE_UPDATE) {
|
} else if (mode == MODE_UPDATE) {
|
||||||
@@ -1528,8 +1530,8 @@ bool VCMFAM::AllocateBuffer(PGLOBAL g)
|
|||||||
/* Do initial action when inserting. */
|
/* Do initial action when inserting. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
bool VCMFAM::InitInsert(PGLOBAL g)
|
bool VCMFAM::InitInsert(PGLOBAL g)
|
||||||
{
|
{
|
||||||
int rc;
|
bool rc = false;
|
||||||
volatile PVCTCOL cp = (PVCTCOL)Tdbp->GetColumns();
|
volatile PVCTCOL cp = (PVCTCOL)Tdbp->GetColumns();
|
||||||
|
|
||||||
// We come here in MODE_INSERT only
|
// We come here in MODE_INSERT only
|
||||||
@@ -1543,24 +1545,22 @@ bool VCMFAM::InitInsert(PGLOBAL g)
|
|||||||
CurNum = Last;
|
CurNum = Last;
|
||||||
} // endif Last
|
} // endif Last
|
||||||
|
|
||||||
// Prepare error return
|
try {
|
||||||
if (g->jump_level == MAX_JUMP) {
|
|
||||||
strcpy(g->Message, MSG(TOO_MANY_JUMPS));
|
|
||||||
return true;
|
|
||||||
} // endif
|
|
||||||
|
|
||||||
if ((rc = setjmp(g->jumper[++g->jump_level])) != 0) {
|
|
||||||
g->jump_level--;
|
|
||||||
return true;
|
|
||||||
} // endif
|
|
||||||
|
|
||||||
// Initialize the column block pointer
|
// Initialize the column block pointer
|
||||||
for (; cp; cp = (PVCTCOL)cp->Next)
|
for (; cp; cp = (PVCTCOL)cp->Next)
|
||||||
cp->ReadBlock(g);
|
cp->ReadBlock(g);
|
||||||
|
|
||||||
g->jump_level--;
|
} catch (int n) {
|
||||||
return false;
|
if (trace)
|
||||||
} // end of InitInsert
|
htrc("Exception %d: %s\n", n, g->Message);
|
||||||
|
rc = true;
|
||||||
|
} catch (const char *msg) {
|
||||||
|
strcpy(g->Message, msg);
|
||||||
|
rc = true;
|
||||||
|
} // end catch
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
} // end of InitInsert
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Data Base write routine for VMP access method. */
|
/* Data Base write routine for VMP access method. */
|
||||||
@@ -2000,7 +2000,7 @@ bool VECFAM::OpenTableFile(PGLOBAL g)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Open the file corresponding to one column. */
|
/* Open the file corresponding to one column. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
bool VECFAM::OpenColumnFile(PGLOBAL g, char *opmode, int i)
|
bool VECFAM::OpenColumnFile(PGLOBAL g, PCSZ opmode, int i)
|
||||||
{
|
{
|
||||||
char filename[_MAX_PATH];
|
char filename[_MAX_PATH];
|
||||||
PDBUSER dup = PlgGetUser(g);
|
PDBUSER dup = PlgGetUser(g);
|
||||||
@@ -2505,7 +2505,7 @@ void VECFAM::CloseTableFile(PGLOBAL g, bool abort)
|
|||||||
if (wrc != RC_FX)
|
if (wrc != RC_FX)
|
||||||
rc = ResetTableSize(g, Block, Last);
|
rc = ResetTableSize(g, Block, Last);
|
||||||
else
|
else
|
||||||
longjmp(g->jumper[g->jump_level], 44);
|
throw 44;
|
||||||
|
|
||||||
} else if (mode == MODE_UPDATE) {
|
} else if (mode == MODE_UPDATE) {
|
||||||
if (UseTemp && !InitUpdate && !Abort) {
|
if (UseTemp && !InitUpdate && !Abort) {
|
||||||
@@ -3145,7 +3145,8 @@ bool BGVFAM::BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req)
|
|||||||
htrc("after write req=%d brc=%d nbw=%d\n", req, brc, nbw);
|
htrc("after write req=%d brc=%d nbw=%d\n", req, brc, nbw);
|
||||||
|
|
||||||
if (!brc || nbw != len) {
|
if (!brc || nbw != len) {
|
||||||
char buf[256], *fn = (h == Hfile) ? To_File : "Tempfile";
|
char buf[256];
|
||||||
|
PCSZ fn = (h == Hfile) ? To_File : "Tempfile";
|
||||||
|
|
||||||
if (brc)
|
if (brc)
|
||||||
strcpy(buf, MSG(BAD_BYTE_NUM));
|
strcpy(buf, MSG(BAD_BYTE_NUM));
|
||||||
@@ -3321,7 +3322,7 @@ bool BGVFAM::SetBlockInfo(PGLOBAL g)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* VEC Create an empty file for new Vector formatted tables. */
|
/* VEC Create an empty file for new Vector formatted tables. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
bool BGVFAM::MakeEmptyFile(PGLOBAL g, char *fn)
|
bool BGVFAM::MakeEmptyFile(PGLOBAL g, PCSZ fn)
|
||||||
{
|
{
|
||||||
// Vector formatted file this will create an empty file of the
|
// Vector formatted file this will create an empty file of the
|
||||||
// required length if it does not exists yet.
|
// required length if it does not exists yet.
|
||||||
@@ -3331,7 +3332,7 @@ bool BGVFAM::MakeEmptyFile(PGLOBAL g, char *fn)
|
|||||||
PlugSetPath(filename, fn, Tdbp->GetPath());
|
PlugSetPath(filename, fn, Tdbp->GetPath());
|
||||||
|
|
||||||
#if defined(__WIN__)
|
#if defined(__WIN__)
|
||||||
char *p;
|
PCSZ p;
|
||||||
DWORD rc;
|
DWORD rc;
|
||||||
bool brc;
|
bool brc;
|
||||||
LARGE_INTEGER of;
|
LARGE_INTEGER of;
|
||||||
@@ -4167,7 +4168,7 @@ void BGVFAM::CloseTableFile(PGLOBAL g, bool abort)
|
|||||||
} else if (AddBlock) {
|
} else if (AddBlock) {
|
||||||
// Last block was not written
|
// Last block was not written
|
||||||
rc = ResetTableSize(g, CurBlk, Nrec);
|
rc = ResetTableSize(g, CurBlk, Nrec);
|
||||||
longjmp(g->jumper[g->jump_level], 44);
|
throw 44;
|
||||||
} // endif
|
} // endif
|
||||||
|
|
||||||
} else if (mode == MODE_UPDATE) {
|
} else if (mode == MODE_UPDATE) {
|
||||||
|
@@ -61,7 +61,7 @@ class DllExport VCTFAM : public FIXFAM {
|
|||||||
virtual bool WriteBlock(PGLOBAL g, PVCTCOL colp);
|
virtual bool WriteBlock(PGLOBAL g, PVCTCOL colp);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool MakeEmptyFile(PGLOBAL g, char *fn);
|
virtual bool MakeEmptyFile(PGLOBAL g, PCSZ fn);
|
||||||
virtual bool OpenTempFile(PGLOBAL g);
|
virtual bool OpenTempFile(PGLOBAL g);
|
||||||
virtual bool MoveLines(PGLOBAL g) {return false;}
|
virtual bool MoveLines(PGLOBAL g) {return false;}
|
||||||
virtual bool MoveIntermediateLines(PGLOBAL g, bool *b = NULL);
|
virtual bool MoveIntermediateLines(PGLOBAL g, bool *b = NULL);
|
||||||
@@ -160,7 +160,7 @@ class DllExport VECFAM : public VCTFAM {
|
|||||||
virtual bool MoveLines(PGLOBAL g);
|
virtual bool MoveLines(PGLOBAL g);
|
||||||
virtual bool MoveIntermediateLines(PGLOBAL g, bool *b = NULL);
|
virtual bool MoveIntermediateLines(PGLOBAL g, bool *b = NULL);
|
||||||
virtual int RenameTempFile(PGLOBAL g);
|
virtual int RenameTempFile(PGLOBAL g);
|
||||||
bool OpenColumnFile(PGLOBAL g, char *opmode, int i);
|
bool OpenColumnFile(PGLOBAL g, PCSZ opmode, int i);
|
||||||
|
|
||||||
// Members
|
// Members
|
||||||
FILE* *Streams; // Points to Dos file structure array
|
FILE* *Streams; // Points to Dos file structure array
|
||||||
@@ -235,7 +235,7 @@ class BGVFAM : public VCTFAM {
|
|||||||
bool BigSeek(PGLOBAL g, HANDLE h, BIGINT pos, bool b = false);
|
bool BigSeek(PGLOBAL g, HANDLE h, BIGINT pos, bool b = false);
|
||||||
bool BigRead(PGLOBAL g, HANDLE h, void *inbuf, int req);
|
bool BigRead(PGLOBAL g, HANDLE h, void *inbuf, int req);
|
||||||
bool BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req);
|
bool BigWrite(PGLOBAL g, HANDLE h, void *inbuf, int req);
|
||||||
virtual bool MakeEmptyFile(PGLOBAL g, char *fn);
|
virtual bool MakeEmptyFile(PGLOBAL g, PCSZ fn);
|
||||||
virtual bool OpenTempFile(PGLOBAL g);
|
virtual bool OpenTempFile(PGLOBAL g);
|
||||||
virtual bool MoveIntermediateLines(PGLOBAL g, bool *b = NULL);
|
virtual bool MoveIntermediateLines(PGLOBAL g, bool *b = NULL);
|
||||||
virtual bool CleanUnusedSpace(PGLOBAL g);
|
virtual bool CleanUnusedSpace(PGLOBAL g);
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*********** File AM Zip C++ Program Source Code File (.CPP) ***********/
|
/*********** File AM Zip C++ Program Source Code File (.CPP) ***********/
|
||||||
/* PROGRAM NAME: FILAMZIP */
|
/* PROGRAM NAME: FILAMZIP */
|
||||||
/* ------------- */
|
/* ------------- */
|
||||||
/* Version 1.1 */
|
/* Version 1.3 */
|
||||||
/* */
|
/* */
|
||||||
/* COPYRIGHT: */
|
/* COPYRIGHT: */
|
||||||
/* ---------- */
|
/* ---------- */
|
||||||
@@ -45,12 +45,12 @@
|
|||||||
|
|
||||||
#define WRITEBUFFERSIZE (16384)
|
#define WRITEBUFFERSIZE (16384)
|
||||||
|
|
||||||
bool ZipLoadFile(PGLOBAL g, char *zfn, char *fn, char *entry, bool append, bool mul);
|
bool ZipLoadFile(PGLOBAL g, PCSZ zfn, PCSZ fn, PCSZ entry, bool append, bool mul);
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Compress a file in zip when creating a table. */
|
/* Compress a file in zip when creating a table. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
static bool ZipFile(PGLOBAL g, ZIPUTIL *zutp, char *fn, char *entry, char *buf)
|
static bool ZipFile(PGLOBAL g, ZIPUTIL *zutp, PCSZ fn, PCSZ entry, char *buf)
|
||||||
{
|
{
|
||||||
int rc = RC_OK, size_read, size_buf = WRITEBUFFERSIZE;
|
int rc = RC_OK, size_read, size_buf = WRITEBUFFERSIZE;
|
||||||
FILE *fin;
|
FILE *fin;
|
||||||
@@ -88,7 +88,7 @@ static bool ZipFile(PGLOBAL g, ZIPUTIL *zutp, char *fn, char *entry, char *buf)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Find and Compress several files in zip when creating a table. */
|
/* Find and Compress several files in zip when creating a table. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
static bool ZipFiles(PGLOBAL g, ZIPUTIL *zutp, char *pat, char *buf)
|
static bool ZipFiles(PGLOBAL g, ZIPUTIL *zutp, PCSZ pat, char *buf)
|
||||||
{
|
{
|
||||||
char filename[_MAX_PATH];
|
char filename[_MAX_PATH];
|
||||||
int rc;
|
int rc;
|
||||||
@@ -203,7 +203,7 @@ static bool ZipFiles(PGLOBAL g, ZIPUTIL *zutp, char *pat, char *buf)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Load and Compress a file in zip when creating a table. */
|
/* Load and Compress a file in zip when creating a table. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
bool ZipLoadFile(PGLOBAL g, char *zfn, char *fn, char *entry, bool append, bool mul)
|
bool ZipLoadFile(PGLOBAL g, PCSZ zfn, PCSZ fn, PCSZ entry, bool append, bool mul)
|
||||||
{
|
{
|
||||||
char *buf;
|
char *buf;
|
||||||
bool err;
|
bool err;
|
||||||
@@ -228,7 +228,7 @@ bool ZipLoadFile(PGLOBAL g, char *zfn, char *fn, char *entry, bool append, bool
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Constructors. */
|
/* Constructors. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
ZIPUTIL::ZIPUTIL(PSZ tgt)
|
ZIPUTIL::ZIPUTIL(PCSZ tgt)
|
||||||
{
|
{
|
||||||
zipfile = NULL;
|
zipfile = NULL;
|
||||||
target = tgt;
|
target = tgt;
|
||||||
@@ -269,7 +269,7 @@ void ZIPUTIL::getTime(tm_zip& tmZip)
|
|||||||
/* append: set true to append the zip file */
|
/* append: set true to append the zip file */
|
||||||
/* return: true if open, false otherwise. */
|
/* return: true if open, false otherwise. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
bool ZIPUTIL::open(PGLOBAL g, char *filename, bool append)
|
bool ZIPUTIL::open(PGLOBAL g, PCSZ filename, bool append)
|
||||||
{
|
{
|
||||||
if (!zipfile && !(zipfile = zipOpen64(filename,
|
if (!zipfile && !(zipfile = zipOpen64(filename,
|
||||||
append ? APPEND_STATUS_ADDINZIP
|
append ? APPEND_STATUS_ADDINZIP
|
||||||
@@ -295,7 +295,7 @@ void ZIPUTIL::close()
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* OpenTableFile: Open a DOS/UNIX table file from a ZIP file. */
|
/* OpenTableFile: Open a DOS/UNIX table file from a ZIP file. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
bool ZIPUTIL::OpenTable(PGLOBAL g, MODE mode, char *fn, bool append)
|
bool ZIPUTIL::OpenTable(PGLOBAL g, MODE mode, PCSZ fn, bool append)
|
||||||
{
|
{
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
/* The file will be compressed. */
|
/* The file will be compressed. */
|
||||||
@@ -338,7 +338,7 @@ bool ZIPUTIL::OpenTable(PGLOBAL g, MODE mode, char *fn, bool append)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Add target in zip file. */
|
/* Add target in zip file. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
bool ZIPUTIL::addEntry(PGLOBAL g, char *entry)
|
bool ZIPUTIL::addEntry(PGLOBAL g, PCSZ entry)
|
||||||
{
|
{
|
||||||
//?? we dont need the stinking time
|
//?? we dont need the stinking time
|
||||||
zip_fileinfo zi = { {0, 0, 0, 0, 0, 0}, 0, 0, 0 };
|
zip_fileinfo zi = { {0, 0, 0, 0, 0, 0}, 0, 0, 0 };
|
||||||
@@ -382,10 +382,11 @@ void ZIPUTIL::closeEntry()
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Constructors. */
|
/* Constructors. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
UNZIPUTL::UNZIPUTL(PSZ tgt, bool mul)
|
UNZIPUTL::UNZIPUTL(PCSZ tgt, bool mul)
|
||||||
{
|
{
|
||||||
zipfile = NULL;
|
zipfile = NULL;
|
||||||
target = tgt;
|
target = tgt;
|
||||||
|
pwd = NULL;
|
||||||
fp = NULL;
|
fp = NULL;
|
||||||
memory = NULL;
|
memory = NULL;
|
||||||
size = 0;
|
size = 0;
|
||||||
@@ -401,6 +402,26 @@ UNZIPUTL::UNZIPUTL(PSZ tgt, bool mul)
|
|||||||
#endif
|
#endif
|
||||||
} // end of UNZIPUTL standard constructor
|
} // end of UNZIPUTL standard constructor
|
||||||
|
|
||||||
|
UNZIPUTL::UNZIPUTL(PDOSDEF tdp)
|
||||||
|
{
|
||||||
|
zipfile = NULL;
|
||||||
|
target = tdp->GetEntry();
|
||||||
|
pwd = tdp->Pwd;
|
||||||
|
fp = NULL;
|
||||||
|
memory = NULL;
|
||||||
|
size = 0;
|
||||||
|
entryopen = false;
|
||||||
|
multiple = tdp->GetMul();
|
||||||
|
memset(fn, 0, sizeof(fn));
|
||||||
|
|
||||||
|
// Init the case mapping table.
|
||||||
|
#if defined(__WIN__)
|
||||||
|
for (int i = 0; i < 256; ++i) mapCaseTable[i] = toupper(i);
|
||||||
|
#else
|
||||||
|
for (int i = 0; i < 256; ++i) mapCaseTable[i] = i;
|
||||||
|
#endif
|
||||||
|
} // end of UNZIPUTL standard constructor
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
UNZIPUTL::UNZIPUTL(PZIPUTIL zutp)
|
UNZIPUTL::UNZIPUTL(PZIPUTIL zutp)
|
||||||
{
|
{
|
||||||
@@ -418,8 +439,8 @@ UNZIPUTL::UNZIPUTL(PZIPUTIL zutp)
|
|||||||
/* This code is the copyright property of Alessandro Felice Cantatore. */
|
/* This code is the copyright property of Alessandro Felice Cantatore. */
|
||||||
/* http://xoomer.virgilio.it/acantato/dev/wildcard/wildmatch.html */
|
/* http://xoomer.virgilio.it/acantato/dev/wildcard/wildmatch.html */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
bool UNZIPUTL::WildMatch(PSZ pat, PSZ str) {
|
bool UNZIPUTL::WildMatch(PCSZ pat, PCSZ str) {
|
||||||
PSZ s, p;
|
PCSZ s, p;
|
||||||
bool star = FALSE;
|
bool star = FALSE;
|
||||||
|
|
||||||
loopStart:
|
loopStart:
|
||||||
@@ -453,7 +474,7 @@ starCheck:
|
|||||||
/* param: filename path and the filename of the zip file to open. */
|
/* param: filename path and the filename of the zip file to open. */
|
||||||
/* return: true if open, false otherwise. */
|
/* return: true if open, false otherwise. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
bool UNZIPUTL::open(PGLOBAL g, char *filename)
|
bool UNZIPUTL::open(PGLOBAL g, PCSZ filename)
|
||||||
{
|
{
|
||||||
if (!zipfile && !(zipfile = unzOpen64(filename)))
|
if (!zipfile && !(zipfile = unzOpen64(filename)))
|
||||||
sprintf(g->Message, "Zipfile open error on %s", filename);
|
sprintf(g->Message, "Zipfile open error on %s", filename);
|
||||||
@@ -543,7 +564,7 @@ int UNZIPUTL::nextEntry(PGLOBAL g)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* OpenTableFile: Open a DOS/UNIX table file from a ZIP file. */
|
/* OpenTableFile: Open a DOS/UNIX table file from a ZIP file. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
bool UNZIPUTL::OpenTable(PGLOBAL g, MODE mode, char *fn)
|
bool UNZIPUTL::OpenTable(PGLOBAL g, MODE mode, PCSZ fn)
|
||||||
{
|
{
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
/* The file will be decompressed into virtual memory. */
|
/* The file will be decompressed into virtual memory. */
|
||||||
@@ -612,6 +633,28 @@ bool UNZIPUTL::OpenTable(PGLOBAL g, MODE mode, char *fn)
|
|||||||
return false;
|
return false;
|
||||||
} // end of OpenTableFile
|
} // end of OpenTableFile
|
||||||
|
|
||||||
|
/***********************************************************************/
|
||||||
|
/* Insert only if the entry does not exist. */
|
||||||
|
/***********************************************************************/
|
||||||
|
bool UNZIPUTL::IsInsertOk(PGLOBAL g, PCSZ fn)
|
||||||
|
{
|
||||||
|
bool ok = true, b = open(g, fn);
|
||||||
|
|
||||||
|
if (!b) {
|
||||||
|
if (!target || *target == 0) {
|
||||||
|
unz_global_info64 ginfo;
|
||||||
|
int err = unzGetGlobalInfo64(zipfile, &ginfo);
|
||||||
|
|
||||||
|
ok = !(err == UNZ_OK && ginfo.number_entry > 0);
|
||||||
|
} else // Check if the target exist
|
||||||
|
ok = (unzLocateFile(zipfile, target, 0) != UNZ_OK);
|
||||||
|
|
||||||
|
unzClose(zipfile);
|
||||||
|
} // endif b
|
||||||
|
|
||||||
|
return ok;
|
||||||
|
} // end of IsInsertOk
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Open target in zip file. */
|
/* Open target in zip file. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@@ -625,18 +668,24 @@ bool UNZIPUTL::openEntry(PGLOBAL g)
|
|||||||
if (rc != UNZ_OK) {
|
if (rc != UNZ_OK) {
|
||||||
sprintf(g->Message, "unzGetCurrentFileInfo64 rc=%d", rc);
|
sprintf(g->Message, "unzGetCurrentFileInfo64 rc=%d", rc);
|
||||||
return true;
|
return true;
|
||||||
} else if ((rc = unzOpenCurrentFile(zipfile)) != UNZ_OK) {
|
} else if ((rc = unzOpenCurrentFilePassword(zipfile, pwd)) != UNZ_OK) {
|
||||||
sprintf(g->Message, "unzOpen fn=%s rc=%d", fn, rc);
|
sprintf(g->Message, "unzOpen fn=%s rc=%d", fn, rc);
|
||||||
return true;
|
return true;
|
||||||
} // endif rc
|
} // endif rc
|
||||||
|
|
||||||
size = finfo.uncompressed_size;
|
size = finfo.uncompressed_size;
|
||||||
|
|
||||||
|
try {
|
||||||
memory = new char[size + 1];
|
memory = new char[size + 1];
|
||||||
|
} catch (...) {
|
||||||
|
strcpy(g->Message, "Out of memory");
|
||||||
|
return true;
|
||||||
|
} // end try/catch
|
||||||
|
|
||||||
if ((rc = unzReadCurrentFile(zipfile, memory, size)) < 0) {
|
if ((rc = unzReadCurrentFile(zipfile, memory, size)) < 0) {
|
||||||
sprintf(g->Message, "unzReadCurrentFile rc = %d", rc);
|
sprintf(g->Message, "unzReadCurrentFile rc = %d", rc);
|
||||||
unzCloseCurrentFile(zipfile);
|
unzCloseCurrentFile(zipfile);
|
||||||
free(memory);
|
delete[] memory;
|
||||||
memory = NULL;
|
memory = NULL;
|
||||||
entryopen = false;
|
entryopen = false;
|
||||||
} else {
|
} else {
|
||||||
@@ -661,7 +710,7 @@ void UNZIPUTL::closeEntry()
|
|||||||
} // endif entryopen
|
} // endif entryopen
|
||||||
|
|
||||||
if (memory) {
|
if (memory) {
|
||||||
free(memory);
|
delete[] memory;
|
||||||
memory = NULL;
|
memory = NULL;
|
||||||
} // endif memory
|
} // endif memory
|
||||||
|
|
||||||
@@ -675,15 +724,17 @@ void UNZIPUTL::closeEntry()
|
|||||||
UNZFAM::UNZFAM(PDOSDEF tdp) : MAPFAM(tdp)
|
UNZFAM::UNZFAM(PDOSDEF tdp) : MAPFAM(tdp)
|
||||||
{
|
{
|
||||||
zutp = NULL;
|
zutp = NULL;
|
||||||
target = tdp->GetEntry();
|
tdfp = tdp;
|
||||||
mul = tdp->GetMul();
|
//target = tdp->GetEntry();
|
||||||
|
//mul = tdp->GetMul();
|
||||||
} // end of UNZFAM standard constructor
|
} // end of UNZFAM standard constructor
|
||||||
|
|
||||||
UNZFAM::UNZFAM(PUNZFAM txfp) : MAPFAM(txfp)
|
UNZFAM::UNZFAM(PUNZFAM txfp) : MAPFAM(txfp)
|
||||||
{
|
{
|
||||||
zutp = txfp->zutp;
|
zutp = txfp->zutp;
|
||||||
target = txfp->target;
|
tdfp = txfp->tdfp;
|
||||||
mul = txfp->mul;
|
//target = txfp->target;
|
||||||
|
//mul = txfp->mul;
|
||||||
} // end of UNZFAM copy constructor
|
} // end of UNZFAM copy constructor
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@@ -711,7 +762,13 @@ int UNZFAM::Cardinality(PGLOBAL g)
|
|||||||
int card = -1;
|
int card = -1;
|
||||||
int len = GetFileLength(g);
|
int len = GetFileLength(g);
|
||||||
|
|
||||||
card = (len / (int)Lrecl) * 2; // Estimated ???
|
if (len) {
|
||||||
|
// Estimated ???
|
||||||
|
card = (len / (int)Lrecl) * 2;
|
||||||
|
card = card ? card : 10; // Lrecl can be too big
|
||||||
|
} else
|
||||||
|
card = 0;
|
||||||
|
|
||||||
return card;
|
return card;
|
||||||
} // end of Cardinality
|
} // end of Cardinality
|
||||||
|
|
||||||
@@ -726,7 +783,7 @@ bool UNZFAM::OpenTableFile(PGLOBAL g)
|
|||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
/* Allocate the ZIP utility class. */
|
/* Allocate the ZIP utility class. */
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
zutp = new(g) UNZIPUTL(target, mul);
|
zutp = new(g) UNZIPUTL(tdfp);
|
||||||
|
|
||||||
// We used the file name relative to recorded datapath
|
// We used the file name relative to recorded datapath
|
||||||
PlugSetPath(filename, To_File, Tdbp->GetPath());
|
PlugSetPath(filename, To_File, Tdbp->GetPath());
|
||||||
@@ -841,17 +898,19 @@ void UNZFAM::CloseTableFile(PGLOBAL g, bool)
|
|||||||
UZXFAM::UZXFAM(PDOSDEF tdp) : MPXFAM(tdp)
|
UZXFAM::UZXFAM(PDOSDEF tdp) : MPXFAM(tdp)
|
||||||
{
|
{
|
||||||
zutp = NULL;
|
zutp = NULL;
|
||||||
target = tdp->GetEntry();
|
tdfp = tdp;
|
||||||
mul = tdp->GetMul();
|
//target = tdp->GetEntry();
|
||||||
|
//mul = tdp->GetMul();
|
||||||
//Lrecl = tdp->GetLrecl();
|
//Lrecl = tdp->GetLrecl();
|
||||||
} // end of UZXFAM standard constructor
|
} // end of UZXFAM standard constructor
|
||||||
|
|
||||||
UZXFAM::UZXFAM(PUZXFAM txfp) : MPXFAM(txfp)
|
UZXFAM::UZXFAM(PUZXFAM txfp) : MPXFAM(txfp)
|
||||||
{
|
{
|
||||||
zutp = txfp->zutp;
|
zutp = txfp->zutp;
|
||||||
target = txfp->target;
|
tdfp = txfp->tdfp;
|
||||||
mul = txfp->mul;
|
//target = txfp->target;
|
||||||
//Lrecl = txfp->Lrecl;
|
//mul = txfp->mul;
|
||||||
|
//Lrecl = txfp->Lrecl;
|
||||||
} // end of UZXFAM copy constructor
|
} // end of UZXFAM copy constructor
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@@ -907,7 +966,7 @@ bool UZXFAM::OpenTableFile(PGLOBAL g)
|
|||||||
/* Allocate the ZIP utility class. */
|
/* Allocate the ZIP utility class. */
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
if (!zutp)
|
if (!zutp)
|
||||||
zutp = new(g)UNZIPUTL(target, mul);
|
zutp = new(g)UNZIPUTL(tdfp);
|
||||||
|
|
||||||
// We used the file name relative to recorded datapath
|
// We used the file name relative to recorded datapath
|
||||||
PlugSetPath(filename, To_File, Tdbp->GetPath());
|
PlugSetPath(filename, To_File, Tdbp->GetPath());
|
||||||
@@ -969,6 +1028,25 @@ bool ZIPFAM::OpenTableFile(PGLOBAL g)
|
|||||||
{
|
{
|
||||||
char filename[_MAX_PATH];
|
char filename[_MAX_PATH];
|
||||||
MODE mode = Tdbp->GetMode();
|
MODE mode = Tdbp->GetMode();
|
||||||
|
int len = TXTFAM::GetFileLength(g);
|
||||||
|
|
||||||
|
// We used the file name relative to recorded datapath
|
||||||
|
PlugSetPath(filename, To_File, Tdbp->GetPath());
|
||||||
|
|
||||||
|
if (len < 0)
|
||||||
|
return true;
|
||||||
|
else if (!append && len > 0) {
|
||||||
|
strcpy(g->Message, "No insert into existing zip file");
|
||||||
|
return true;
|
||||||
|
} else if (append && len > 0) {
|
||||||
|
UNZIPUTL *zutp = new(g) UNZIPUTL(target, false);
|
||||||
|
|
||||||
|
if (!zutp->IsInsertOk(g, filename)) {
|
||||||
|
strcpy(g->Message, "No insert into existing entry");
|
||||||
|
return true;
|
||||||
|
} // endif Ok
|
||||||
|
|
||||||
|
} // endif's
|
||||||
|
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
/* Allocate the ZIP utility class. */
|
/* Allocate the ZIP utility class. */
|
||||||
@@ -1028,7 +1106,7 @@ ZPXFAM::ZPXFAM(PDOSDEF tdp) : FIXFAM(tdp)
|
|||||||
target = tdp->GetEntry();
|
target = tdp->GetEntry();
|
||||||
append = tdp->GetAppend();
|
append = tdp->GetAppend();
|
||||||
//Lrecl = tdp->GetLrecl();
|
//Lrecl = tdp->GetLrecl();
|
||||||
} // end of UZXFAM standard constructor
|
} // end of ZPXFAM standard constructor
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* OpenTableFile: Open a DOS/UNIX table file from a ZIP file. */
|
/* OpenTableFile: Open a DOS/UNIX table file from a ZIP file. */
|
||||||
@@ -1037,6 +1115,22 @@ bool ZPXFAM::OpenTableFile(PGLOBAL g)
|
|||||||
{
|
{
|
||||||
char filename[_MAX_PATH];
|
char filename[_MAX_PATH];
|
||||||
MODE mode = Tdbp->GetMode();
|
MODE mode = Tdbp->GetMode();
|
||||||
|
int len = TXTFAM::GetFileLength(g);
|
||||||
|
|
||||||
|
if (len < 0)
|
||||||
|
return true;
|
||||||
|
else if (!append && len > 0) {
|
||||||
|
strcpy(g->Message, "No insert into existing zip file");
|
||||||
|
return true;
|
||||||
|
} else if (append && len > 0) {
|
||||||
|
UNZIPUTL *zutp = new(g) UNZIPUTL(target, false);
|
||||||
|
|
||||||
|
if (!zutp->IsInsertOk(g, filename)) {
|
||||||
|
strcpy(g->Message, "No insert into existing entry");
|
||||||
|
return true;
|
||||||
|
} // endif Ok
|
||||||
|
|
||||||
|
} // endif's
|
||||||
|
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
/* Allocate the ZIP utility class. */
|
/* Allocate the ZIP utility class. */
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/************** filamzip H Declares Source Code File (.H) **************/
|
/************** filamzip H Declares Source Code File (.H) **************/
|
||||||
/* Name: filamzip.h Version 1.1 */
|
/* Name: filamzip.h Version 1.2 */
|
||||||
/* */
|
/* */
|
||||||
/* (C) Copyright to the author Olivier BERTRAND 2016-2017 */
|
/* (C) Copyright to the author Olivier BERTRAND 2016-2017 */
|
||||||
/* */
|
/* */
|
||||||
@@ -27,16 +27,13 @@ typedef class ZPXFAM *PZPXFAM;
|
|||||||
class DllExport ZIPUTIL : public BLOCK {
|
class DllExport ZIPUTIL : public BLOCK {
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
ZIPUTIL(PSZ tgt);
|
ZIPUTIL(PCSZ tgt);
|
||||||
//ZIPUTIL(ZIPUTIL *zutp);
|
//ZIPUTIL(ZIPUTIL *zutp);
|
||||||
|
|
||||||
// Implementation
|
|
||||||
//PTXF Duplicate(PGLOBAL g) { return (PTXF) new(g)UNZFAM(this); }
|
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
bool OpenTable(PGLOBAL g, MODE mode, char *fn, bool append);
|
bool OpenTable(PGLOBAL g, MODE mode, PCSZ fn, bool append);
|
||||||
bool open(PGLOBAL g, char *fn, bool append);
|
bool open(PGLOBAL g, PCSZ fn, bool append);
|
||||||
bool addEntry(PGLOBAL g, char *entry);
|
bool addEntry(PGLOBAL g, PCSZ entry);
|
||||||
void close(void);
|
void close(void);
|
||||||
void closeEntry(void);
|
void closeEntry(void);
|
||||||
int writeEntry(PGLOBAL g, char *buf, int len);
|
int writeEntry(PGLOBAL g, char *buf, int len);
|
||||||
@@ -44,15 +41,10 @@ class DllExport ZIPUTIL : public BLOCK {
|
|||||||
|
|
||||||
// Members
|
// Members
|
||||||
zipFile zipfile; // The ZIP container file
|
zipFile zipfile; // The ZIP container file
|
||||||
PSZ target; // The target file name
|
PCSZ target; // The target file name
|
||||||
//unz_file_info finfo; // The current file info
|
PCSZ pwd; // The ZIP file password
|
||||||
PFBLOCK fp;
|
PFBLOCK fp;
|
||||||
//char *memory;
|
|
||||||
//uint size;
|
|
||||||
//int multiple; // Multiple targets
|
|
||||||
bool entryopen; // True when open current entry
|
bool entryopen; // True when open current entry
|
||||||
//char fn[FILENAME_MAX]; // The current entry file name
|
|
||||||
//char mapCaseTable[256];
|
|
||||||
}; // end of ZIPUTIL
|
}; // end of ZIPUTIL
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@@ -61,25 +53,27 @@ class DllExport ZIPUTIL : public BLOCK {
|
|||||||
class DllExport UNZIPUTL : public BLOCK {
|
class DllExport UNZIPUTL : public BLOCK {
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
UNZIPUTL(PSZ tgt, bool mul);
|
UNZIPUTL(PCSZ tgt, bool mul);
|
||||||
//UNZIPUTL(UNZIPUTL *zutp);
|
UNZIPUTL(PDOSDEF tdp);
|
||||||
|
|
||||||
// Implementation
|
// Implementation
|
||||||
//PTXF Duplicate(PGLOBAL g) { return (PTXF) new(g)UNZFAM(this); }
|
//PTXF Duplicate(PGLOBAL g) { return (PTXF) new(g)UNZFAM(this); }
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
bool OpenTable(PGLOBAL g, MODE mode, char *fn);
|
bool OpenTable(PGLOBAL g, MODE mode, PCSZ fn);
|
||||||
bool open(PGLOBAL g, char *fn);
|
bool open(PGLOBAL g, PCSZ fn);
|
||||||
bool openEntry(PGLOBAL g);
|
bool openEntry(PGLOBAL g);
|
||||||
void close(void);
|
void close(void);
|
||||||
void closeEntry(void);
|
void closeEntry(void);
|
||||||
bool WildMatch(PSZ pat, PSZ str);
|
bool WildMatch(PCSZ pat, PCSZ str);
|
||||||
int findEntry(PGLOBAL g, bool next);
|
int findEntry(PGLOBAL g, bool next);
|
||||||
int nextEntry(PGLOBAL g);
|
int nextEntry(PGLOBAL g);
|
||||||
|
bool IsInsertOk(PGLOBAL g, PCSZ fn);
|
||||||
|
|
||||||
// Members
|
// Members
|
||||||
unzFile zipfile; // The ZIP container file
|
unzFile zipfile; // The ZIP container file
|
||||||
PSZ target; // The target file name
|
PCSZ target; // The target file name
|
||||||
|
PCSZ pwd; // The ZIP file password
|
||||||
unz_file_info finfo; // The current file info
|
unz_file_info finfo; // The current file info
|
||||||
PFBLOCK fp;
|
PFBLOCK fp;
|
||||||
char *memory;
|
char *memory;
|
||||||
@@ -119,8 +113,7 @@ class DllExport UNZFAM : public MAPFAM {
|
|||||||
protected:
|
protected:
|
||||||
// Members
|
// Members
|
||||||
UNZIPUTL *zutp;
|
UNZIPUTL *zutp;
|
||||||
PSZ target;
|
PDOSDEF tdfp;
|
||||||
bool mul;
|
|
||||||
}; // end of UNZFAM
|
}; // end of UNZFAM
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@@ -147,8 +140,7 @@ class DllExport UZXFAM : public MPXFAM {
|
|||||||
protected:
|
protected:
|
||||||
// Members
|
// Members
|
||||||
UNZIPUTL *zutp;
|
UNZIPUTL *zutp;
|
||||||
PSZ target;
|
PDOSDEF tdfp;
|
||||||
bool mul;
|
|
||||||
}; // end of UZXFAM
|
}; // end of UZXFAM
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@@ -175,8 +167,9 @@ class DllExport ZIPFAM : public DOSFAM {
|
|||||||
protected:
|
protected:
|
||||||
// Members
|
// Members
|
||||||
ZIPUTIL *zutp;
|
ZIPUTIL *zutp;
|
||||||
PSZ target;
|
PCSZ target;
|
||||||
bool append;
|
bool append;
|
||||||
|
//bool replace;
|
||||||
}; // end of ZIPFAM
|
}; // end of ZIPFAM
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@@ -200,7 +193,7 @@ class DllExport ZPXFAM : public FIXFAM {
|
|||||||
protected:
|
protected:
|
||||||
// Members
|
// Members
|
||||||
ZIPUTIL *zutp;
|
ZIPUTIL *zutp;
|
||||||
PSZ target;
|
PCSZ target;
|
||||||
bool append;
|
bool append;
|
||||||
}; // end of ZPXFAM
|
}; // end of ZPXFAM
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/***************** Filter C++ Class Filter Code (.CPP) *****************/
|
/***************** Filter C++ Class Filter Code (.CPP) *****************/
|
||||||
/* Name: FILTER.CPP Version 3.9 */
|
/* Name: FILTER.CPP Version 4.0 */
|
||||||
/* */
|
/* */
|
||||||
/* (C) Copyright to the author Olivier BERTRAND 1998-2014 */
|
/* (C) Copyright to the author Olivier BERTRAND 1998-2017 */
|
||||||
/* */
|
/* */
|
||||||
/* This file contains the class FILTER function code. */
|
/* This file contains the class FILTER function code. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@@ -87,7 +87,7 @@ BYTE OpBmp(PGLOBAL g, OPVAL opc)
|
|||||||
case OP_EXIST: bt = 0x00; break;
|
case OP_EXIST: bt = 0x00; break;
|
||||||
default:
|
default:
|
||||||
sprintf(g->Message, MSG(BAD_FILTER_OP), opc);
|
sprintf(g->Message, MSG(BAD_FILTER_OP), opc);
|
||||||
longjmp(g->jumper[g->jump_level], TYPE_ARRAY);
|
throw TYPE_ARRAY;
|
||||||
} // endswitch opc
|
} // endswitch opc
|
||||||
|
|
||||||
return bt;
|
return bt;
|
||||||
@@ -1409,7 +1409,7 @@ PFIL FILTER::Copy(PTABS t)
|
|||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
/* Make file output of FILTER contents. */
|
/* Make file output of FILTER contents. */
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
void FILTER::Print(PGLOBAL g, FILE *f, uint n)
|
void FILTER::Printf(PGLOBAL g, FILE *f, uint n)
|
||||||
{
|
{
|
||||||
char m[64];
|
char m[64];
|
||||||
|
|
||||||
@@ -1431,7 +1431,7 @@ void FILTER::Print(PGLOBAL g, FILE *f, uint n)
|
|||||||
if (lin && fp->GetArgType(i) == TYPE_FILTER)
|
if (lin && fp->GetArgType(i) == TYPE_FILTER)
|
||||||
fprintf(f, "%s Filter at %p\n", m, fp->Arg(i));
|
fprintf(f, "%s Filter at %p\n", m, fp->Arg(i));
|
||||||
else
|
else
|
||||||
fp->Arg(i)->Print(g, f, n + 2);
|
fp->Arg(i)->Printf(g, f, n + 2);
|
||||||
|
|
||||||
} // endfor i
|
} // endfor i
|
||||||
|
|
||||||
@@ -1442,7 +1442,7 @@ void FILTER::Print(PGLOBAL g, FILE *f, uint n)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Make string output of TABLE contents (z should be checked). */
|
/* Make string output of TABLE contents (z should be checked). */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
void FILTER::Print(PGLOBAL g, char *ps, uint z)
|
void FILTER::Prints(PGLOBAL g, char *ps, uint z)
|
||||||
{
|
{
|
||||||
#define FLEN 100
|
#define FLEN 100
|
||||||
|
|
||||||
@@ -1470,7 +1470,7 @@ void FILTER::Print(PGLOBAL g, char *ps, uint z)
|
|||||||
bcp = bxp;
|
bcp = bxp;
|
||||||
p = bcp->Cold;
|
p = bcp->Cold;
|
||||||
n = FLEN;
|
n = FLEN;
|
||||||
fp->Arg(0)->Print(g, p, n);
|
fp->Arg(0)->Prints(g, p, n);
|
||||||
n = FLEN - strlen(p);
|
n = FLEN - strlen(p);
|
||||||
|
|
||||||
switch (fp->Opc) {
|
switch (fp->Opc) {
|
||||||
@@ -1516,7 +1516,7 @@ void FILTER::Print(PGLOBAL g, char *ps, uint z)
|
|||||||
|
|
||||||
n = FLEN - strlen(p);
|
n = FLEN - strlen(p);
|
||||||
p += strlen(p);
|
p += strlen(p);
|
||||||
fp->Arg(1)->Print(g, p, n);
|
fp->Arg(1)->Prints(g, p, n);
|
||||||
} else
|
} else
|
||||||
if (!bcp) {
|
if (!bcp) {
|
||||||
strncat(ps, "???", z);
|
strncat(ps, "???", z);
|
||||||
@@ -1712,7 +1712,7 @@ PFIL PrepareFilter(PGLOBAL g, PFIL fp, bool having)
|
|||||||
break; // Remove eventual ending separator(s)
|
break; // Remove eventual ending separator(s)
|
||||||
|
|
||||||
// if (fp->Convert(g, having))
|
// if (fp->Convert(g, having))
|
||||||
// longjmp(g->jumper[g->jump_level], TYPE_FILTER);
|
// throw TYPE_ARRAY;
|
||||||
|
|
||||||
filp = fp;
|
filp = fp;
|
||||||
fp = fp->Next;
|
fp = fp->Next;
|
||||||
@@ -1745,7 +1745,7 @@ DllExport bool ApplyFilter(PGLOBAL g, PFIL filp)
|
|||||||
// return TRUE;
|
// return TRUE;
|
||||||
|
|
||||||
if (filp->Eval(g))
|
if (filp->Eval(g))
|
||||||
longjmp(g->jumper[g->jump_level], TYPE_FILTER);
|
throw TYPE_FILTER;
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace > 1)
|
||||||
htrc("PlugFilter filp=%p result=%d\n",
|
htrc("PlugFilter filp=%p result=%d\n",
|
||||||
|
@@ -61,8 +61,8 @@ class DllExport FILTER : public XOBJECT { /* Filter description block */
|
|||||||
//virtual PXOB CheckSubQuery(PGLOBAL, PSQL);
|
//virtual PXOB CheckSubQuery(PGLOBAL, PSQL);
|
||||||
//virtual bool CheckLocal(PTDB);
|
//virtual bool CheckLocal(PTDB);
|
||||||
//virtual int CheckSpcCol(PTDB tdbp, int n);
|
//virtual int CheckSpcCol(PTDB tdbp, int n);
|
||||||
virtual void Print(PGLOBAL g, FILE *f, uint n);
|
virtual void Printf(PGLOBAL g, FILE *f, uint n);
|
||||||
virtual void Print(PGLOBAL g, char *ps, uint z);
|
virtual void Prints(PGLOBAL g, char *ps, uint z);
|
||||||
// PFIL Linearize(bool nosep);
|
// PFIL Linearize(bool nosep);
|
||||||
// PFIL Link(PGLOBAL g, PFIL fil2);
|
// PFIL Link(PGLOBAL g, PFIL fil2);
|
||||||
// PFIL RemoveLastSep(void);
|
// PFIL RemoveLastSep(void);
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* GLOBAL.H: Declaration file used by all CONNECT implementations. */
|
/* GLOBAL.H: Declaration file used by all CONNECT implementations. */
|
||||||
/* (C) Copyright Olivier Bertrand 1993-2014 */
|
/* (C) Copyright Olivier Bertrand 1993-2017 */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@@ -59,7 +59,7 @@
|
|||||||
#define NO_IVAL -95684275 /* Used by GetIntegerOption */
|
#define NO_IVAL -95684275 /* Used by GetIntegerOption */
|
||||||
#define VMLANG 370 /* Size of olf VM lang blocks */
|
#define VMLANG 370 /* Size of olf VM lang blocks */
|
||||||
#define MAX_JUMP 24 /* Maximum jump level number */
|
#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 STR_SIZE 501 /* Length of char strings. */
|
||||||
#define STD_INPUT 0 /* Standard language input */
|
#define STD_INPUT 0 /* Standard language input */
|
||||||
#define STD_OUTPUT 1 /* Standard language output */
|
#define STD_OUTPUT 1 /* Standard language output */
|
||||||
@@ -229,8 +229,9 @@ typedef struct _parm {
|
|||||||
typedef struct _global { /* Global structure */
|
typedef struct _global { /* Global structure */
|
||||||
void *Sarea; /* Points to work area */
|
void *Sarea; /* Points to work area */
|
||||||
uint Sarea_Size; /* Work area size */
|
uint Sarea_Size; /* Work area size */
|
||||||
PACTIVITY Activityp, ActivityStart;
|
PACTIVITY Activityp;
|
||||||
char Message[MAX_STR];
|
char Message[MAX_STR];
|
||||||
|
ulong More; /* Used by jsonudf */
|
||||||
int Createas; /* To pass info to created table */
|
int Createas; /* To pass info to created table */
|
||||||
void *Xchk; /* indexes in create/alter */
|
void *Xchk; /* indexes in create/alter */
|
||||||
short Alchecked; /* Checked for ALTER */
|
short Alchecked; /* Checked for ALTER */
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user