未验证 提交 a585d2d0 编写于 作者: X xiaoleizi2016 提交者: GitHub

Merge branch 'master' into issue_29

...@@ -73,15 +73,20 @@ function do_config() ...@@ -73,15 +73,20 @@ function do_config()
echo -e "\033[31m ===build debug version=== \033[0m" echo -e "\033[31m ===build debug version=== \033[0m"
;; ;;
xgcov) xgcov)
# configure for release # configure for gcov
./configure --with-gcc-version=9.3.0 --with-coverage=yes --enable-buildtime=no --enable-strip-ut=no --enable-silent-rules --enable-dlink-observer=no ./configure --with-gcc-version=9.3.0 --with-coverage=yes --enable-buildtime=no --enable-strip-ut=no --enable-silent-rules --enable-dlink-observer=no
echo -e "\033[31m ===build gcov version=== \033[0m" echo -e "\033[31m ===build gcov version=== \033[0m"
;; ;;
xperf) xperf)
# configure for release # configure for perf
./configure --with-gcc-version=9.3.0 --with-coverage=no --enable-buildtime=no --enable-strip-ut=no --enable-silent-rules --enable-dlink-observer=no --with-release --with-perf ./configure --with-gcc-version=9.3.0 --with-coverage=no --enable-buildtime=no --enable-strip-ut=no --enable-silent-rules --enable-dlink-observer=no --with-release --with-perf
echo -e "\033[31m ===build perf version=== \033[0m" echo -e "\033[31m ===build perf version=== \033[0m"
;; ;;
xasan)
# configure for asan
./configure --with-gcc-version=9.3.0 --with-coverage=no --enable-buildtime=no --enable-strip-ut=no --enable-silent-rules --enable-dlink-observer=no --with-asan
echo -e "\033[31m ===build asan version=== \033[0m"
;;
*) *)
# configure for release # configure for release
./configure --with-gcc-version=9.3.0 --with-coverage=no --enable-buildtime=no --enable-strip-ut=no --enable-silent-rules --enable-dlink-observer=no --with-release ./configure --with-gcc-version=9.3.0 --with-coverage=no --enable-buildtime=no --enable-strip-ut=no --enable-silent-rules --enable-dlink-observer=no --with-release
......
AC_INIT([OceanBase], AC_INIT([OceanBase],
[3.2.3.5], [4.0.0],
[wgs13579@gmail.com], [wgs13579@gmail.com],
[obproxy-ce], [obproxy-ce],
[http://oceanbase.taobao.org/]) [http://oceanbase.taobao.org/])
obapi_version="3.2.3.5" obapi_version="4.0.0"
AC_SUBST(obapi_version) AC_SUBST(obapi_version)
AC_DISABLE_STATIC AC_DISABLE_STATIC
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
if test "$withval" = "yes"; then if test "$withval" = "yes"; then
case "$host_cpu" in case "$host_cpu" in
*aarch64* ) *aarch64* )
AM_CXXFLAGS="-g -O2 -D_OB_VERSION=1000 -D_NO_EXCEPTION -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -DNDEBUG -D__USE_LARGEFILE64 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -Wall -Wextra -Wno-unused-parameter -Wformat -Wno-conversion -Wno-deprecated -Wno-invalid-offsetof -Wno-unused-result -Wno-format-security -finline-functions -fno-strict-aliasing -mtune=generic -Wno-psabi -Wno-sign-compare -Wno-class-memaccess -Wno-deprecated-copy -Wno-ignored-qualifiers -Wno-aligned-new -Wno-format-truncation -Wno-literal-suffix -Wno-format-overflow -Wno-stringop-truncation -Wno-memset-elt-size -Wno-cast-function-type -Wno-address-of-packed-member -fuse-ld=lld -ffunction-sections -Wl,--no-warn-symbol-ordering,--symbol-ordering-file,${ac_abs_confdir}/hotfuncs.txt" AM_CXXFLAGS="-g -O2 -D_OB_VERSION=1000 -D_NO_EXCEPTION -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -DNDEBUG -D__USE_LARGEFILE64 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -Wall -Wextra -Wno-unused-parameter -Wformat -Wno-conversion -Wno-deprecated -Wno-invalid-offsetof -Wno-unused-result -Wno-format-security -finline-functions -fno-strict-aliasing -mtune=generic -march=armv8-a+crc -Wno-psabi -Wno-sign-compare -Wno-class-memaccess -Wno-deprecated-copy -Wno-ignored-qualifiers -Wno-aligned-new -Wno-format-truncation -Wno-literal-suffix -Wno-format-overflow -Wno-stringop-truncation -Wno-memset-elt-size -Wno-cast-function-type -Wno-address-of-packed-member -fuse-ld=lld -ffunction-sections -Wl,--no-warn-symbol-ordering,--symbol-ordering-file,${ac_abs_confdir}/hotfuncs.txt"
AM_CFLAGS="-g -O2 -D_OB_VERSION=1000 -DCOMPATIBLE -D__USE_LARGEFILE64 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -DNDEBUG -finline-functions -fno-strict-aliasing -Wall -mtune=generic -Wno-psabi -Wno-sign-compare -fuse-ld=lld -ffunction-sections -Wl,--no-warn-symbol-ordering,--symbol-ordering-file,${ac_abs_confdir}/hotfuncs.txt" AM_CFLAGS="-g -O2 -D_OB_VERSION=1000 -DCOMPATIBLE -D__USE_LARGEFILE64 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -DNDEBUG -finline-functions -fno-strict-aliasing -Wall -mtune=generic -Wno-psabi -Wno-sign-compare -fuse-ld=lld -ffunction-sections -Wl,--no-warn-symbol-ordering,--symbol-ordering-file,${ac_abs_confdir}/hotfuncs.txt"
;; ;;
* ) * )
...@@ -118,6 +118,18 @@ ...@@ -118,6 +118,18 @@
[with_perf=no] [with_perf=no]
) )
AC_ARG_WITH([asan],
AS_HELP_STRING([--with-asan],
[with asan (default is NO)]),
[
if test "$withval" = "yes"; then
AM_CXXFLAGS="${AM_CXXFLAGS} -fsanitize=address -fstack-protector-strong -fno-optimize-sibling-calls -fno-omit-frame-pointer -static-libasan -fno-var-tracking-assignments -fno-optimize-sibling-calls -fno-inline -DUSING_ASAN"
AM_CFLAGS="${AM_CFLAGS} -fsanitize=address -fstack-protector-strong -fno-optimize-sibling-calls -fno-omit-frame-pointer -static-libasan -fno-var-tracking-assignments -fno-optimize-sibling-calls -fno-inline -DUSING_ASAN"
fi
],
[with_asan=no]
)
AC_ARG_WITH([5u-support], AC_ARG_WITH([5u-support],
AS_HELP_STRING([--with-5u-support], AS_HELP_STRING([--with-5u-support],
[with 5u support (default is NO)]), [with 5u support (default is NO)]),
......
...@@ -147,7 +147,7 @@ function check_opt() ...@@ -147,7 +147,7 @@ function check_opt()
OBPROXY_OPT_LOCAL="${OBPROXY_OPT_LOCAL},$OBPROXY_EXTRA_OPT" OBPROXY_OPT_LOCAL="${OBPROXY_OPT_LOCAL},$OBPROXY_EXTRA_OPT"
fi fi
OBPROXY_OPT_LOCAL=",enable_cached_server=true,enable_get_rslist_remote=true,monitor_stat_dump_interval=1s,enable_qos=true,enable_standby=false,query_digest_time_threshold=2ms,monitor_cost_ms_unit=true,enable_strict_kernel_release=false,enable_proxy_scramble=true,work_thread_num=$WORK_THREAD_NUM,proxy_mem_limited='2G',log_dir_size_threshold=10G${OBPROXY_OPT_LOCAL}" OBPROXY_OPT_LOCAL=",server_detect_mode=0,enable_primary_zone=false,enable_cached_server=true,enable_get_rslist_remote=true,monitor_stat_dump_interval=1s,enable_qos=true,enable_standby=false,query_digest_time_threshold=2ms,monitor_cost_ms_unit=true,enable_strict_kernel_release=false,enable_proxy_scramble=true,work_thread_num=$WORK_THREAD_NUM,proxy_mem_limited='2G',log_dir_size_threshold=10G${OBPROXY_OPT_LOCAL}"
} }
# change to the path where this script locates. # change to the path where this script locates.
......
...@@ -4125,9 +4125,17 @@ int obj_accuracy_check(ObCastCtx &cast_ctx, ...@@ -4125,9 +4125,17 @@ int obj_accuracy_check(ObCastCtx &cast_ctx,
const ObObj *&res_obj) const ObObj *&res_obj)
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
bool valid_accuracy = true;
ObObjType type = obj.get_type();
if (ob_is_number_tc(type) || ob_is_double_tc(type) || ob_is_float_tc(type)) {
if (accuracy.precision_ == -1 || accuracy.scale_ == -1) {
valid_accuracy = false; // invalid accuracy
}
}
if (accuracy.is_valid()) { LOG_DEBUG("obj_accuracy_check before", K(obj), K(accuracy), K(cs_type), K(valid_accuracy));
LOG_DEBUG("obj_accuracy_check before", K(obj), K(accuracy), K(cs_type));
if (valid_accuracy && accuracy.is_valid()) {
switch (obj.get_type_class()) { switch (obj.get_type_class()) {
case ObFloatTC: { case ObFloatTC: {
ret = float_range_check(cast_ctx, accuracy, obj, buf_obj, res_obj, cast_ctx.cast_mode_); ret = float_range_check(cast_ctx, accuracy, obj, buf_obj, res_obj, cast_ctx.cast_mode_);
......
...@@ -307,6 +307,9 @@ int ObSMUtils::get_ob_type(ObObjType &ob_type, EMySQLFieldType mysql_type) ...@@ -307,6 +307,9 @@ int ObSMUtils::get_ob_type(ObObjType &ob_type, EMySQLFieldType mysql_type)
case OB_MYSQL_TYPE_COMPLEX: case OB_MYSQL_TYPE_COMPLEX:
ob_type = ObExtendType; ob_type = ObExtendType;
break; break;
case OB_MYSQL_TYPE_OB_UROWID:
ob_type = ObURowIDType;
break;
default: default:
_OB_LOG(WARN, "unsupport MySQL type %d", mysql_type); _OB_LOG(WARN, "unsupport MySQL type %d", mysql_type);
ret = OB_OBJ_TYPE_ERROR; ret = OB_OBJ_TYPE_ERROR;
......
...@@ -40,9 +40,15 @@ lib/charset/ob_charset.cpp\ ...@@ -40,9 +40,15 @@ lib/charset/ob_charset.cpp\
lib/charset/ob_ctype.h\ lib/charset/ob_ctype.h\
lib/charset/ob_ctype.c\ lib/charset/ob_ctype.c\
lib/charset/ob_ctype_utf8.c\ lib/charset/ob_ctype_utf8.c\
lib/charset/ob_ctype_gb18030.cc\
lib/charset/ob_ctype_gbk.c\
lib/charset/ob_ctype_utf16.c\
lib/charset/ob_ctype_uca.c\
lib/charset/ob_ctype_mb.c\ lib/charset/ob_ctype_mb.c\
lib/charset/ob_ctype_bin.c\ lib/charset/ob_ctype_bin.c\
lib/charset/ob_ctype_simple.c\
lib/charset/ob_mysql_global.h\ lib/charset/ob_mysql_global.h\
lib/charset/ob_config.h\
lib/charset/ob_dtoa.h\ lib/charset/ob_dtoa.h\
lib/charset/ob_dtoa.c\ lib/charset/ob_dtoa.c\
lib/charset/ob_uctype.h\ lib/charset/ob_uctype.h\
...@@ -207,6 +213,10 @@ lib/utility/ob_template_utils.h\ ...@@ -207,6 +213,10 @@ lib/utility/ob_template_utils.h\
lib/utility/serialization.h\ lib/utility/serialization.h\
lib/utility/ob_unify_serialize.h\ lib/utility/ob_unify_serialize.h\
lib/utility/ob_serialization_helper.h\ lib/utility/ob_serialization_helper.h\
lib/utility/ob_2_0_full_link_trace_util.h\
lib/utility/ob_2_0_full_link_trace_util.cpp\
lib/utility/ob_2_0_full_link_trace_info.h\
lib/utility/ob_2_0_full_link_trace_info.cpp\
lib/net/ob_addr.h\ lib/net/ob_addr.h\
lib/net/ob_addr.cpp\ lib/net/ob_addr.cpp\
lib/net/tbnetutil.cpp\ lib/net/tbnetutil.cpp\
...@@ -226,6 +236,9 @@ lib/stat/ob_stat_template.h\ ...@@ -226,6 +236,9 @@ lib/stat/ob_stat_template.h\
lib/stat/ob_di_list.h\ lib/stat/ob_di_list.h\
lib/stat/ob_di_tls.h\ lib/stat/ob_di_tls.h\
lib/trace/ob_trace_event.h\ lib/trace/ob_trace_event.h\
lib/trace/ob_trace.h\
lib/trace/ob_trace.cpp\
lib/trace/ob_trace_def.h\
lib/profile/ob_trace_id.h\ lib/profile/ob_trace_id.h\
lib/wait_event/ob_wait_class.h\ lib/wait_event/ob_wait_class.h\
lib/wait_event/ob_wait_event.h\ lib/wait_event/ob_wait_event.h\
......
...@@ -28,6 +28,8 @@ using namespace oceanbase::lib; ...@@ -28,6 +28,8 @@ using namespace oceanbase::lib;
EXTERN_C_BEGIN EXTERN_C_BEGIN
#ifndef USING_ASAN
extern void *__libc_malloc(size_t size); extern void *__libc_malloc(size_t size);
extern void __libc_free(void *ptr); extern void __libc_free(void *ptr);
extern void *__libc_realloc(void *ptr, size_t size); extern void *__libc_realloc(void *ptr, size_t size);
...@@ -290,4 +292,6 @@ int posix_memalign(void **memptr, size_t alignment, size_t size) ...@@ -290,4 +292,6 @@ int posix_memalign(void **memptr, size_t alignment, size_t size)
return err; return err;
} }
#endif
EXTERN_C_END EXTERN_C_END
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "lib/thread_local/ob_tsi_factory.h" #include "lib/thread_local/ob_tsi_factory.h"
#include "lib/utility/utility.h" #include "lib/utility/utility.h"
#include <algorithm> #include <algorithm>
#include "obutils/ob_proxy_config.h"
#ifdef __OB_MTRACE__ #ifdef __OB_MTRACE__
#include <execinfo.h> #include <execinfo.h>
#endif #endif
......
...@@ -235,6 +235,7 @@ MOD_ITEM_DEF(OB_PROXY_QOS) ...@@ -235,6 +235,7 @@ MOD_ITEM_DEF(OB_PROXY_QOS)
MOD_ITEM_DEF(OB_PROXY_SSL_RELATED) MOD_ITEM_DEF(OB_PROXY_SSL_RELATED)
MOD_ITEM_DEF(OB_PROXY_CONFIG_TABLE) MOD_ITEM_DEF(OB_PROXY_CONFIG_TABLE)
MOD_ITEM_DEF(OB_PROMETHEUS_RELATED) MOD_ITEM_DEF(OB_PROMETHEUS_RELATED)
MOD_ITEM_DEF(OB_PROXY_SESS_SYNC)
//mergeservermodules //mergeservermodules
MOD_ITEM_DEF(OB_MS_CELL_ARRAY) MOD_ITEM_DEF(OB_MS_CELL_ARRAY)
......
此差异已折叠。
...@@ -27,15 +27,26 @@ enum ObCharsetType ...@@ -27,15 +27,26 @@ enum ObCharsetType
CHARSET_INVALID = 0, CHARSET_INVALID = 0,
CHARSET_BINARY = 1, CHARSET_BINARY = 1,
CHARSET_UTF8MB4 = 2, CHARSET_UTF8MB4 = 2,
CHARSET_GBK = 3,
CHARSET_UTF16 = 4,
CHARSET_GB18030 = 5,
CHARSET_MAX, CHARSET_MAX,
}; };
enum ObCollationType enum ObCollationType
{ {
CS_TYPE_INVALID = 0, CS_TYPE_INVALID = 0,
CS_TYPE_GBK_CHINESE_CI = 28,
CS_TYPE_UTF8MB4_GENERAL_CI = 45, CS_TYPE_UTF8MB4_GENERAL_CI = 45,
CS_TYPE_UTF8MB4_BIN = 46, CS_TYPE_UTF8MB4_BIN = 46,
CS_TYPE_UTF16_GENERAL_CI = 54,
CS_TYPE_UTF16_BIN = 55,
CS_TYPE_BINARY = 63, CS_TYPE_BINARY = 63,
CS_TYPE_GBK_BIN = 87,
CS_TYPE_UTF16_UNICODE_CI = 101,
CS_TYPE_UTF8MB4_UNICODE_CI = 224,
CS_TYPE_GB18030_CHINESE_CI = 248,
CS_TYPE_GB18030_BIN = 249,
CS_TYPE_MAX, CS_TYPE_MAX,
}; };
/* /*
...@@ -89,8 +100,8 @@ private: ...@@ -89,8 +100,8 @@ private:
virtual ~ObCharset() {}; virtual ~ObCharset() {};
public: public:
static const int64_t CHARSET_WRAPPER_COUNT = 2; static const int64_t CHARSET_WRAPPER_COUNT = 5;
static const int64_t COLLATION_WRAPPER_COUNT = 3; static const int64_t COLLATION_WRAPPER_COUNT = 11;
static double strntod(const char *str, static double strntod(const char *str,
size_t str_len, size_t str_len,
......
/**
* Copyright (c) 2021 OceanBase
* OceanBase Database Proxy(ODP) is licensed under Mulan PubL v2.
* You can use this software according to the terms and conditions of the Mulan PubL v2.
* You may obtain a copy of Mulan PubL v2 at:
* http://license.coscl.org.cn/MulanPubL-2.0
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PubL v2 for more details.
*/
#ifndef OB_CONFIG_H
#define OB_CONFIG_H
#define _GNU_SOURCE 1
#define SIZEOF_SIZE_T 8
#define SIZEOF_CHARP 8
#define SIZEOF_VOIDP 8
#define SIZEOF_LONG 8
#define SIZEOF_CHAR 1
#define HAS_CHAR 1
#define HAS_LONG 1
#define HAS_CHARP 1
#define SIZEOF_SHORT 2
#define HAS_SHORT 1
#define SIZEOF_INT 4
#define HAS_INT 1
#define SIZEOF_LONG_LONG 8
#define HAS_LONG_LONG 1
#define SIZEOF_OFF_T 8
#define HAS_OFF_T 1
#define SIZEOF_SIGSET_T 128
#define HAS_SIGSET_T 1
#define HAS_SIZE_T 1
#define SIZEOF_UINT 4
#define HAS_UINT 1
#define SIZEOF_ULONG 8
#define HAS_ULONG 1
#define HAS_U_INT32_T 1
#define SIZEOF_U_INT32_T 4
#define HAS_MBSTATE_T
#define MAX_INDEXES 64U
#define QSORT_TYPE_IS_VOID 1
#define SIGNAL_RETURN_TYPE_IS_VOID 1
#define VOID_SIGHANDLER 1
#define RETSIGTYPE void
#define RETQSORTTYPE void
#define STRUCT_RLIMIT struct rlimit
#define SOCKET_SIZE_TYPE socklen_t
#endif
...@@ -12,85 +12,93 @@ ...@@ -12,85 +12,93 @@
#include "lib/charset/ob_ctype.h" #include "lib/charset/ob_ctype.h"
static uint32_t static uint32
ob_convert_internal(char *to, uint32_t to_length, ob_convert_internal(char *to, uint32 to_length,
const ObCharsetInfo *to_cs, const ObCharsetInfo *to_cs,
const char *from, uint32_t from_length, const char *from, uint32 from_length,
const ObCharsetInfo *from_cs, uint32_t *errors) const ObCharsetInfo *from_cs, uint *errors)
{ {
int res; unsigned int error_num= 0;
int cnvres;
ob_wc_t wc; ob_wc_t wc;
const unsigned char *from_end = (const unsigned char*) from + from_length; const unsigned char *from_end= (const unsigned char*) from + from_length;
char *to_start= to; char *to_start= to;
unsigned char *to_end= (unsigned char*) to + to_length; unsigned char *to_end= (unsigned char*) to + to_length;
ob_charset_conv_mb_wc mb_wc= from_cs->cset->mb_wc;
ob_charset_conv_wc_mb wc_mb= to_cs->cset->wc_mb; ob_charset_conv_wc_mb wc_mb= to_cs->cset->wc_mb;
uint32_t error_count= 0; ob_charset_conv_mb_wc mb_wc= from_cs->cset->mb_wc;
pbool conitnue = TRUE;
while (1) { while (conitnue) {
if ((res = (*mb_wc)((unsigned char *) from, from_end, &wc)) > 0) { if ((cnvres= (*mb_wc)(from_cs, &wc, (unsigned char*) from, from_end)) > 0) {
from+= res; from+= cnvres;
} else if (res == OB_CS_ERR_ILLEGAL_SEQUENCE) { } else if (cnvres == OB_CS_ILSEQ) {
error_count++;
from++; from++;
wc= '?'; wc= '?';
} else if (res > OB_CS_ERR_TOOSMALL) { error_num++;
/* } else if (cnvres > OB_CS_TOOSMALL) {
A correct multibyte sequence detected from+= (-cnvres);
But it doesn't have Unicode mapping.
*/
error_count++;
from+= (-res);
wc= '?'; wc= '?';
error_num++;
} else { } else {
break; // Not enough characters break;
} }
outp: pbool go = TRUE;
if ((res= (*wc_mb)(wc, (unsigned char*) to, to_end)) > 0) { while (go) {
to+= res; go = FALSE;
} else if (res == OB_CS_ERR_ILLEGAL_UNICODE && wc != '?') { if ((cnvres= (*wc_mb)(to_cs, wc, (unsigned char*) to, to_end)) > 0)
error_count++; to+= cnvres;
wc= '?'; else if (cnvres == OB_CS_ILUNI && wc != '?') {
goto outp; error_num++;
} else { wc= '?';
break; go = TRUE;
} else {
conitnue = FALSE;
}
} }
} }
*errors= error_count; *errors= error_num;
return (uint32_t) (to - to_start); return (uint32) (to - to_start);
} }
uint32_t
ob_convert(char *to, uint32_t to_length, const ObCharsetInfo *to_cs, uint32
const char *from, uint32_t from_length, ob_convert(char *to, uint32 to_length, const ObCharsetInfo *to_cs,
const ObCharsetInfo *from_cs, uint32_t *errors) { const char *from, uint32 from_length,
uint32_t length, length2; const ObCharsetInfo *from_cs, uint *errors)
/* {
If any of the character sets is not ASCII compatible, uint32 length, length2;
immediately switch to slow mb_wc->wc_mb method.
*/
if ((to_cs->state | from_cs->state) & OB_CS_NONASCII) { if ((to_cs->state | from_cs->state) & OB_CS_NONASCII) {
return ob_convert_internal(to, to_length, to_cs, return ob_convert_internal(to, to_length, to_cs, from, from_length, from_cs, errors);
from, from_length, from_cs, errors); } else {
length= length2= OB_MIN(to_length, from_length);
} }
length= length2= to_length < from_length ? to_length : from_length; #if defined(__i386__)
while (length >= 4) {
if ((*(uint32*)from) & 0x80808080) break;
*((uint32*) to) = *((const uint32*) from);
from += 4;
to += 4;
length -= 4;
}
#endif /* __i386__ */
for (; ; *to++= *from++, length--) { while (TRUE) {
if (!length) { if (!length) {
*errors= 0; *errors= 0;
return length2; return length2;
} } else if (*((unsigned char*) from) > 0x7F) {
if (*((unsigned char*) from) > 0x7F) { /* A non-ASCII character */ uint32 copied_length= length2 - length;
uint32_t copied_length= length2 - length;
to_length-= copied_length; to_length-= copied_length;
from_length-= copied_length; from_length-= copied_length;
return copied_length + ob_convert_internal(to, to_length, to_cs, return copied_length + ob_convert_internal(to, to_length, to_cs,
from, from_length, from_cs, from, from_length, from_cs,
errors); errors);
} }
*to++= *from++;
length--;
} }
return 0; return 0;
} }
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
...@@ -31,12 +31,12 @@ typedef enum ...@@ -31,12 +31,12 @@ typedef enum
//================================================== //==================================================
double ob_strtod(const char *str, char **end, int *error); double ob_strtod(const char *str, char **end, int *error);
size_t ob_fcvt(double x, int precision, int width, char *to, ob_bool *error); size_t ob_fcvt(double x, int precision, int width, char *to, bool *error);
size_t ob_gcvt(double x, ob_gcvt_arg_type type, int width, char *to, ob_bool *error); size_t ob_gcvt(double x, ob_gcvt_arg_type type, int width, char *to, bool *error);
size_t ob_gcvt_opt(double x, ob_gcvt_arg_type type, int width, char *to, ob_bool *error, size_t ob_gcvt_opt(double x, ob_gcvt_arg_type type, int width, char *to, bool *error,
ob_bool use_oracle_mode); bool use_oracle_mode);
size_t ob_gcvt_strict(double x, ob_gcvt_arg_type type, int width, char *to, ob_bool *error, size_t ob_gcvt_strict(double x, ob_gcvt_arg_type type, int width, char *to, bool *error,
ob_bool use_oracle_mode, ob_bool use_force_e_format); bool use_oracle_mode, bool use_force_e_format);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -13,6 +13,49 @@ ...@@ -13,6 +13,49 @@
#ifndef OCEANBASE_LIB_OBMYSQL_OB_MYSQL_GLOBAL_ #ifndef OCEANBASE_LIB_OBMYSQL_OB_MYSQL_GLOBAL_
#define OCEANBASE_LIB_OBMYSQL_OB_MYSQL_GLOBAL_ #define OCEANBASE_LIB_OBMYSQL_OB_MYSQL_GLOBAL_
#define MY_GLOBAL_INCLUDED
#if !defined(__WIN__) && defined(_WIN32)
#define __WIN__
#endif
#define INNODB_COMPATIBILITY_HOOKS
#ifdef __CYGWIN__
#undef WIN
#undef WIN32
#undef _WIN
#undef _WIN32
#undef _WIN64
#undef __WIN__
#undef __WIN32__
#define HAS_ERRNO_AS_DEFINE
#endif
#if defined(i386) && !defined(__i386__)
#define __i386__
#endif
#ifdef __cplusplus
#define C_MODE_START extern "C" {
#define C_MODE_END }
#else
#define C_MODE_START
#define C_MODE_END
#endif
#ifdef __cplusplus
#define CPP_UNNAMED_NS_START namespace {
#define CPP_UNNAMED_NS_END }
#endif
#include "lib/charset/ob_config.h"
#include <stdbool.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
...@@ -37,96 +80,307 @@ ...@@ -37,96 +80,307 @@
#include <assert.h> #include <assert.h>
#define TRUE (1)
#define FALSE (0)
#define MY_MAX(a, b) ((a) > (b) ? (a) : (b))
#define MY_MIN(a, b) ((a) < (b) ? (a) : (b))
typedef unsigned char uchar; #if defined(_lint) || defined(FORCE_INIT_OF_VARS) || \
typedef signed char int8; (defined(__GNUC__) && defined(__cplusplus))
#define LINT_INIT(var) var= 0
#else
#define LINT_INIT(var)
#endif
#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || \
defined(__cplusplus) || !defined(__GNUC__)
#define UNINIT_VAR(x) x= 0
#else
#define UNINIT_VAR(x) x= x
#endif
#define set_if_smaller(a,b) do { if ((a) > (b)) (a)=(b); } while(0)
#ifndef TRUE
#define TRUE (1)
#define FALSE (0)
#endif
typedef int File;
typedef int my_socket;
#define INVALID_SOCKET -1
#define sig_handler RETSIGTYPE
#define OB_MAX(a, b) ((a) > (b) ? (a) : (b))
#define OB_MIN(a, b) ((a) < (b) ? (a) : (b))
#define MY_ALIGN(A,L) (((A) + (L) - 1) & ~((L) - 1))
#define ALIGN_SIZE(A) MY_ALIGN((A),sizeof(double))
#define NullS (char *) 0
#ifdef STDCALL
#undef STDCALL
#endif
#ifdef _WIN32
#define STDCALL __stdcall
#else
#define STDCALL
#endif
#ifndef HAS_UCHAR
typedef unsigned char uchar;
#endif
#ifndef HAS_UINT8
typedef unsigned char uint8; typedef unsigned char uint8;
typedef short int16; #endif
typedef unsigned short uint16; #ifndef HAS_INT16
typedef int int32; typedef short int16;
typedef unsigned int uint32; #endif
typedef unsigned long ulong; #ifndef HAS_UINT16
typedef unsigned long ulonglong; typedef unsigned short uint16;
typedef long longlong; #endif
#ifndef HAS_INT32
typedef int int32;
#endif
#ifndef HAS_UINT32
typedef unsigned int uint32;
#endif
#ifndef longlong_defined
#if SIZEOF_LONG_LONG != 8 || !defined(HAS_LONG_LONG)
typedef unsigned long ulonglong;
typedef long longlong;
#else
typedef unsigned long long int ulonglong;
typedef long long int longlong;
#endif
#if !defined(__USE_MISC) && !defined(HAS_ULONG)
typedef unsigned long ulong;
#endif
#endif
#ifndef HAS_INT64
typedef longlong int64; typedef longlong int64;
#endif
#ifndef HAS_UINT64
typedef ulonglong uint64; typedef ulonglong uint64;
typedef char ob_bool; #endif
#if SIZEOF_CHARP == SIZEOF_INT
typedef int int_ptr;
#elif SIZEOF_CHARP == SIZEOF_LONG
typedef long int_ptr;
#elif SIZEOF_CHARP == SIZEOF_LONG_LONG
typedef long long int_ptr;
#else
#error sizeof(void *) is neither sizeof(int) nor sizeof(long) nor sizeof(long long)
#endif
#if defined(NO_CLIENT_LONG_LONG)
typedef unsigned long my_ulonglong;
#elif !defined (__WIN__)
typedef unsigned long long my_ulonglong;
#else
typedef unsigned __int64 my_ulonglong;
#endif
#if !defined(_WIN32)
typedef off_t os_off_t;
#if SIZEOF_OFF_T <= 4
typedef unsigned long ob_off_t;
#else
typedef ulonglong ob_off_t;
#endif
#if defined(_WIN32)
typedef unsigned long long ob_off_t;
typedef unsigned long long os_off_t;
#endif
#endif
#define MY_FILEPOS_ERROR (~(ob_off_t) 0)
typedef ulonglong table_map;
typedef ulonglong nesting_map;
typedef int myf;
typedef char my_bool;
#define MYF(v) (myf) (v)
#ifndef LL
#ifdef HAS_LONG_LONG
#define LL(A) A ## LL
#else
#define LL(A) A ## L
#endif
#endif
#ifndef ULL
#ifdef HAS_LONG_LONG
#define ULL(A) A ## ULL
#else
#define ULL(A) A ## UL
#endif
#endif
#if !defined(HAS_UINT)
#undef HAS_UINT
#define HAS_UINT
typedef unsigned int uint; typedef unsigned int uint;
typedef unsigned short ushort; typedef unsigned short ushort;
#endif
#if defined(__GNUC__) && !defined(_lint)
typedef char pchar;
typedef char puchar;
typedef char pbool;
typedef short pshort;
typedef float pfloat;
#else
typedef int pchar;
typedef uint puchar;
typedef int pbool;
typedef int pshort;
typedef double pfloat;
#endif
C_MODE_START
typedef int (*qsort_cmp)(const void *,const void *);
typedef int (*qsort_cmp2)(const void*, const void *,const void *);
C_MODE_END
#define qsort_t RETQSORTTYPE
#if defined(HAS_LONG_LONG) && !defined(LONGLONG_MIN)
#define LONGLONG_MIN ((long long) 0x8000000000000000LL)
#define LONGLONG_MAX ((long long) 0x7FFFFFFFFFFFFFFFLL)
#endif
#if defined(HAS_LONG_LONG) && !defined(ULONGLONG_MAX)
//=================================================================== #ifdef ULLONG_MAX
#define ULONGLONG_MAX ULLONG_MAX
#else
#define ULONGLONG_MAX ((unsigned long long)(~0ULL))
#define ob_sint1korr(P) (*((int8_t*)(P))) #endif
#define ob_uint1korr(P) (*((uint8_t *)P)) #endif
#define ob_sint2korr(P) (int16) (*((int16 *) (P))) #define INT_MAX8 0x7F
#define ob_sint3korr(P) ((int32) ((((uchar) (P)[2]) & 128) ? \ #define INT_MIN8 (~0x7F)
(((uint32) 255L << 24) | \ #define UINT_MAX8 0xFF
(((uint32) (uchar) (P)[2]) << 16) |\ #define INT_MAX16 0x7FFF
(((uint32) (uchar) (P)[1]) << 8) | \ #define INT_MIN16 (~0x7FFF)
((uint32) (uchar) (P)[0])) : \ #define UINT_MAX16 0xFFFF
(((uint32) (uchar) (P)[2]) << 16) |\ #define INT_MAX24 0x007FFFFF
(((uint32) (uchar) (P)[1]) << 8) | \ #define INT_MIN24 (~0x007FFFFF)
((uint32) (uchar) (P)[0]))) #define UINT_MAX24 0x00FFFFFF
#define ob_sint4korr(P) (int32) (*((int32 *) (P))) #define INT_MAX32 0x7FFFFFFFL
#define ob_uint2korr(P) (uint16) (*((uint16 *) (P))) #define INT_MIN32 (~0x7FFFFFFFL)
#define ob_uint3korr(P) (uint32) (((uint32) ((uchar) (P)[0])) +\ #define UINT_MAX32 0xFFFFFFFFL
(((uint32) ((uchar) (P)[1])) << 8) +\ #define INT_MAX64 0x7FFFFFFFFFFFFFFFLL
(((uint32) ((uchar) (P)[2])) << 16)) #define INT_MIN64 (~0x7FFFFFFFFFFFFFFFLL)
#define ob_uint4korr(P) (uint32) (*((uint32 *) (P)))
#define ob_uint5korr(P) ((ulonglong)(((uint32) ((uchar) (P)[0])) +\ #ifndef DBL_MAX
(((uint32) ((uchar) (P)[1])) << 8) +\ #define DBL_MAX 1.79769313486231470e+308
(((uint32) ((uchar) (P)[2])) << 16) +\ #define FLT_MAX ((float)3.40282346638528860e+38)
(((uint32) ((uchar) (P)[3])) << 24)) +\ #endif
(((ulonglong) ((uchar) (P)[4])) << 32)) #ifndef DBL_MIN
#define ob_uint6korr(P) ((ulonglong)(((uint32) ((uchar) (P)[0])) + \ #define DBL_MIN 4.94065645841246544e-324
(((uint32) ((uchar) (P)[1])) << 8) + \ #define FLT_MIN ((float)1.40129846432481707e-45)
(((uint32) ((uchar) (P)[2])) << 16) + \ #endif
(((uint32) ((uchar) (P)[3])) << 24)) + \
(((ulonglong) ((uchar) (P)[4])) << 32) + \ #define int1store(T,A) do { *((uint8_t *)(T)) = (uint8_t)(A); } while (0)
(((ulonglong) ((uchar) (P)[5])) << 40)) #define int2store(T,A) do { unsigned char *pT= (unsigned char*)(T);\
#define ob_uint8korr(P) (ulonglong) (*((ulonglong *) (P))) *((unsigned short*)(pT))= (unsigned short) (A);\
#define ob_sint8korr(P) (longlong) (*((longlong *) (P)))
#define ob_int1store(P,V) do { *((uint8_t *)(P)) = (uint8_t)(V); } while (0)
#define ob_int2store(P,V) do { uchar *pP= (uchar*)(P);\
*((uint16*)(pP))= (uint16) (V);\
} while (0)
#define ob_int3store(P,V) do { *(P)= (uchar) ((V));\
*(P+1)=(uchar) (((uint) (V) >> 8));\
*(P+2)=(uchar) (((V) >> 16));\
} while (0) } while (0)
#define ob_int4store(P,V) do { uchar *pP= (uchar*)(P);\
*((uint32 *) (pP))= (uint32) (V); \
} while (0)
#define ob_int5store(P,V) do { *(P)= (uchar)((V));\
*((P)+1)=(uchar) (((V) >> 8));\
*((P)+2)=(uchar) (((V) >> 16));\
*((P)+3)=(uchar) (((V) >> 24));\
*((P)+4)=(uchar) (((V) >> 32));\
} while(0)
#define ob_int6store(P,V) do { *(P)= (uchar)((V)); \
*((P)+1)=(uchar) (((V) >> 8)); \
*((P)+2)=(uchar) (((V) >> 16)); \
*((P)+3)=(uchar) (((V) >> 24)); \
*((P)+4)=(uchar) (((V) >> 32)); \
*((P)+5)=(uchar) (((V) >> 40)); \
} while(0)
#define ob_int8store(P,V) do { uchar *pP= (uchar*)(P);\
*((ulonglong *) (pP))= (ulonglong) (V);\
} while(0)
#define int3store(T,A) do { *(T)= (unsigned char) ((A));\
*(T+1)=(unsigned char) (((uint) (A) >> 8));\
*(T+2)=(unsigned char) (((A) >> 16));\
} while (0)
#define int4store(T,A) do { unsigned char *pT= (unsigned char*)(T);\
*((unsigned int *) (pT))= (unsigned int) (A); \
} while (0)
#define int5store(T,A) do { *(T)= (unsigned char)((A));\
*((T)+1)=(unsigned char) (((A) >> 8));\
*((T)+2)=(unsigned char) (((A) >> 16));\
*((T)+3)=(unsigned char) (((A) >> 24));\
*((T)+4)=(unsigned char) (((A) >> 32));\
} while(0)
#define int6store(T,A) do { *(T)= (unsigned char)((A)); \
*((T)+1)=(unsigned char) (((A) >> 8)); \
*((T)+2)=(unsigned char) (((A) >> 16)); \
*((T)+3)=(unsigned char) (((A) >> 24)); \
*((T)+4)=(unsigned char) (((A) >> 32)); \
*((T)+5)=(unsigned char) (((A) >> 40)); \
} while(0)
#define int8store(T,A) do { unsigned char *pT= (unsigned char*)(T);\
*((uint64 *) (pT))= (uint64) (A);\
} while(0)
#define uint1korr(A) (*((uint8_t *)A))
#define uint2korr(A) (unsigned short) (*((unsigned short *) (A)))
#define uint3korr(A) (unsigned int) (((unsigned int) ((unsigned char) (A)[0])) +\
(((unsigned int) ((unsigned char) (A)[1])) << 8) +\
(((unsigned int) ((unsigned char) (A)[2])) << 16))
#define uint4korr(A) (unsigned int) (*((unsigned int *) (A)))
#define uint5korr(A) ((uint64)(((unsigned int) ((unsigned char) (A)[0])) +\
(((unsigned int) ((unsigned char) (A)[1])) << 8) +\
(((unsigned int) ((unsigned char) (A)[2])) << 16) +\
(((unsigned int) ((unsigned char) (A)[3])) << 24)) +\
(((uint64) ((unsigned char) (A)[4])) << 32))
#define uint6korr(A) ((uint64)(((unsigned int) ((unsigned char) (A)[0])) + \
(((unsigned int) ((unsigned char) (A)[1])) << 8) + \
(((unsigned int) ((unsigned char) (A)[2])) << 16) + \
(((unsigned int) ((unsigned char) (A)[3])) << 24)) + \
(((uint64) ((unsigned char) (A)[4])) << 32) + \
(((uint64) ((unsigned char) (A)[5])) << 40))
#define uint8korr(A) (uint64) (*((uint64 *) (A)))
#define sint1korr(A) (*((int8_t*)(A)))
#define sint2korr(A) (short) (*((short *) (A)))
#define sint3korr(A) ((int) ((((unsigned char) (A)[2]) & 128) ? \
(((unsigned int) 255L << 24) | \
(((unsigned int) (unsigned char) (A)[2]) << 16) |\
(((unsigned int) (unsigned char) (A)[1]) << 8) | \
((unsigned int) (unsigned char) (A)[0])) : \
(((unsigned int) (unsigned char) (A)[2]) << 16) |\
(((unsigned int) (unsigned char) (A)[1]) << 8) | \
((unsigned int) (unsigned char) (A)[0])))
#define sint4korr(A) (int) (*((int *) (A)))
#define sint8korr(A) (int64) (*((int64 *) (A)))
#ifndef MYSQL_PLUGIN_IMPORT
#if (defined(_WIN32) && defined(MYSQL_DYNAMIC_PLUGIN))
#define MYSQL_PLUGIN_IMPORT __declspec(dllimport)
#else
#define MYSQL_PLUGIN_IMPORT
#endif
#endif
enum loglevel { enum loglevel {
ERROR_LEVEL= 0, ERROR_LEVEL= 0,
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册