Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Types: add support for constant_keyword type #224

Merged
merged 1 commit into from
Mar 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -200,12 +200,6 @@ set(LIBCURL_PATH_SRC ${CMAKE_SOURCE_DIR}/libs/curl CACHE PATH
set(LIBCURL_BUILD_TYPE debug CACHE STRING
"Lib curl build type: debug (default) or release")

# zlib paths
set(ZLIB_PATH_SRC ${CMAKE_SOURCE_DIR}/libs/zlib CACHE PATH
"Lib zlib source path")
set(ZLIB_PATH_INST ${CMAKE_BINARY_DIR}/zlib CACHE PATH
"Lib zlib install path")

if (${LIBCURL_BUILD_TYPE} MATCHES [Dd][Ee][Bb][Uu][Gg])
set(LIBCURL_DEBUG_ENABLED yes)
set(LIBCURL_BUILD_TYPE debug)
Expand All @@ -232,6 +226,12 @@ set(LIBCURL_LD_PATH
set(LIBCURL_INC_PATH ${LIBCURL_PATH_SRC}/include CACHE PATH
"Lib curl include path")

# zlib paths
set(ZLIB_PATH_SRC ${CMAKE_SOURCE_DIR}/libs/zlib CACHE PATH
"Lib zlib source path")
set(ZLIB_PATH_INST ${LIBCURL_PATH_SRC}/builds/zlib-${TARCH} CACHE PATH
"Lib zlib install path")

# Build zlib, then libcurl.
# Note: this happens at config time as a pre-requisite, for now. This might
# be changed to a build target later (possibly as a CMake subproject: re-link
Expand All @@ -256,7 +256,7 @@ if (NOT IS_DIRECTORY ${LIBCURL_LD_PATH})
endif (${CMD_RETURN})
# libcurl expects a /lib and a /include folder under the location provided
# as the path to zlib. zlib/win32's makefile has no install target, so
# we'll just cmake-install them under the building dir.
# we'll just cmake-install them (under libcurl's build folder).
file(INSTALL ${ZLIB_PATH_SRC}/zlib.lib DESTINATION ${ZLIB_PATH_INST}/lib)
file(GLOB ZLIB_H_FILES LIST_DIRECTORIES false ${ZLIB_PATH_SRC}
${ZLIB_PATH_SRC}/*.h)
Expand Down
12 changes: 12 additions & 0 deletions driver/connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@
#define TYPE_UNSUPPORTED "UNSUPPORTED"
/* 12 */
#define TYPE_SCALED_FLOAT "SCALED_FLOAT"
/* 16 */
#define TYPE_CONSTANT_KEYWORD "CONSTANT_KEYWORD"

/*
* intervals
*/
Expand Down Expand Up @@ -2233,6 +2236,15 @@ static BOOL elastic_name2types(wstr_st *type_name,
return TRUE;
}
break;

/* 16: CONSTANT_KEYWORD */
case sizeof(TYPE_CONSTANT_KEYWORD) - 1:
if (! wmemncasecmp(type_name->str,
MK_WPTR(TYPE_CONSTANT_KEYWORD), type_name->cnt)) {
*c_sql = ES_CKEYWORD_TO_CSQL;
*sql = ES_CKEYWORD_TO_SQL;
return TRUE;
}
}

return elastic_intervals_name2types(type_name, c_sql, sql);
Expand Down
9 changes: 6 additions & 3 deletions driver/connect.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,16 @@
#define ES_BOOLEAN_TO_CSQL SQL_C_BIT
#define ES_BOOLEAN_TO_SQL SQL_BIT
/* 12: SQL_VARCHAR -> SQL_C_WCHAR */
#define ES_KEYWORD_TO_CSQL SQL_C_WCHAR /* XXX: CBOR needs _CHAR */
#define ES_KEYWORD_TO_CSQL SQL_C_WCHAR
#define ES_KEYWORD_TO_SQL SQL_VARCHAR
/* 12: SQL_VARCHAR -> SQL_C_WCHAR */
#define ES_TEXT_TO_CSQL SQL_C_WCHAR /* XXX: CBOR needs _CHAR */
#define ES_CKEYWORD_TO_CSQL SQL_C_WCHAR
#define ES_CKEYWORD_TO_SQL SQL_VARCHAR
/* 12: SQL_VARCHAR -> SQL_C_WCHAR */
#define ES_TEXT_TO_CSQL SQL_C_WCHAR
#define ES_TEXT_TO_SQL SQL_VARCHAR
/* 12: SQL_VARCHAR -> SQL_C_WCHAR */
#define ES_IP_TO_CSQL SQL_C_WCHAR /* XXX: CBOR needs _CHAR */
#define ES_IP_TO_CSQL SQL_C_WCHAR
#define ES_IP_TO_SQL SQL_VARCHAR
/* 92: SQL_TYPE_TIME -> SQL_C_TYPE_TIME */
#define ES_TIME_TO_CSQL SQL_C_TYPE_TIME
Expand Down