Changeset: a3cfb5549512 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/a3cfb5549512 Modified Files: sql/backends/monet5/rel_bin.c sql/backends/monet5/sql_statement.c sql/backends/monet5/sql_statement.h sql/include/sql_relation.h sql/server/rel_dump.c sql/server/rel_exp.c sql/server/rel_optimize_others.c sql/server/rel_optimize_proj.c sql/server/rel_optimize_sel.c sql/server/rel_optimizer.c sql/server/rel_propagate.c sql/server/rel_rel.c sql/server/rel_rel.h sql/server/rel_schema.c sql/server/rel_select.c sql/server/rel_statistics.c sql/server/rel_unnest.c sql/test/BugTracker-2010/Tests/ORDER_BY_over_UNION_EXCEPT_INTERSECT.Bug-2606.test sql/test/BugTracker-2016/Tests/merge_project.Bug-3955.test sql/test/BugTracker-2021/Tests/plan-not-optimal-view.Bug-7140.test sql/test/BugTracker-2024/Tests/atom_cmp-Bug-7477.test sql/test/SQLancer/Tests/sqlancer17.test sql/test/bugs/Tests/rtrim_bug.test sql/test/merge-partitions/Tests/mergepart31.test sql/test/miscellaneous/Tests/simple_plans.test sql/test/pg_regress/Tests/alter_table.test sql/test/prepare/Tests/prepare-complex.stable.out sql/test/prepare/Tests/rename_exps.Bug-3974.stable.out sql/test/prepare/Tests/sqlancer_prepare.stable.out sql/test/prepare/Tests/sqlancer_prepare.stable.out.int128 Branch: label Log Message:
merged with default fixed issues on munion reimplemented code generation for check constraint diffs (truncated from 5007 to 300 lines): diff --git a/clients/odbc/driver/CMakeLists.txt b/clients/odbc/driver/CMakeLists.txt --- a/clients/odbc/driver/CMakeLists.txt +++ b/clients/odbc/driver/CMakeLists.txt @@ -124,14 +124,9 @@ target_include_directories(MonetODBC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/monetdb>) -target_compile_definitions(MonetODBC - PRIVATE - LIBMONETODBCS) - target_link_libraries(MonetODBC PRIVATE monetdb_config_header - mutils mapi mutf8 ${ODBCINST_LIBRARIES}) diff --git a/clients/odbc/driver/ODBCGlobal.h b/clients/odbc/driver/ODBCGlobal.h --- a/clients/odbc/driver/ODBCGlobal.h +++ b/clients/odbc/driver/ODBCGlobal.h @@ -49,16 +49,6 @@ #define ODBCDEBUG 1 -#ifdef WIN32 -#ifndef LIBMONETODBC -#define odbc_export extern __declspec(dllimport) -#else -#define odbc_export extern __declspec(dllexport) -#endif -#else -#define odbc_export extern -#endif - /* standard ODBC driver include files */ #include <sqltypes.h> /* ODBC C typedefs */ /* Note: sqlext.h includes sql.h so it is not needed here to be included */ diff --git a/clients/odbc/setup/drvcfg.h b/clients/odbc/setup/drvcfg.h --- a/clients/odbc/setup/drvcfg.h +++ b/clients/odbc/setup/drvcfg.h @@ -32,16 +32,6 @@ #define ODBCVER 0x0351 -#ifdef WIN32 -#ifndef LIBMONETODBCS -#define odbc_export extern __declspec(dllimport) -#else -#define odbc_export extern __declspec(dllexport) -#endif -#else -#define odbc_export extern -#endif - #include <odbcinst.h> /******************************************************** @@ -148,7 +138,7 @@ extern "C" { #endif /* ONLY IMPLEMENTED IN DRIVER SETUP (not in ODBCINST) */ - odbc_export int ODBCINSTGetProperties(HODBCINSTPROPERTY hFirstProperty); + extern int ODBCINSTGetProperties(HODBCINSTPROPERTY hFirstProperty); #if defined(__cplusplus) } diff --git a/clients/odbc/winsetup/setup.c b/clients/odbc/winsetup/setup.c --- a/clients/odbc/winsetup/setup.c +++ b/clients/odbc/winsetup/setup.c @@ -22,10 +22,6 @@ #define ALREADY_HAVE_WINDOWS_TYPE 1 #include <sql.h> #include <sqlext.h> -#ifdef EXPORT -#undef EXPORT -#endif -#define EXPORT __declspec(dllexport) #include <odbcinst.h> #include "resource.h" diff --git a/common/stream/text_stream.c b/common/stream/text_stream.c --- a/common/stream/text_stream.c +++ b/common/stream/text_stream.c @@ -30,6 +30,7 @@ struct inner_state { pump_buffer src_win; pump_buffer dst_win; pump_buffer putback_win; + pump_state *outer_state; char putback_buf[UTF8BOMLENGTH]; bool crlf_pending; char buffer[BUFFER_SIZE]; @@ -88,42 +89,69 @@ take_byte(inner_state_t *ist) static pump_result text_pump_in(inner_state_t *ist, pump_action action) { - bool crlf_pending = ist->crlf_pending; + assert(ist->dst_win.count > 0); + assert(ist->src_win.count > 0 || action == PUMP_FINISH); - while (ist->src_win.count > 0 && ist->dst_win.count > 0) { - char c = take_byte(ist); - switch (c) { - case '\r': - if (crlf_pending) { - // put the previous one, which is clearly not followed by an \n - put_byte(ist, '\r'); - } - crlf_pending = true; - continue; - case '\n': - put_byte(ist, c); - crlf_pending = false; - continue; - default: - if (crlf_pending) { - put_byte(ist, '\r'); - crlf_pending = false; - // if dst_win.count was 1, there is no room for another put_byte(). - if (ist->dst_win.count > 0) { - put_byte(ist, c); - } else { - // no room anymore for char c, put it back! - ist->src_win.start--; - ist->src_win.count++; - } - } else { - put_byte(ist, c); - } - continue; + if (ist->crlf_pending) { + if (ist->src_win.count > 0) { + if (ist->src_win.start[0] != '\n') { + // CR not followed by a LF, emit it + put_byte(ist, '\r'); + } + } else { + assert(action == PUMP_FINISH); + // CR followed by end of file, not LF, so emit it + put_byte(ist, '\r'); } + // in any case, the CR is no longer pending + ist->crlf_pending = false; } - ist->crlf_pending = crlf_pending; + while (1) { + size_t span = ist->src_win.count < ist->dst_win.count + ? ist->src_win.count + : ist->dst_win.count; + if (span == 0) + break; + + if (ist->src_win.start[0] == '\r') { + // Looking at a CR. We'll handle just that, then make another round of the while loop + if (ist->src_win.count == 1) { + // Don't know what will follow, move it to the flag. + // Then stop, as all available input has been consumed + take_byte(ist); + ist->crlf_pending = true; + break; + } + assert(ist->src_win.count > 1); // We can safely look ahead + if (ist->src_win.start[1] == '\n') { + // Drop the CR, move the LF + take_byte(ist); + put_byte(ist, take_byte(ist)); + } else { + // Move the CR + put_byte(ist, take_byte(ist)); + } + // progress has been made, consider the situation anew + continue; + } else { + // The remaining input data does not start with a CR. + // Move all non-CR data to the output buffer + char *cr = memchr(ist->src_win.start, '\r', span); + if (cr != NULL) { + span = cr - ist->src_win.start; + } + assert(span > 0); + memcpy(ist->dst_win.start, ist->src_win.start, span); + ist->src_win.start += span; + ist->src_win.count -= span; + ist->dst_win.start += span; + ist->dst_win.count -= span; + continue; + } + // Unreachable, all branches above explicitly break or continue + assert(0 && "UNREACHABLE"); + } if (action == PUMP_FINISH) { if (ist->src_win.count > 0) @@ -150,16 +178,20 @@ text_pump_in(inner_state_t *ist, pump_ac static pump_result text_pump_in_with_putback(inner_state_t *ist, pump_action action) { - if (ist->putback_win.count > 0) { - pump_buffer tmp = ist->src_win; - ist->src_win = ist->putback_win; - pump_result ret = text_pump_in(ist, PUMP_NO_FLUSH); - ist->putback_win = ist->src_win; - ist->src_win = tmp; - if (ret == PUMP_ERROR) - return PUMP_ERROR; + if (ist->putback_win.count == 0) { + // no need for this function anymore + assert(ist->outer_state->worker == text_pump_in_with_putback); + ist->outer_state->worker = text_pump_in; + return text_pump_in(ist, action); } - return text_pump_in(ist, action); + + // first empty the putback buffer + pump_buffer tmp = ist->src_win; + ist->src_win = ist->putback_win; + pump_result ret = text_pump_in(ist, PUMP_NO_FLUSH); + ist->putback_win = ist->src_win; + ist->src_win = tmp; + return ret; } @@ -295,6 +327,7 @@ create_text_stream(stream *inner) state->finalizer = text_end; state->get_error = get_error; + inner_state->outer_state = state; inner_state->putback_win.start = inner_state->putback_buf; inner_state->putback_win.count = 0; if (inner->readonly) { diff --git a/common/utils/CMakeLists.txt b/common/utils/CMakeLists.txt --- a/common/utils/CMakeLists.txt +++ b/common/utils/CMakeLists.txt @@ -32,10 +32,7 @@ target_link_libraries(mutils mutf8) target_compile_definitions(mutils PRIVATE - LIBMUTILS - LIBGDK - LIBMAPI - LIBMEROUTIL) + LIBMUTILS) set_target_properties(mutils PROPERTIES @@ -74,8 +71,6 @@ target_link_libraries(mcrypt target_compile_definitions(mcrypt PRIVATE - LIBMONETDB5 - LIBMAPI LIBMCRYPT) set_target_properties(mcrypt @@ -108,8 +103,7 @@ target_link_libraries(msabaoth target_compile_definitions(msabaoth PRIVATE - LIBMSABAOTH - LIBMONETDB5) + LIBMSABAOTH) set_target_properties(msabaoth PROPERTIES diff --git a/common/utils/mcrypt.h b/common/utils/mcrypt.h --- a/common/utils/mcrypt.h +++ b/common/utils/mcrypt.h @@ -14,7 +14,7 @@ #define _SEEN_MCRYPT_H 1 #if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__) -#if !defined(LIBMAPI) && !defined(LIBMCRYPT) && !defined(LIBMONETDB5) +#if !defined(LIBMAPI) && !defined(LIBMCRYPT) #define mcrypt_export extern __declspec(dllimport) #else #define mcrypt_export extern __declspec(dllexport) diff --git a/common/utils/mutils.c b/common/utils/mutils.c --- a/common/utils/mutils.c +++ b/common/utils/mutils.c @@ -838,7 +838,7 @@ get_bin_path(void) uint32_t size = PATH_MAX; if (_NSGetExecutablePath(buf, &size) == 0 && realpath(buf, _bin_path) != NULL) - return _bin_path; + return _bin_path; #elif defined(BSD) && defined(KERN_PROC_PATHNAME) /* BSD */ int mib[4]; size_t cb = sizeof(_bin_path); diff --git a/common/utils/muuid.h b/common/utils/muuid.h --- a/common/utils/muuid.h +++ b/common/utils/muuid.h @@ -17,13 +17,14 @@ * msabaoth is part of monetdb5 and we want this function to be * exported so that the call in sql can be satisfied by the version * that is included in monetdb5 */ -extern #ifdef WIN32 -#if !defined(LIBMSABAOTH) && !defined(LIBMUUID) _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org