From f302921b7db2e9ec6c6b15969f6b41413b460810 Mon Sep 17 00:00:00 2001 From: Wesley Wang Date: Sat, 11 Sep 2021 19:10:55 +0800 Subject: [PATCH] Feature 1. Optimize the use of epoll_wait, fully event-driven 2. New replication table supports evenly distributed routing 3. Support weak read requests sent to backup copies 4. Supports random selection of the partition route when the partition cannot be calculated 5. Supports routing that contains Chinese full-width punctuation(commas, brackets, spaces) 6. Support COM_CHANGE_USER command Bugfix 1. Fix the problem of client connection failure when enable_proxy_scramble is configured as true 2. Fix that after starting through rslist, the server list is not rebuilt after the server is offline, and the server still accesses the offline server, which causes the access to continue to fail 3. Fix the problem that the 127.0.0.1 rslist cannot be matched with the server in all_server and cannot be accessed at startup 4. Fix the problem that ODP cannot be accessed normally from the local configuration file after OCP hangs 5. Fix the problem of ODP tenant name being injected 6. Fix the problem that thread variables cannot be synchronized when switching sessions in ODP 3.x 7. Fix the problem that hint contains special symbols, which causes insertion and parsing to fail 8. Fix the disconnection problem when the cursor does not exist 9. Fix the problem that the connection to the main library without cluster id can be successfully executed after several queries and the link is broken 11.Fix the problem of continuous access failure if rslist is returned to rslist after rslist is started --- configure.ac | 6 +- src/common/ob_obj_cast.cpp | 41 +- src/common/ob_obj_cast.h | 1 + src/lib/lock/ob_mutex.h | 14 + src/lib/net/ob_addr.h | 7 +- src/obproxy/cmd/ob_alter_config_handler.cpp | 3 +- src/obproxy/cmd/ob_dds_config_handler.cpp | 13 +- src/obproxy/cmd/ob_dds_config_handler.h | 3 +- .../ob_proxy_parallel_execute_cont.cpp | 2 +- src/obproxy/iocore/eventsystem/ob_ethread.cpp | 21 +- src/obproxy/iocore/eventsystem/ob_ethread.h | 2 + src/obproxy/iocore/eventsystem/ob_lock.h | 25 +- .../iocore/eventsystem/ob_protected_queue.cpp | 23 +- src/obproxy/iocore/net/Makemodule.am | 1 + src/obproxy/iocore/net/ob_event_io.h | 1 + src/obproxy/iocore/net/ob_net.cpp | 3 - src/obproxy/iocore/net/ob_net.h | 1 - src/obproxy/iocore/net/ob_socket_manager.h | 2 - src/obproxy/iocore/net/ob_timerfd_manager.h | 77 + src/obproxy/iocore/net/ob_unix_net.cpp | 52 +- src/obproxy/iocore/net/ob_unix_net.h | 5 +- .../iocore/net/ob_unix_net_vconnection.cpp | 6 + src/obproxy/ob_proxy.cpp | 31 +- src/obproxy/obutils/ob_cached_variables.cpp | 6 + src/obproxy/obutils/ob_cached_variables.h | 3 + .../obutils/ob_config_server_processor.cpp | 25 +- .../obutils/ob_config_server_processor.h | 4 +- src/obproxy/obutils/ob_congestion_manager.h | 1 + .../obutils/ob_hot_upgrade_processor.cpp | 5 +- src/obproxy/obutils/ob_proxy_config.h | 4 +- .../obutils/ob_proxy_config_processor.cpp | 8 +- .../ob_proxy_create_server_conn_cont.cpp | 4 +- .../obutils/ob_proxy_json_config_info.cpp | 175 +- .../obutils/ob_proxy_json_config_info.h | 7 +- src/obproxy/obutils/ob_proxy_sql_parser.cpp | 3 +- src/obproxy/obutils/ob_proxy_sql_parser.h | 1 + .../obutils/ob_resource_pool_processor.cpp | 20 +- .../obutils/ob_server_state_processor.cpp | 5 +- src/obproxy/opsql/Makemodule.am | 22 +- .../opsql/dual_parser/ob_dual_parser.cpp | 9 +- .../opsql/dual_parser/ob_dual_parser.h | 7 +- src/obproxy/opsql/expr_parser/gen_parser.sh | 95 +- .../opsql/expr_parser/ob_expr_parser.h | 38 +- .../opsql/expr_parser/ob_expr_parser.l | 12 +- .../opsql/expr_parser/ob_expr_parser.y | 9 +- .../expr_parser/ob_expr_parser_utf8_lex.c | 2743 +++++++ .../expr_parser/ob_expr_parser_utf8_lex.h | 349 + .../expr_parser/ob_expr_parser_utf8_tab.c | 2529 +++++++ .../expr_parser/ob_expr_parser_utf8_tab.h | 131 + .../opsql/expr_resolver/ob_expr_resolver.cpp | 7 +- src/obproxy/opsql/parser/gen_parser.sh | 93 +- src/obproxy/opsql/parser/ob_proxy_parser.h | 25 +- src/obproxy/opsql/parser/ob_proxy_parser.l | 156 +- src/obproxy/opsql/parser/ob_proxy_parser.y | 11 +- .../opsql/parser/ob_proxy_parser_utf8_lex.c | 6714 +++++++++++++++++ .../opsql/parser/ob_proxy_parser_utf8_lex.h | 370 + .../opsql/parser/ob_proxy_parser_utf8_tab.c | 4397 +++++++++++ .../opsql/parser/ob_proxy_parser_utf8_tab.h | 260 + src/obproxy/proxy/client/ob_client_utils.cpp | 19 +- src/obproxy/proxy/client/ob_client_utils.h | 22 +- src/obproxy/proxy/client/ob_client_vc.cpp | 54 +- src/obproxy/proxy/client/ob_client_vc.h | 4 + .../proxy/client/ob_mysql_client_pool.cpp | 3 +- .../proxy/client/ob_mysql_client_pool.h | 1 + src/obproxy/proxy/client/ob_mysql_proxy.cpp | 14 +- src/obproxy/proxy/client/ob_mysql_proxy.h | 6 +- .../proxy/client/ob_raw_mysql_client.cpp | 29 +- .../proxy/client/ob_raw_mysql_client.h | 3 +- .../proxy/mysql/ob_mysql_client_session.cpp | 1 - src/obproxy/proxy/mysql/ob_mysql_sm.cpp | 47 +- src/obproxy/proxy/mysql/ob_mysql_sm.h | 1 + src/obproxy/proxy/mysql/ob_mysql_transact.cpp | 191 +- src/obproxy/proxy/mysql/ob_mysql_transact.h | 7 +- .../proxy/mysqllib/ob_mysql_common_define.h | 2 +- .../mysqllib/ob_mysql_request_analyzer.cpp | 11 +- .../mysqllib/ob_mysql_request_analyzer.h | 4 +- .../mysqllib/ob_mysql_request_builder.cpp | 2 - .../proxy/mysqllib/ob_proxy_session_info.cpp | 15 +- .../proxy/mysqllib/ob_proxy_session_info.h | 38 +- .../ob_proxy_session_info_handler.cpp | 75 +- .../mysqllib/ob_proxy_session_info_handler.h | 4 + .../proxy/mysqllib/ob_session_field_mgr.cpp | 16 +- src/obproxy/proxy/route/ob_ldc_location.cpp | 12 +- src/obproxy/proxy/route/ob_ldc_location.h | 1 + src/obproxy/proxy/route/ob_ldc_route.cpp | 89 + src/obproxy/proxy/route/ob_ldc_route.h | 21 + src/obproxy/proxy/route/ob_ldc_struct.h | 185 +- src/obproxy/proxy/route/ob_mysql_route.cpp | 9 +- src/obproxy/proxy/route/ob_mysql_route.h | 6 +- .../proxy/route/ob_partition_entry.cpp | 1 + src/obproxy/proxy/route/ob_partition_entry.h | 6 +- src/obproxy/proxy/route/ob_route_struct.cpp | 1 + src/obproxy/proxy/route/ob_route_struct.h | 20 +- src/obproxy/proxy/route/ob_route_utils.cpp | 87 +- src/obproxy/proxy/route/ob_routine_cache.cpp | 38 +- src/obproxy/proxy/route/ob_routine_cache.h | 23 +- src/obproxy/proxy/route/ob_server_route.cpp | 1 + src/obproxy/proxy/route/ob_server_route.h | 40 +- src/obproxy/proxy/route/ob_table_cache.h | 1 + src/obproxy/proxy/route/ob_table_entry.cpp | 1 + src/obproxy/proxy/route/ob_table_entry.h | 5 +- .../proxy/route/obproxy_expr_calculator.cpp | 116 +- .../proxy/route/obproxy_expr_calculator.h | 9 +- src/obproxy/proxy/route/obproxy_part_mgr.cpp | 227 +- src/obproxy/proxy/route/obproxy_part_mgr.h | 27 +- src/rpc/obmysql/ob_mysql_packet.cpp | 29 + src/rpc/obmysql/ob_mysql_packet.h | 5 +- src/rpc/obmysql/packet/ompk_change_user.cpp | 308 +- src/rpc/obmysql/packet/ompk_change_user.h | 105 +- src/share/part/ob_part_desc.cpp | 8 + src/share/part/ob_part_desc.h | 1 + src/share/part/ob_part_desc_hash.cpp | 20 +- src/share/part/ob_part_desc_hash.h | 1 + src/share/part/ob_part_desc_key.cpp | 20 +- src/share/part/ob_part_desc_key.h | 1 + src/share/part/ob_part_desc_list.cpp | 30 +- src/share/part/ob_part_desc_list.h | 9 +- src/share/part/ob_part_desc_range.cpp | 32 +- src/share/part/ob_part_desc_range.h | 12 +- unittest/obproxy/ob_expr_parser_checker.cpp | 89 +- unittest/obproxy/ob_expr_parser_checker.h | 7 +- unittest/obproxy/obproxy_parser_checker.cpp | 34 +- unittest/obproxy/obproxy_parser_checker.h | 12 +- unittest/obproxy/obproxy_parser_test.cpp | 4 +- unittest/obproxy/test_dual_parser.cpp | 14 +- unittest/obproxy/test_eventsystem_api.cpp | 1 - unittest/obproxy/test_ldc_location.cpp | 9 +- 127 files changed, 20198 insertions(+), 636 deletions(-) create mode 100644 src/obproxy/iocore/net/ob_timerfd_manager.h create mode 100644 src/obproxy/opsql/expr_parser/ob_expr_parser_utf8_lex.c create mode 100644 src/obproxy/opsql/expr_parser/ob_expr_parser_utf8_lex.h create mode 100644 src/obproxy/opsql/expr_parser/ob_expr_parser_utf8_tab.c create mode 100644 src/obproxy/opsql/expr_parser/ob_expr_parser_utf8_tab.h create mode 100644 src/obproxy/opsql/parser/ob_proxy_parser_utf8_lex.c create mode 100644 src/obproxy/opsql/parser/ob_proxy_parser_utf8_lex.h create mode 100644 src/obproxy/opsql/parser/ob_proxy_parser_utf8_tab.c create mode 100644 src/obproxy/opsql/parser/ob_proxy_parser_utf8_tab.h diff --git a/configure.ac b/configure.ac index 02f73f2..cffaf5a 100644 --- a/configure.ac +++ b/configure.ac @@ -1,10 +1,10 @@ AC_INIT([OceanBase], - [3.1.0], - [huating.zmq@alipay.com], + [3.2.0], + [wgs13579@gmail.com], [obproxy], [http://oceanbase.taobao.org/]) - obapi_version="3.1.0" + obapi_version="3.2.0" AC_SUBST(obapi_version) AC_DISABLE_STATIC diff --git a/src/common/ob_obj_cast.cpp b/src/common/ob_obj_cast.cpp index 253e939..99eafd9 100644 --- a/src/common/ob_obj_cast.cpp +++ b/src/common/ob_obj_cast.cpp @@ -2613,9 +2613,43 @@ static int string_string(const ObObjType expect_type, ObObjCastParams ¶ms, } else { ObString str; in.get_string(str); - ret = copy_string(params, expect_type, str, out); - if (CS_TYPE_INVALID != in.get_collation_type()) { - out.set_collation_type(in.get_collation_type()); + if (0 != str.length() + && CS_TYPE_BINARY != in.get_collation_type() + && CS_TYPE_BINARY != params.dest_collation_ + && (ObCharset::charset_type_by_coll(in.get_collation_type()) + != ObCharset::charset_type_by_coll(params.dest_collation_))) { + char *buf = NULL; + // buf_len is related to the encoding length, gbk uses 2 bytes to encode a character, utf8mb4 uses 1 to 4 bytes + // CharConvertFactorNum is a multiple of the requested memory size + const int32_t CharConvertFactorNum = 2; + int32_t buf_len = str.length() * CharConvertFactorNum; + uint32_t result_len = 0; + if (OB_UNLIKELY(NULL == (buf = static_cast(params.alloc(buf_len))))) { + ret = OB_ALLOCATE_MEMORY_FAILED; + LOG_ERROR("alloc memory failed", K(ret)); + } else if (OB_FAIL(ObCharset::charset_convert(in.get_collation_type(), + str.ptr(), + str.length(), + params.dest_collation_, + buf, + buf_len, + result_len))) { + LOG_WARN("charset convert failed", K(ret), K(in.get_collation_type()), K(params.dest_collation_)); + } + + LOG_DEBUG("convert result", K(str), "result", ObHexEscapeSqlStr(ObString(result_len, buf))); + + if (OB_SUCC(ret)) { + out.set_string(expect_type, buf, static_cast(result_len)); + if (CS_TYPE_INVALID != in.get_collation_type()) { + out.set_collation_type(params.dest_collation_); + } + } + } else { + ret = copy_string(params, expect_type, str, out); + if (CS_TYPE_INVALID != in.get_collation_type()) { + out.set_collation_type(in.get_collation_type()); + } } } if (OB_SUCC(ret)) { @@ -3230,6 +3264,7 @@ int ObObjCasterV2::to_type(const ObObjType expect_type, const ObCollationType ex const ObObjTypeClass in_tc = in_obj.get_type_class(); const ObObjTypeClass out_tc = ob_obj_type_class(expect_type); cast_ctx.warning_ = OB_SUCCESS; + cast_ctx.dest_collation_ = expect_cs_type; if (OB_UNLIKELY(ob_is_invalid_obj_tc(in_tc) || ob_is_invalid_obj_tc(out_tc))) { ret = OB_ERR_UNEXPECTED; LOG_WARN("unexpected type", K(ret), K(in_obj), K(expect_type)); diff --git a/src/common/ob_obj_cast.h b/src/common/ob_obj_cast.h index 06d6cb9..a4bdd1a 100644 --- a/src/common/ob_obj_cast.h +++ b/src/common/ob_obj_cast.h @@ -121,6 +121,7 @@ struct ObObjCastParams const ObZerofillInfo *zf_info_; ObCollationType connection_collation_; ObAccuracy *res_accuracy_; + ObCollationType dest_collation_; }; /** * cast functions to do the real work diff --git a/src/lib/lock/ob_mutex.h b/src/lib/lock/ob_mutex.h index 6c926ba..5f38311 100644 --- a/src/lib/lock/ob_mutex.h +++ b/src/lib/lock/ob_mutex.h @@ -39,6 +39,20 @@ private: DISALLOW_COPY_AND_ASSIGN(ObMutex); }; +static inline int mutex_acquire(ObMutex *m) +{ + return m->lock(); +} + +static inline bool mutex_try_acquire(ObMutex *m) +{ + return common::OB_SUCCESS == m->trylock(); +} +static inline int mutex_release(ObMutex *m) +{ + return m->unlock(); +} + typedef ObLockGuard ObMutexGuard; } // end of namespace lib diff --git a/src/lib/net/ob_addr.h b/src/lib/net/ob_addr.h index 42d8b84..5d92f6f 100644 --- a/src/lib/net/ob_addr.h +++ b/src/lib/net/ob_addr.h @@ -63,6 +63,11 @@ public: memset(&ip_, 0, sizeof (ip_)); } + inline bool is_ip_loopback() const + { + return (IPV4 == version_ && INADDR_LOOPBACK == ip_.v4_) + || (IPV6 == version_ && IN6_IS_ADDR_LOOPBACK(ip_.v6_)); + } static uint32_t convert_ipv4_addr(const char *ip); int64_t to_string(char *buffer, const int64_t size) const; @@ -101,7 +106,7 @@ private: VER version_; union { - uint32_t v4_; + uint32_t v4_; //host byte order uint32_t v6_[4]; } ip_; int32_t port_; diff --git a/src/obproxy/cmd/ob_alter_config_handler.cpp b/src/obproxy/cmd/ob_alter_config_handler.cpp index bd92059..f53b211 100644 --- a/src/obproxy/cmd/ob_alter_config_handler.cpp +++ b/src/obproxy/cmd/ob_alter_config_handler.cpp @@ -69,7 +69,8 @@ int ObAlterConfigSetHandler::handle_set_config(int event, void *data) ObString value_string(value_str_); if ((0 == key_string.case_compare("observer_sys_password") - || 0 == key_string.case_compare("obproxy_sys_password")) + || 0 == key_string.case_compare("obproxy_sys_password") + || 0 == key_string.case_compare("observer_sys_password1")) && !value_string.empty()) { char passwd_staged1_buf[ENC_STRING_BUF_LEN]; ObString passwd_string(ENC_STRING_BUF_LEN, passwd_staged1_buf); diff --git a/src/obproxy/cmd/ob_dds_config_handler.cpp b/src/obproxy/cmd/ob_dds_config_handler.cpp index 91dfd7f..71e0d26 100644 --- a/src/obproxy/cmd/ob_dds_config_handler.cpp +++ b/src/obproxy/cmd/ob_dds_config_handler.cpp @@ -309,7 +309,8 @@ int ObDdsConfigHandler::handle_select_sql_variables() } if (OB_FAIL(ret)) { //do nothing - } else if (OB_FAIL(handle_parse_where_fields(&allocator, expr_result))) { + } else if (OB_FAIL(handle_parse_where_fields(&allocator, expr_result, + static_cast(sm_->get_client_session()->get_session_info().get_collation_connection())))) { WARN_ICMD("fail to parse where fileds", K(ret)); } else { ObString app_block = table_name; @@ -335,7 +336,8 @@ int ObDdsConfigHandler::handle_select_sql_variables() return event_ret; } -int ObDdsConfigHandler::handle_parse_where_fields(ObArenaAllocator* allocator, ObExprParseResult& expr_result) +int ObDdsConfigHandler::handle_parse_where_fields(ObArenaAllocator* allocator, ObExprParseResult& expr_result, + ObCollationType connection_collation) { int ret = OB_SUCCESS; bool need_parse_fields = true; @@ -360,7 +362,9 @@ int ObDdsConfigHandler::handle_parse_where_fields(ObArenaAllocator* allocator, O } else { ObExprParser expr_parser(*allocator, parse_mode); expr_result.part_key_info_.key_num_ = 0; - if (OB_FAIL(expr_parser.parse_reqsql(sql, sql_parse_result.get_parsed_length(), expr_result, sql_parse_result.get_stmt_type()))) { + if (OB_FAIL(expr_parser.parse_reqsql(sql, sql_parse_result.get_parsed_length(), + expr_result, sql_parse_result.get_stmt_type(), + connection_collation))) { WARN_ICMD("fail to do expr parse_reqsql", K(sql), K(ret)); } else { DEBUG_ICMD("parse success:", K(sql), K(expr_result.all_relation_info_.relation_num_)); @@ -445,7 +449,8 @@ int ObDdsConfigHandler::handle_update_variables() ObString table_name = client_request.get_parse_result().get_table_name(); ObArenaAllocator allocator; ObExprParseResult expr_result; - if (OB_FAIL(handle_parse_where_fields(&allocator, expr_result))) { + if (OB_FAIL(handle_parse_where_fields(&allocator, expr_result, + static_cast(sm_->get_client_session()->get_session_info().get_collation_connection())))) { WARN_ICMD("fail to parse where fileds", K(ret)); } else { ObString app_block = table_name; diff --git a/src/obproxy/cmd/ob_dds_config_handler.h b/src/obproxy/cmd/ob_dds_config_handler.h index d580bc9..da9a976 100644 --- a/src/obproxy/cmd/ob_dds_config_handler.h +++ b/src/obproxy/cmd/ob_dds_config_handler.h @@ -56,7 +56,8 @@ private: common::ObString& config_val); int handle_parse_where_fields(common::ObArenaAllocator* allocator, - ObExprParseResult& expr_result); + ObExprParseResult& expr_result, + common::ObCollationType connection_collation); int update_dds_config_to_processor(const common::ObString& app_name, const common::ObString& app_version, const common::ObString& app_block, diff --git a/src/obproxy/executor/ob_proxy_parallel_execute_cont.cpp b/src/obproxy/executor/ob_proxy_parallel_execute_cont.cpp index 84bc558..1ed1f4d 100644 --- a/src/obproxy/executor/ob_proxy_parallel_execute_cont.cpp +++ b/src/obproxy/executor/ob_proxy_parallel_execute_cont.cpp @@ -103,7 +103,7 @@ int ObProxyParallelResp::next(ObObj *&rows) } else { ObCastCtx cast_ctx(allocator_, NULL, CM_NULL_ON_WARN, cs_type); // use src_obj as buf_obj - if (OB_FAIL(ObObjCasterV2::to_type(ob_type, cast_ctx, rows[i], rows[i]))) { + if (OB_FAIL(ObObjCasterV2::to_type(ob_type, cs_type, cast_ctx, rows[i], rows[i]))) { COMMON_LOG(WARN, "failed to cast obj", "idx", i, "row", rows[i], K(ob_type), K(cs_type), K(ret)); } } diff --git a/src/obproxy/iocore/eventsystem/ob_ethread.cpp b/src/obproxy/iocore/eventsystem/ob_ethread.cpp index 7084a86..95d764b 100644 --- a/src/obproxy/iocore/eventsystem/ob_ethread.cpp +++ b/src/obproxy/iocore/eventsystem/ob_ethread.cpp @@ -348,7 +348,7 @@ void ObEThread::execute() Que(ObEvent, link_) negative_queue; ObEvent *e = NULL; ObHRTime next_time = 0; - ObHRTime sleep_time = 0; + sleep_time_ = 0; bool done_one = false; //NOTE:: the precision of schedule in ObEThread is [-5ms, 60ms) @@ -389,6 +389,21 @@ void ObEThread::execute() } //3.1 execute all the available external events that have already been dequeued dequeue_local_event(negative_queue); + if (ethreads_to_be_signalled_count_ > 0) { + flush_signals(this); + } + + if (event_queue_external_.get_local_queue_size() > 0 || event_queue_external_.get_atomic_list_size() > 0) { + sleep_time_ = 0; + } else { + cur_time_ = get_hrtime_internal(); + sleep_time_ = event_queue_.earliest_timeout() - cur_time_; + if (sleep_time_ <= 0) { + sleep_time_ = 0; + } else if (sleep_time_ > THREAD_MAX_HEARTBEAT_MSECONDS * HRTIME_MSECOND) { + sleep_time_ = THREAD_MAX_HEARTBEAT_MSECONDS * HRTIME_MSECOND; + } + } // execute poll events while (NULL != (e = negative_queue.dequeue())) { @@ -403,9 +418,9 @@ void ObEThread::execute() //4. wait for the appropriate event } else { next_time = event_queue_.earliest_timeout(); - sleep_time = next_time - cur_time_; + sleep_time_ = next_time - cur_time_; - if (sleep_time > THREAD_MAX_HEARTBEAT_MSECONDS * HRTIME_MSECOND) { + if (sleep_time_ > THREAD_MAX_HEARTBEAT_MSECONDS * HRTIME_MSECOND) { next_time = cur_time_ + THREAD_MAX_HEARTBEAT_MSECONDS * HRTIME_MSECOND; } // dequeue all the external events and put them in a local queue. diff --git a/src/obproxy/iocore/eventsystem/ob_ethread.h b/src/obproxy/iocore/eventsystem/ob_ethread.h index fa2b01d..527cf56 100644 --- a/src/obproxy/iocore/eventsystem/ob_ethread.h +++ b/src/obproxy/iocore/eventsystem/ob_ethread.h @@ -335,6 +335,8 @@ public: ObProtectedQueue event_queue_external_; ObPriorityEventQueue event_queue_; + ObHRTime sleep_time_; + ObEThread **ethreads_to_be_signalled_; int64_t ethreads_to_be_signalled_count_; diff --git a/src/obproxy/iocore/eventsystem/ob_lock.h b/src/obproxy/iocore/eventsystem/ob_lock.h index fea2ff2..8cc95ba 100644 --- a/src/obproxy/iocore/eventsystem/ob_lock.h +++ b/src/obproxy/iocore/eventsystem/ob_lock.h @@ -198,21 +198,14 @@ public: #endif //OB_HAS_EVENT_DEBUG } - virtual ~ObProxyMutex() { common::mutex_destroy(&the_mutex_); } + virtual ~ObProxyMutex() {} /** * Initializes the underlying mutex object. * After constructing your ObProxyMutex object, use this function * to initialize the underlying mutex object with an optional name. */ - int init() - { - int ret = common::OB_SUCCESS; - if (OB_FAIL(common::mutex_init(&the_mutex_))) { - PROXY_EVENT_LOG(ERROR, "fail to init mutex", K(ret)); - } - return ret; - } + int init() { return common::OB_SUCCESS; } void free() { @@ -221,10 +214,6 @@ public: print_lock_stats(1); #endif //OB_HAS_LOCK_CONTENTION_PROFILING #endif //OB_HAS_EVENT_DEBUG - int ret = common::OB_SUCCESS; - if (OB_FAIL(common::mutex_destroy(&the_mutex_))) { - PROXY_EVENT_LOG(ERROR, "fail to destroy mutex", K(ret)); - } op_reclaim_free(this); } @@ -241,7 +230,7 @@ public: * The platform independent mutex for the ObProxyMutex class. You * must not modify or set it directly. */ - ObMutex the_mutex_; + lib::ObMutex the_mutex_; /** * Backpointer to owning thread. @@ -286,7 +275,7 @@ inline bool mutex_trylock( PROXY_EVENT_LOG(WARN, "argument is error", K(t), K(m)); } else { if (m->thread_holding_ != t) { - if (OB_UNLIKELY(!common::mutex_try_acquire(&m->the_mutex_))) { + if (OB_UNLIKELY(!lib::mutex_try_acquire(&m->the_mutex_))) { #ifdef OB_HAS_EVENT_DEBUG lock_waiting(m->srcloc_, m->handler_); #ifdef OB_HAS_LOCK_CONTENTION_PROFILING @@ -339,7 +328,7 @@ inline bool mutex_trylock_spin( } else { if (m->thread_holding_ != t) { do { - bret = common::mutex_try_acquire(&m->the_mutex_); + bret = lib::mutex_try_acquire(&m->the_mutex_); } while (--spincnt && OB_UNLIKELY(!bret)); if (OB_UNLIKELY(!bret)) { @@ -393,7 +382,7 @@ inline bool mutex_lock( PROXY_EVENT_LOG(WARN, "argument is error", K(t), K(m)); } else { if (m->thread_holding_ != t) { - if (OB_UNLIKELY(common::OB_SUCCESS != common::mutex_acquire(&m->the_mutex_))) { + if (OB_UNLIKELY(common::OB_SUCCESS != lib::mutex_acquire(&m->the_mutex_))) { bret = false; PROXY_EVENT_LOG(ERROR, "fail to acquire mutex"); } else { @@ -444,7 +433,7 @@ inline void mutex_unlock(ObProxyMutex *m, ObEThread *t) m->handler_ = NULL; #endif //OB_HAS_EVENT_DEBUG m->thread_holding_ = NULL; - if (OB_UNLIKELY(common::OB_SUCCESS != common::mutex_release(&m->the_mutex_))) { + if (OB_UNLIKELY(common::OB_SUCCESS != lib::mutex_release(&m->the_mutex_))) { PROXY_EVENT_LOG(ERROR, "fail to release mutex"); } } diff --git a/src/obproxy/iocore/eventsystem/ob_protected_queue.cpp b/src/obproxy/iocore/eventsystem/ob_protected_queue.cpp index 5923ec1..8243557 100644 --- a/src/obproxy/iocore/eventsystem/ob_protected_queue.cpp +++ b/src/obproxy/iocore/eventsystem/ob_protected_queue.cpp @@ -32,6 +32,7 @@ #define USING_LOG_PREFIX PROXY_EVENT #include "iocore/eventsystem/ob_event_system.h" +#include "iocore/net/ob_unix_net.h" using namespace oceanbase::common; @@ -71,6 +72,9 @@ void ObProtectedQueue::enqueue(ObEvent *e, const bool fast_signal) if (OB_FAIL(signal())) { LOG_WARN("fail to do signal, it should not happened", K(ret)); } + if (NULL != e_ethread->net_poll_) { + e_ethread->get_net_poll().timerfd_settime(); + } if (fast_signal) { if (NULL != e_ethread->signal_hook_) { e_ethread->signal_hook_(*e_ethread); @@ -81,7 +85,13 @@ void ObProtectedQueue::enqueue(ObEvent *e, const bool fast_signal) #ifdef EAGER_SIGNALLING // Try to signal now and avoid deferred posting. if (OB_SUCC(e_ethread->event_queue_external_.try_signal())) { - need_break = true; + if (NULL != e_ethread->net_poll_) { + if (OB_SUCC(e_ethread->get_net_poll().timerfd_settime())) { + need_break = true; + } + } else { + need_break = true; + } } #endif if (!need_break) { @@ -146,7 +156,13 @@ void flush_signals(ObEThread *thr) // Try to signal as many threads as possible without blocking. if (NULL != thr->ethreads_to_be_signalled_[i]) { if (thr->ethreads_to_be_signalled_[i]->event_queue_external_.try_signal()) { - thr->ethreads_to_be_signalled_[i] = 0; + if (NULL != thr->ethreads_to_be_signalled_[i]->net_poll_) { + if (OB_SUCC(thr->ethreads_to_be_signalled_[i]->get_net_poll().timerfd_settime())) { + thr->ethreads_to_be_signalled_[i] = 0; + } + } else { + thr->ethreads_to_be_signalled_[i] = 0; + } } } } @@ -156,6 +172,9 @@ void flush_signals(ObEThread *thr) if (OB_FAIL(thr->ethreads_to_be_signalled_[i]->event_queue_external_.signal())) { LOG_WARN("failed to do signal, it should not happened", K(ret)); } + if (NULL != thr->ethreads_to_be_signalled_[i]->net_poll_) { + thr->ethreads_to_be_signalled_[i]->get_net_poll().timerfd_settime(); + } if (NULL != thr->ethreads_to_be_signalled_[i]->signal_hook_) { thr->ethreads_to_be_signalled_[i]->signal_hook_(*(thr->ethreads_to_be_signalled_[i])); } diff --git a/src/obproxy/iocore/net/Makemodule.am b/src/obproxy/iocore/net/Makemodule.am index 1ab7294..52936c2 100644 --- a/src/obproxy/iocore/net/Makemodule.am +++ b/src/obproxy/iocore/net/Makemodule.am @@ -5,6 +5,7 @@ obproxy/iocore/net/ob_connection.cpp\ obproxy/iocore/net/ob_inet.h\ obproxy/iocore/net/ob_inet.cpp\ obproxy/iocore/net/ob_socket_manager.h\ +obproxy/iocore/net/ob_timerfd_manager.h\ obproxy/iocore/net/ob_net_vconnection.h\ obproxy/iocore/net/ob_unix_net.h\ obproxy/iocore/net/ob_unix_net.cpp\ diff --git a/src/obproxy/iocore/net/ob_event_io.h b/src/obproxy/iocore/net/ob_event_io.h index 83c76ae..1529fa2 100644 --- a/src/obproxy/iocore/net/ob_event_io.h +++ b/src/obproxy/iocore/net/ob_event_io.h @@ -53,6 +53,7 @@ namespace net #define EVENTIO_NETACCEPT 1 #define EVENTIO_READWRITE_VC 2 #define EVENTIO_ASYNC_SIGNAL 3 +#define EVENTIO_TIMER 4 #ifdef USE_EDGE_TRIGGER_EPOLL #define USE_EDGE_TRIGGER 1 diff --git a/src/obproxy/iocore/net/ob_net.cpp b/src/obproxy/iocore/net/ob_net.cpp index 46fcf91..fc47218 100644 --- a/src/obproxy/iocore/net/ob_net.cpp +++ b/src/obproxy/iocore/net/ob_net.cpp @@ -45,8 +45,6 @@ namespace net } // This will get set via either command line or ObProxyConfig. -// epoll timeout -int net_config_poll_timeout = -1; int init_net(ObModuleVersion version, const ObNetOptions &net_options) { @@ -69,7 +67,6 @@ int init_net(ObModuleVersion version, const ObNetOptions &net_options) int update_net_options(const ObNetOptions &net_options) { int ret = OB_SUCCESS; - net_config_poll_timeout = static_cast(net_options.poll_timeout_); if (OB_FAIL(update_cop_config(net_options.default_inactivity_timeout_, net_options.max_client_connections_))) { PROXY_NET_LOG(WARN, "fail to update_cop_config", K(net_options.default_inactivity_timeout_), diff --git a/src/obproxy/iocore/net/ob_net.h b/src/obproxy/iocore/net/ob_net.h index 93966b8..f5b10de 100644 --- a/src/obproxy/iocore/net/ob_net.h +++ b/src/obproxy/iocore/net/ob_net.h @@ -79,7 +79,6 @@ namespace net struct ObNetOptions { - int64_t poll_timeout_; int64_t max_connections_; int64_t default_inactivity_timeout_; int64_t max_client_connections_; diff --git a/src/obproxy/iocore/net/ob_socket_manager.h b/src/obproxy/iocore/net/ob_socket_manager.h index 7c7cde6..e667cae 100644 --- a/src/obproxy/iocore/net/ob_socket_manager.h +++ b/src/obproxy/iocore/net/ob_socket_manager.h @@ -44,8 +44,6 @@ namespace obproxy namespace net { -extern int net_config_poll_timeout; - class ObSocketManager { ObSocketManager() { }; diff --git a/src/obproxy/iocore/net/ob_timerfd_manager.h b/src/obproxy/iocore/net/ob_timerfd_manager.h new file mode 100644 index 0000000..47c36e5 --- /dev/null +++ b/src/obproxy/iocore/net/ob_timerfd_manager.h @@ -0,0 +1,77 @@ +/** + * 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 OBPROXY_TIMERFD_MANAGER_H +#define OBPROXY_TIMERFD_MANAGER_H + +#include + +namespace oceanbase +{ +namespace obproxy +{ +namespace net +{ + +class ObTimerFdManager +{ + ObTimerFdManager() { }; + ~ObTimerFdManager() { }; +public: + static int timerfd_create(int clockid, int flags, int &timerfd); + static int timerfd_settime(int timerfd, int flags, int64_t new_value_sec, int64_t new_value_nsec); + static void timerfd_close(int timerfd); +private: + DISALLOW_COPY_AND_ASSIGN(ObTimerFdManager); +}; + +inline int ObTimerFdManager::timerfd_create(int clockid, int flags, int &timerfd) +{ + int ret = common::OB_SUCCESS; + timerfd = ::timerfd_create(clockid, flags); + if (OB_UNLIKELY(timerfd < 0)) { + ret = ob_get_sys_errno(); + } + return ret; +} + +inline int ObTimerFdManager::timerfd_settime(int timerfd, int flags, int64_t new_value_sec, int64_t new_value_nsec) +{ + int ret = common::OB_SUCCESS; + + struct itimerspec new_value; + new_value.it_value.tv_sec = new_value_sec; //Turn off the timer during initialization + new_value.it_value.tv_nsec = new_value_nsec; + + new_value.it_interval.tv_sec = 0; + new_value.it_interval.tv_nsec = 0; + + // Set the timer + ret = ::timerfd_settime(timerfd, flags, &new_value, NULL); + if (OB_UNLIKELY(ret < 0)) { + ret = ob_get_sys_errno(); + } + return ret; +} + +inline void ObTimerFdManager::timerfd_close(int timerfd) +{ + if (timerfd >= 0) { + ::close(timerfd); + } +} + +} // end of namespace net +} // end of namespace obproxy +} // end of namespace oceanbase + +#endif // OBPROXY_TIMERFD_MANAGER_H diff --git a/src/obproxy/iocore/net/ob_unix_net.cpp b/src/obproxy/iocore/net/ob_unix_net.cpp index 70c06c2..2fb3564 100644 --- a/src/obproxy/iocore/net/ob_unix_net.cpp +++ b/src/obproxy/iocore/net/ob_unix_net.cpp @@ -33,6 +33,7 @@ #include "iocore/net/ob_net.h" #include "iocore/net/ob_unix_net.h" #include "iocore/net/ob_event_io.h" +#include "iocore/net/ob_timerfd_manager.h" using namespace oceanbase::common; using namespace oceanbase::obproxy::event; @@ -205,7 +206,8 @@ int initialize_thread_for_net(ObEThread *thread) ObNetPoll::ObNetPoll(ObNetHandler &nh) : poll_descriptor_(NULL), nh_(nh), - poll_timeout_(-1) + timer_fd_(OB_INVALID_INDEX), + ep_(NULL) { } @@ -213,6 +215,13 @@ ObNetPoll::~ObNetPoll() { delete poll_descriptor_; poll_descriptor_ = NULL; + + if (NULL != ep_) { + op_reclaim_free(ep_); + ep_ = NULL; + } + + ObTimerFdManager::timerfd_close(timer_fd_); } int ObNetPoll::init() @@ -230,11 +239,36 @@ int ObNetPoll::init() PROXY_NET_LOG(WARN, "fail to init poll_descriptor"); delete poll_descriptor_; poll_descriptor_ = NULL; + } else if (OB_FAIL(ObTimerFdManager::timerfd_create(CLOCK_REALTIME, TFD_NONBLOCK, timer_fd_))) { + PROXY_NET_LOG(WARN, "fail to create timerfd", K(timer_fd_), KERRMSGS, K(ret)); + } else if (OB_FAIL(ObTimerFdManager::timerfd_settime(timer_fd_, 0, 0, 0))) { + PROXY_NET_LOG(WARN, "fail to set timerfd time", K(timer_fd_), KERRMSGS, K(ret)); + } else if (OB_ISNULL(ep_ = op_reclaim_alloc(ObEventIO))) { + ret = OB_ALLOCATE_MEMORY_FAILED; + PROXY_NET_LOG(ERROR, "fail to new ObEventIO", K(ret)); + } else { + struct epoll_event ev; + memset(&ev, 0, sizeof(ev)); + ev.events = EVENTIO_READ; + ev.data.ptr = ep_; + ep_->type_ = EVENTIO_TIMER; + if (OB_FAIL(ObSocketManager::epoll_ctl(poll_descriptor_->epoll_fd_, EPOLL_CTL_ADD, timer_fd_, &ev))) { + PROXY_NET_LOG(WARN, "fail to epoll_ctl, op is EPOLL_CTL_ADD", K(poll_descriptor_->epoll_fd_), K_(timer_fd), K(ret)); + } } } return ret; } +int ObNetPoll::timerfd_settime() +{ + int ret = OB_SUCCESS; + if (timer_fd_ > 0 && OB_FAIL(ObTimerFdManager::timerfd_settime(timer_fd_, 0, 0, 1))) { + PROXY_NET_LOG(WARN, "fail to set timer time, it should not happened", K(timer_fd_), K(ret)); + } + return ret; +} + ObInactivityCop::ObInactivityCop(ObProxyMutex *m) : ObContinuation(m), default_inactivity_timeout_(1800), total_connections_in_(0), max_connections_in_(0), connections_per_thread_in_(0) @@ -503,17 +537,18 @@ int ObNetHandler::main_net_event(int event, ObEvent *e) ObEventIO *epd = NULL; NET_INCREMENT_DYN_STAT(NET_HANDLER_RUN); - if (OB_LIKELY(!read_ready_list_.empty() || !write_ready_list_.empty() - || !read_enable_list_.empty() || !write_enable_list_.empty())) { - poll_timeout = 0; // poll immediately returns -- we have triggered stuff to process right now - } else { - poll_timeout = net_config_poll_timeout; - } if(OB_ISNULL(ethread = trigger_event_->ethread_)) { ret = OB_ERR_UNEXPECTED; PROXY_NET_LOG(WARN, "fail to get trigger_event_'s ethread", K(trigger_event_), K(ret)); } else { + if (OB_LIKELY(!read_ready_list_.empty() || !write_ready_list_.empty() + || !read_enable_list_.empty() || !write_enable_list_.empty())) { + poll_timeout = 0; // poll immediately returns -- we have triggered stuff to process right now + } else { + poll_timeout = (int32_t)(hrtime_to_msec(ethread->sleep_time_)); + } + ObPollDescriptor &pd = ethread->get_net_poll().get_poll_descriptor(); if (OB_FAIL(ObSocketManager::epoll_wait(pd.epoll_fd_, pd.epoll_triggered_events_, @@ -562,6 +597,9 @@ int ObNetHandler::main_net_event(int event, ObEvent *e) } } else if (EVENTIO_ASYNC_SIGNAL == epd->type_) { net_signal_hook_callback(*ethread); + } else if (EVENTIO_TIMER == epd->type_) { + uint64_t exp; + read(ethread->get_net_poll().get_timer_fd(), &exp, sizeof(uint64_t)); //Need to read uint64_t size, otherwise an error will occur } } } diff --git a/src/obproxy/iocore/net/ob_unix_net.h b/src/obproxy/iocore/net/ob_unix_net.h index dc63583..f8603c2 100644 --- a/src/obproxy/iocore/net/ob_unix_net.h +++ b/src/obproxy/iocore/net/ob_unix_net.h @@ -60,13 +60,16 @@ public: ~ObNetPoll(); int init(); ObPollDescriptor &get_poll_descriptor() { return *poll_descriptor_; } + int timerfd_settime(); + int get_timer_fd() { return timer_fd_; } public: ObPollDescriptor *poll_descriptor_; private: ObNetHandler &nh_; - int poll_timeout_; + int timer_fd_; + ObEventIO *ep_; DISALLOW_COPY_AND_ASSIGN(ObNetPoll); }; diff --git a/src/obproxy/iocore/net/ob_unix_net_vconnection.cpp b/src/obproxy/iocore/net/ob_unix_net_vconnection.cpp index b3a121f..1897fb2 100644 --- a/src/obproxy/iocore/net/ob_unix_net_vconnection.cpp +++ b/src/obproxy/iocore/net/ob_unix_net_vconnection.cpp @@ -309,6 +309,9 @@ inline bool ObUnixNetVConnection::handle_read_from_net_error(ObEThread &thread, read_.triggered_ = false; nh_->read_ready_list_.remove(this); } else if (0 == total_read || OB_SYS_ECONNRESET == error) { + if (OB_SYS_ETIMEDOUT == error) { + PROXY_NET_LOG(INFO, "recv OB_SYS_ETIMEDOUT error when read, maybe KeepAlive fail"); + } read_.triggered_ = false; nh_->read_ready_list_.remove(this); if (EVENT_DONE == read_signal_done(VC_EVENT_EOS)) { @@ -354,6 +357,9 @@ inline bool ObUnixNetVConnection::handle_write_to_net_error(ObEThread &thread, nh_->write_ready_list_.remove(this); write_reschedule(); } else if (0 == total_write || OB_SYS_ECONNRESET == error) { + if (OB_SYS_ETIMEDOUT == error) { + PROXY_NET_LOG(INFO, "recv OB_SYS_ETIMEDOUT erroru when write, maybe KeepAlive fail"); + } write_.triggered_ = false; if (EVENT_DONE == write_signal_done(VC_EVENT_EOS)) { is_done = true; diff --git a/src/obproxy/ob_proxy.cpp b/src/obproxy/ob_proxy.cpp index 2396bef..86e7df1 100644 --- a/src/obproxy/ob_proxy.cpp +++ b/src/obproxy/ob_proxy.cpp @@ -195,7 +195,6 @@ int ObProxy::init(ObProxyOptions &opts, ObAppVersionInfo &proxy_version) regression_cont_.set_regression_test(opts.regression_test_); #endif ObNetOptions net_options; - net_options.poll_timeout_ = usec_to_msec(config_->net_config_poll_timeout); net_options.default_inactivity_timeout_ = usec_to_sec(config_->default_inactivity_timeout); net_options.max_client_connections_ = config_->client_max_connections; @@ -273,6 +272,32 @@ int ObProxy::start() } + if (OB_SUCC(ret)) { + char *password1 = NULL; + char *password2 = NULL; + password1 = getenv("observer_sys_password"); + password2 = getenv("observer_sys_password1"); + if (NULL != password1) { + ObString key_string("observer_sys_password"); + ObString value_string(password1); + if (OB_FAIL(get_global_proxy_config().update_config_item(key_string, value_string))) { + LOG_WARN("fail to update config", K(key_string)); + } + } + + if (OB_SUCC(ret) && NULL != password2) { + ObString key_string("observer_sys_password1"); + ObString value_string(password2); + if (OB_FAIL(get_global_proxy_config().update_config_item(key_string, value_string))) { + LOG_WARN("fail to update config", K(key_string)); + } + } + + if (OB_SUCC(ret) && OB_FAIL(get_global_proxy_config().dump_config_to_local())) { + LOG_WARN("fail to dump config to local", K(ret)); + } + } + if (OB_SUCC(ret) && config_->is_metadb_used()) { if (is_force_remote_start_ && meta_client_proxy_.is_inited()) { if (OB_FAIL(meta_client_proxy_.clear_raw_execute())) { @@ -874,7 +899,6 @@ int ObProxy::do_reload_config(obutils::ObProxyConfig &config) if (OB_SUCC(ret)) { // net related ObNetOptions net_options; - net_options.poll_timeout_ = usec_to_msec(config_->net_config_poll_timeout); net_options.default_inactivity_timeout_ = usec_to_sec(config.default_inactivity_timeout); net_options.max_client_connections_ = config.client_max_connections; update_net_options(net_options); @@ -901,6 +925,7 @@ int ObProxy::get_meta_table_server(ObIArray &replicas, O const ObString user_name(ObProxyTableInfo::READ_ONLY_USERNAME); const ObString database(ObProxyTableInfo::READ_ONLY_DATABASE); ObString password(config_->observer_sys_password.str()); + ObString password1(config_->observer_sys_password1.str()); ObSEArray rs_list; // first get from local @@ -921,7 +946,7 @@ int ObProxy::get_meta_table_server(ObIArray &replicas, O if (rs_list.count() <= 0) { ret = OB_ERR_UNEXPECTED; LOG_WARN("rs_list count must > 0", K(ret)); - } else if (OB_FAIL(raw_client.init(user_name, password, database))) { + } else if (OB_FAIL(raw_client.init(user_name, password, database, password1))) { LOG_WARN("fail to init raw mysql client", K(ret)); } else if (OB_FAIL(raw_client.set_server_addr(rs_list))) { LOG_WARN("fail to set server addr", K(ret)); diff --git a/src/obproxy/obutils/ob_cached_variables.cpp b/src/obproxy/obutils/ob_cached_variables.cpp index f904681..b5d098e 100644 --- a/src/obproxy/obutils/ob_cached_variables.cpp +++ b/src/obproxy/obutils/ob_cached_variables.cpp @@ -43,6 +43,7 @@ static const ObString type_names[CACHED_VAR_MAX + 1] = { ObString(OB_SV_LOWER_CASE_TABLE_NAMES), ObString(OB_SV_TX_READ_ONLY), ObString(OB_SV_READ_CONSISTENCY), + ObString(OB_SV_COLLATION_CONNECTION), ObString("CACHED_VAR_MAX"), }; @@ -108,6 +109,11 @@ int ObCachedVariables::update_var(const ObCachedVariableType &type, const ObObj break; } + case CACHED_INT_VAR_COLLATION_CONNECTION: { + cached_vars_[index] = obj; + break; + } + case CACHED_VAR_MAX: // not a cached variables, do nothing break; diff --git a/src/obproxy/obutils/ob_cached_variables.h b/src/obproxy/obutils/ob_cached_variables.h index 8566578..d9e6bae 100644 --- a/src/obproxy/obutils/ob_cached_variables.h +++ b/src/obproxy/obutils/ob_cached_variables.h @@ -34,6 +34,7 @@ enum ObCachedVariableType CACHED_INT_VAR_LOWER_CASE_TABLE_NAMES, CACHED_INT_VAR_TX_READ_ONLY, CACHED_INT_VAR_READ_CONSISTENCY, + CACHED_INT_VAR_COLLATION_CONNECTION, CACHED_VAR_MAX, }; @@ -50,6 +51,7 @@ public: int update_var(const ObCachedVariableType &type, const common::ObObj &obj); int64_t get_query_timeout() const { return get_int_var(CACHED_INT_VAR_QUERY_TIMEOUT); } + int64_t get_collation_connection() const { return get_int_var(CACHED_INT_VAR_COLLATION_CONNECTION); } int64_t get_trx_timeout() const { return get_int_var(CACHED_INT_VAR_TRX_TIMEOUT); } int64_t get_wait_timeout() const { return get_int_var(CACHED_INT_VAR_WAIT_TIMEOUT); } int64_t get_net_read_timeout() const { return get_int_var(CACHED_INT_VAR_NET_READ_TIMEOUT); } @@ -60,6 +62,7 @@ public: int64_t get_read_consistency() const { return get_int_var(CACHED_INT_VAR_READ_CONSISTENCY); } const common::ObObj &get_query_timeout_obj() const { return get_obj_var(CACHED_INT_VAR_QUERY_TIMEOUT); } + const common::ObObj &get_collation_connection_obj() const { return get_obj_var(CACHED_INT_VAR_COLLATION_CONNECTION); } const common::ObObj &get_trx_timeout_obj() const { return get_obj_var(CACHED_INT_VAR_TRX_TIMEOUT); } const common::ObObj &get_wait_timeout_obj() const { return get_obj_var(CACHED_INT_VAR_WAIT_TIMEOUT); } const common::ObObj &get_net_read_timeout_obj() const { return get_obj_var(CACHED_INT_VAR_NET_READ_TIMEOUT); } diff --git a/src/obproxy/obutils/ob_config_server_processor.cpp b/src/obproxy/obutils/ob_config_server_processor.cpp index febf185..f35d0a9 100644 --- a/src/obproxy/obutils/ob_config_server_processor.cpp +++ b/src/obproxy/obutils/ob_config_server_processor.cpp @@ -820,7 +820,10 @@ int ObConfigServerProcessor::swap_with_rslist(ObProxyJsonConfigInfo *new_json_in && OB_FAIL(new_json_info->set_master_cluster_id(old_cluster_info.cluster_name_, old_cluster_info.master_cluster_id_))) { LOG_WARN("fail to set cluster id", K(old_cluster_info), K(ret)); - } else if (NULL != sub_cluster_info && OB_FAIL(new_json_info->set_cluster_web_rs_list(old_cluster_info.cluster_name_, old_cluster_info.master_cluster_id_, sub_cluster_info->web_rs_list_, ObString::make_string(cluster_role_to_str(sub_cluster_info->role_))))) { + } else if (NULL != sub_cluster_info + && OB_FAIL(new_json_info->set_cluster_web_rs_list(old_cluster_info.cluster_name_, old_cluster_info.master_cluster_id_, + sub_cluster_info->web_rs_list_, sub_cluster_info->origin_web_rs_list_, + ObString::make_string(cluster_role_to_str(sub_cluster_info->role_))))) { if (OB_ENTRY_NOT_EXIST != ret && OB_EAGAIN != ret) { LOG_WARN("fail to set cluster web rs_list", K(old_cluster_info), K(ret)); } else { @@ -861,7 +864,8 @@ int ObConfigServerProcessor::swap_with_rslist(ObProxyJsonConfigInfo *new_json_in } if (OB_FAIL(ret)) { } else if (OB_FAIL(new_json_info->set_cluster_web_rs_list(old_it->cluster_name_, sub_it->cluster_id_, - sub_it->web_rs_list_, ObString::make_string(cluster_role_to_str(sub_it->role_))))) { + sub_it->web_rs_list_, sub_it->origin_web_rs_list_, + ObString::make_string(cluster_role_to_str(sub_it->role_))))) { if (OB_ENTRY_NOT_EXIST != ret && OB_EAGAIN != ret) { LOG_WARN("fail to set cluster web rs_list", KPC(old_it.value_), K(ret)); } else if (OB_EAGAIN == ret) { @@ -1938,6 +1942,17 @@ int ObConfigServerProcessor::fetch_rs_list_from_url(const char *url, const ObStr return ret; } +int ObConfigServerProcessor::swap_origin_web_rslist_and_build_sys(const ObString &cluster, const int64_t cluster_id, const bool need_save_rslist_hash) +{ + int ret = OB_SUCCESS; + + if (OB_FAIL(json_config_info_->swap_origin_web_rslist_and_build_sys(cluster, cluster_id, need_save_rslist_hash))) { + LOG_WARN("fail to parse remote rslist", K(cluster), K(cluster_id), K(ret)); + } + + return ret; +} + int ObConfigServerProcessor::refresh_idc_list_from_url(const char *url, const ObString &cluster_name, const int64_t cluster_id, ObProxyIDCList &idc_list) { @@ -1951,7 +1966,7 @@ int ObConfigServerProcessor::refresh_idc_list_from_url(const char *url, LOG_ERROR("fail to alloc memory for region idc json info", K(ret)); } else if (FALSE_IT(json.assign_buffer(buf, static_cast(OB_PROXY_CONFIG_BUFFER_SIZE)))) { // impossible - } else if (OB_FAIL(do_fetch_json_info(url, json))) { + } else if (OB_FAIL(do_fetch_json_info(url, json, CURL_IDC_TRANSFER_TIMEOUT))) { LOG_INFO("fail to fetch region idc json info", K(json), K(ret)); } else { Value *root = NULL; @@ -1996,7 +2011,7 @@ int ObConfigServerProcessor::refresh_idc_list_from_url(const char *url, return ret; } -int ObConfigServerProcessor::do_fetch_json_info(const char *url, ObString &json) +int ObConfigServerProcessor::do_fetch_json_info(const char *url, ObString &json, int64_t timeout) { int ret = OB_SUCCESS; @@ -2006,7 +2021,7 @@ int ObConfigServerProcessor::do_fetch_json_info(const char *url, ObString &json) } else { int64_t fetch_attempts = 0; do { - if (OB_FAIL(fetch_by_curl(url, CURL_TRANSFER_TIMEOUT, + if (OB_FAIL(fetch_by_curl(url, timeout, static_cast(&json), write_data))) { LOG_WARN("fail to fetch json info", "try attempts:", fetch_attempts, K(url), K(is_inited_), K(ret)); } diff --git a/src/obproxy/obutils/ob_config_server_processor.h b/src/obproxy/obutils/ob_config_server_processor.h index eea7eb1..38d6568 100644 --- a/src/obproxy/obutils/ob_config_server_processor.h +++ b/src/obproxy/obutils/ob_config_server_processor.h @@ -57,6 +57,7 @@ public: const int64_t cluster_id, common::ObIArray &rs_list, const bool need_update_dummy_entry = true); + int swap_origin_web_rslist_and_build_sys(const ObString &cluster, const int64_t cluster_id, const bool need_save_rslist_hash); int refresh_idc_list(const common::ObString &cluster_name, const int64_t cluster_id, ObProxyIDCList &idc_list); @@ -176,7 +177,7 @@ private: int refresh_json_config_info(const bool force_refresh = false); int get_json_config_info(const char *url, const bool version_only = false); int parse_json_config_info(const common::ObString &json_str, const bool version_only = false); - virtual int do_fetch_json_info(const char *url, common::ObString &json); + virtual int do_fetch_json_info(const char *url, common::ObString &json, int64_t timeout = CURL_TRANSFER_TIMEOUT); int handle_content_string(char *content, const int64_t content_length); int init_json(const common::ObString &json_str, json::Value *&json_root, common::ObArenaAllocator &allocator); @@ -200,6 +201,7 @@ private: static const int64_t ITEM_STR_SIZE = 512; static const int64_t CURL_CONNECTION_TIMEOUT = 10; static const int64_t CURL_TRANSFER_TIMEOUT = 5; + static const int64_t CURL_IDC_TRANSFER_TIMEOUT = 1; static const int64_t CURL_TRANSFER_TIMEOUT_LARGE = 120; static const ObConfigServerHeaderVersion HEADER_VERSION = HEADER_VERSION_ZLIB_COMPRESS; diff --git a/src/obproxy/obutils/ob_congestion_manager.h b/src/obproxy/obutils/ob_congestion_manager.h index dd7dce4..a85d868 100644 --- a/src/obproxy/obutils/ob_congestion_manager.h +++ b/src/obproxy/obutils/ob_congestion_manager.h @@ -156,6 +156,7 @@ public: ObCongestionZoneState *get_zone_state(const common::ObString &zone_name); bool is_base_servers_added() const { return is_base_servers_added_; } void set_base_servers_added() { is_base_servers_added_ = true; } + void clear_base_servers_added() { is_base_servers_added_ = false; } bool is_congestion_avail(); int update_tc_congestion_map(ObCongestionEntry &entry); DECLARE_TO_STRING; diff --git a/src/obproxy/obutils/ob_hot_upgrade_processor.cpp b/src/obproxy/obutils/ob_hot_upgrade_processor.cpp index 660a3d4..036bbfe 100644 --- a/src/obproxy/obutils/ob_hot_upgrade_processor.cpp +++ b/src/obproxy/obutils/ob_hot_upgrade_processor.cpp @@ -1318,6 +1318,7 @@ int ObHotUpgradeProcessor::init_raw_client(ObRawMysqlClient &raw_client, const O //1. get config server username and passwd ObString string_username; ObString string_passwd; + ObString string_passwd1; ObString string_db; char full_user_name[OB_PROXY_FULL_USER_NAME_MAX_LEN + 1] = {0}; char passwd_staged1_buf[ENC_STRING_BUF_LEN] = {0}; // 1B '*' + 40B octal num @@ -1360,6 +1361,8 @@ int ObHotUpgradeProcessor::init_raw_client(ObRawMysqlClient &raw_client, const O string_username.assign_ptr(full_user_name, static_cast(pos)); string_passwd.assign_ptr(get_global_proxy_config().observer_sys_password.str(), static_cast(strlen(get_global_proxy_config().observer_sys_password.str()))); + string_passwd1.assign_ptr(get_global_proxy_config().observer_sys_password1.str(), + static_cast(strlen(get_global_proxy_config().observer_sys_password1.str()))); string_db.assign_ptr(ObProxyTableInfo::READ_ONLY_DATABASE, static_cast(STRLEN(ObProxyTableInfo::READ_ONLY_DATABASE))); } @@ -1394,7 +1397,7 @@ int ObHotUpgradeProcessor::init_raw_client(ObRawMysqlClient &raw_client, const O LOG_WARN("fail to set addr", K(proxy_ip_), K(proxy_port_), K(ret)); } else if (OB_FAIL(local_addrs.push_back(addr))) { LOG_WARN("fail to push addr to local_addrs", K(addr), K(ret)); - } else if (OB_FAIL(raw_client.init(string_username, string_passwd, string_db))) { + } else if (OB_FAIL(raw_client.init(string_username, string_passwd, string_db, string_passwd1))) { LOG_WARN("fail to init raw mysql client", K(string_username), K(string_db), K(ret)); } else if (OB_FAIL(raw_client.set_server_addr(local_addrs))) { LOG_WARN("fail to set server addr", K(ret)); diff --git a/src/obproxy/obutils/ob_proxy_config.h b/src/obproxy/obutils/ob_proxy_config.h index 86c374e..d30f4a8 100644 --- a/src/obproxy/obutils/ob_proxy_config.h +++ b/src/obproxy/obutils/ob_proxy_config.h @@ -200,7 +200,7 @@ public: //net related DEF_BOOL(frequent_accept, "true", "frequent accept", CFG_NEED_REBOOT, CFG_SECTION_OBPROXY, CFG_VISIBLE_LEVEL_USER); DEF_INT(net_accept_threads, "2", "[0,8]", "net accept threads num, [0, 8]", CFG_NEED_REBOOT, CFG_SECTION_OBPROXY, CFG_VISIBLE_LEVEL_USER); - DEF_TIME(net_config_poll_timeout, "1ms", "[0,]", "epoll_wait timeout for net events, [0, +∞], if set a value <= 0, proxy treat it as 0", CFG_NO_NEED_REBOOT, CFG_SECTION_OBPROXY, CFG_VISIBLE_LEVEL_USER); + DEF_TIME(net_config_poll_timeout, "1ms", "[0,]", "not used, just for compatible", CFG_NO_NEED_REBOOT, CFG_SECTION_OBPROXY, CFG_VISIBLE_LEVEL_USER); DEF_TIME(default_inactivity_timeout, "180000s", "[1s,30d]", "default inactivity timeout, [1s, 30d]", CFG_NO_NEED_REBOOT, CFG_SECTION_OBPROXY, CFG_VISIBLE_LEVEL_USER); DEF_CAP(sock_recv_buffer_size_out, "0", "[0,8MB]", "sock param, recv buffer size, [0, 8MB], if set a negative value, proxy treat it as 0", CFG_NO_NEED_REBOOT, CFG_SECTION_OBPROXY, CFG_VISIBLE_LEVEL_USER); DEF_CAP(sock_send_buffer_size_out, "0", "[0,8MB]", "sock param, send buffer size, [0, 8MB], if set a negative value, proxy treat it as 0", CFG_NO_NEED_REBOOT, CFG_SECTION_OBPROXY, CFG_VISIBLE_LEVEL_USER); @@ -345,6 +345,7 @@ public: // in public cloud, will assign a vip addr to proxy. qa_mode_mock_slb_vip is a vip addr for testing DEF_STR(qa_mode_mock_public_cloud_slb_addr, "127.0.0.1:33045", "mock public cloud slb addr", CFG_NO_NEED_REBOOT, CFG_SECTION_OBPROXY, CFG_VISIBLE_LEVEL_USER); DEF_INT(qa_mode_mock_public_cloud_vid, "1", "[1,102400]", "mock public cloud vid", CFG_NO_NEED_REBOOT, CFG_SECTION_OBPROXY, CFG_VISIBLE_LEVEL_USER); + DEF_STR(proxy_route_policy, "", "proxy route policy", CFG_NO_NEED_REBOOT, CFG_SECTION_OBPROXY, CFG_VISIBLE_LEVEL_SYS); DEF_STR(mysql_version, "5.6.25", "returned version for mysql mode, default value is 5.6.25. If set, proxy will send new version when user connect to proxy", CFG_NO_NEED_REBOOT, CFG_SECTION_OBPROXY, CFG_VISIBLE_LEVEL_USER) // sql table cache @@ -436,6 +437,7 @@ public: DEF_STR(inspector_password, "", "password for inspector user", CFG_NO_NEED_REBOOT, CFG_SECTION_OBPROXY, CFG_VISIBLE_LEVEL_SYS); DEF_STR(obproxy_sys_password, "", "password for obproxy sys user", CFG_NO_NEED_REBOOT, CFG_SECTION_OBPROXY, CFG_VISIBLE_LEVEL_SYS); DEF_STR(observer_sys_password, "", "password for observer sys user", CFG_NO_NEED_REBOOT, CFG_SECTION_OBPROXY, CFG_VISIBLE_LEVEL_SYS); + DEF_STR(observer_sys_password1, "", "password for observer sys user", CFG_NO_NEED_REBOOT, CFG_SECTION_OBPROXY, CFG_VISIBLE_LEVEL_SYS); }; ObProxyConfig &get_global_proxy_config(); diff --git a/src/obproxy/obutils/ob_proxy_config_processor.cpp b/src/obproxy/obutils/ob_proxy_config_processor.cpp index b148886..3b8d737 100644 --- a/src/obproxy/obutils/ob_proxy_config_processor.cpp +++ b/src/obproxy/obutils/ob_proxy_config_processor.cpp @@ -1839,13 +1839,7 @@ int ObProxyConfigProcessor::update_global_proxy_config(const ObProxyAppConfig &n ret = OB_ERR_NULL_VALUE; LOG_WARN("fail to get reload config", K(ret)); } - if (OB_SUCC(ret)) { - if (NULL == cur_app_config || new_app_config.init_config_.version_ != cur_app_config->init_config_.version_) { - if (OB_FAIL(do_update_global_proxy_config(new_app_config.init_config_, old_global_config_items))) { - LOG_WARN("fail to update init config to global proxy config", K_(new_app_config.init_config), K(ret)); - } - } - } + // Update the configuration of dynamic_config, the init configuration passes in the parameters at startup if (OB_SUCC(ret)) { if (NULL == cur_app_config || new_app_config.dynamic_config_.version_ != cur_app_config->dynamic_config_.version_) { if (OB_FAIL(do_update_global_proxy_config(new_app_config.dynamic_config_, old_global_config_items))) { diff --git a/src/obproxy/obutils/ob_proxy_create_server_conn_cont.cpp b/src/obproxy/obutils/ob_proxy_create_server_conn_cont.cpp index cfbeb66..ac42478 100644 --- a/src/obproxy/obutils/ob_proxy_create_server_conn_cont.cpp +++ b/src/obproxy/obutils/ob_proxy_create_server_conn_cont.cpp @@ -413,7 +413,7 @@ int ObProxyCreateServerConnCont::do_create_server_conn() LOG_WARN("fail to init proxy", K(login_info.username_), K(login_info.db_)); } else if (DB_OB_ORACLE == server_type || DB_OB_MYSQL == server_type) { if (OB_FAIL(proxy->rebuild_client_pool(cr_, is_meta_mysql_client, - cluster_name, OB_DEFAULT_CLUSTER_ID, login_info.username_, passwd_string, login_info.db_, &client_pool_option))) { + cluster_name, OB_DEFAULT_CLUSTER_ID, login_info.username_, passwd_string, login_info.db_, "", &client_pool_option))) { LOG_WARN("fail to create mysql client pool", K(login_info), K(ret)); } else { LOG_DEBUG("succ to create ob client pool", K(login_info.username_), K(server_type), @@ -421,7 +421,7 @@ int ObProxyCreateServerConnCont::do_create_server_conn() } } else if (DB_MYSQL == server_type) { if (OB_FAIL(proxy->rebuild_client_pool(schema_key.shard_conn_, - is_meta_mysql_client, user_name, passwd_string, database_name, &client_pool_option))) { + is_meta_mysql_client, user_name, passwd_string, database_name, "", &client_pool_option))) { LOG_WARN("fail to create mysql client pool", K(user_name), K(database_name), K(ret)); } else { LOG_DEBUG("succ to create mysql clinet pool", K(login_info.username_), K(database_name), K(server_type), diff --git a/src/obproxy/obutils/ob_proxy_json_config_info.cpp b/src/obproxy/obutils/ob_proxy_json_config_info.cpp index 1db5da7..092d05d 100644 --- a/src/obproxy/obutils/ob_proxy_json_config_info.cpp +++ b/src/obproxy/obutils/ob_proxy_json_config_info.cpp @@ -811,11 +811,44 @@ int ObProxyJsonConfigInfo::parse(const Value *json_value) int ObProxyJsonConfigInfo::parse_local_rslist(const Value *root) { int ret = OB_SUCCESS; - bool is_from_local = true; - if (OB_FAIL(parse_rslist_array_data(root, ObString::make_empty_string(), is_from_local))) { - LOG_WARN("fail to parse rs list array data for local rslist", K(ret)); + if (OB_FAIL(ObProxyJsonUtils::check_config_info_type(root, JT_ARRAY))) { + LOG_WARN("fail to check local rs list", K(ret)); } else { - LOG_DEBUG("succ to parse all local rslist"); + bool is_from_local = true; + ObString app_name = ObString::make_empty_string(); + + int64_t json_cluster_id = OB_DEFAULT_CLUSTER_ID; + LocationList web_rslist; + bool is_primary = false; + ObString cluster_name; + + DLIST_FOREACH(it, root->get_array()) { + json_cluster_id = OB_DEFAULT_CLUSTER_ID; + web_rslist.reuse(); + is_primary = false; + cluster_name.reset(); + if (OB_FAIL(parse_rslist_data(it, app_name, json_cluster_id, web_rslist, is_primary, cluster_name, is_from_local))) { + if (OB_EAGAIN == ret) { + // here e_again means local rslist for this cluster is empty, do nothing and go on parsing + ret = OB_SUCCESS; + } else { + LOG_WARN("fail to parse rslist data", K(ret)); + } + } + + if (OB_SUCC(ret) && is_primary) { + int64_t master_cluster_id = OB_DEFAULT_CLUSTER_ID; + if (OB_FAIL(get_master_cluster_id(cluster_name, master_cluster_id))) { + LOG_WARN("fail to get master cluster id", K(cluster_name), K(ret)); + } else if (OB_DEFAULT_CLUSTER_ID == master_cluster_id) { + if (OB_FAIL(set_master_cluster_id(cluster_name, json_cluster_id))) { + LOG_WARN("fail to set master cluster id", K(json_cluster_id), K(ret)); + } else if (OB_FAIL(ObRouteUtils::build_and_add_sys_dummy_entry(cluster_name, OB_DEFAULT_CLUSTER_ID, web_rslist, !is_from_local))) { + LOG_WARN("fail to build and add dummy entry", K(cluster_name), K(web_rslist), K(ret)); + } + } + } + } //end traverse rs list array } return ret; } @@ -1026,7 +1059,10 @@ int ObProxyJsonConfigInfo::parse_remote_rslist(const Value *root, const ObString if (OB_FAIL(parse_rslist_data(value, appname, json_cluster_id, web_rslist, is_primary, cluster_name, is_from_local, need_update_dummy_entry)) && OB_EAGAIN != ret) { LOG_WARN("fail to parse remote rslist data", K(ret)); - } else if (OB_DEFAULT_CLUSTER_ID == cluster_id || is_primary) { + // If there is no cluster id, there must be no active/standby case. + // It must be set, otherwise the cluster resource of the main library cannot be obtained when get_cluster_resource + // If you bring the cluster id, because you want to access a specific library, the main library information is not updated + } else if (OB_DEFAULT_CLUSTER_ID == cluster_id) { if (OB_FAIL(set_master_cluster_id(is_from_local ? cluster_name : appname, json_cluster_id))) { LOG_WARN("fail to set master cluster id", K(json_cluster_id), K(ret)); } else if (OB_FAIL(ObRouteUtils::build_and_add_sys_dummy_entry( @@ -1116,26 +1152,28 @@ int ObProxyJsonConfigInfo::parse_rslist_data(const Value *json_value, const ObSt } } - const bool is_rslist = !is_from_local; - web_rslist.reuse(); - if (OB_FAIL(parse_rslist_item(rslist, is_from_local ? cluster_name : appname, web_rslist, false))) { - LOG_WARN("fail to parse rslist item", K(rslist), K(ret)); - } else if (NULL != readonly_rslist - && OB_FAIL(parse_rslist_item(readonly_rslist, is_from_local ? cluster_name : appname, web_rslist, true))) { - LOG_WARN("fail to parse readonly_rslist item", K(readonly_rslist), K(ret)); - } else if (OB_FAIL(reset_create_failure_count(is_from_local ? cluster_name : appname, json_cluster_id))) { - LOG_WARN("fail to reset_create_failure_count", K(json_cluster_id), K(ret)); - } else if (web_rslist.empty()) { - LOG_INFO("rslist is empty", K(web_rslist), K(json_cluster_id), K(cluster_name)); - } else if (OB_FAIL(set_cluster_web_rs_list(is_from_local ? cluster_name : appname, json_cluster_id, web_rslist, - role_str.empty() ? ObString::make_string(PRIMARY_ROLE) : role_str))) { - if (OB_EAGAIN == ret) { - LOG_DEBUG("web rslist is not changed, no need to update", K(role_str), K(ret)); - ret = OB_SUCCESS; - } else { - LOG_WARN("fail to set cluster web rs list", K(web_rslist), K(role_str), K(ret)); + if (OB_SUCC(ret)) { + web_rslist.reuse(); + if (OB_FAIL(parse_rslist_item(rslist, is_from_local ? cluster_name : appname, web_rslist, false))) { + LOG_WARN("fail to parse rslist item", K(rslist), K(ret)); + } else if (NULL != readonly_rslist + && OB_FAIL(parse_rslist_item(readonly_rslist, is_from_local ? cluster_name : appname, web_rslist, true))) { + LOG_WARN("fail to parse readonly_rslist item", K(readonly_rslist), K(ret)); + } else if (OB_FAIL(reset_create_failure_count(is_from_local ? cluster_name : appname, json_cluster_id))) { + LOG_WARN("fail to reset_create_failure_count", K(json_cluster_id), K(ret)); + } else if (web_rslist.empty()) { + LOG_INFO("rslist is empty", K(web_rslist), K(json_cluster_id), K(cluster_name)); + } else if (OB_FAIL(set_cluster_web_rs_list(is_from_local ? cluster_name : appname, json_cluster_id, web_rslist, + web_rslist, role_str.empty() ? ObString::make_string(PRIMARY_ROLE) : role_str))) { + if (OB_EAGAIN == ret) { + LOG_DEBUG("web rslist is not changed, no need to update", K(role_str), K(ret)); + ret = OB_SUCCESS; + } else { + LOG_WARN("fail to set cluster web rs list", K(web_rslist), K(role_str), K(ret)); + } } } + if (OB_SUCC(ret)) { if (role_str.empty() || role_str.case_compare(PRIMARY_ROLE) == 0) { is_primary = true; @@ -1153,6 +1191,7 @@ int ObProxyJsonConfigInfo::parse_rslist_data(const Value *json_value, const ObSt } } if (OB_SUCC(ret) && need_update_dummy_entry) { + const bool is_rslist = !is_from_local; if (OB_FAIL(ObRouteUtils::build_and_add_sys_dummy_entry( is_from_local ? cluster_name : appname, json_cluster_id, web_rslist, is_rslist))) { LOG_WARN("fail to build and add dummy entry", K(cluster_name), K(cluster_id), K(web_rslist), K(ret)); @@ -1163,6 +1202,36 @@ int ObProxyJsonConfigInfo::parse_rslist_data(const Value *json_value, const ObSt return ret; } +int ObProxyJsonConfigInfo::swap_origin_web_rslist_and_build_sys(const ObString &cluster_name, const int64_t cluster_id, const bool need_save_rslist_hash) +{ + int ret = OB_SUCCESS; + ObProxySubClusterInfo *sub_cluster_info = NULL; + if (OB_FAIL(reset_create_failure_count(cluster_name, cluster_id))) { + LOG_WARN("fail to reset_create_failure_count", K(cluster_name), K(cluster_id), K(ret)); + } else if (OB_FAIL(get_sub_cluster_info(cluster_name, cluster_id, sub_cluster_info))) { + LOG_WARN("cluster not exist", K(cluster_name), K(cluster_id), K(ret)); + } else if (OB_ISNULL(sub_cluster_info)) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("cluster_info is NULL", K(cluster_name), K(cluster_id), K(ret)); + } else { + LOG_INFO("will update rslist", K(cluster_name), K(cluster_id), + "real cluster_id", sub_cluster_info->cluster_id_, + "old rslist", sub_cluster_info->web_rs_list_, + "new rslist", sub_cluster_info->origin_web_rs_list_); + if (OB_FAIL(sub_cluster_info->web_rs_list_.assign(sub_cluster_info->origin_web_rs_list_))) { + LOG_WARN("fail to set cluster web_rs_list", K(cluster_name), K(cluster_id), + "origin_web_rs_list", sub_cluster_info->origin_web_rs_list_, K(ret)); + } else if (OB_FAIL(ObRouteUtils::build_and_add_sys_dummy_entry(cluster_name, cluster_id, sub_cluster_info->origin_web_rs_list_, true))) { + LOG_WARN("fail to build and add dummy entry", K(cluster_name), K(cluster_id), + "origin_web_rs_list", sub_cluster_info->origin_web_rs_list_, K(ret)); + } else if (need_save_rslist_hash) { + sub_cluster_info->rs_list_hash_ = ObProxyClusterInfo::get_server_list_hash(sub_cluster_info->origin_web_rs_list_); + } + } + + return ret; +} + //{ // "Message":"successful", // "Success":true, @@ -1701,14 +1770,14 @@ int ObProxyJsonConfigInfo::copy_bin_url(char *bin_url, const int64_t len) const } int ObProxyJsonConfigInfo::set_cluster_web_rs_list(const ObString &cluster_name, const int64_t cluster_id, - const LocationList &web_rs_list, const ObString &role, const uint64_t cur_rs_list_hash/*0*/) + const LocationList &web_rs_list, const LocationList &origin_web_rs_list, const ObString &role, const uint64_t cur_rs_list_hash/*0*/) { int ret = OB_SUCCESS; ObProxyClusterInfo *cluster_info = NULL; ObProxySubClusterInfo *sub_cluster_info = NULL; bool new_sub_cluster_info = false; - if (web_rs_list.empty()) { - LOG_INFO("rslist is empty", K(web_rs_list), K(cluster_name)); + if (web_rs_list.empty() && origin_web_rs_list.empty()) { + LOG_INFO("rslist is empty", K(web_rs_list), K(origin_web_rs_list), K(cluster_name)); } else { if (cluster_name == OB_META_DB_CLUSTER_NAME) { cluster_info = const_cast(&data_info_.meta_table_info_.cluster_info_); @@ -1739,30 +1808,34 @@ int ObProxyJsonConfigInfo::set_cluster_web_rs_list(const ObString &cluster_name, if (OB_ISNULL(sub_cluster_info)) { ret = OB_ERR_UNEXPECTED; LOG_WARN("sub cluster info is null", K(ret)); - } else if (!sub_cluster_info->is_web_rs_list_changed(web_rs_list) - && !sub_cluster_info->is_cluster_role_changed(role)) { - ret = OB_EAGAIN; - } else { - LOG_INFO("will update rslist", - "old rslist", sub_cluster_info->web_rs_list_, - "new rslist", web_rs_list, - "old cluster role", cluster_role_to_str(sub_cluster_info->role_), - K(role), K(cluster_name), K(cluster_id)); - if (OB_FAIL(sub_cluster_info->web_rs_list_.assign(web_rs_list))) { - LOG_WARN("fail to set cluster web_rs_list", K(cluster_name), K(cluster_id), K(web_rs_list), K(ret)); + } else if (!origin_web_rs_list.empty() && OB_FAIL(sub_cluster_info->origin_web_rs_list_.assign(origin_web_rs_list))) { + LOG_WARN("fail to set cluster origin_web_rs_list", K(cluster_name), K(cluster_id), K(origin_web_rs_list), K(ret)); + } else if (!web_rs_list.empty()) { + if (!sub_cluster_info->is_web_rs_list_changed(web_rs_list) + && !sub_cluster_info->is_cluster_role_changed(role)) { + ret = OB_EAGAIN; } else { - if (0 == cur_rs_list_hash) { - sub_cluster_info->rs_list_hash_ = ObProxyClusterInfo::get_server_list_hash(web_rs_list); + LOG_INFO("will update rslist", + "old rslist", sub_cluster_info->web_rs_list_, + "new rslist", web_rs_list, + "old cluster role", cluster_role_to_str(sub_cluster_info->role_), + K(role), K(cluster_name), K(cluster_id)); + if (OB_FAIL(sub_cluster_info->web_rs_list_.assign(web_rs_list))) { + LOG_WARN("fail to set cluster web_rs_list", K(cluster_name), K(cluster_id), K(web_rs_list), K(ret)); } else { - sub_cluster_info->rs_list_hash_ = cur_rs_list_hash; - } - if (role.case_compare(PRIMARY_ROLE) == 0) { - sub_cluster_info->role_ = PRIMARY; - } else if (role.case_compare(STANDBY_ROLE) == 0) { - sub_cluster_info->role_ = STANDBY; - } else { - ret = OB_ERR_UNEXPECTED; - LOG_WARN("unexpected role", K(role), K(cluster_name), K(cluster_id), K(ret)); + if (0 == cur_rs_list_hash) { + sub_cluster_info->rs_list_hash_ = ObProxyClusterInfo::get_server_list_hash(web_rs_list); + } else { + sub_cluster_info->rs_list_hash_ = cur_rs_list_hash; + } + if (role.case_compare(PRIMARY_ROLE) == 0) { + sub_cluster_info->role_ = PRIMARY; + } else if (role.case_compare(STANDBY_ROLE) == 0) { + sub_cluster_info->role_ = STANDBY; + } else { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("unexpected role", K(role), K(cluster_name), K(cluster_id), K(ret)); + } } } } @@ -1886,7 +1959,7 @@ int ObProxyJsonConfigInfo::add_default_cluster_info(ObProxyClusterInfo *cluster_ { int ret = OB_SUCCESS; int64_t default_cluster_id = OB_DEFAULT_CLUSTER_ID; - bool is_rslist = true; + bool is_rslist = false; ObProxySubClusterInfo *sub_cluster_info = NULL; if (OB_ISNULL(cluster_info)) { ret = OB_INVALID_ARGUMENT; @@ -1898,7 +1971,9 @@ int ObProxyJsonConfigInfo::add_default_cluster_info(ObProxyClusterInfo *cluster_ cluster_info->master_cluster_id_ = default_cluster_id; sub_cluster_info->cluster_id_ = default_cluster_id; sub_cluster_info->role_ = PRIMARY; - if (OB_FAIL(sub_cluster_info->web_rs_list_.assign(web_rs_list))) { + if (OB_FAIL(sub_cluster_info->origin_web_rs_list_.assign(web_rs_list))) { + LOG_WARN("fail to set default cluster origin_web_rs_list", K(cluster_info), K(web_rs_list), K(ret)); + } else if (OB_FAIL(sub_cluster_info->web_rs_list_.assign(web_rs_list))) { LOG_WARN("fail to set default cluster web_rs_list", K(cluster_info), K(web_rs_list), K(ret)); } else if (OB_FAIL(ObRouteUtils::build_and_add_sys_dummy_entry( cluster_info->cluster_name_, default_cluster_id, web_rs_list, is_rslist))) { diff --git a/src/obproxy/obutils/ob_proxy_json_config_info.h b/src/obproxy/obutils/ob_proxy_json_config_info.h index 8df879b..b0134ed 100644 --- a/src/obproxy/obutils/ob_proxy_json_config_info.h +++ b/src/obproxy/obutils/ob_proxy_json_config_info.h @@ -357,7 +357,9 @@ public: int update_rslist(const LocationList &rs_list, const uint64_t hash = 0); int get_idc_region(const common::ObString &idc_name, ObProxyNameString ®ion_name) const; - void reuse_rslist() { web_rs_list_.reuse(); } + void reuse_rslist() { + web_rs_list_.reuse(); + } void reuse_idc_list() { idc_list_.reuse(); } DECLARE_TO_STRING; @@ -369,6 +371,7 @@ public: uint64_t rs_list_hash_; int64_t create_failure_count_;//if cnt > 3 && rslist exist , reset rslist; LocationList web_rs_list_; + LocationList origin_web_rs_list_; ObProxyIDCList idc_list_; LINK(ObProxySubClusterInfo, sub_cluster_link_); @@ -666,6 +669,7 @@ public: int parse_rslist_item(const json::Value *root, const common::ObString &appname, LocationList &web_rslist, const bool is_readonly_zone); int get_rslist_file_max_size(int64_t &max_size); + int swap_origin_web_rslist_and_build_sys(const ObString &cluster_name, const int64_t cluster_id, const bool need_save_rslist_hash); int idc_list_to_json(char *buf, const int64_t buf_len, int64_t &data_len); int parse_local_idc_list(const json::Value *root); @@ -753,6 +757,7 @@ public: int set_cluster_web_rs_list(const common::ObString &cluster_name, const int64_t cluster_id, const LocationList &web_rs_list, + const LocationList &origin_web_rs_list, const common::ObString &role, const uint64_t cur_rs_list_hash = 0); int set_master_cluster_id(const common::ObString &cluster_name, const int64_t cluster_id); diff --git a/src/obproxy/obutils/ob_proxy_sql_parser.cpp b/src/obproxy/obutils/ob_proxy_sql_parser.cpp index daf7d58..cc470b0 100644 --- a/src/obproxy/obutils/ob_proxy_sql_parser.cpp +++ b/src/obproxy/obutils/ob_proxy_sql_parser.cpp @@ -868,6 +868,7 @@ int ObProxySqlParser::parse_sql(const ObString &sql, const ObProxyParseMode parse_mode, ObSqlParseResult &sql_parse_result, const bool use_lower_case_name, + ObCollationType connection_collation, const bool drop_origin_db_table_name /*false*/, const bool is_sharding_request /*false*/) { @@ -887,7 +888,7 @@ int ObProxySqlParser::parse_sql(const ObString &sql, ObProxyParseResult obproxy_parse_result; int tmp_ret = OB_SUCCESS; - if (OB_SUCCESS != (tmp_ret = obproxy_parser.parse(sql, obproxy_parse_result))) { + if (OB_SUCCESS != (tmp_ret = obproxy_parser.parse(sql, obproxy_parse_result, connection_collation))) { LOG_INFO("fail to parse sql, will go on anyway", K(sql), K(tmp_ret)); } else if (OB_SUCCESS != (tmp_ret = sql_parse_result.load_result(obproxy_parse_result, use_lower_case_name, drop_origin_db_table_name, is_sharding_request))) { diff --git a/src/obproxy/obutils/ob_proxy_sql_parser.h b/src/obproxy/obutils/ob_proxy_sql_parser.h index aaf3bfe..a8559c8 100644 --- a/src/obproxy/obutils/ob_proxy_sql_parser.h +++ b/src/obproxy/obutils/ob_proxy_sql_parser.h @@ -888,6 +888,7 @@ public: const ObProxyParseMode parse_mode, ObSqlParseResult &sql_parse_result, const bool use_lower_case_name, + common::ObCollationType connection_collation, const bool drop_origin_db_table_name = false, const bool is_sharding_request = false); diff --git a/src/obproxy/obutils/ob_resource_pool_processor.cpp b/src/obproxy/obutils/ob_resource_pool_processor.cpp index 5b79733..df65603 100644 --- a/src/obproxy/obutils/ob_resource_pool_processor.cpp +++ b/src/obproxy/obutils/ob_resource_pool_processor.cpp @@ -165,9 +165,10 @@ int ObRslistFetchCont::init_task() { int ret = OB_SUCCESS; + ObConfigServerProcessor &cs_processor = get_global_config_server_processor(); + if (OB_LIKELY(get_global_proxy_config().with_config_server_)) { ObSEArray rs_list; - ObConfigServerProcessor &cs_processor = get_global_config_server_processor(); if (OB_FAIL(cs_processor.get_newest_cluster_rs_list(cr_->get_cluster_name(), cr_->get_cluster_id(), rs_list, need_update_dummy_entry_))) { LOG_WARN("fail to get cluster rslist", K_(cr_->cluster_info_key), K(ret)); @@ -178,6 +179,16 @@ int ObRslistFetchCont::init_task() fetch_result_ = true; } + if (!fetch_result_) { + // If rstlist is started, do not modify the rslist_hash value + bool need_save_rslist_hash = get_global_proxy_config().with_config_server_; + if (OB_FAIL(cs_processor.swap_origin_web_rslist_and_build_sys(cr_->get_cluster_name(), cr_->get_cluster_id(), need_save_rslist_hash))) { + LOG_WARN("fail to swap origin web rslist", K_(cr_->cluster_info_key), K(ret)); + } else { + fetch_result_ = true; + } + } + LOG_DEBUG("finish to ObRslistFetchCont", K_(cr_->cluster_info_key), K(ret)); need_callback_ = true; @@ -204,6 +215,7 @@ int ObIDCListFetchCont::init_task() if (OB_FAIL(cs_processor.refresh_idc_list(cr_->get_cluster_name(), cr_->get_cluster_id(), idc_list))) { LOG_INFO("fail to refresh_idc_list", "cluster_name", cr_->get_cluster_name(), "cluster_id", cr_->get_cluster_id(), K(ret)); + fetch_result_ = true; } else { fetch_result_ = true; } @@ -1464,8 +1476,9 @@ int ObClusterResource::init_local_config(const ObResourcePoolConfig &config) const ObString user_name(ObProxyTableInfo::READ_ONLY_USERNAME); const ObString database(ObProxyTableInfo::READ_ONLY_DATABASE); ObString password(get_global_proxy_config().observer_sys_password.str()); + ObString password1(get_global_proxy_config().observer_sys_password1.str()); - if (OB_FAIL(mysql_proxy_.init(timeout_ms, user_name, password, database))) { + if (OB_FAIL(mysql_proxy_.init(timeout_ms, user_name, password, database, password1))) { LOG_WARN("fail to init mysql proxy", K(ret)); } else if (OB_FAIL(rebuild_mysql_client_pool( get_global_resource_pool_processor().get_default_cluster_resource()))) { @@ -1594,9 +1607,10 @@ int ObClusterResource::rebuild_mysql_client_pool(ObClusterResource *cr) const ObString user_name(ObProxyTableInfo::READ_ONLY_USERNAME); const ObString database(ObProxyTableInfo::READ_ONLY_DATABASE); ObString password(get_global_proxy_config().observer_sys_password.str()); + ObString password1(get_global_proxy_config().observer_sys_password1.str()); const bool is_meta_mysql_client = (get_global_resource_pool_processor().get_default_cluster_resource() == cr); if (OB_FAIL(mysql_proxy_.rebuild_client_pool(cr, is_meta_mysql_client, get_cluster_name(), get_cluster_id(), user_name, - password, database))) { + password, database, password1))) { LOG_WARN("fail to create mysql client pool", K(ret)); } } diff --git a/src/obproxy/obutils/ob_server_state_processor.cpp b/src/obproxy/obutils/ob_server_state_processor.cpp index 22f7788..d0f6c60 100644 --- a/src/obproxy/obutils/ob_server_state_processor.cpp +++ b/src/obproxy/obutils/ob_server_state_processor.cpp @@ -975,7 +975,7 @@ int ObServerStateRefreshCont::handle_rs_changed(const ObIArraydestroy(); cont = NULL; } + } else { + congestion_manager_->clear_base_servers_added(); + LOG_INFO("congestion manager's base servers has cleared", K_(cluster_name), K_(cluster_id)); } } else { LOG_DEBUG("refresh rslist task has been scheduled", K_(cluster_name), K_(cluster_id), diff --git a/src/obproxy/opsql/Makemodule.am b/src/obproxy/opsql/Makemodule.am index 0f361ae..10a3edb 100644 --- a/src/obproxy/opsql/Makemodule.am +++ b/src/obproxy/opsql/Makemodule.am @@ -4,11 +4,14 @@ obproxy/opsql/ob_proxy_parse_type.h\ obproxy/opsql/ob_proxy_parse_malloc.h\ obproxy/opsql/ob_proxy_parse_malloc.cpp +opsql_parser_utf8_sources:=\ +obproxy/opsql/parser/ob_proxy_parser_utf8_lex.c\ +obproxy/opsql/parser/ob_proxy_parser_utf8_lex.h\ +obproxy/opsql/parser/ob_proxy_parser_utf8_tab.c\ +obproxy/opsql/parser/ob_proxy_parser_utf8_tab.h + opsql_parser_sources:=\ -obproxy/opsql/parser/ob_proxy_parser_lex.c\ -obproxy/opsql/parser/ob_proxy_parser_lex.h\ -obproxy/opsql/parser/ob_proxy_parser_tab.c\ -obproxy/opsql/parser/ob_proxy_parser_tab.h\ +${opsql_parser_utf8_sources}\ obproxy/opsql/parser/ob_proxy_parse_result.h\ obproxy/opsql/parser/ob_proxy_parse_result.cpp\ obproxy/opsql/parser/ob_proxy_parser.h @@ -17,11 +20,14 @@ opsql_dual_parser_sources:=\ obproxy/opsql/dual_parser/ob_dual_parser.h\ obproxy/opsql/dual_parser/ob_dual_parser.cpp +opsql_expr_utf8_parser_sources:=\ +obproxy/opsql/expr_parser/ob_expr_parser_utf8_lex.c\ +obproxy/opsql/expr_parser/ob_expr_parser_utf8_lex.h\ +obproxy/opsql/expr_parser/ob_expr_parser_utf8_tab.c\ +obproxy/opsql/expr_parser/ob_expr_parser_utf8_tab.h + opsql_expr_parser_sources:=\ -obproxy/opsql/expr_parser/ob_expr_parser_lex.c\ -obproxy/opsql/expr_parser/ob_expr_parser_lex.h\ -obproxy/opsql/expr_parser/ob_expr_parser_tab.c\ -obproxy/opsql/expr_parser/ob_expr_parser_tab.h\ +${opsql_expr_utf8_parser_sources}\ obproxy/opsql/expr_parser/ob_expr_parse_result.h\ obproxy/opsql/expr_parser/ob_expr_parse_result.cpp\ obproxy/opsql/expr_parser/ob_expr_parser_utils.h\ diff --git a/src/obproxy/opsql/dual_parser/ob_dual_parser.cpp b/src/obproxy/opsql/dual_parser/ob_dual_parser.cpp index f493a26..6fe7f40 100644 --- a/src/obproxy/opsql/dual_parser/ob_dual_parser.cpp +++ b/src/obproxy/opsql/dual_parser/ob_dual_parser.cpp @@ -382,7 +382,7 @@ int ObProxyDualParser::parse_where_key_word() return OB_SUCCESS; } -int ObProxyDualParser::parse_where_fields() +int ObProxyDualParser::parse_where_fields(ObCollationType connection_collation) { int ret = OB_SUCCESS; // OB_PROXY_MAX_CONFIG_STRING_LENGTH is 512 @@ -416,7 +416,7 @@ int ObProxyDualParser::parse_where_fields() expr_sql += (len_before_where - 1); } } - if (OB_FAIL(expr_parser.parse(expr_sql, expr_result))) { + if (OB_FAIL(expr_parser.parse(expr_sql, expr_result, connection_collation))) { LOG_DEBUG("parse failed ", K(expr_sql)); } else { LOG_DEBUG("expr_sql", K(expr_sql)); @@ -426,7 +426,8 @@ int ObProxyDualParser::parse_where_fields() } int ObProxyDualParser::parse(const common::ObString &sql_string, - ObProxyDualParseResult &parse_result) + ObProxyDualParseResult &parse_result, + ObCollationType connection_collation) { int ret = OB_SUCCESS; reset(); @@ -445,7 +446,7 @@ int ObProxyDualParser::parse(const common::ObString &sql_string, LOG_WARN("parse_key_word DUAL failed"); } else if (OB_FAIL(parse_where_key_word())) { LOG_DEBUG("parse_where_and_fields failed"); - } else if (OB_FAIL(parse_where_fields())) { + } else if (OB_FAIL(parse_where_fields(connection_collation))) { LOG_DEBUG("parse_where_fields failed"); } return ret; diff --git a/src/obproxy/opsql/dual_parser/ob_dual_parser.h b/src/obproxy/opsql/dual_parser/ob_dual_parser.h index 6aed86b..9022329 100644 --- a/src/obproxy/opsql/dual_parser/ob_dual_parser.h +++ b/src/obproxy/opsql/dual_parser/ob_dual_parser.h @@ -28,14 +28,15 @@ public: ObProxyDualParser(); ~ObProxyDualParser(); int parse(const common::ObString &sql_string, - obutils::ObProxyDualParseResult &parse_result); + obutils::ObProxyDualParseResult &parse_result, + common::ObCollationType connection_collation); bool is_valid_result(); private: int skip_comments(); int parse_key_word(const char* key, bool allow_semi = false); int parse_seqs_and_fields(); int parse_where_key_word(); - int parse_where_fields(); + int parse_where_fields(common::ObCollationType connection_collation); inline bool is_slash_char(const char c) { return c == '/'; @@ -90,4 +91,4 @@ private: } // end of namespace opsql } // end of namespace obproxy } // end of namespace oceanbase -#endif // OB_PROXY_DUAL_PARSER_H_ \ No newline at end of file +#endif // OB_PROXY_DUAL_PARSER_H_ diff --git a/src/obproxy/opsql/expr_parser/gen_parser.sh b/src/obproxy/opsql/expr_parser/gen_parser.sh index 703aecf..6727bc4 100755 --- a/src/obproxy/opsql/expr_parser/gen_parser.sh +++ b/src/obproxy/opsql/expr_parser/gen_parser.sh @@ -7,9 +7,30 @@ set +x CURDIR="$(dirname $(readlink -f "$0"))" export PATH=${CURDIR}/../../../..//deps/3rd/usr/local/oceanbase/devtools/bin/:/usr/local/bin:$PATH export BISON_PKGDATADIR=${CURDIR}/../../../../deps/3rd/usr/local/oceanbase/devtools/share/bison/ +# generate oracle utf8 expr_parser(support multi_byte_space, multi_byte_comma, multi_byte_left_parenthesis, multi_byte_right_parenthesis) +##1.copy lex and yacc files +cat ob_expr_parser.y > ob_expr_parser_utf8.y +cat ob_expr_parser.l > ob_expr_parser_utf8.l +##2.replace name +sed "s/ob_expr_parser_yy/ob_expr_parser_utf8_yy/g" -i ob_expr_parser_utf8.y +sed "s/ob_expr_parser_yy/ob_expr_parser_utf8_yy/g" -i ob_expr_parser_utf8.l +sed "s/ob_expr_parser_lex/ob_expr_parser_utf8_lex/g" -i ob_expr_parser_utf8.y +sed "s/ob_expr_parser_lex/ob_expr_parser_utf8_lex/g" -i ob_expr_parser_utf8.l +sed "s/ob_expr_parser_tab/ob_expr_parser_utf8_tab/g" -i ob_expr_parser_utf8.l +sed "s/ob_expr_parser_fatal_error/ob_expr_utf8_parser_fatal_error/g" -i ob_expr_parser_utf8.y +sed "s/ob_expr_parser_fatal_error/ob_expr_utf8_parser_fatal_error/g" -i ob_expr_parser_utf8.l +sed "s/ob_expr_parse_sql/ob_expr_parse_utf8_sql/g" -i ob_expr_parser_utf8.y +##3.add multi_byte_space, multi_byte_comma, multi_byte_left_parenthesis, multi_byte_right_parenthesis code. +sed "s/multi_byte_space \[\\\u3000\]/multi_byte_space ([\\\xe3\][\\\x80\][\\\x80])/g" -i ob_expr_parser_utf8.l +sed "s/multi_byte_comma \[\\\uff0c\]/multi_byte_comma ([\\\xef\][\\\xbc\][\\\x8c])/g" -i ob_expr_parser_utf8.l +sed "s/multi_byte_left_parenthesis \[\\\uff08\]/multi_byte_left_parenthesis ([\\\xef\][\\\xbc\][\\\x88])/g" -i ob_expr_parser_utf8.l +sed "s/multi_byte_right_parenthesis \[\\\uff09\]/multi_byte_right_parenthesis ([\\\xef\][\\\xbc\][\\\x89])/g" -i ob_expr_parser_utf8.l +sed 's/space \[ \\t\\n\\r\\f\]/space (\[ \\t\\n\\r\\f\]|{multi_byte_space})/g' -i ob_expr_parser_utf8.l +##4.generate oracle utf8 parser files + # run bison #bison -p obexpr -v -Werror -d ob_expr_parser.y -o ob_expr_parser_tab.c -bison -p obexpr -v -Werror -d ob_expr_parser.y -o ob_expr_parser_tab.c +bison -v -Werror -d ob_expr_parser_utf8.y -o ob_expr_parser_utf8_tab.c if [ $? -ne 0 ] then echo Compile error[$?], abort. @@ -17,68 +38,72 @@ then fi # format tab.h -sed "s/YY\([a-zA-Z_]*\)/OBEXPR\1/g" -i ob_expr_parser_tab.h -sed "s/yy\([a-zA-Z_]*\)/obexpr\1/g" -i ob_expr_parser_tab.h +sed "s/YY\([a-zA-Z_]*\)/OBEXPR\1/g" -i ob_expr_parser_utf8_tab.h +sed "s/yy\([a-zA-Z_]*\)/obexpr\1/g" -i ob_expr_parser_utf8_tab.h sed "/Tokens/i #ifndef YY_OBEXPR_OB_EXPR_PARSER_TAB_H_INCLUDED\n\ # define YY_OBEXPR_OB_EXPR_PARSER_TAB_H_INCLUDED\n\ /* Debug traces. */\n\ -#ifndef OBEXPRDEBUG\n\ +#ifndef OBEXPR_UTF8_DEBUG\n\ # if defined YYDEBUG\n\ #if YYDEBUG\n\ -# define OBEXPRDEBUG 1\n\ +# define OBEXPR_UTF8_DEBUG 1\n\ # else\n\ -# define OBEXPRDEBUG 0\n\ +# define OBEXPR_UTF8_DEBUG 0\n\ # endif\n\ # else /* ! defined YYDEBUG */\n\ -# define OBEXPRDEBUG 0\n\ +# define OBEXPR_UTF8_DEBUG 0\n\ # endif /* ! defined YYDEBUG */\n\ -#endif /* ! defined OBEXPRDEBUG */\n\ -#if OBEXPRDEBUG\n\ -extern int obexprdebug;\n\ -#endif" -i ob_expr_parser_tab.h -echo "#endif" >> ob_expr_parser_tab.h +#endif /* ! defined OBEXPR_UTF8_DEBUG */\n\ +#if OBEXPR_UTF8_DEBUG\n\ +extern int ob_expr_parser_utf8_yydebug;\n\ +#endif" -i ob_expr_parser_utf8_tab.h +echo "#endif" >> ob_expr_parser_utf8_tab.h # formart tab.c -sed "/#define yyparse/i #define YYSTYPE OBEXPRSTYPE\n#define YYLTYPE OBEXPRLTYPE" -i ob_expr_parser_tab.c -sed "/Tokens/,/Copy the second/{s/YY\([a-zA-Z_]\)/OBEXPR\1/g}" -i ob_expr_parser_tab.c -sed "/Tokens/,/Copy the second/{s/yy\([a-zA-Z_]\)/obexpr\1/g}" -i ob_expr_parser_tab.c -sed "s/yylex (\&yylval, \&yylloc)/yylex (\&yylval, \&yylloc, YYLEX_PARAM)/g" -i ob_expr_parser_tab.c +sed "/#define yyparse/i #define YYSTYPE OBEXPRSTYPE\n#define YYLTYPE OBEXPRLTYPE" -i ob_expr_parser_utf8_tab.c +sed "/Tokens/,/Copy the second/{s/YY\([a-zA-Z_]\)/OBEXPR\1/g}" -i ob_expr_parser_utf8_tab.c +sed "/Tokens/,/Copy the second/{s/yy\([a-zA-Z_]\)/obexpr\1/g}" -i ob_expr_parser_utf8_tab.c +sed "s/yylex (\&yylval, \&yylloc)/yylex (\&yylval, \&yylloc, YYLEX_PARAM)/g" -i ob_expr_parser_utf8_tab.c sed "/Tokens/i #ifndef YY_OBEXPR_OB_EXPR_PARSER_TAB_H_INCLUDED\n\ # define YY_OBEXPR_OB_EXPR_PARSER_TAB_H_INCLUDED\n\ /* Debug traces. */\n\ -#ifndef OBEXPRDEBUG\n\ +#ifndef OBEXPR_UTF8_DEBUG\n\ # if defined YYDEBUG\n\ #if YYDEBUG\n\ -# define OBEXPRDEBUG 1\n\ +# define OBEXPR_UTF8_DEBUG 1\n\ # else\n\ -# define OBEXPRDEBUG 0\n\ +# define OBEXPR_UTF8_DEBUG 0\n\ # endif\n\ # else /* ! defined YYDEBUG */\n\ -# define OBEXPRDEBUG 0\n\ +# define OBEXPR_UTF8_DEBUG 0\n\ # endif /* ! defined YYDEBUG */\n\ -#endif /* ! defined OBEXPRDEBUG */\n\ -#if OBEXPRDEBUG\n\ -extern int obexprdebug;\n\ -#endif" -i ob_expr_parser_tab.c -sed "/Copy the second/i #endif" -i ob_expr_parser_tab.c +#endif /* ! defined OBEXPR_UTF8_DEBUG */\n\ +#if OBEXPR_UTF8_DEBUG\n\ +extern int ob_expr_parser_utf8_yydebug;\n\ +#endif" -i ob_expr_parser_utf8_tab.c +sed "/Copy the second/i #endif" -i ob_expr_parser_utf8_tab.c sed "/Cause a token to be read/a \ \ \ if (SELECT_STMT_PARSE_MODE == result->parse_mode_) {\n\ yychar = DUMMY_SELECT_CLAUSE;\n\ } else if (INSERT_STMT_PARSE_MODE == result->parse_mode_) {\n\ yychar = DUMMY_INSERT_CLAUSE;\n\ }\n\ -" -i ob_expr_parser_tab.c +" -i ob_expr_parser_utf8_tab.c # run flex #flex -P obexpr -Cfea -o ob_expr_parser_lex.c ob_expr_parser.l ob_expr_parser_tab.h -flex -P obexpr -o ob_expr_parser_lex.c ob_expr_parser.l ob_expr_parser_tab.h +flex -o ob_expr_parser_utf8_lex.c ob_expr_parser_utf8.l ob_expr_parser_utf8_tab.h # format lex.h -sed "s/YYSTYPE/OBEXPRSTYPE/g" -i ob_expr_parser_lex.h -sed "s/YYLTYPE/OBEXPRLTYPE/g" -i ob_expr_parser_lex.h -sed "/static int yy_top_state (yyscan_t yyscanner );/d" -i ob_expr_parser_lex.c -sed "/static int yy_top_state/,/\}/d" -i ob_expr_parser_lex.c -sed "/\*yy_cp = '\\\0';/d" -i ob_expr_parser_lex.c -sed "/Setup the input buffer state to scan the given bytes/,/}/{/int i/d}" -i ob_expr_parser_lex.c -sed "/Setup the input buffer state to scan the given bytes/,/}/{/for ( i = 0; i < _yybytes_len; ++i )/d}" -i ob_expr_parser_lex.c -sed "/Setup the input buffer state to scan the given bytes/,/}/{s/\tbuf\[i\] = yybytes\[i\]/memcpy(buf, yybytes, _yybytes_len)/g}" -i ob_expr_parser_lex.c +sed "s/YYSTYPE/OBEXPRSTYPE/g" -i ob_expr_parser_utf8_lex.h +sed "s/YYLTYPE/OBEXPRLTYPE/g" -i ob_expr_parser_utf8_lex.h +sed "/static int yy_top_state (yyscan_t yyscanner );/d" -i ob_expr_parser_utf8_lex.c +sed "/static int yy_top_state/,/\}/d" -i ob_expr_parser_utf8_lex.c +sed "/\*yy_cp = '\\\0';/d" -i ob_expr_parser_utf8_lex.c +sed "/Setup the input buffer state to scan the given bytes/,/}/{/int i/d}" -i ob_expr_parser_utf8_lex.c +sed "/Setup the input buffer state to scan the given bytes/,/}/{/for ( i = 0; i < _yybytes_len; ++i )/d}" -i ob_expr_parser_utf8_lex.c +sed "/Setup the input buffer state to scan the given bytes/,/}/{s/\tbuf\[i\] = yybytes\[i\]/memcpy(buf, yybytes, _yybytes_len)/g}" -i ob_expr_parser_utf8_lex.c +##5.clean useless files +rm -f ob_expr_parser_utf8.l +rm -f ob_expr_parser_utf8.y +rm -f ob_expr_parser_utf8.output diff --git a/src/obproxy/opsql/expr_parser/ob_expr_parser.h b/src/obproxy/opsql/expr_parser/ob_expr_parser.h index f3be3b1..3a374aa 100644 --- a/src/obproxy/opsql/expr_parser/ob_expr_parser.h +++ b/src/obproxy/opsql/expr_parser/ob_expr_parser.h @@ -19,7 +19,7 @@ #include "proxy/mysqllib/ob_proxy_mysql_request.h" #include "lib/string/ob_string.h" -extern "C" int ob_expr_parse_sql(ObExprParseResult *p, const char *pszSql, size_t iLen); +extern "C" int ob_expr_parse_utf8_sql(ObExprParseResult *p, const char *pszSql, size_t iLen); namespace oceanbase { @@ -39,9 +39,12 @@ public: // will not be inherited, do not set to virtual ~ObExprParser() {} - int parse(const common::ObString &sql_string, ObExprParseResult &parse_result); + int parse(const common::ObString &sql_string, ObExprParseResult &parse_result, + common::ObCollationType connection_collation); - int parse_reqsql(const common::ObString &req_sql, int64_t parsed_length, ObExprParseResult &parse_result, ObProxyBasicStmtType stmt_type); + int parse_reqsql(const common::ObString &req_sql, int64_t parsed_length, + ObExprParseResult &parse_result, ObProxyBasicStmtType stmt_type, + common::ObCollationType connection_collation); void free_result(ObExprParseResult &parse_result); private: @@ -100,21 +103,33 @@ inline void ObExprParser::free_result(ObExprParseResult &parse_result) } inline int ObExprParser::parse(const common::ObString &sql_string, - ObExprParseResult &parse_result) + ObExprParseResult &parse_result, + common::ObCollationType connection_collation) { int ret = common::OB_SUCCESS; if (common::OB_SUCCESS != init_result(parse_result, sql_string.ptr())) { ret = common::OB_ERR_PARSER_INIT; PROXY_LOG(WARN, "failed to initialized parser", KERRMSGS, K(ret)); - } else if (common::OB_SUCCESS != ob_expr_parse_sql(&parse_result, - sql_string.ptr(), - static_cast(sql_string.length()))) { - ret = common::OB_ERR_PARSE_SQL; + } else { + switch (connection_collation) { + case 45/*CS_TYPE_UTF8MB4_GENERAL_CI*/: + case 46/*CS_TYPE_UTF8MB4_BIN*/: + default: + if (common::OB_SUCCESS != ob_expr_parse_utf8_sql(&parse_result, + sql_string.ptr(), + static_cast(sql_string.length()))) { + ret = common::OB_ERR_PARSE_SQL; + PROXY_LOG(WARN, "failed to parser utf8 sql", KERRMSGS, K(connection_collation), K(ret)); + } + break; + } } return ret; } -inline int ObExprParser::parse_reqsql(const common::ObString &req_sql, int64_t parsed_length, ObExprParseResult &expr_result, ObProxyBasicStmtType stmt_type) +inline int ObExprParser::parse_reqsql(const common::ObString &req_sql, int64_t parsed_length, + ObExprParseResult &expr_result, ObProxyBasicStmtType stmt_type, + common::ObCollationType connection_collation) { int ret = common::OB_SUCCESS; common::ObString expr_sql = obproxy::proxy::ObProxyMysqlRequest::get_expr_sql(req_sql, parsed_length); @@ -142,11 +157,10 @@ inline int ObExprParser::parse_reqsql(const common::ObString &req_sql, int64_t p } if (NULL != pos) { - const int32_t len_before_where = static_cast(pos - expr_sql_str); - expr_sql += (len_before_where - 1); + expr_sql += static_cast(pos - expr_sql_str); } } - if (OB_FAIL(parse(expr_sql, expr_result))) { + if (OB_FAIL(parse(expr_sql, expr_result, connection_collation))) { PROXY_LOG(DEBUG, "fail to do expr parse", K(expr_sql), K(ret)); } else { PROXY_LOG(DEBUG, "succ to do expr parse", "expr_result", ObExprParseResultPrintWrapper(expr_result), K(expr_sql)); diff --git a/src/obproxy/opsql/expr_parser/ob_expr_parser.l b/src/obproxy/opsql/expr_parser/ob_expr_parser.l index e20c18c..1d8151e 100644 --- a/src/obproxy/opsql/expr_parser/ob_expr_parser.l +++ b/src/obproxy/opsql/expr_parser/ob_expr_parser.l @@ -1,6 +1,7 @@ %option noyywrap nounput noinput case-insensitive %option stack noyyalloc noyyrealloc noyyfree %option reentrant bison-bridge bison-locations +%option prefix="ob_expr_parser_yy" %option header-file="ob_expr_parser_lex.h" %{ #define YYSTYPE OBEXPRSTYPE @@ -49,6 +50,11 @@ do {\ %x dq %x bt +/*following character status will be rewrite by gen_parse.sh according to connection character*/ +multi_byte_space [\u3000] +multi_byte_comma [\uff0c] +multi_byte_left_parenthesis [\uff08] +multi_byte_right_parenthesis [\uff09] space [ \t\n\r\f] identifer ([A-Za-z0-9$_]*) int_num [0-9]+ @@ -81,6 +87,7 @@ btend {backtick} btdouble {backtick}{backtick} btcontent [^`]+ +comma , leftbracket \( rightbracket \) @@ -118,7 +125,10 @@ IN { return IN; } {number} { RETURN_NUMBER_VAL(); } {identifer} { RETURN_NAME_OB(); } {whitespace} { } -[-+().;*&~|^/%,:!@=] { return yytext[0]; } +{comma}|{multi_byte_comma} { return ','; } +{leftbracket}|{multi_byte_left_parenthesis} { return '('; } +{rightbracket}|{multi_byte_right_parenthesis} { return ')'; } +[-+.;*&~|^/%:!@=] { return yytext[0]; } /* comment */ {c_cmt_begin} { PUSH_STATE(in_c_comment); } diff --git a/src/obproxy/opsql/expr_parser/ob_expr_parser.y b/src/obproxy/opsql/expr_parser/ob_expr_parser.y index 9610ed0..588d3e4 100644 --- a/src/obproxy/opsql/expr_parser/ob_expr_parser.y +++ b/src/obproxy/opsql/expr_parser/ob_expr_parser.y @@ -1,5 +1,6 @@ %define api.pure %parse-param {ObExprParseResult* result} +%name-prefix "ob_expr_parser_yy" %locations %no-lines %verbose @@ -562,7 +563,7 @@ void yyerror(YYLTYPE* yylloc, ObExprParseResult* p, char* s, ...) void ob_expr_parser_fatal_error(yyconst char *msg, yyscan_t yyscanner) { fprintf(stderr, "FATAL ERROR:%s\n", msg); - ObExprParseResult *p = obexprget_extra(yyscanner); + ObExprParseResult *p = ob_expr_parser_yyget_extra(yyscanner); if (OB_ISNULL(p)) { fprintf(stderr, "unexpected null parse result\n"); } else { @@ -577,15 +578,15 @@ int ob_expr_parse_sql(ObExprParseResult* p, const char* buf, size_t len) if (OB_ISNULL(p) || OB_ISNULL(buf) || OB_UNLIKELY(len <= 0)) { ret = OB_INVALID_ARGUMENT; // print err msg later - } else if (OB_FAIL(obexprlex_init_extra(p, &(p->yyscan_info_)))) { + } else if (OB_FAIL(ob_expr_parser_yylex_init_extra(p, &(p->yyscan_info_)))) { // print err msg later } else { int val = setjmp(p->jmp_buf_); if (val) { ret = OB_PARSER_ERR_PARSE_SQL; } else { - obexpr_scan_buffer((char *)buf, len, p->yyscan_info_); - if (OB_FAIL(obexprparse(p))) { + ob_expr_parser_yy_scan_buffer((char *)buf, len, p->yyscan_info_); + if (OB_FAIL(ob_expr_parser_yyparse(p))) { // print err msg later } else { // do nothing diff --git a/src/obproxy/opsql/expr_parser/ob_expr_parser_utf8_lex.c b/src/obproxy/opsql/expr_parser/ob_expr_parser_utf8_lex.c new file mode 100644 index 0000000..2e469cf --- /dev/null +++ b/src/obproxy/opsql/expr_parser/ob_expr_parser_utf8_lex.c @@ -0,0 +1,2743 @@ +#line 2 "ob_expr_parser_utf8_lex.c" + +#line 4 "ob_expr_parser_utf8_lex.c" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 35 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include +#include +#include +#include + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have . Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; +#endif /* ! C99 */ + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! FLEXINT_H */ + +#ifdef __cplusplus + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) + +#define YY_USE_CONST + +#endif /* defined (__STDC__) */ +#endif /* ! __cplusplus */ + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) + +/* An opaque pointer. */ +#ifndef YY_TYPEDEF_YY_SCANNER_T +#define YY_TYPEDEF_YY_SCANNER_T +typedef void* yyscan_t; +#endif + +/* For convenience, these vars (plus the bison vars far below) + are macros in the reentrant scanner. */ +#define yyin yyg->yyin_r +#define yyout yyg->yyout_r +#define yyextra yyg->yyextra_r +#define yyleng yyg->yyleng_r +#define yytext yyg->yytext_r +#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno) +#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column) +#define yy_flex_debug yyg->yy_flex_debug_r + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN yyg->yy_start = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START ((yyg->yy_start - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE ob_expr_parser_utf8_yyrestart(yyin ,yyscanner ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#define YY_BUF_SIZE 16384 +#endif + +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + + #define YY_LESS_LINENO(n) + +/* Return all but the first "n" matched characters back to the input stream. */ +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = yyg->yy_hold_char; \ + YY_RESTORE_YY_MORE_OFFSET \ + yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via ob_expr_parser_utf8_yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + * + * Returns the top of the stack, or NULL. + */ +#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \ + ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \ + : NULL) + +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] + +void ob_expr_parser_utf8_yyrestart (FILE *input_file ,yyscan_t yyscanner ); +void ob_expr_parser_utf8_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); +YY_BUFFER_STATE ob_expr_parser_utf8_yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner ); +void ob_expr_parser_utf8_yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); +void ob_expr_parser_utf8_yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); +void ob_expr_parser_utf8_yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); +void ob_expr_parser_utf8_yypop_buffer_state (yyscan_t yyscanner ); + +static void ob_expr_parser_utf8_yyensure_buffer_stack (yyscan_t yyscanner ); +static void ob_expr_parser_utf8_yy_load_buffer_state (yyscan_t yyscanner ); +static void ob_expr_parser_utf8_yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner ); + +#define YY_FLUSH_BUFFER ob_expr_parser_utf8_yy_flush_buffer(YY_CURRENT_BUFFER ,yyscanner) + +YY_BUFFER_STATE ob_expr_parser_utf8_yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); +YY_BUFFER_STATE ob_expr_parser_utf8_yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); +YY_BUFFER_STATE ob_expr_parser_utf8_yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); + +void *ob_expr_parser_utf8_yyalloc (yy_size_t ,yyscan_t yyscanner ); +void *ob_expr_parser_utf8_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner ); +void ob_expr_parser_utf8_yyfree (void * ,yyscan_t yyscanner ); + +#define yy_new_buffer ob_expr_parser_utf8_yy_create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + ob_expr_parser_utf8_yyensure_buffer_stack (yyscanner); \ + YY_CURRENT_BUFFER_LVALUE = \ + ob_expr_parser_utf8_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + ob_expr_parser_utf8_yyensure_buffer_stack (yyscanner); \ + YY_CURRENT_BUFFER_LVALUE = \ + ob_expr_parser_utf8_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* Begin user sect3 */ + +#define ob_expr_parser_utf8_yywrap(n) 1 +#define YY_SKIP_YYWRAP + +typedef unsigned char YY_CHAR; + +typedef int yy_state_type; + +#define yytext_ptr yytext_r + +static yy_state_type yy_get_previous_state (yyscan_t yyscanner ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner); +static int yy_get_next_buffer (yyscan_t yyscanner ); +static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + yyg->yytext_ptr = yy_bp; \ + yyleng = (size_t) (yy_cp - yy_bp); \ + yyg->yy_hold_char = *yy_cp; \ + yyg->yy_c_buf_p = yy_cp; + +#define YY_NUM_RULES 57 +#define YY_END_OF_BUFFER 58 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_accept[193] = + { 0, + 30, 30, 0, 0, 0, 0, 0, 0, 0, 0, + 58, 56, 31, 31, 35, 46, 31, 30, 35, 35, + 40, 33, 34, 32, 35, 35, 35, 28, 35, 23, + 18, 21, 25, 30, 30, 30, 30, 30, 30, 30, + 30, 30, 30, 30, 30, 30, 52, 35, 56, 56, + 39, 38, 39, 41, 42, 57, 47, 48, 57, 54, + 55, 31, 0, 24, 31, 30, 14, 0, 29, 36, + 29, 28, 30, 0, 26, 22, 20, 30, 2, 30, + 30, 30, 30, 17, 30, 30, 11, 15, 30, 30, + 30, 30, 16, 0, 0, 0, 37, 41, 0, 0, + + 43, 0, 0, 44, 47, 0, 49, 0, 0, 0, + 50, 54, 53, 31, 0, 0, 29, 0, 0, 29, + 27, 19, 13, 30, 5, 30, 30, 30, 30, 30, + 4, 30, 30, 33, 34, 32, 45, 0, 45, 0, + 0, 51, 0, 51, 0, 0, 31, 31, 31, 0, + 0, 29, 0, 29, 29, 30, 30, 30, 10, 30, + 30, 30, 30, 0, 0, 0, 0, 31, 30, 7, + 30, 6, 9, 30, 1, 0, 0, 45, 0, 0, + 0, 0, 51, 0, 0, 30, 8, 3, 0, 0, + 12, 0 + + } ; + +static yyconst flex_int32_t yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 2, 4, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 21, 9, 22, + 23, 24, 25, 9, 26, 27, 8, 28, 29, 30, + 31, 32, 33, 34, 8, 35, 36, 37, 38, 39, + 8, 40, 41, 42, 43, 44, 45, 8, 8, 8, + 1, 46, 1, 9, 8, 47, 48, 49, 8, 50, + + 51, 52, 53, 54, 55, 56, 8, 57, 58, 59, + 60, 61, 8, 62, 63, 64, 65, 66, 67, 8, + 8, 8, 1, 68, 1, 9, 1, 69, 1, 1, + 1, 1, 1, 1, 1, 70, 71, 1, 1, 72, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 73, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 74, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 75, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static yyconst flex_int32_t yy_meta[76] = + { 0, + 1, 1, 2, 2, 1, 3, 1, 4, 1, 1, + 5, 1, 1, 1, 1, 1, 1, 1, 1, 4, + 1, 1, 1, 1, 1, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 6, 7, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static yyconst flex_int16_t yy_base[209] = + { 0, + 0, 0, 73, 74, 67, 68, 74, 75, 321, 320, + 366, 497, 80, 87, 341, 497, 0, 0, 497, 353, + 497, 497, 497, 497, 345, 340, 345, 74, 78, 62, + 497, 335, 497, 59, 68, 63, 62, 78, 68, 68, + 74, 71, 71, 81, 86, 83, 497, 289, 287, 282, + 497, 497, 121, 0, 139, 0, 0, 145, 0, 0, + 307, 155, 284, 497, 0, 0, 497, 161, 116, 497, + 124, 148, 154, 332, 331, 326, 497, 88, 0, 75, + 120, 132, 128, 0, 140, 140, 0, 0, 133, 137, + 145, 152, 497, 280, 113, 172, 497, 0, 185, 337, + + 497, 330, 277, 497, 0, 202, 497, 339, 327, 273, + 497, 0, 497, 207, 272, 197, 187, 203, 319, 318, + 317, 497, 0, 148, 0, 178, 189, 187, 192, 193, + 0, 184, 188, 497, 497, 497, 497, 325, 324, 228, + 265, 497, 327, 325, 237, 261, 230, 249, 251, 253, + 295, 285, 277, 266, 260, 207, 203, 208, 0, 214, + 229, 231, 232, 266, 168, 269, 128, 259, 236, 0, + 235, 0, 0, 233, 0, 281, 287, 290, 296, 121, + 300, 306, 310, 315, 86, 258, 0, 0, 321, 323, + 0, 497, 392, 399, 406, 413, 420, 95, 427, 434, + + 441, 448, 455, 461, 468, 475, 482, 489 + } ; + +static yyconst flex_int16_t yy_def[209] = + { 0, + 192, 1, 193, 193, 194, 194, 195, 195, 196, 196, + 192, 192, 192, 192, 192, 192, 197, 198, 192, 192, + 192, 192, 192, 192, 192, 192, 192, 198, 192, 192, + 192, 192, 192, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 192, 192, 192, 192, + 192, 192, 192, 199, 192, 200, 201, 192, 202, 203, + 192, 192, 192, 192, 197, 198, 192, 192, 192, 192, + 192, 198, 198, 192, 192, 192, 192, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 192, 192, 192, 192, 192, 199, 192, 204, + + 192, 192, 192, 192, 201, 192, 192, 205, 192, 192, + 192, 203, 192, 206, 192, 192, 192, 192, 192, 198, + 192, 192, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 192, 192, 192, 192, 204, 204, 192, + 192, 192, 205, 205, 192, 192, 206, 206, 206, 192, + 192, 192, 192, 192, 192, 198, 198, 198, 198, 198, + 198, 198, 198, 207, 192, 208, 192, 206, 198, 198, + 198, 198, 198, 198, 198, 207, 207, 207, 207, 192, + 208, 208, 208, 208, 192, 198, 198, 198, 207, 208, + 198, 0, 192, 192, 192, 192, 192, 192, 192, 192, + + 192, 192, 192, 192, 192, 192, 192, 192 + } ; + +static yyconst flex_int16_t yy_nxt[573] = + { 0, + 12, 13, 14, 13, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 19, 19, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 18, 18, 36, + 37, 38, 39, 40, 41, 18, 18, 42, 18, 43, + 44, 18, 18, 45, 46, 12, 47, 34, 35, 18, + 18, 36, 37, 38, 39, 40, 41, 18, 18, 42, + 18, 43, 44, 18, 18, 45, 46, 48, 12, 12, + 12, 12, 12, 49, 50, 52, 52, 55, 55, 58, + 58, 62, 62, 62, 76, 64, 53, 53, 62, 62, + 62, 71, 74, 72, 74, 78, 80, 75, 66, 79, + + 81, 82, 73, 83, 84, 85, 86, 87, 89, 90, + 88, 91, 56, 56, 92, 123, 124, 78, 80, 59, + 59, 79, 81, 82, 73, 83, 84, 85, 86, 87, + 89, 90, 88, 91, 96, 69, 92, 123, 124, 97, + 99, 99, 99, 117, 116, 100, 106, 106, 106, 101, + 107, 108, 118, 63, 166, 102, 62, 62, 62, 125, + 63, 109, 114, 114, 114, 71, 116, 72, 119, 126, + 119, 127, 128, 120, 118, 129, 73, 130, 131, 132, + 133, 125, 134, 135, 136, 96, 99, 99, 99, 164, + 97, 126, 156, 127, 128, 137, 185, 129, 73, 130, + + 131, 132, 133, 106, 106, 106, 117, 142, 148, 114, + 114, 151, 103, 151, 156, 118, 152, 153, 110, 153, + 157, 158, 154, 159, 160, 161, 162, 163, 63, 164, + 164, 164, 192, 192, 115, 169, 180, 118, 166, 166, + 166, 170, 157, 158, 171, 159, 160, 161, 162, 163, + 148, 114, 114, 192, 192, 172, 173, 169, 103, 174, + 175, 192, 192, 170, 186, 187, 171, 177, 164, 164, + 182, 166, 166, 188, 183, 110, 178, 172, 173, 155, + 149, 174, 175, 192, 192, 154, 186, 187, 177, 164, + 164, 178, 192, 192, 191, 188, 154, 178, 192, 192, + + 178, 165, 192, 192, 152, 183, 178, 182, 166, 166, + 167, 183, 192, 192, 152, 183, 191, 192, 192, 168, + 183, 114, 149, 192, 192, 192, 192, 148, 183, 106, + 144, 178, 144, 99, 139, 139, 121, 120, 155, 179, + 150, 146, 184, 145, 144, 141, 140, 139, 62, 122, + 75, 121, 94, 113, 95, 94, 93, 77, 70, 69, + 179, 68, 67, 64, 189, 192, 61, 61, 192, 192, + 192, 192, 192, 192, 192, 192, 192, 192, 192, 184, + 192, 192, 192, 190, 192, 192, 192, 192, 192, 177, + 192, 182, 51, 51, 51, 51, 51, 51, 51, 54, + + 54, 54, 54, 54, 54, 54, 57, 57, 57, 57, + 57, 57, 57, 60, 60, 60, 60, 60, 60, 60, + 65, 192, 65, 65, 65, 65, 65, 98, 98, 98, + 98, 192, 192, 98, 104, 104, 104, 104, 104, 104, + 104, 105, 105, 192, 105, 105, 192, 105, 111, 111, + 111, 111, 111, 111, 111, 112, 112, 112, 112, 112, + 112, 138, 192, 138, 138, 138, 138, 138, 143, 192, + 143, 143, 143, 143, 143, 147, 147, 147, 147, 147, + 147, 147, 176, 176, 176, 176, 176, 176, 176, 181, + 181, 181, 181, 181, 181, 181, 11, 192, 192, 192, + + 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, + 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, + 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, + 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, + 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, + 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, + 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, + 192, 192 + } ; + +static yyconst flex_int16_t yy_chk[573] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 3, 4, 5, 6, 7, + 8, 13, 13, 13, 30, 30, 3, 4, 14, 14, + 14, 28, 29, 28, 29, 34, 35, 29, 198, 34, + + 36, 37, 28, 38, 39, 40, 41, 42, 43, 44, + 42, 45, 5, 6, 46, 78, 80, 34, 35, 7, + 8, 34, 36, 37, 28, 38, 39, 40, 41, 42, + 43, 44, 42, 45, 53, 69, 46, 78, 80, 53, + 55, 55, 55, 71, 69, 55, 58, 58, 58, 55, + 58, 58, 71, 13, 185, 55, 62, 62, 62, 81, + 14, 58, 68, 68, 68, 72, 69, 72, 73, 82, + 73, 83, 85, 73, 71, 86, 72, 89, 90, 91, + 92, 81, 95, 95, 95, 96, 99, 99, 99, 180, + 96, 82, 124, 83, 85, 99, 167, 86, 72, 89, + + 90, 91, 92, 106, 106, 106, 117, 106, 114, 114, + 114, 116, 55, 116, 124, 117, 116, 118, 58, 118, + 126, 127, 118, 128, 129, 130, 132, 133, 62, 140, + 140, 140, 147, 147, 68, 156, 165, 117, 145, 145, + 145, 157, 126, 127, 158, 128, 129, 130, 132, 133, + 148, 148, 148, 149, 149, 160, 161, 156, 99, 162, + 163, 168, 168, 157, 169, 171, 158, 164, 164, 164, + 166, 166, 166, 174, 166, 106, 164, 160, 161, 155, + 114, 162, 163, 176, 176, 154, 169, 171, 177, 177, + 177, 176, 178, 178, 186, 174, 153, 177, 179, 179, + + 178, 140, 181, 181, 152, 181, 179, 182, 182, 182, + 145, 182, 183, 183, 151, 183, 186, 184, 184, 149, + 184, 150, 148, 189, 189, 190, 190, 168, 190, 146, + 144, 189, 143, 141, 139, 138, 121, 120, 119, 164, + 115, 110, 166, 109, 108, 103, 102, 100, 94, 76, + 75, 74, 63, 61, 50, 49, 48, 32, 27, 26, + 177, 25, 20, 15, 179, 11, 10, 9, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 182, + 0, 0, 0, 184, 0, 0, 0, 0, 0, 189, + 0, 190, 193, 193, 193, 193, 193, 193, 193, 194, + + 194, 194, 194, 194, 194, 194, 195, 195, 195, 195, + 195, 195, 195, 196, 196, 196, 196, 196, 196, 196, + 197, 0, 197, 197, 197, 197, 197, 199, 199, 199, + 199, 0, 0, 199, 200, 200, 200, 200, 200, 200, + 200, 201, 201, 0, 201, 201, 0, 201, 202, 202, + 202, 202, 202, 202, 202, 203, 203, 203, 203, 203, + 203, 204, 0, 204, 204, 204, 204, 204, 205, 0, + 205, 205, 205, 205, 205, 206, 206, 206, 206, 206, + 206, 206, 207, 207, 207, 207, 207, 207, 207, 208, + 208, 208, 208, 208, 208, 208, 192, 192, 192, 192, + + 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, + 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, + 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, + 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, + 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, + 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, + 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, + 192, 192 + } ; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET +#line 1 "ob_expr_parser_utf8.l" +#define YY_NO_INPUT 1 +#line 7 "ob_expr_parser_utf8.l" +#define YYSTYPE OBEXPRSTYPE +#define YYLTYPE OBEXPRLTYPE +#include +#include "opsql/ob_proxy_parse_define.h" +#include "opsql/ob_proxy_parse_malloc.h" +#include "opsql/expr_parser/ob_expr_parse_result.h" +#include "opsql/expr_parser/ob_expr_parser_utf8_tab.h" +extern void ob_expr_utf8_parser_fatal_error(yyconst char *msg, yyscan_t yyscanner); + +void store_expr_str(char* str, int64_t str_len, char* end_ptr, void *yyscanner); +void store_pos_place_holder(char* str, void *yyscanner); + +#define YY_FATAL_ERROR(msg) ob_expr_utf8_parser_fatal_error(msg, yyscanner) + +#define PUSH_STATE(state) \ + { yy_push_state(state, yyscanner); } + +#define POP_STATE(state) \ + { yy_pop_state(yyscanner); } + +#define RETURN_INT_VAL() \ +do {\ + errno = 0;\ + yylval->num = strtoll(yytext, NULL, 10);\ + if (0 != errno) {\ + yylval->num = 0;\ + }\ + return INT_VAL;\ +} while (0); + +#define RETURN_STR_VAL() \ + { store_expr_str(yytext, yyleng, yytext + yyleng, yyscanner); return STR_VAL; } + +#define RETURN_NUMBER_VAL() \ + { store_expr_str(yytext, yyleng, yytext + yyleng, yyscanner); return STR_VAL; } + +#define RETURN_NAME_OB() \ + { store_expr_str(yytext, yyleng, yytext + yyleng, yyscanner); return NAME_OB; } + + + + + +/*following character status will be rewrite by gen_parse.sh according to connection character*/ +#line 674 "ob_expr_parser_utf8_lex.c" + +#define INITIAL 0 +#define in_c_comment 1 +#define sq 2 +#define dq 3 +#define bt 4 + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +/* Holds the entire state of the reentrant scanner. */ +struct yyguts_t + { + + /* User-defined. Not touched by flex. */ + YY_EXTRA_TYPE yyextra_r; + + /* The rest are the same as the globals declared in the non-reentrant scanner. */ + FILE *yyin_r, *yyout_r; + size_t yy_buffer_stack_top; /**< index of top of stack. */ + size_t yy_buffer_stack_max; /**< capacity of stack. */ + YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ + char yy_hold_char; + int yy_n_chars; + int yyleng_r; + char *yy_c_buf_p; + int yy_init; + int yy_start; + int yy_did_buffer_switch_on_eof; + int yy_start_stack_ptr; + int yy_start_stack_depth; + int *yy_start_stack; + yy_state_type yy_last_accepting_state; + char* yy_last_accepting_cpos; + + int yylineno_r; + int yy_flex_debug_r; + + char *yytext_r; + int yy_more_flag; + int yy_more_len; + + YYSTYPE * yylval_r; + + YYLTYPE * yylloc_r; + + }; /* end struct yyguts_t */ + +static int yy_init_globals (yyscan_t yyscanner ); + + /* This must go here because YYSTYPE and YYLTYPE are included + * from bison output in section 1.*/ + # define yylval yyg->yylval_r + + # define yylloc yyg->yylloc_r + +int ob_expr_parser_utf8_yylex_init (yyscan_t* scanner); + +int ob_expr_parser_utf8_yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner); + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int ob_expr_parser_utf8_yylex_destroy (yyscan_t yyscanner ); + +int ob_expr_parser_utf8_yyget_debug (yyscan_t yyscanner ); + +void ob_expr_parser_utf8_yyset_debug (int debug_flag ,yyscan_t yyscanner ); + +YY_EXTRA_TYPE ob_expr_parser_utf8_yyget_extra (yyscan_t yyscanner ); + +void ob_expr_parser_utf8_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); + +FILE *ob_expr_parser_utf8_yyget_in (yyscan_t yyscanner ); + +void ob_expr_parser_utf8_yyset_in (FILE * in_str ,yyscan_t yyscanner ); + +FILE *ob_expr_parser_utf8_yyget_out (yyscan_t yyscanner ); + +void ob_expr_parser_utf8_yyset_out (FILE * out_str ,yyscan_t yyscanner ); + +int ob_expr_parser_utf8_yyget_leng (yyscan_t yyscanner ); + +char *ob_expr_parser_utf8_yyget_text (yyscan_t yyscanner ); + +int ob_expr_parser_utf8_yyget_lineno (yyscan_t yyscanner ); + +void ob_expr_parser_utf8_yyset_lineno (int line_number ,yyscan_t yyscanner ); + +YYSTYPE * ob_expr_parser_utf8_yyget_lval (yyscan_t yyscanner ); + +void ob_expr_parser_utf8_yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner ); + + YYLTYPE *ob_expr_parser_utf8_yyget_lloc (yyscan_t yyscanner ); + + void ob_expr_parser_utf8_yyset_lloc (YYLTYPE * yylloc_param ,yyscan_t yyscanner ); + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int ob_expr_parser_utf8_yywrap (yyscan_t yyscanner ); +#else +extern int ob_expr_parser_utf8_yywrap (yyscan_t yyscanner ); +#endif +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner); +#endif + +#ifndef YY_NO_INPUT + +#ifdef __cplusplus +static int yyinput (yyscan_t yyscanner ); +#else +static int input (yyscan_t yyscanner ); +#endif + +#endif + + static void yy_push_state (int new_state ,yyscan_t yyscanner); + + static void yy_pop_state (yyscan_t yyscanner ); + + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#define YY_READ_BUF_SIZE 8192 +#endif + +/* Copy whatever the last rule matched to the standard output. */ +#ifndef ECHO +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO fwrite( yytext, yyleng, 1, yyout ) +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + int n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + } \ + }\ +\ + +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner) +#endif + +/* end tables serialization structures and prototypes */ + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 + +extern int ob_expr_parser_utf8_yylex \ + (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner); + +#define YY_DECL int ob_expr_parser_utf8_yylex \ + (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner) +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK break; +#endif + +#define YY_RULE_SETUP \ + YY_USER_ACTION + +/** The main scanner function which does all the work. + */ +YY_DECL +{ + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + +#line 94 "ob_expr_parser_utf8.l" + +#line 925 "ob_expr_parser_utf8_lex.c" + + yylval = yylval_param; + + yylloc = yylloc_param; + + if ( !yyg->yy_init ) + { + yyg->yy_init = 1; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! yyg->yy_start ) + yyg->yy_start = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! YY_CURRENT_BUFFER ) { + ob_expr_parser_utf8_yyensure_buffer_stack (yyscanner); + YY_CURRENT_BUFFER_LVALUE = + ob_expr_parser_utf8_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); + } + + ob_expr_parser_utf8_yy_load_buffer_state(yyscanner ); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = yyg->yy_c_buf_p; + + /* Support of yytext. */ + *yy_cp = yyg->yy_hold_char; + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = yyg->yy_start; +yy_match: + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { + yyg->yy_last_accepting_state = yy_current_state; + yyg->yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 193 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 497 ); + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = yyg->yy_last_accepting_cpos; + yy_current_state = yyg->yy_last_accepting_state; + yy_act = yy_accept[yy_current_state]; + } + + YY_DO_BEFORE_ACTION; + +do_action: /* This label is used only to access EOF actions. */ + + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = yyg->yy_hold_char; + yy_cp = yyg->yy_last_accepting_cpos; + yy_current_state = yyg->yy_last_accepting_state; + goto yy_find_action; + +case 1: +YY_RULE_SETUP +#line 95 "ob_expr_parser_utf8.l" +{ return WHERE; } + YY_BREAK +case 2: +YY_RULE_SETUP +#line 96 "ob_expr_parser_utf8.l" +{ return AS; } + YY_BREAK +case 3: +YY_RULE_SETUP +#line 97 "ob_expr_parser_utf8.l" +{ return VALUES; } + YY_BREAK +case 4: +YY_RULE_SETUP +#line 98 "ob_expr_parser_utf8.l" +{ return SET; } + YY_BREAK +case 5: +YY_RULE_SETUP +#line 99 "ob_expr_parser_utf8.l" +{ return END_WHERE; } + YY_BREAK +case 6: +YY_RULE_SETUP +#line 100 "ob_expr_parser_utf8.l" +{ return END_WHERE; } + YY_BREAK +case 7: +YY_RULE_SETUP +#line 101 "ob_expr_parser_utf8.l" +{ return END_WHERE; } + YY_BREAK +case 8: +YY_RULE_SETUP +#line 102 "ob_expr_parser_utf8.l" +{ return END_WHERE; } + YY_BREAK +case 9: +YY_RULE_SETUP +#line 103 "ob_expr_parser_utf8.l" +{ return ROWID; } + YY_BREAK +case 10: +YY_RULE_SETUP +#line 105 "ob_expr_parser_utf8.l" +{ return JOIN; } + YY_BREAK +case 11: +YY_RULE_SETUP +#line 106 "ob_expr_parser_utf8.l" +{ return ON; } + YY_BREAK +case 12: +YY_RULE_SETUP +#line 107 "ob_expr_parser_utf8.l" +{ return BETWEEN; } + YY_BREAK +case 13: +YY_RULE_SETUP +#line 108 "ob_expr_parser_utf8.l" +{ return AND_OP; } + YY_BREAK +case 14: +YY_RULE_SETUP +#line 109 "ob_expr_parser_utf8.l" +{ return AND_OP; } + YY_BREAK +case 15: +YY_RULE_SETUP +#line 110 "ob_expr_parser_utf8.l" +{ return OR_OP; } + YY_BREAK +case 16: +YY_RULE_SETUP +#line 111 "ob_expr_parser_utf8.l" +{ return OR_OP; } + YY_BREAK +case 17: +YY_RULE_SETUP +#line 112 "ob_expr_parser_utf8.l" +{ return IN; } + YY_BREAK +case 18: +YY_RULE_SETUP +#line 113 "ob_expr_parser_utf8.l" +{ return COMP_EQ; } + YY_BREAK +case 19: +YY_RULE_SETUP +#line 114 "ob_expr_parser_utf8.l" +{ return COMP_NSEQ; } + YY_BREAK +case 20: +YY_RULE_SETUP +#line 115 "ob_expr_parser_utf8.l" +{ return COMP_GE; } + YY_BREAK +case 21: +YY_RULE_SETUP +#line 116 "ob_expr_parser_utf8.l" +{ return COMP_GT; } + YY_BREAK +case 22: +YY_RULE_SETUP +#line 117 "ob_expr_parser_utf8.l" +{ return COMP_LE; } + YY_BREAK +case 23: +YY_RULE_SETUP +#line 118 "ob_expr_parser_utf8.l" +{ return COMP_LT; } + YY_BREAK +case 24: +YY_RULE_SETUP +#line 119 "ob_expr_parser_utf8.l" +{ return COMP_NE; } + YY_BREAK +case 25: +YY_RULE_SETUP +#line 120 "ob_expr_parser_utf8.l" +{ return PLACE_HOLDER; } + YY_BREAK +case 26: +YY_RULE_SETUP +#line 121 "ob_expr_parser_utf8.l" +{ store_pos_place_holder(yytext + 1, yyscanner); return POS_PLACE_HOLDER; } + YY_BREAK +case 27: +YY_RULE_SETUP +#line 122 "ob_expr_parser_utf8.l" +{ store_pos_place_holder(yytext + 1, yyscanner); return POS_PLACE_HOLDER; } + YY_BREAK +case 28: +YY_RULE_SETUP +#line 124 "ob_expr_parser_utf8.l" +{ RETURN_INT_VAL(); } + YY_BREAK +case 29: +YY_RULE_SETUP +#line 125 "ob_expr_parser_utf8.l" +{ RETURN_NUMBER_VAL(); } + YY_BREAK +case 30: +YY_RULE_SETUP +#line 126 "ob_expr_parser_utf8.l" +{ RETURN_NAME_OB(); } + YY_BREAK +case 31: +/* rule 31 can match eol */ +YY_RULE_SETUP +#line 127 "ob_expr_parser_utf8.l" +{ } + YY_BREAK +case 32: +YY_RULE_SETUP +#line 128 "ob_expr_parser_utf8.l" +{ return ','; } + YY_BREAK +case 33: +YY_RULE_SETUP +#line 129 "ob_expr_parser_utf8.l" +{ return '('; } + YY_BREAK +case 34: +YY_RULE_SETUP +#line 130 "ob_expr_parser_utf8.l" +{ return ')'; } + YY_BREAK +case 35: +YY_RULE_SETUP +#line 131 "ob_expr_parser_utf8.l" +{ return yytext[0]; } + YY_BREAK +/* comment */ +case 36: +YY_RULE_SETUP +#line 134 "ob_expr_parser_utf8.l" +{ PUSH_STATE(in_c_comment); } + YY_BREAK +case 37: +YY_RULE_SETUP +#line 135 "ob_expr_parser_utf8.l" +{ POP_STATE(); } + YY_BREAK +case 38: +/* rule 38 can match eol */ +YY_RULE_SETUP +#line 136 "ob_expr_parser_utf8.l" +{} + YY_BREAK +case 39: +YY_RULE_SETUP +#line 137 "ob_expr_parser_utf8.l" +{} + YY_BREAK +/* quote */ +case 40: +YY_RULE_SETUP +#line 140 "ob_expr_parser_utf8.l" +{ + PUSH_STATE(sq); + ObExprParseResult *p = (ObExprParseResult *)yyextra; + if (OB_NOTNULL(p)) { + p->tmp_buf_ = (yytext + 1); + p->tmp_start_ptr_ = yytext; + p->tmp_len_ = 0; + } +} + YY_BREAK +case 41: +/* rule 41 can match eol */ +YY_RULE_SETUP +#line 150 "ob_expr_parser_utf8.l" +{ + ObExprParseResult *p = (ObExprParseResult *)yyextra; + if (OB_NOTNULL(p)) { + p->tmp_len_ += yyleng; + } +} + YY_BREAK +case 42: +YY_RULE_SETUP +#line 157 "ob_expr_parser_utf8.l" +{ + POP_STATE(); + ObExprParseResult *p = (ObExprParseResult *)yyextra; + if (OB_NOTNULL(p)) { + store_expr_str(p->tmp_buf_, p->tmp_len_, p->tmp_start_ptr_ + p->tmp_len_ + 2, yyscanner); + } + return STR_VAL; +} + YY_BREAK +case 43: +YY_RULE_SETUP +#line 166 "ob_expr_parser_utf8.l" +{} + YY_BREAK +case 44: +/* rule 44 can match eol */ +YY_RULE_SETUP +#line 167 "ob_expr_parser_utf8.l" +{ + ObExprParseResult *p = (ObExprParseResult *)yyextra; + if (OB_NOTNULL(p)) { + p->tmp_len_ += yyleng; + } +} + YY_BREAK +case 45: +/* rule 45 can match eol */ +YY_RULE_SETUP +#line 173 "ob_expr_parser_utf8.l" +{} + YY_BREAK +case YY_STATE_EOF(sq): +#line 174 "ob_expr_parser_utf8.l" +{ return ERROR; } + YY_BREAK +/* dquote */ +case 46: +YY_RULE_SETUP +#line 178 "ob_expr_parser_utf8.l" +{ + PUSH_STATE(dq); + ObExprParseResult *p = (ObExprParseResult *)yyextra; + if (OB_NOTNULL(p)) { + p->tmp_buf_ = (yytext + 1); + p->tmp_start_ptr_ = yytext; + p->tmp_len_ = 0; + } +} + YY_BREAK +case 47: +/* rule 47 can match eol */ +YY_RULE_SETUP +#line 188 "ob_expr_parser_utf8.l" +{ + ObExprParseResult *p = (ObExprParseResult *)yyextra; + if (OB_NOTNULL(p)) { + p->tmp_len_ += yyleng; + } +} + YY_BREAK +case 48: +YY_RULE_SETUP +#line 195 "ob_expr_parser_utf8.l" +{ + POP_STATE(); + ObExprParseResult *p = (ObExprParseResult *)yyextra; + if (OB_NOTNULL(p)) { + store_expr_str(p->tmp_buf_, p->tmp_len_, p->tmp_start_ptr_ + p->tmp_len_ + 2, yyscanner); + if (p->is_oracle_mode_) { + return NAME_OB; + } + } + return STR_VAL; +} + YY_BREAK +case 49: +YY_RULE_SETUP +#line 207 "ob_expr_parser_utf8.l" +{} + YY_BREAK +case 50: +/* rule 50 can match eol */ +YY_RULE_SETUP +#line 208 "ob_expr_parser_utf8.l" +{} + YY_BREAK +case 51: +/* rule 51 can match eol */ +YY_RULE_SETUP +#line 209 "ob_expr_parser_utf8.l" +{} + YY_BREAK +case YY_STATE_EOF(dq): +#line 210 "ob_expr_parser_utf8.l" +{ return ERROR; } + YY_BREAK +/* backtick */ +case 52: +YY_RULE_SETUP +#line 214 "ob_expr_parser_utf8.l" +{ + PUSH_STATE(bt); + ObExprParseResult *p = (ObExprParseResult *)yyextra; + if (NULL != p) { + p->tmp_buf_ = (char *)obproxy_parse_malloc(OBPROXY_MAX_NAME_LENGTH, p->malloc_pool_); + p->tmp_start_ptr_ = yytext; + p->tmp_len_ = 0; + } +} + YY_BREAK +case 53: +YY_RULE_SETUP +#line 224 "ob_expr_parser_utf8.l" +{ + ObExprParseResult *p = (ObExprParseResult *)yyextra; + if (NULL != p && NULL != p->tmp_buf_ && p->tmp_len_ + 1 < OBPROXY_MAX_NAME_LENGTH) { + p->tmp_buf_[p->tmp_len_++] = '`'; + } +} + YY_BREAK +case 54: +/* rule 54 can match eol */ +YY_RULE_SETUP +#line 231 "ob_expr_parser_utf8.l" +{ + ObExprParseResult *p = (ObExprParseResult *)yyextra; + if (NULL != p && NULL != p->tmp_buf_ && p->tmp_len_ + yyleng < OBPROXY_MAX_NAME_LENGTH) { + memcpy(p->tmp_buf_ + p->tmp_len_, yytext, yyleng); + p->tmp_len_ += yyleng; + } +} + YY_BREAK +case 55: +YY_RULE_SETUP +#line 239 "ob_expr_parser_utf8.l" +{ + POP_STATE(); + ObExprParseResult *p = (ObExprParseResult *)yyextra; + if (NULL != p && NULL != p->tmp_buf_) { + yylval->str.str_ = obproxy_parse_strndup(p->tmp_buf_, p->tmp_len_, p->malloc_pool_); + yylval->str.str_len_ = p->tmp_len_; + yylval->str.end_ptr_ = p->tmp_start_ptr_ + p->tmp_len_ + 2; + } + return NAME_OB; +} + YY_BREAK +case YY_STATE_EOF(bt): +#line 250 "ob_expr_parser_utf8.l" +{ + return ERROR; +} + YY_BREAK +case YY_STATE_EOF(INITIAL): +case YY_STATE_EOF(in_c_comment): +#line 254 "ob_expr_parser_utf8.l" +{ return END_P; } + YY_BREAK +case 56: +YY_RULE_SETUP +#line 255 "ob_expr_parser_utf8.l" +{ return IGNORED_WORD; } + YY_BREAK +case 57: +YY_RULE_SETUP +#line 256 "ob_expr_parser_utf8.l" +ECHO; + YY_BREAK +#line 1405 "ob_expr_parser_utf8_lex.c" + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = yyg->yy_hold_char; + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * ob_expr_parser_utf8_yylex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( yyscanner ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner); + + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++yyg->yy_c_buf_p; + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = yyg->yy_c_buf_p; + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( yyscanner ) ) + { + case EOB_ACT_END_OF_FILE: + { + yyg->yy_did_buffer_switch_on_eof = 0; + + if ( ob_expr_parser_utf8_yywrap(yyscanner ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! yyg->yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + yyg->yy_c_buf_p = + yyg->yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( yyscanner ); + + yy_cp = yyg->yy_c_buf_p; + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + yyg->yy_c_buf_p = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars]; + + yy_current_state = yy_get_previous_state( yyscanner ); + + yy_cp = yyg->yy_c_buf_p; + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ +} /* end of ob_expr_parser_utf8_yylex */ + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ +static int yy_get_next_buffer (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = yyg->yytext_ptr; + register int number_to_move, i; + int ret_val; + + if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0; + + else + { + int num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + + int yy_c_buf_p_offset = + (int) (yyg->yy_c_buf_p - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + ob_expr_parser_utf8_yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + yyg->yy_n_chars, (size_t) num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + if ( yyg->yy_n_chars == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + ob_expr_parser_utf8_yyrestart(yyin ,yyscanner); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) ob_expr_parser_utf8_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + } + + yyg->yy_n_chars += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + + yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +} + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + + static yy_state_type yy_get_previous_state (yyscan_t yyscanner) +{ + register yy_state_type yy_current_state; + register char *yy_cp; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + yy_current_state = yyg->yy_start; + + for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + yyg->yy_last_accepting_state = yy_current_state; + yyg->yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 193 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + } + + return yy_current_state; +} + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner) +{ + register int yy_is_jam; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */ + register char *yy_cp = yyg->yy_c_buf_p; + + register YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + yyg->yy_last_accepting_state = yy_current_state; + yyg->yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 193 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 192); + + return yy_is_jam ? 0 : yy_current_state; +} + +#ifndef YY_NO_INPUT +#ifdef __cplusplus + static int yyinput (yyscan_t yyscanner) +#else + static int input (yyscan_t yyscanner) +#endif + +{ + int c; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + *yyg->yy_c_buf_p = yyg->yy_hold_char; + + if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) + /* This was really a NUL. */ + *yyg->yy_c_buf_p = '\0'; + + else + { /* need more input */ + int offset = yyg->yy_c_buf_p - yyg->yytext_ptr; + ++yyg->yy_c_buf_p; + + switch ( yy_get_next_buffer( yyscanner ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + ob_expr_parser_utf8_yyrestart(yyin ,yyscanner); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( ob_expr_parser_utf8_yywrap(yyscanner ) ) + return EOF; + + if ( ! yyg->yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(yyscanner); +#else + return input(yyscanner); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + yyg->yy_c_buf_p = yyg->yytext_ptr + offset; + break; + } + } + } + + c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */ + *yyg->yy_c_buf_p = '\0'; /* preserve yytext */ + yyg->yy_hold_char = *++yyg->yy_c_buf_p; + + return c; +} +#endif /* ifndef YY_NO_INPUT */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * @param yyscanner The scanner object. + * @note This function does not reset the start condition to @c INITIAL . + */ + void ob_expr_parser_utf8_yyrestart (FILE * input_file , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if ( ! YY_CURRENT_BUFFER ){ + ob_expr_parser_utf8_yyensure_buffer_stack (yyscanner); + YY_CURRENT_BUFFER_LVALUE = + ob_expr_parser_utf8_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); + } + + ob_expr_parser_utf8_yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner); + ob_expr_parser_utf8_yy_load_buffer_state(yyscanner ); +} + +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * @param yyscanner The scanner object. + */ + void ob_expr_parser_utf8_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* TODO. We should be able to replace this entire function body + * with + * ob_expr_parser_utf8_yypop_buffer_state(); + * ob_expr_parser_utf8_yypush_buffer_state(new_buffer); + */ + ob_expr_parser_utf8_yyensure_buffer_stack (yyscanner); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *yyg->yy_c_buf_p = yyg->yy_hold_char; + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + ob_expr_parser_utf8_yy_load_buffer_state(yyscanner ); + + /* We don't actually know whether we did this switch during + * EOF (ob_expr_parser_utf8_yywrap()) processing, but the only time this flag + * is looked at is after ob_expr_parser_utf8_yywrap() is called, so it's safe + * to go ahead and always set it. + */ + yyg->yy_did_buffer_switch_on_eof = 1; +} + +static void ob_expr_parser_utf8_yy_load_buffer_state (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + yyg->yy_hold_char = *yyg->yy_c_buf_p; +} + +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * @param yyscanner The scanner object. + * @return the allocated buffer state. + */ + YY_BUFFER_STATE ob_expr_parser_utf8_yy_create_buffer (FILE * file, int size , yyscan_t yyscanner) +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) ob_expr_parser_utf8_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in ob_expr_parser_utf8_yy_create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) ob_expr_parser_utf8_yyalloc(b->yy_buf_size + 2 ,yyscanner ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in ob_expr_parser_utf8_yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + ob_expr_parser_utf8_yy_init_buffer(b,file ,yyscanner); + + return b; +} + +/** Destroy the buffer. + * @param b a buffer created with ob_expr_parser_utf8_yy_create_buffer() + * @param yyscanner The scanner object. + */ + void ob_expr_parser_utf8_yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if ( ! b ) + return; + + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + ob_expr_parser_utf8_yyfree((void *) b->yy_ch_buf ,yyscanner ); + + ob_expr_parser_utf8_yyfree((void *) b ,yyscanner ); +} + +#ifndef __cplusplus +extern int isatty (int ); +#endif /* __cplusplus */ + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a ob_expr_parser_utf8_yyrestart() or at EOF. + */ + static void ob_expr_parser_utf8_yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner) + +{ + int oerrno = errno; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + ob_expr_parser_utf8_yy_flush_buffer(b ,yyscanner); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + /* If b is the current buffer, then ob_expr_parser_utf8_yy_init_buffer was _probably_ + * called from ob_expr_parser_utf8_yyrestart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; + + errno = oerrno; +} + +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * @param yyscanner The scanner object. + */ + void ob_expr_parser_utf8_yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == YY_CURRENT_BUFFER ) + ob_expr_parser_utf8_yy_load_buffer_state(yyscanner ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * @param yyscanner The scanner object. + */ +void ob_expr_parser_utf8_yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if (new_buffer == NULL) + return; + + ob_expr_parser_utf8_yyensure_buffer_stack(yyscanner); + + /* This block is copied from ob_expr_parser_utf8_yy_switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *yyg->yy_c_buf_p = yyg->yy_hold_char; + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + yyg->yy_buffer_stack_top++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from ob_expr_parser_utf8_yy_switch_to_buffer. */ + ob_expr_parser_utf8_yy_load_buffer_state(yyscanner ); + yyg->yy_did_buffer_switch_on_eof = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * @param yyscanner The scanner object. + */ +void ob_expr_parser_utf8_yypop_buffer_state (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if (!YY_CURRENT_BUFFER) + return; + + ob_expr_parser_utf8_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner); + YY_CURRENT_BUFFER_LVALUE = NULL; + if (yyg->yy_buffer_stack_top > 0) + --yyg->yy_buffer_stack_top; + + if (YY_CURRENT_BUFFER) { + ob_expr_parser_utf8_yy_load_buffer_state(yyscanner ); + yyg->yy_did_buffer_switch_on_eof = 1; + } +} + +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void ob_expr_parser_utf8_yyensure_buffer_stack (yyscan_t yyscanner) +{ + int num_to_alloc; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (!yyg->yy_buffer_stack) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; + yyg->yy_buffer_stack = (struct yy_buffer_state**)ob_expr_parser_utf8_yyalloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + , yyscanner); + if ( ! yyg->yy_buffer_stack ) + YY_FATAL_ERROR( "out of dynamic memory in ob_expr_parser_utf8_yyensure_buffer_stack()" ); + + memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + yyg->yy_buffer_stack_max = num_to_alloc; + yyg->yy_buffer_stack_top = 0; + return; + } + + if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = yyg->yy_buffer_stack_max + grow_size; + yyg->yy_buffer_stack = (struct yy_buffer_state**)ob_expr_parser_utf8_yyrealloc + (yyg->yy_buffer_stack, + num_to_alloc * sizeof(struct yy_buffer_state*) + , yyscanner); + if ( ! yyg->yy_buffer_stack ) + YY_FATAL_ERROR( "out of dynamic memory in ob_expr_parser_utf8_yyensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*)); + yyg->yy_buffer_stack_max = num_to_alloc; + } +} + +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * @param yyscanner The scanner object. + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE ob_expr_parser_utf8_yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) +{ + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) ob_expr_parser_utf8_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in ob_expr_parser_utf8_yy_scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + ob_expr_parser_utf8_yy_switch_to_buffer(b ,yyscanner ); + + return b; +} + +/** Setup the input buffer state to scan a string. The next call to ob_expr_parser_utf8_yylex() will + * scan from a @e copy of @a str. + * @param yystr a NUL-terminated string to scan + * @param yyscanner The scanner object. + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * ob_expr_parser_utf8_yy_scan_bytes() instead. + */ +YY_BUFFER_STATE ob_expr_parser_utf8_yy_scan_string (yyconst char * yystr , yyscan_t yyscanner) +{ + + return ob_expr_parser_utf8_yy_scan_bytes(yystr,strlen(yystr) ,yyscanner); +} + +/** Setup the input buffer state to scan the given bytes. The next call to ob_expr_parser_utf8_yylex() will + * scan from a @e copy of @a bytes. + * @param bytes the byte buffer to scan + * @param len the number of bytes in the buffer pointed to by @a bytes. + * @param yyscanner The scanner object. + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE ob_expr_parser_utf8_yy_scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner) +{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = _yybytes_len + 2; + buf = (char *) ob_expr_parser_utf8_yyalloc(n ,yyscanner ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in ob_expr_parser_utf8_yy_scan_bytes()" ); + + memcpy(buf, yybytes, _yybytes_len); + + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + + b = ob_expr_parser_utf8_yy_scan_buffer(buf,n ,yyscanner); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in ob_expr_parser_utf8_yy_scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; +} + + static void yy_push_state (int new_state , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if ( yyg->yy_start_stack_ptr >= yyg->yy_start_stack_depth ) + { + yy_size_t new_size; + + yyg->yy_start_stack_depth += YY_START_STACK_INCR; + new_size = yyg->yy_start_stack_depth * sizeof( int ); + + if ( ! yyg->yy_start_stack ) + yyg->yy_start_stack = (int *) ob_expr_parser_utf8_yyalloc(new_size ,yyscanner ); + + else + yyg->yy_start_stack = (int *) ob_expr_parser_utf8_yyrealloc((void *) yyg->yy_start_stack,new_size ,yyscanner ); + + if ( ! yyg->yy_start_stack ) + YY_FATAL_ERROR( "out of memory expanding start-condition stack" ); + } + + yyg->yy_start_stack[yyg->yy_start_stack_ptr++] = YY_START; + + BEGIN(new_state); +} + + static void yy_pop_state (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if ( --yyg->yy_start_stack_ptr < 0 ) + YY_FATAL_ERROR( "start-condition stack underflow" ); + + BEGIN(yyg->yy_start_stack[yyg->yy_start_stack_ptr]); +} + + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner) +{ + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); +} + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + yytext[yyleng] = yyg->yy_hold_char; \ + yyg->yy_c_buf_p = yytext + yyless_macro_arg; \ + yyg->yy_hold_char = *yyg->yy_c_buf_p; \ + *yyg->yy_c_buf_p = '\0'; \ + yyleng = yyless_macro_arg; \ + } \ + while ( 0 ) + +/* Accessor methods (get/set functions) to struct members. */ + +/** Get the user-defined data for this scanner. + * @param yyscanner The scanner object. + */ +YY_EXTRA_TYPE ob_expr_parser_utf8_yyget_extra (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyextra; +} + +/** Get the current line number. + * @param yyscanner The scanner object. + */ +int ob_expr_parser_utf8_yyget_lineno (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (! YY_CURRENT_BUFFER) + return 0; + + return yylineno; +} + +/** Get the current column number. + * @param yyscanner The scanner object. + */ +int ob_expr_parser_utf8_yyget_column (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (! YY_CURRENT_BUFFER) + return 0; + + return yycolumn; +} + +/** Get the input stream. + * @param yyscanner The scanner object. + */ +FILE *ob_expr_parser_utf8_yyget_in (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyin; +} + +/** Get the output stream. + * @param yyscanner The scanner object. + */ +FILE *ob_expr_parser_utf8_yyget_out (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyout; +} + +/** Get the length of the current token. + * @param yyscanner The scanner object. + */ +int ob_expr_parser_utf8_yyget_leng (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyleng; +} + +/** Get the current token. + * @param yyscanner The scanner object. + */ + +char *ob_expr_parser_utf8_yyget_text (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yytext; +} + +/** Set the user-defined data. This data is never touched by the scanner. + * @param user_defined The data to be associated with this scanner. + * @param yyscanner The scanner object. + */ +void ob_expr_parser_utf8_yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyextra = user_defined ; +} + +/** Set the current line number. + * @param line_number + * @param yyscanner The scanner object. + */ +void ob_expr_parser_utf8_yyset_lineno (int line_number , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* lineno is only valid if an input buffer exists. */ + if (! YY_CURRENT_BUFFER ) + yy_fatal_error( "ob_expr_parser_utf8_yyset_lineno called with no buffer" , yyscanner); + + yylineno = line_number; +} + +/** Set the current column. + * @param line_number + * @param yyscanner The scanner object. + */ +void ob_expr_parser_utf8_yyset_column (int column_no , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* column is only valid if an input buffer exists. */ + if (! YY_CURRENT_BUFFER ) + yy_fatal_error( "ob_expr_parser_utf8_yyset_column called with no buffer" , yyscanner); + + yycolumn = column_no; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param in_str A readable stream. + * @param yyscanner The scanner object. + * @see ob_expr_parser_utf8_yy_switch_to_buffer + */ +void ob_expr_parser_utf8_yyset_in (FILE * in_str , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyin = in_str ; +} + +void ob_expr_parser_utf8_yyset_out (FILE * out_str , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyout = out_str ; +} + +int ob_expr_parser_utf8_yyget_debug (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yy_flex_debug; +} + +void ob_expr_parser_utf8_yyset_debug (int bdebug , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yy_flex_debug = bdebug ; +} + +/* Accessor methods for yylval and yylloc */ + +YYSTYPE * ob_expr_parser_utf8_yyget_lval (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yylval; +} + +void ob_expr_parser_utf8_yyset_lval (YYSTYPE * yylval_param , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yylval = yylval_param; +} + +YYLTYPE *ob_expr_parser_utf8_yyget_lloc (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yylloc; +} + +void ob_expr_parser_utf8_yyset_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yylloc = yylloc_param; +} + +/* User-visible API */ + +/* ob_expr_parser_utf8_yylex_init is special because it creates the scanner itself, so it is + * the ONLY reentrant function that doesn't take the scanner as the last argument. + * That's why we explicitly handle the declaration, instead of using our macros. + */ + +int ob_expr_parser_utf8_yylex_init(yyscan_t* ptr_yy_globals) + +{ + if (ptr_yy_globals == NULL){ + errno = EINVAL; + return 1; + } + + *ptr_yy_globals = (yyscan_t) ob_expr_parser_utf8_yyalloc ( sizeof( struct yyguts_t ), NULL ); + + if (*ptr_yy_globals == NULL){ + errno = ENOMEM; + return 1; + } + + /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */ + memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); + + return yy_init_globals ( *ptr_yy_globals ); +} + +/* ob_expr_parser_utf8_yylex_init_extra has the same functionality as ob_expr_parser_utf8_yylex_init, but follows the + * convention of taking the scanner as the last argument. Note however, that + * this is a *pointer* to a scanner, as it will be allocated by this call (and + * is the reason, too, why this function also must handle its own declaration). + * The user defined value in the first argument will be available to ob_expr_parser_utf8_yyalloc in + * the yyextra field. + */ + +int ob_expr_parser_utf8_yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals ) + +{ + struct yyguts_t dummy_yyguts; + + ob_expr_parser_utf8_yyset_extra (yy_user_defined, &dummy_yyguts); + + if (ptr_yy_globals == NULL){ + errno = EINVAL; + return 1; + } + + *ptr_yy_globals = (yyscan_t) ob_expr_parser_utf8_yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); + + if (*ptr_yy_globals == NULL){ + errno = ENOMEM; + return 1; + } + + /* By setting to 0xAA, we expose bugs in + yy_init_globals. Leave at 0x00 for releases. */ + memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); + + ob_expr_parser_utf8_yyset_extra (yy_user_defined, *ptr_yy_globals); + + return yy_init_globals ( *ptr_yy_globals ); +} + +static int yy_init_globals (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from ob_expr_parser_utf8_yylex_destroy(), so don't allocate here. + */ + + yyg->yy_buffer_stack = 0; + yyg->yy_buffer_stack_top = 0; + yyg->yy_buffer_stack_max = 0; + yyg->yy_c_buf_p = (char *) 0; + yyg->yy_init = 0; + yyg->yy_start = 0; + + yyg->yy_start_stack_ptr = 0; + yyg->yy_start_stack_depth = 0; + yyg->yy_start_stack = NULL; + +/* Defined in main.c */ +#ifdef YY_STDINIT + yyin = stdin; + yyout = stdout; +#else + yyin = (FILE *) 0; + yyout = (FILE *) 0; +#endif + + /* For future reference: Set errno on error, since we are called by + * ob_expr_parser_utf8_yylex_init() + */ + return 0; +} + +/* ob_expr_parser_utf8_yylex_destroy is for both reentrant and non-reentrant scanners. */ +int ob_expr_parser_utf8_yylex_destroy (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + ob_expr_parser_utf8_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner ); + YY_CURRENT_BUFFER_LVALUE = NULL; + ob_expr_parser_utf8_yypop_buffer_state(yyscanner); + } + + /* Destroy the stack itself. */ + ob_expr_parser_utf8_yyfree(yyg->yy_buffer_stack ,yyscanner); + yyg->yy_buffer_stack = NULL; + + /* Destroy the start condition stack. */ + ob_expr_parser_utf8_yyfree(yyg->yy_start_stack ,yyscanner ); + yyg->yy_start_stack = NULL; + + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * ob_expr_parser_utf8_yylex() is called, initialization will occur. */ + yy_init_globals( yyscanner); + + /* Destroy the main struct (reentrant only). */ + ob_expr_parser_utf8_yyfree ( yyscanner , yyscanner ); + yyscanner = NULL; + return 0; +} + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner) +{ + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) +{ + register int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; +} +#endif + +#define YYTABLES_NAME "yytables" + +#line 256 "ob_expr_parser_utf8.l" + + + +inline void *ob_expr_parser_utf8_yyalloc(size_t bytes,void *yyscanner) +{ + void *ptr_ret = NULL; + ObExprParseResult *p = ob_expr_parser_utf8_yyget_extra(yyscanner); + if (OB_ISNULL(p)) { + // print err into msg buffer later + } else { + ptr_ret = obproxy_parse_malloc(bytes, p->malloc_pool_); + } + return ptr_ret; +} + +inline void *ob_expr_parser_utf8_yyrealloc(void *ptr,size_t bytes,void *yyscanner) +{ + void *ptr_ret = NULL; + ObExprParseResult *p = ob_expr_parser_utf8_yyget_extra(yyscanner); + if (OB_ISNULL(p)) { + // print err into msg buffer later + } else { + ptr_ret = obproxy_parse_realloc(ptr, bytes, p->malloc_pool_); + } + return ptr_ret; + +} + +inline void ob_expr_parser_utf8_yyfree(void *ptr,void *yyscanner) +{ + // Do nothing -- we leave it to the garbage collector. + obproxy_parse_free(ptr); +} + +inline void store_expr_str(char* str, int64_t str_len, char*end_ptr, void *yyscanner) +{ + YYSTYPE *lval = ob_expr_parser_utf8_yyget_lval(yyscanner); + if (OB_ISNULL(lval)) { + // do nothing + } else { + lval->str.str_ = str; + lval->str.end_ptr_ = end_ptr; + lval->str.str_len_ = str_len; + } +} + +inline void store_pos_place_holder(char *str, void *yyscanner) +{ + YYSTYPE *lval = ob_expr_parser_utf8_yyget_lval(yyscanner); + if (OB_ISNULL(lval)) { + // do nothing + } else { + errno = 0; + lval->num = strtoll(str, NULL, 10); + if (0 != errno) { + lval->num = 0; + } + } +} + +/* A Bison parser, made by GNU Bison 2.4.1. */ + +/* Skeleton interface for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. + + 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 + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + + +#ifndef YY_OBEXPR_OB_EXPR_PARSER_TAB_H_INCLUDED +# define YY_OBEXPR_OB_EXPR_PARSER_TAB_H_INCLUDED +/* Debug traces. */ +#ifndef OBEXPR_UTF8_DEBUG +# if defined YYDEBUG +#if YYDEBUG +# define OBEXPR_UTF8_DEBUG 1 +# else +# define OBEXPR_UTF8_DEBUG 0 +# endif +# else /* ! defined YYDEBUG */ +# define OBEXPR_UTF8_DEBUG 0 +# endif /* ! defined YYDEBUG */ +#endif /* ! defined OBEXPR_UTF8_DEBUG */ +#if OBEXPR_UTF8_DEBUG +extern int ob_expr_parser_utf8_yydebug; +#endif +/* Tokens. */ +#ifndef OBEXPRTOKENTYPE +# define OBEXPRTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum obexprtokentype { + DUMMY_SELECT_CLAUSE = 258, + DUMMY_INSERT_CLAUSE = 259, + WHERE = 260, + AS = 261, + VALUES = 262, + SET = 263, + END_WHERE = 264, + JOIN = 265, + AND_OP = 266, + OR_OP = 267, + IN = 268, + ON = 269, + BETWEEN = 270, + ROWID = 271, + COMP_EQ = 272, + COMP_NSEQ = 273, + COMP_GE = 274, + COMP_GT = 275, + COMP_LE = 276, + COMP_LT = 277, + COMP_NE = 278, + PLACE_HOLDER = 279, + END_P = 280, + ERROR = 281, + IGNORED_WORD = 282, + NAME_OB = 283, + STR_VAL = 284, + INT_VAL = 285, + POS_PLACE_HOLDER = 286 + }; +#endif + + + +#if ! defined OBEXPRSTYPE && ! defined OBEXPRSTYPE_IS_DECLARED +typedef union OBEXPRSTYPE +{ + + + int64_t num; + ObProxyParseString str; + ObProxyFunctionType func; + ObProxyOperatorType operator; + ObProxyTokenNode *node; + ObProxyTokenList *list; + ObProxyRelationExpr *relation; + + + +} OBEXPRSTYPE; +# define OBEXPRSTYPE_IS_TRIVIAL 1 +# define obexprstype OBEXPRSTYPE /* obsolescent; will be withdrawn */ +# define OBEXPRSTYPE_IS_DECLARED 1 +#endif + + + +#if ! defined OBEXPRLTYPE && ! defined OBEXPRLTYPE_IS_DECLARED +typedef struct OBEXPRLTYPE +{ + int first_line; + int first_column; + int last_line; + int last_column; +} OBEXPRLTYPE; +# define obexprltype OBEXPRLTYPE /* obsolescent; will be withdrawn */ +# define OBEXPRLTYPE_IS_DECLARED 1 +# define OBEXPRLTYPE_IS_TRIVIAL 1 +#endif + + + +#endif + diff --git a/src/obproxy/opsql/expr_parser/ob_expr_parser_utf8_lex.h b/src/obproxy/opsql/expr_parser/ob_expr_parser_utf8_lex.h new file mode 100644 index 0000000..c6b5617 --- /dev/null +++ b/src/obproxy/opsql/expr_parser/ob_expr_parser_utf8_lex.h @@ -0,0 +1,349 @@ +#ifndef ob_expr_parser_utf8_yyHEADER_H +#define ob_expr_parser_utf8_yyHEADER_H 1 +#define ob_expr_parser_utf8_yyIN_HEADER 1 + +#line 6 "ob_expr_parser_utf8_lex.h" + +#line 8 "ob_expr_parser_utf8_lex.h" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 35 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include +#include +#include +#include + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have . Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; +#endif /* ! C99 */ + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! FLEXINT_H */ + +#ifdef __cplusplus + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) + +#define YY_USE_CONST + +#endif /* defined (__STDC__) */ +#endif /* ! __cplusplus */ + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + +/* An opaque pointer. */ +#ifndef YY_TYPEDEF_YY_SCANNER_T +#define YY_TYPEDEF_YY_SCANNER_T +typedef void* yyscan_t; +#endif + +/* For convenience, these vars (plus the bison vars far below) + are macros in the reentrant scanner. */ +#define yyin yyg->yyin_r +#define yyout yyg->yyout_r +#define yyextra yyg->yyextra_r +#define yyleng yyg->yyleng_r +#define yytext yyg->yytext_r +#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno) +#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column) +#define yy_flex_debug yyg->yy_flex_debug_r + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#define YY_BUF_SIZE 16384 +#endif + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +void ob_expr_parser_utf8_yyrestart (FILE *input_file ,yyscan_t yyscanner ); +void ob_expr_parser_utf8_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); +YY_BUFFER_STATE ob_expr_parser_utf8_yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner ); +void ob_expr_parser_utf8_yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); +void ob_expr_parser_utf8_yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); +void ob_expr_parser_utf8_yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); +void ob_expr_parser_utf8_yypop_buffer_state (yyscan_t yyscanner ); + +YY_BUFFER_STATE ob_expr_parser_utf8_yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); +YY_BUFFER_STATE ob_expr_parser_utf8_yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); +YY_BUFFER_STATE ob_expr_parser_utf8_yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); + +void *ob_expr_parser_utf8_yyalloc (yy_size_t ,yyscan_t yyscanner ); +void *ob_expr_parser_utf8_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner ); +void ob_expr_parser_utf8_yyfree (void * ,yyscan_t yyscanner ); + +/* Begin user sect3 */ + +#define ob_expr_parser_utf8_yywrap(n) 1 +#define YY_SKIP_YYWRAP + +#define yytext_ptr yytext_r + +#ifdef YY_HEADER_EXPORT_START_CONDITIONS +#define INITIAL 0 +#define in_c_comment 1 +#define sq 2 +#define dq 3 +#define bt 4 + +#endif + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +int ob_expr_parser_utf8_yylex_init (yyscan_t* scanner); + +int ob_expr_parser_utf8_yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner); + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int ob_expr_parser_utf8_yylex_destroy (yyscan_t yyscanner ); + +int ob_expr_parser_utf8_yyget_debug (yyscan_t yyscanner ); + +void ob_expr_parser_utf8_yyset_debug (int debug_flag ,yyscan_t yyscanner ); + +YY_EXTRA_TYPE ob_expr_parser_utf8_yyget_extra (yyscan_t yyscanner ); + +void ob_expr_parser_utf8_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); + +FILE *ob_expr_parser_utf8_yyget_in (yyscan_t yyscanner ); + +void ob_expr_parser_utf8_yyset_in (FILE * in_str ,yyscan_t yyscanner ); + +FILE *ob_expr_parser_utf8_yyget_out (yyscan_t yyscanner ); + +void ob_expr_parser_utf8_yyset_out (FILE * out_str ,yyscan_t yyscanner ); + +int ob_expr_parser_utf8_yyget_leng (yyscan_t yyscanner ); + +char *ob_expr_parser_utf8_yyget_text (yyscan_t yyscanner ); + +int ob_expr_parser_utf8_yyget_lineno (yyscan_t yyscanner ); + +void ob_expr_parser_utf8_yyset_lineno (int line_number ,yyscan_t yyscanner ); + +OBEXPRSTYPE * ob_expr_parser_utf8_yyget_lval (yyscan_t yyscanner ); + +void ob_expr_parser_utf8_yyset_lval (OBEXPRSTYPE * yylval_param ,yyscan_t yyscanner ); + + OBEXPRLTYPE *ob_expr_parser_utf8_yyget_lloc (yyscan_t yyscanner ); + + void ob_expr_parser_utf8_yyset_lloc (OBEXPRLTYPE * yylloc_param ,yyscan_t yyscanner ); + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int ob_expr_parser_utf8_yywrap (yyscan_t yyscanner ); +#else +extern int ob_expr_parser_utf8_yywrap (yyscan_t yyscanner ); +#endif +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner); +#endif + +#ifndef YY_NO_INPUT + +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#define YY_READ_BUF_SIZE 8192 +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 + +extern int ob_expr_parser_utf8_yylex \ + (OBEXPRSTYPE * yylval_param,OBEXPRLTYPE * yylloc_param ,yyscan_t yyscanner); + +#define YY_DECL int ob_expr_parser_utf8_yylex \ + (OBEXPRSTYPE * yylval_param, OBEXPRLTYPE * yylloc_param , yyscan_t yyscanner) +#endif /* !YY_DECL */ + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + +#undef YY_NEW_FILE +#undef YY_FLUSH_BUFFER +#undef yy_set_bol +#undef yy_new_buffer +#undef yy_set_interactive +#undef YY_DO_BEFORE_ACTION + +#ifdef YY_DECL_IS_OURS +#undef YY_DECL_IS_OURS +#undef YY_DECL +#endif + +#line 256 "ob_expr_parser_utf8.l" + + +#line 348 "ob_expr_parser_utf8_lex.h" +#undef ob_expr_parser_utf8_yyIN_HEADER +#endif /* ob_expr_parser_utf8_yyHEADER_H */ diff --git a/src/obproxy/opsql/expr_parser/ob_expr_parser_utf8_tab.c b/src/obproxy/opsql/expr_parser/ob_expr_parser_utf8_tab.c new file mode 100644 index 0000000..c6fe746 --- /dev/null +++ b/src/obproxy/opsql/expr_parser/ob_expr_parser_utf8_tab.c @@ -0,0 +1,2529 @@ + +/* A Bison parser, made by GNU Bison 2.4.1. */ + +/* Skeleton implementation for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. + + 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 + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Bison version. */ +#define YYBISON_VERSION "2.4.1" + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 1 + +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + +/* Using locations. */ +#define YYLSP_NEEDED 1 + +/* Substitute the variable and function names. */ +#define YYSTYPE OBEXPRSTYPE +#define YYLTYPE OBEXPRLTYPE +#define yyparse ob_expr_parser_utf8_yyparse +#define yylex ob_expr_parser_utf8_yylex +#define yyerror ob_expr_parser_utf8_yyerror +#define yylval ob_expr_parser_utf8_yylval +#define yychar ob_expr_parser_utf8_yychar +#define yydebug ob_expr_parser_utf8_yydebug +#define yynerrs ob_expr_parser_utf8_yynerrs +#define yylloc ob_expr_parser_utf8_yylloc + +/* Copy the first part of user declarations. */ + + +#include +#include "opsql/ob_proxy_parse_define.h" +#include "opsql/expr_parser/ob_expr_parse_result.h" + + + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 0 +#endif + +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE 0 +#endif + + +#ifndef YY_OBEXPR_OB_EXPR_PARSER_TAB_H_INCLUDED +# define YY_OBEXPR_OB_EXPR_PARSER_TAB_H_INCLUDED +/* Debug traces. */ +#ifndef OBEXPR_UTF8_DEBUG +# if defined YYDEBUG +#if YYDEBUG +# define OBEXPR_UTF8_DEBUG 1 +# else +# define OBEXPR_UTF8_DEBUG 0 +# endif +# else /* ! defined YYDEBUG */ +# define OBEXPR_UTF8_DEBUG 0 +# endif /* ! defined YYDEBUG */ +#endif /* ! defined OBEXPR_UTF8_DEBUG */ +#if OBEXPR_UTF8_DEBUG +extern int ob_expr_parser_utf8_yydebug; +#endif +/* Tokens. */ +#ifndef OBEXPRTOKENTYPE +# define OBEXPRTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum obexprtokentype { + DUMMY_SELECT_CLAUSE = 258, + DUMMY_INSERT_CLAUSE = 259, + WHERE = 260, + AS = 261, + VALUES = 262, + SET = 263, + END_WHERE = 264, + JOIN = 265, + AND_OP = 266, + OR_OP = 267, + IN = 268, + ON = 269, + BETWEEN = 270, + ROWID = 271, + COMP_EQ = 272, + COMP_NSEQ = 273, + COMP_GE = 274, + COMP_GT = 275, + COMP_LE = 276, + COMP_LT = 277, + COMP_NE = 278, + PLACE_HOLDER = 279, + END_P = 280, + ERROR = 281, + IGNORED_WORD = 282, + NAME_OB = 283, + STR_VAL = 284, + INT_VAL = 285, + POS_PLACE_HOLDER = 286 + }; +#endif + + + +#if ! defined OBEXPRSTYPE && ! defined OBEXPRSTYPE_IS_DECLARED +typedef union OBEXPRSTYPE +{ + + + int64_t num; + ObProxyParseString str; + ObProxyFunctionType func; + ObProxyOperatorType operator; + ObProxyTokenNode *node; + ObProxyTokenList *list; + ObProxyRelationExpr *relation; + + + +} OBEXPRSTYPE; +# define OBEXPRSTYPE_IS_TRIVIAL 1 +# define obexprstype OBEXPRSTYPE /* obsolescent; will be withdrawn */ +# define OBEXPRSTYPE_IS_DECLARED 1 +#endif + +#if ! defined OBEXPRLTYPE && ! defined OBEXPRLTYPE_IS_DECLARED +typedef struct OBEXPRLTYPE +{ + int first_line; + int first_column; + int last_line; + int last_column; +} OBEXPRLTYPE; +# define obexprltype OBEXPRLTYPE /* obsolescent; will be withdrawn */ +# define OBEXPRLTYPE_IS_DECLARED 1 +# define OBEXPRLTYPE_IS_TRIVIAL 1 +#endif + + +#endif +/* Copy the second part of user declarations. */ + + +#include "ob_expr_parser_utf8_lex.h" +#define YYLEX_PARAM result->yyscan_info_ +extern void yyerror(YYLTYPE* yylloc, ObExprParseResult* p, char* s,...); +extern void *obproxy_parse_malloc(const size_t nbyte, void *malloc_pool); + +static inline bool is_equal(ObProxyParseString *l, ObProxyParseString *r) +{ + return NULL != l && NULL != r && l->str_len_ == r->str_len_ + && 0 == strncasecmp(l->str_, r->str_, l->str_len_); +} + +static inline void add_token(ObProxyTokenList *list, ObExprParseResult *result, ObProxyTokenNode *node) +{ + UNUSED(result); // use for perf later + if (OB_ISNULL(list) || OB_ISNULL(node)) { + // do nothing + } else { + if (TOKEN_COLUMN == node->type_) { + list->column_node_ = node; + } + if (NULL != list->tail_) { + list->tail_->next_ = node; + list->tail_ = node; + } + } +} + +// expr in (xxx,xxx,xxx) +static inline void add_token_list(ObProxyTokenList *list, ObProxyTokenList *next_list) +{ + if (OB_ISNULL(list) || OB_ISNULL(next_list)) { + } else if (NULL != list->tail_ + && NULL != next_list->head_ + && (TOKEN_INT_VAL == list->tail_->type_ || TOKEN_STR_VAL == list->tail_->type_) + && (TOKEN_INT_VAL == next_list->head_->type_ || TOKEN_STR_VAL == next_list->head_->type_)) { + list->tail_->next_ = next_list->head_; + list->tail_ = next_list->head_; + list->tail_->next_ = NULL; + } +} + +static inline ObProxyFunctionType get_reverse_func(ObProxyFunctionType type) +{ + ObProxyFunctionType ret_type = type; + switch (type) { + case F_COMP_GE: + ret_type = F_COMP_LE; + break; + case F_COMP_GT: + ret_type = F_COMP_LT; + break; + case F_COMP_LE: + ret_type = F_COMP_GE; + break; + case F_COMP_LT: + ret_type = F_COMP_GT; + break; + default: + // do nothing + break; + } + return ret_type; +} + +static inline int64_t get_mask(ObProxyFunctionType type, ObProxyPartKeyLevel level) +{ + int64_t mask = 0; + int64_t flag = NO_BOUND_FLAG; + switch (type) { + case F_COMP_EQ: + case F_COMP_NSEQ: + flag = BOTH_BOUND_FLAG; + break; + case F_COMP_GE: + case F_COMP_GT: + flag = LOW_BOUND_FLAG; + break; + case F_COMP_LE: + case F_COMP_LT: + flag = HIGH_BOUND_FLAG; + break; + default: + break; + } + switch (level) { + case PART_KEY_LEVEL_ONE: + mask = GET_FIRST_PART_MASK(flag); + break; + case PART_KEY_LEVEL_TWO: + mask = GET_SUB_PART_MASK(flag); + break; + case PART_KEY_LEVEL_BOTH: + mask = GET_FIRST_PART_MASK(flag) | GET_SUB_PART_MASK(flag); + break; + default: + break; + } + return mask; +} + +static inline void set_part_key_column_idx(ObExprParseResult *result, ObProxyParseString *column_name) +{ + int64_t i = 0; + for (i = 0; i < result->part_key_info_.key_num_; ++i) { + if (is_equal(column_name, &result->part_key_info_.part_keys_[i].name_)) { + result->part_key_info_.part_keys_[i].idx_ = result->column_idx_; + break; + } + } +} + +#define malloc_node(node, result, type) \ + do { \ + if (OB_ISNULL(node = ((ObProxyTokenNode *)obproxy_parse_malloc(sizeof(ObProxyTokenNode), \ + result->malloc_pool_)))) { \ + YYABORT; \ + } else { \ + node->type_ = type; \ + node->child_ = NULL; \ + node->next_ = NULL; \ + } \ + } while(0) \ + +#define malloc_list(list, result, node) \ + do { \ + if (OB_ISNULL(list = ((ObProxyTokenList *)obproxy_parse_malloc(sizeof(ObProxyTokenList), \ + result->malloc_pool_)))) { \ + YYABORT; \ + } else if (OB_ISNULL(node)) { \ + list->column_node_ = NULL; \ + } else { \ + if (TOKEN_COLUMN == node->type_) { \ + list->column_node_ = node; \ + } else { \ + list->column_node_ = NULL; \ + } \ + list->head_ = node; \ + list->tail_ = node; \ + } \ + } while(0) \ + +#define check_and_add_relation(result, relation) \ + do { \ + if (NULL == relation) { \ + } else { \ + int64_t new_mask = get_mask(relation->type_, relation->level_); \ + if ((result->cur_mask_ | new_mask) != result->cur_mask_) { \ + if (result->relation_info_.relation_num_ < OBPROXY_MAX_RELATION_NUM) { \ + result->relation_info_.relations_[result->relation_info_.relation_num_++] = relation; \ + result->cur_mask_ = (result->cur_mask_ | new_mask); \ + } else { \ + /* YYACCEPT; */ \ + } \ + } \ + if ((result->cur_mask_ & result->target_mask_) == result->target_mask_) { \ + /* YYACCEPT; */ \ + } \ + } \ + } while(0) \ + +static int64_t get_part_key_idx(ObProxyParseString *db_name, + ObProxyParseString *table_name, + ObProxyParseString *column_name, + ObExprParseResult *result) +{ + int64_t part_key_idx = IDX_NO_PART_KEY_COLUMN; + if (NULL != db_name && !is_equal(db_name, &result->table_info_.database_name_)) { + part_key_idx = IDX_NO_PART_KEY_COLUMN; + } else if (NULL != table_name + && !is_equal(table_name, &result->table_info_.table_name_) + && !is_equal(table_name, &result->table_info_.alias_name_)) { + part_key_idx = IDX_NO_PART_KEY_COLUMN; + } else if (NULL != column_name) { + int64_t i = 0; + for (i = 0; i < result->part_key_info_.key_num_ && part_key_idx < 0; ++i) { + if (is_equal(column_name, &result->part_key_info_.part_keys_[i].name_)) { + part_key_idx = i; + break; + } + } + } + return part_key_idx; +} +static inline void add_relation(ObExprParseResult *result, + ObProxyTokenList *left_value, + ObProxyFunctionType type, + ObProxyTokenList *right_value) +{ + if (result->all_relation_info_.relation_num_ < OBPROXY_MAX_RELATION_NUM) { + ObProxyRelationExpr *relation = NULL; + ObProxyTokenList *tmp_left = NULL; + ObProxyTokenList *tmp_right = NULL; + ObProxyFunctionType tmp_type = F_NONE; + ObProxyPartKeyLevel tmp_level = PART_KEY_LEVEL_ZERO; + + if (NULL != left_value->column_node_ + && TOKEN_COLUMN == left_value->column_node_->type_) { + tmp_left = left_value; + tmp_right = right_value; + tmp_type = type; + } else if (NULL != right_value->column_node_ + && TOKEN_COLUMN == right_value->column_node_->type_) { + tmp_left = right_value; + tmp_right = left_value; + tmp_type = get_reverse_func(type); + } + + if (NULL == tmp_left || NULL == tmp_right || F_COMP_NE == tmp_type) { + // will return null + } else if (OB_ISNULL(relation = ((ObProxyRelationExpr *)obproxy_parse_malloc( + sizeof(ObProxyRelationExpr), result->malloc_pool_)))) { + // will return null + } else { + relation->left_value_ = tmp_left; + relation->type_ = tmp_type; + relation->right_value_ = tmp_right; + relation->level_ = tmp_level; + + result->all_relation_info_.relations_[result->all_relation_info_.relation_num_++] = relation; + } + } +} + + +static inline ObProxyRelationExpr *get_relation(ObExprParseResult *result, + ObProxyTokenList *left_value, + ObProxyFunctionType type, + ObProxyTokenList *right_value) +{ + ObProxyRelationExpr *relation = NULL; + ObProxyTokenList *tmp_left = NULL; + ObProxyTokenList *tmp_right = NULL; + ObProxyFunctionType tmp_type = F_NONE; + ObProxyPartKeyLevel tmp_level = PART_KEY_LEVEL_ZERO; + int64_t tmp_column_idx_ = -1; + + if (NULL != left_value->column_node_ + && TOKEN_COLUMN == left_value->column_node_->type_ + && left_value->column_node_->part_key_idx_ >= 0) { + tmp_left = left_value; + tmp_level = result->part_key_info_.part_keys_[left_value->column_node_->part_key_idx_].level_; + tmp_right = right_value; + tmp_type = type; + tmp_column_idx_ = left_value->column_node_->part_key_idx_; + } else if (NULL != right_value->column_node_ + && TOKEN_COLUMN == right_value->column_node_->type_ + && right_value->column_node_->part_key_idx_ >= 0) { + tmp_left = right_value; + tmp_level = result->part_key_info_.part_keys_[right_value->column_node_->part_key_idx_].level_; + tmp_right = left_value; + tmp_type = get_reverse_func(type); + tmp_column_idx_ = right_value->column_node_->part_key_idx_; + } + + if (NULL == tmp_left || NULL == tmp_right || F_COMP_NE == tmp_type) { + // will return null + } else if (OB_ISNULL(relation = ((ObProxyRelationExpr *)obproxy_parse_malloc( + sizeof(ObProxyRelationExpr), result->malloc_pool_)))) { + // will return null + } else { + relation->column_idx_ = tmp_column_idx_; + relation->left_value_ = tmp_left; + relation->type_ = tmp_type; + relation->right_value_ = tmp_right; + relation->level_ = tmp_level; + } + return relation; +} + +static inline ObProxyRelationExpr *get_values_relation(ObExprParseResult *result, + ObProxyTokenList *right_value) +{ + ObProxyRelationExpr *relation = NULL; + if (NULL == right_value) { + // will return null + } else { + int64_t i = 0; + for (i = 0; i < result->part_key_info_.key_num_; ++i) { + if (result->values_list_idx_ == result->part_key_info_.part_keys_[i].idx_) { + if (OB_ISNULL(relation = ((ObProxyRelationExpr *)obproxy_parse_malloc( + sizeof(ObProxyRelationExpr), result->malloc_pool_)))) { + } else { + relation->column_idx_ = i; + relation->type_ = F_COMP_EQ; + relation->right_value_ = right_value; + relation->level_ = result->part_key_info_.part_keys_[i].level_; + } + break; + } + } + } + return relation; +} + +static inline void add_left_relation_value(ObExprParseResult *result, + ObProxyTokenList *left_value) +{ + ObProxyRelationExpr *relation = NULL; + if (NULL == left_value) { + // will return + } else if (result->all_relation_info_.relation_num_ >= OBPROXY_MAX_RELATION_NUM) { + // do nothing + } else if (OB_ISNULL(relation = ((ObProxyRelationExpr *)obproxy_parse_malloc( + sizeof(ObProxyRelationExpr), result->malloc_pool_)))) { + } else { + relation->type_ = F_COMP_EQ; + relation->left_value_ = left_value; + relation->right_value_ = NULL; + result->all_relation_info_.relations_[result->all_relation_info_.relation_num_++] = relation; + } +} + +static inline void add_right_relation_value(ObExprParseResult *result, + ObProxyTokenList *right_value) +{ + if (NULL == right_value) { + // will return + } else if (result->all_relation_info_.relation_num_ >= OBPROXY_MAX_RELATION_NUM) { + // do nohting + } else if (result->all_relation_info_.right_value_num_ >= result->all_relation_info_.relation_num_) { + // ignore + } else if (OB_ISNULL(result->all_relation_info_.relations_[result->all_relation_info_.right_value_num_])) { + } else { + ObProxyRelationExpr *relation = result->all_relation_info_.relations_[result->all_relation_info_.right_value_num_++]; + relation->type_ = F_COMP_EQ; + relation->right_value_ = right_value; + } +} + + + + +#ifdef short +# undef short +#endif + +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; +#endif + +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#elif (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +typedef signed char yytype_int8; +#else +typedef short int yytype_int8; +#endif + +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; +#endif + +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; +#endif + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int +# endif +#endif + +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + +#ifndef YY_ +# if YYENABLE_NLS +# if ENABLE_NLS +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_(msgid) dgettext ("bison-runtime", msgid) +# endif +# endif +# ifndef YY_ +# define YY_(msgid) msgid +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(e) ((void) (e)) +#else +# define YYUSE(e) /* empty */ +#endif + +/* Identity function, used to suppress warnings about constant conditions. */ +#ifndef lint +# define YYID(n) (n) +#else +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static int +YYID (int yyi) +#else +static int +YYID (yyi) + int yyi; +#endif +{ + return yyi; +} +#endif + +#if ! defined yyoverflow || YYERROR_VERBOSE + +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include /* INFRINGES ON USER NAME SPACE */ +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined _STDLIB_H \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# endif +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ + + +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \ + && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; + YYLTYPE yyls_alloc; +}; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ + + 2 * YYSTACK_GAP_MAXIMUM) + +/* Copy COUNT objects from FROM to TO. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# else +# define YYCOPY(To, From, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (YYID (0)) +# endif +# endif + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (YYID (0)) + +#endif + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 17 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 207 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 44 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 24 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 79 +/* YYNRULES -- Number of states. */ +#define YYNSTATES 143 + +/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 286 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +static const yytype_uint8 yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 43, 2, 2, 2, 41, 42, 2, + 35, 32, 39, 37, 36, 38, 34, 40, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 33, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31 +}; + +#if YYDEBUG +/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in + YYRHS. */ +static const yytype_uint8 yyprhs[] = +{ + 0, 0, 3, 6, 9, 13, 16, 21, 23, 25, + 27, 29, 31, 33, 36, 40, 43, 48, 52, 57, + 63, 70, 72, 76, 82, 86, 92, 96, 102, 108, + 114, 118, 120, 122, 124, 126, 128, 130, 132, 134, + 138, 140, 142, 145, 146, 150, 154, 156, 160, 166, + 171, 176, 178, 180, 182, 184, 186, 188, 190, 192, + 194, 196, 198, 200, 205, 210, 214, 216, 220, 226, + 227, 231, 233, 237, 239, 241, 245, 247, 251, 252 +}; + +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const yytype_int8 yyrhs[] = +{ + 45, 0, -1, 3, 46, -1, 4, 60, -1, 5, + 51, 47, -1, 48, 47, -1, 48, 5, 51, 47, + -1, 1, -1, 9, -1, 32, -1, 33, -1, 25, + -1, 49, -1, 48, 49, -1, 50, 14, 51, -1, + 10, 28, -1, 10, 28, 34, 28, -1, 10, 28, + 28, -1, 10, 28, 6, 28, -1, 10, 28, 34, + 28, 28, -1, 10, 28, 34, 28, 6, 28, -1, + 52, -1, 51, 11, 52, -1, 35, 51, 11, 52, + 32, -1, 51, 12, 52, -1, 35, 51, 12, 52, + 32, -1, 55, 53, 55, -1, 35, 55, 53, 55, + 32, -1, 55, 13, 35, 54, 32, -1, 55, 15, + 55, 11, 55, -1, 16, 17, 29, -1, 17, -1, + 18, -1, 19, -1, 20, -1, 21, -1, 22, -1, + 23, -1, 55, -1, 54, 36, 55, -1, 56, -1, + 58, -1, 56, 58, -1, -1, 56, 36, 56, -1, + 57, 36, 56, -1, 28, -1, 28, 34, 28, -1, + 28, 34, 28, 34, 28, -1, 28, 35, 56, 32, + -1, 28, 35, 57, 32, -1, 30, -1, 29, -1, + 59, -1, 24, -1, 31, -1, 37, -1, 38, -1, + 39, -1, 40, -1, 41, -1, 42, -1, 43, -1, + 62, 7, 61, 47, -1, 8, 66, 67, 47, -1, + 14, 51, 47, -1, 46, -1, 35, 65, 32, -1, + 61, 36, 35, 65, 32, -1, -1, 35, 63, 32, + -1, 64, -1, 63, 36, 64, -1, 28, -1, 55, + -1, 65, 36, 55, -1, 52, -1, 66, 36, 52, + -1, -1, 5, 51, -1 +}; + +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +static const yytype_uint16 yyrline[] = +{ + 0, 374, 374, 375, 377, 378, 379, 380, 382, 383, + 384, 385, 387, 388, 390, 392, 393, 394, 395, 396, + 397, 399, 400, 401, 402, 403, 405, 406, 407, 408, + 418, 425, 426, 427, 428, 429, 430, 431, 433, 434, + 436, 438, 439, 441, 442, 443, 445, 451, 457, 463, + 469, 474, 475, 476, 477, 483, 489, 490, 491, 492, + 493, 494, 495, 497, 498, 499, 500, 502, 506, 511, + 512, 517, 521, 526, 532, 542, 552, 553, 555, 556 +}; +#endif + +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "$end", "error", "$undefined", "DUMMY_SELECT_CLAUSE", + "DUMMY_INSERT_CLAUSE", "WHERE", "AS", "VALUES", "SET", "END_WHERE", + "JOIN", "AND_OP", "OR_OP", "IN", "ON", "BETWEEN", "ROWID", "COMP_EQ", + "COMP_NSEQ", "COMP_GE", "COMP_GT", "COMP_LE", "COMP_LT", "COMP_NE", + "PLACE_HOLDER", "END_P", "ERROR", "IGNORED_WORD", "NAME_OB", "STR_VAL", + "INT_VAL", "POS_PLACE_HOLDER", "')'", "';'", "'.'", "'('", "','", "'+'", + "'-'", "'*'", "'/'", "'%'", "'&'", "'!'", "$accept", "start", + "select_root", "end_flag", "join_expr_list", "join_on_expr", "join_expr", + "cond_expr", "bool_pri", "comp", "in_expr_list", "expr", "token_list", + "func_param_list", "token", "operator", "insert_root", + "values_expr_lists", "opt_column_list", "column_list", "opt_column", + "values_expr_list", "set_expr", "opt_where_clause", 0 +}; +#endif + +# ifdef YYPRINT +/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to + token YYLEX-NUM. */ +static const yytype_uint16 yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 41, 59, 46, 40, 44, 43, 45, 42, + 47, 37, 38, 33 +}; +# endif + +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 44, 45, 45, 46, 46, 46, 46, 47, 47, + 47, 47, 48, 48, 49, 50, 50, 50, 50, 50, + 50, 51, 51, 51, 51, 51, 52, 52, 52, 52, + 52, 53, 53, 53, 53, 53, 53, 53, 54, 54, + 55, 56, 56, 57, 57, 57, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 59, 59, 59, 59, + 59, 59, 59, 60, 60, 60, 60, 61, 61, 62, + 62, 63, 63, 64, 65, 65, 66, 66, 67, 67 +}; + +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 2, 2, 3, 2, 4, 1, 1, 1, + 1, 1, 1, 2, 3, 2, 4, 3, 4, 5, + 6, 1, 3, 5, 3, 5, 3, 5, 5, 5, + 3, 1, 1, 1, 1, 1, 1, 1, 1, 3, + 1, 1, 2, 0, 3, 3, 1, 3, 5, 4, + 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 4, 4, 3, 1, 3, 5, 0, + 3, 1, 3, 1, 1, 3, 1, 3, 0, 2 +}; + +/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state + STATE-NUM when YYTABLE doesn't specify something else to do. Zero + means the default is an error. */ +static const yytype_uint8 yydefact[] = +{ + 0, 0, 0, 0, 7, 0, 0, 2, 0, 12, + 0, 0, 0, 0, 66, 3, 0, 1, 0, 54, + 46, 52, 51, 55, 0, 56, 57, 58, 59, 60, + 61, 62, 0, 21, 0, 40, 41, 53, 15, 0, + 8, 11, 9, 10, 5, 13, 0, 0, 76, 78, + 0, 73, 0, 71, 0, 0, 0, 43, 0, 0, + 0, 0, 4, 0, 0, 31, 32, 33, 34, 35, + 36, 37, 0, 42, 0, 17, 0, 0, 14, 0, + 0, 0, 0, 65, 70, 0, 0, 0, 30, 47, + 0, 0, 0, 0, 0, 22, 24, 0, 0, 26, + 18, 16, 6, 0, 79, 77, 64, 72, 74, 0, + 0, 63, 0, 49, 0, 50, 0, 22, 24, 26, + 0, 38, 0, 0, 19, 0, 67, 0, 0, 48, + 44, 45, 23, 25, 27, 28, 0, 29, 20, 75, + 0, 39, 68 +}; + +/* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int8 yydefgoto[] = +{ + -1, 3, 7, 44, 8, 9, 10, 32, 33, 72, + 120, 34, 35, 91, 36, 37, 15, 87, 16, 52, + 53, 109, 49, 82 +}; + +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +#define YYPACT_NINF -54 +static const yytype_int16 yypact[] = +{ + 73, 19, 7, 6, -54, 86, -17, -54, 76, -54, + 2, 106, 86, -10, -54, -54, 30, -54, 27, -54, + 58, -54, -54, -54, 86, -54, -54, -54, -54, -54, + -54, -54, 57, -54, 177, 146, -54, -54, -3, 86, + -54, -54, -54, -54, -54, -54, 86, 146, -54, 0, + 57, -54, -6, -54, -7, 26, 22, 146, 88, 177, + 106, 106, -54, 23, 146, -54, -54, -54, -54, -54, + -54, -54, 146, -54, 32, -54, 37, 57, 94, 184, + 86, 106, 62, -54, -54, -10, 146, 13, -54, 33, + 126, 3, 106, 106, 146, -54, -54, 146, 69, -54, + -54, 4, -54, 146, 94, -54, -54, -54, -54, 11, + 53, -54, 63, -54, 146, -54, 146, 75, 79, 81, + 21, -54, 146, 90, -54, 81, -54, 146, 146, -54, + 146, 146, -54, -54, -54, -54, 146, -54, -54, -54, + 42, -54, -54 +}; + +/* YYPGOTO[NTERM-NUM]. */ +static const yytype_int8 yypgoto[] = +{ + -54, -54, 117, -23, -54, 112, -54, -5, -9, -46, + -54, -24, -53, -54, -34, -54, -54, -54, -54, -54, + 46, 5, -54, -54 +}; + +/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule which + number is the opposite. If zero, do what YYDEFACT says. + If YYTABLE_NINF, syntax error. */ +#define YYTABLE_NINF -70 +static const yytype_int16 yytable[] = +{ + 59, 73, 48, 74, 90, 80, 17, 50, 4, 62, + 123, 38, 5, 94, -69, 11, 46, 6, 51, 58, + 4, 12, 40, 79, 5, 75, 84, 83, 86, 6, + 85, 76, 124, 103, 77, 115, 81, 54, 41, 116, + 98, 78, 13, 126, 55, 42, 43, 127, 99, 110, + 89, 95, 96, 135, 102, 88, 73, 136, 97, 106, + 100, 130, 108, 131, 111, 101, 40, 112, 60, 61, + 119, 40, 105, 121, 142, 104, 1, 2, 127, 125, + 122, 39, 41, 117, 118, 40, 6, 41, 128, 42, + 43, 129, 56, 57, 42, 43, 73, 73, 137, 92, + 93, 41, 18, 139, 108, 60, 61, 132, 42, 43, + 19, 133, 141, 134, 20, 21, 22, 23, 138, 14, + 45, 24, 18, 25, 26, 27, 28, 29, 30, 31, + 19, 107, 0, 140, 20, 21, 22, 23, 0, 0, + 0, 47, 0, 25, 26, 27, 28, 29, 30, 31, + 19, 0, 0, 0, 20, 21, 22, 23, 113, 0, + 0, 0, 114, 25, 26, 27, 28, 29, 30, 31, + 19, 0, 0, 0, 20, 21, 22, 23, 0, 0, + 0, 0, 0, 25, 26, 27, 28, 29, 30, 31, + 63, 0, 64, 0, 65, 66, 67, 68, 69, 70, + 71, 65, 66, 67, 68, 69, 70, 71 +}; + +static const yytype_int16 yycheck[] = +{ + 24, 35, 11, 6, 57, 5, 0, 12, 1, 32, + 6, 28, 5, 59, 7, 8, 14, 10, 28, 24, + 1, 14, 9, 47, 5, 28, 32, 50, 35, 10, + 36, 34, 28, 79, 39, 32, 36, 7, 25, 36, + 64, 46, 35, 32, 17, 32, 33, 36, 72, 36, + 28, 60, 61, 32, 77, 29, 90, 36, 35, 82, + 28, 114, 86, 116, 87, 28, 9, 34, 11, 12, + 94, 9, 81, 97, 32, 80, 3, 4, 36, 103, + 11, 5, 25, 92, 93, 9, 10, 25, 35, 32, + 33, 28, 34, 35, 32, 33, 130, 131, 122, 11, + 12, 25, 16, 127, 128, 11, 12, 32, 32, 33, + 24, 32, 136, 32, 28, 29, 30, 31, 28, 2, + 8, 35, 16, 37, 38, 39, 40, 41, 42, 43, + 24, 85, -1, 128, 28, 29, 30, 31, -1, -1, + -1, 35, -1, 37, 38, 39, 40, 41, 42, 43, + 24, -1, -1, -1, 28, 29, 30, 31, 32, -1, + -1, -1, 36, 37, 38, 39, 40, 41, 42, 43, + 24, -1, -1, -1, 28, 29, 30, 31, -1, -1, + -1, -1, -1, 37, 38, 39, 40, 41, 42, 43, + 13, -1, 15, -1, 17, 18, 19, 20, 21, 22, + 23, 17, 18, 19, 20, 21, 22, 23 +}; + +/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const yytype_uint8 yystos[] = +{ + 0, 3, 4, 45, 1, 5, 10, 46, 48, 49, + 50, 8, 14, 35, 46, 60, 62, 0, 16, 24, + 28, 29, 30, 31, 35, 37, 38, 39, 40, 41, + 42, 43, 51, 52, 55, 56, 58, 59, 28, 5, + 9, 25, 32, 33, 47, 49, 14, 35, 52, 66, + 51, 28, 63, 64, 7, 17, 34, 35, 51, 55, + 11, 12, 47, 13, 15, 17, 18, 19, 20, 21, + 22, 23, 53, 58, 6, 28, 34, 51, 51, 55, + 5, 36, 67, 47, 32, 36, 35, 61, 29, 28, + 56, 57, 11, 12, 53, 52, 52, 35, 55, 55, + 28, 28, 47, 53, 51, 52, 47, 64, 55, 65, + 36, 47, 34, 32, 36, 32, 36, 52, 52, 55, + 54, 55, 11, 6, 28, 55, 32, 36, 35, 28, + 56, 56, 32, 32, 32, 32, 36, 55, 28, 55, + 65, 55, 32 +}; + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + + +/* Like YYERROR except do call yyerror. This remains here temporarily + to ease the transition to the new meaning of YYERROR, for GCC. + Once GCC version 2 has supplanted version 1, this can go. */ + +#define YYFAIL goto yyerrlab + +#define YYRECOVERING() (!!yyerrstatus) + +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + yytoken = YYTRANSLATE (yychar); \ + YYPOPSTACK (1); \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (&yylloc, result, YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ +while (YYID (0)) + + +#define YYTERROR 1 +#define YYERRCODE 256 + + +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ + +#define YYRHSLOC(Rhs, K) ((Rhs)[K]) +#ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (YYID (N)) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ + while (YYID (0)) +#endif + + +/* YY_LOCATION_PRINT -- Print the location on the stream. + This macro was not mandated originally: define only if we know + we won't break user code: when these are the locations we know. */ + +#ifndef YY_LOCATION_PRINT +# if YYLTYPE_IS_TRIVIAL +# define YY_LOCATION_PRINT(File, Loc) \ + fprintf (File, "%d.%d-%d.%d", \ + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) +# else +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +# endif +#endif + + +/* YYLEX -- calling `yylex' with the right arguments. */ + +#ifdef YYLEX_PARAM +# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) +#else +# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) +#endif + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (YYID (0)) + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value, Location, result); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (YYID (0)) + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, ObExprParseResult* result) +#else +static void +yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, result) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; + YYLTYPE const * const yylocationp; + ObExprParseResult* result; +#endif +{ + if (!yyvaluep) + return; + YYUSE (yylocationp); + YYUSE (result); +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# else + YYUSE (yyoutput); +# endif + switch (yytype) + { + default: + break; + } +} + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, ObExprParseResult* result) +#else +static void +yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp, result) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; + YYLTYPE const * const yylocationp; + ObExprParseResult* result; +#endif +{ + if (yytype < YYNTOKENS) + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + + YY_LOCATION_PRINT (yyoutput, *yylocationp); + YYFPRINTF (yyoutput, ": "); + yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, result); + YYFPRINTF (yyoutput, ")"); +} + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +#else +static void +yy_stack_print (yybottom, yytop) + yytype_int16 *yybottom; + yytype_int16 *yytop; +#endif +{ + YYFPRINTF (stderr, "Stack now"); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (YYID (0)) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, ObExprParseResult* result) +#else +static void +yy_reduce_print (yyvsp, yylsp, yyrule, result) + YYSTYPE *yyvsp; + YYLTYPE *yylsp; + int yyrule; + ObExprParseResult* result; +#endif +{ + int yynrhs = yyr2[yyrule]; + int yyi; + unsigned long int yylno = yyrline[yyrule]; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], + &(yyvsp[(yyi + 1) - (yynrhs)]) + , &(yylsp[(yyi + 1) - (yynrhs)]) , result); + YYFPRINTF (stderr, "\n"); + } +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyvsp, yylsp, Rule, result); \ +} while (YYID (0)) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !YYDEBUG */ + + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH 10000 +#endif + + + +#if YYERROR_VERBOSE + +# ifndef yystrlen +# if defined __GLIBC__ && defined _STRING_H +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static YYSIZE_T +yystrlen (const char *yystr) +#else +static YYSIZE_T +yystrlen (yystr) + const char *yystr; +#endif +{ + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) + continue; + return yylen; +} +# endif +# endif + +# ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static char * +yystpcpy (char *yydest, const char *yysrc) +#else +static char * +yystpcpy (yydest, yysrc) + char *yydest; + const char *yysrc; +#endif +{ + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + YYSIZE_T yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (! yyres) + return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +/* Copy into YYRESULT an error message about the unexpected token + YYCHAR while in state YYSTATE. Return the number of bytes copied, + including the terminating null byte. If YYRESULT is null, do not + copy anything; just return the number of bytes that would be + copied. As a special case, return 0 if an ordinary "syntax error" + message will do. Return YYSIZE_MAXIMUM if overflow occurs during + size calculation. */ +static YYSIZE_T +yysyntax_error (char *yyresult, int yystate, int yychar) +{ + int yyn = yypact[yystate]; + + if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) + return 0; + else + { + int yytype = YYTRANSLATE (yychar); + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + int yysize_overflow = 0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + int yyx; + +# if 0 + /* This is so xgettext sees the translatable formats that are + constructed on the fly. */ + YY_("syntax error, unexpected %s"); + YY_("syntax error, unexpected %s, expecting %s"); + YY_("syntax error, unexpected %s, expecting %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); +# endif + char *yyfmt; + char const *yyf; + static char const yyunexpected[] = "syntax error, unexpected %s"; + static char const yyexpecting[] = ", expecting %s"; + static char const yyor[] = " or %s"; + char yyformat[sizeof yyunexpected + + sizeof yyexpecting - 1 + + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) + * (sizeof yyor - 1))]; + char const *yyprefix = yyexpecting; + + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yycount = 1; + + yyarg[0] = yytname[yytype]; + yyfmt = yystpcpy (yyformat, yyunexpected); + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + yyformat[sizeof yyunexpected - 1] = '\0'; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + yyfmt = yystpcpy (yyfmt, yyprefix); + yyprefix = yyor; + } + + yyf = YY_(yyformat); + yysize1 = yysize + yystrlen (yyf); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + + if (yysize_overflow) + return YYSIZE_MAXIMUM; + + if (yyresult) + { + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + char *yyp = yyresult; + int yyi = 0; + while ((*yyp = *yyf) != '\0') + { + if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyf += 2; + } + else + { + yyp++; + yyf++; + } + } + } + return yysize; + } +} +#endif /* YYERROR_VERBOSE */ + + +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, ObExprParseResult* result) +#else +static void +yydestruct (yymsg, yytype, yyvaluep, yylocationp, result) + const char *yymsg; + int yytype; + YYSTYPE *yyvaluep; + YYLTYPE *yylocationp; + ObExprParseResult* result; +#endif +{ + YYUSE (yyvaluep); + YYUSE (yylocationp); + YYUSE (result); + + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + + switch (yytype) + { + + default: + break; + } +} + +/* Prevent warnings from -Wmissing-prototypes. */ +#ifdef YYPARSE_PARAM +#if defined __STDC__ || defined __cplusplus +int yyparse (void *YYPARSE_PARAM); +#else +int yyparse (); +#endif +#else /* ! YYPARSE_PARAM */ +#if defined __STDC__ || defined __cplusplus +int yyparse (ObExprParseResult* result); +#else +int yyparse (); +#endif +#endif /* ! YYPARSE_PARAM */ + + + + + +/*-------------------------. +| yyparse or yypush_parse. | +`-------------------------*/ + +#ifdef YYPARSE_PARAM +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (void *YYPARSE_PARAM) +#else +int +yyparse (YYPARSE_PARAM) + void *YYPARSE_PARAM; +#endif +#else /* ! YYPARSE_PARAM */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (ObExprParseResult* result) +#else +int +yyparse (result) + ObExprParseResult* result; +#endif +#endif +{ +/* The lookahead symbol. */ +int yychar; + +/* The semantic value of the lookahead symbol. */ +YYSTYPE yylval; + +/* Location data for the lookahead symbol. */ +YYLTYPE yylloc; + + /* Number of syntax errors so far. */ + int yynerrs; + + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + + /* The stacks and their tools: + `yyss': related to states. + `yyvs': related to semantic values. + `yyls': related to locations. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; + + /* The location stack. */ + YYLTYPE yylsa[YYINITDEPTH]; + YYLTYPE *yyls; + YYLTYPE *yylsp; + + /* The locations where the error started and ended. */ + YYLTYPE yyerror_range[2]; + + YYSIZE_T yystacksize; + + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken; + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + YYLTYPE yyloc; + +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) + + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; + + yytoken = 0; + yyss = yyssa; + yyvs = yyvsa; + yyls = yylsa; + yystacksize = YYINITDEPTH; + + YYDPRINTF ((stderr, "Starting parse\n")); + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + if (SELECT_STMT_PARSE_MODE == result->parse_mode_) { + yychar = DUMMY_SELECT_CLAUSE; + } else if (INSERT_STMT_PARSE_MODE == result->parse_mode_) { + yychar = DUMMY_INSERT_CLAUSE; + } + + + /* Initialize stack pointers. + Waste one element of value and location stack + so that they stay on the same level as the state stack. + The wasted elements are never initialized. */ + yyssp = yyss; + yyvsp = yyvs; + yylsp = yyls; + +#if YYLTYPE_IS_TRIVIAL + /* Initialize the default location before parsing starts. */ + yylloc.first_line = yylloc.last_line = 1; + yylloc.first_column = yylloc.last_column = 1; +#endif + + goto yysetstate; + +/*------------------------------------------------------------. +| yynewstate -- Push a new state, which is found in yystate. | +`------------------------------------------------------------*/ + yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. So pushing a state here evens the stacks. */ + yyssp++; + + yysetstate: + *yyssp = yystate; + + if (yyss + yystacksize - 1 <= yyssp) + { + /* Get the current used size of the three stacks, in elements. */ + YYSIZE_T yysize = yyssp - yyss + 1; + +#ifdef yyoverflow + { + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; + YYLTYPE *yyls1 = yyls; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yyls1, yysize * sizeof (*yylsp), + &yystacksize); + + yyls = yyls1; + yyss = yyss1; + yyvs = yyvs1; + } +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyexhaustedlab; +# else + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + goto yyexhaustedlab; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); + YYSTACK_RELOCATE (yyls_alloc, yyls); +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif +#endif /* no yyoverflow */ + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; + yylsp = yyls + yysize - 1; + + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + + if (yystate == YYFINAL) + YYACCEPT; + + goto yybackup; + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: + + /* Do appropriate processing given the current state. Read a + lookahead token if we need one and don't already have one. */ + + /* First try to decide what to do without reference to lookahead token. */ + yyn = yypact[yystate]; + if (yyn == YYPACT_NINF) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = YYLEX; + } + + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + goto yydefault; + yyn = yytable[yyn]; + if (yyn <= 0) + { + if (yyn == 0 || yyn == YYTABLE_NINF) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + /* Shift the lookahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the shifted token. */ + yychar = YYEMPTY; + + yystate = yyn; + *++yyvsp = yylval; + *++yylsp = yylloc; + goto yynewstate; + + +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ +yyreduce: + /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; + + /* If YYLEN is nonzero, implement the default value of the action: + `$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + + /* Default location. */ + YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 4: + + { YYACCEPT; ;} + break; + + case 5: + + { YYACCEPT; ;} + break; + + case 6: + + { YYACCEPT; ;} + break; + + case 7: + + { YYACCEPT; ;} + break; + + case 21: + + { check_and_add_relation(result, (yyvsp[(1) - (1)].relation)); ;} + break; + + case 22: + + { check_and_add_relation(result, (yyvsp[(3) - (3)].relation)); ;} + break; + + case 23: + + { check_and_add_relation(result, (yyvsp[(4) - (5)].relation)); ;} + break; + + case 24: + + { check_and_add_relation(result, (yyvsp[(3) - (3)].relation)); ;} + break; + + case 25: + + { check_and_add_relation(result, (yyvsp[(4) - (5)].relation)); ;} + break; + + case 26: + + { add_relation(result, (yyvsp[(1) - (3)].list), (yyvsp[(2) - (3)].func),(yyvsp[(3) - (3)].list)); (yyval.relation) = get_relation(result, (yyvsp[(1) - (3)].list), (yyvsp[(2) - (3)].func), (yyvsp[(3) - (3)].list)); ;} + break; + + case 27: + + { (yyval.relation) = get_relation(result, (yyvsp[(2) - (5)].list), (yyvsp[(3) - (5)].func), (yyvsp[(4) - (5)].list)); add_relation(result, (yyvsp[(2) - (5)].list), (yyvsp[(3) - (5)].func),(yyvsp[(4) - (5)].list)); ;} + break; + + case 28: + + { (yyval.relation) = get_relation(result, (yyvsp[(1) - (5)].list), F_COMP_EQ, (yyvsp[(4) - (5)].list)); add_relation(result, (yyvsp[(1) - (5)].list), F_COMP_EQ,(yyvsp[(4) - (5)].list)); ;} + break; + + case 29: + + { + (yyval.relation) = get_relation(result, (yyvsp[(1) - (5)].list), F_COMP_GE, (yyvsp[(3) - (5)].list)); + check_and_add_relation(result, (yyval.relation)); + add_relation(result, (yyvsp[(1) - (5)].list), F_COMP_GE, (yyvsp[(3) - (5)].list)); + (yyval.relation) = get_relation(result, (yyvsp[(1) - (5)].list), F_COMP_LE, (yyvsp[(5) - (5)].list)); + check_and_add_relation(result, (yyval.relation)); + add_relation(result, (yyvsp[(1) - (5)].list), F_COMP_LE, (yyvsp[(5) - (5)].list)); + (yyval.relation) = NULL; + ;} + break; + + case 30: + + { + result->has_rowid_ =true; + result->rowid_str_ = (yyvsp[(3) - (3)].str); + (yyval.relation) = NULL; + ;} + break; + + case 31: + + { (yyval.func) = F_COMP_EQ; ;} + break; + + case 32: + + { (yyval.func) = F_COMP_NSEQ; ;} + break; + + case 33: + + { (yyval.func) = F_COMP_GE; ;} + break; + + case 34: + + { (yyval.func) = F_COMP_GT; ;} + break; + + case 35: + + { (yyval.func) = F_COMP_LE; ;} + break; + + case 36: + + { (yyval.func) = F_COMP_LT; ;} + break; + + case 37: + + { (yyval.func) = F_COMP_NE; ;} + break; + + case 38: + + { (yyval.list) = (yyvsp[(1) - (1)].list); ;} + break; + + case 39: + + { (yyval.list) = (yyvsp[(1) - (3)].list); add_token_list((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].list)); ;} + break; + + case 40: + + { (yyval.list) = (yyvsp[(1) - (1)].list); ;} + break; + + case 41: + + { malloc_list((yyval.list), result, (yyvsp[(1) - (1)].node)); ;} + break; + + case 42: + + { add_token((yyvsp[(1) - (2)].list), result, (yyvsp[(2) - (2)].node)); (yyval.list) = (yyvsp[(1) - (2)].list); ;} + break; + + case 44: + + {;} + break; + + case 45: + + {;} + break; + + case 46: + + { + malloc_node((yyval.node), result, TOKEN_COLUMN); + (yyval.node)->part_key_idx_ = get_part_key_idx(NULL, NULL, &(yyvsp[(1) - (1)].str), result); + (yyval.node)->column_name_ = (yyvsp[(1) - (1)].str); + ;} + break; + + case 47: + + { + malloc_node((yyval.node), result, TOKEN_COLUMN); + (yyval.node)->part_key_idx_ = get_part_key_idx(NULL, &(yyvsp[(1) - (3)].str), &(yyvsp[(3) - (3)].str), result); + (yyval.node)->column_name_ = (yyvsp[(3) - (3)].str); + ;} + break; + + case 48: + + { + malloc_node((yyval.node), result, TOKEN_COLUMN); + (yyval.node)->part_key_idx_ = get_part_key_idx(&(yyvsp[(1) - (5)].str), &(yyvsp[(3) - (5)].str), &(yyvsp[(5) - (5)].str), result); + (yyval.node)->column_name_ = (yyvsp[(5) - (5)].str); + ;} + break; + + case 49: + + { + malloc_node((yyval.node), result, TOKEN_FUNC); + (yyval.node)->str_value_ = (yyvsp[(1) - (4)].str); + (yyval.node)->child_ = (yyvsp[(3) - (4)].list); + ;} + break; + + case 50: + + { + malloc_node((yyval.node), result, TOKEN_FUNC); + (yyval.node)->str_value_ = (yyvsp[(1) - (4)].str); + ;} + break; + + case 51: + + { malloc_node((yyval.node), result, TOKEN_INT_VAL); (yyval.node)->int_value_ = (yyvsp[(1) - (1)].num); ;} + break; + + case 52: + + { malloc_node((yyval.node), result, TOKEN_STR_VAL); (yyval.node)->str_value_ = (yyvsp[(1) - (1)].str); ;} + break; + + case 53: + + { malloc_node((yyval.node), result, TOKEN_OPERATOR); (yyval.node)->operator_ = (yyvsp[(1) - (1)].operator); ;} + break; + + case 54: + + { + result->placeholder_list_idx_++; + malloc_node((yyval.node), result, TOKEN_PLACE_HOLDER); + (yyval.node)->placeholder_idx_ = result->placeholder_list_idx_ - 1; + ;} + break; + + case 55: + + { + malloc_node((yyval.node), result, TOKEN_PLACE_HOLDER); + (yyval.node)->placeholder_idx_ = (yyvsp[(1) - (1)].num); + ;} + break; + + case 56: + + { (yyval.operator) = OPT_ADD; ;} + break; + + case 57: + + { (yyval.operator) = OPT_MINUS; ;} + break; + + case 58: + + { (yyval.operator) = OPT_MUL; ;} + break; + + case 59: + + { (yyval.operator) = OPT_DIV; ;} + break; + + case 60: + + { (yyval.operator) = OPT_MOD; ;} + break; + + case 61: + + { (yyval.operator) = OPT_AND; ;} + break; + + case 62: + + { (yyval.operator) = OPT_NOT; ;} + break; + + case 63: + + { YYACCEPT; ;} + break; + + case 64: + + { YYACCEPT; ;} + break; + + case 65: + + { YYACCEPT; ;} + break; + + case 67: + + { + result->multi_param_values_++; + ;} + break; + + case 68: + + { + result->multi_param_values_++; + ;} + break; + + case 71: + + { + malloc_list((yyval.list), result, (yyvsp[(1) - (1)].node)); + add_left_relation_value(result, (yyval.list)); + ;} + break; + + case 72: + + { + malloc_list((yyval.list), result, (yyvsp[(3) - (3)].node)); + add_left_relation_value(result, (yyval.list)); + ;} + break; + + case 73: + + { + set_part_key_column_idx(result, &(yyvsp[(1) - (1)].str)); + result->column_idx_++; + malloc_node((yyval.node), result, TOKEN_COLUMN); + (yyval.node)->column_name_ = (yyvsp[(1) - (1)].str); + ;} + break; + + case 74: + + { + if (result->multi_param_values_ < 1) { + result->values_list_idx_ = 0; + result->all_relation_info_.right_value_num_ = 0; + ObProxyRelationExpr *relation = get_values_relation(result, (yyvsp[(1) - (1)].list)); + check_and_add_relation(result, relation); + add_right_relation_value(result, (yyvsp[(1) - (1)].list)); + } + ;} + break; + + case 75: + + { + if (result->multi_param_values_ < 1) { + result->values_list_idx_++; + ObProxyRelationExpr *relation = get_values_relation(result, (yyvsp[(3) - (3)].list)); + check_and_add_relation(result, relation); + add_right_relation_value(result, (yyvsp[(3) - (3)].list)); + } + ;} + break; + + case 76: + + { check_and_add_relation(result, (yyvsp[(1) - (1)].relation)); ;} + break; + + case 77: + + { check_and_add_relation(result, (yyvsp[(3) - (3)].relation)); ;} + break; + + case 79: + + {;} + break; + + + + default: break; + } + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + + *++yyvsp = yyval; + *++yylsp = yyloc; + + /* Now `shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTOKENS]; + + goto yynewstate; + + +/*------------------------------------. +| yyerrlab -- here on detecting error | +`------------------------------------*/ +yyerrlab: + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; +#if ! YYERROR_VERBOSE + yyerror (&yylloc, result, YY_("syntax error")); +#else + { + YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); + if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) + { + YYSIZE_T yyalloc = 2 * yysize; + if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) + yyalloc = YYSTACK_ALLOC_MAXIMUM; + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yyalloc); + if (yymsg) + yymsg_alloc = yyalloc; + else + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + } + } + + if (0 < yysize && yysize <= yymsg_alloc) + { + (void) yysyntax_error (yymsg, yystate, yychar); + yyerror (&yylloc, result, yymsg); + } + else + { + yyerror (&yylloc, result, YY_("syntax error")); + if (yysize != 0) + goto yyexhaustedlab; + } + } +#endif + } + + yyerror_range[0] = yylloc; + + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + if (yychar <= YYEOF) + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } + else + { + yydestruct ("Error: discarding", + yytoken, &yylval, &yylloc, result); + yychar = YYEMPTY; + } + } + + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; + + +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (/*CONSTCOND*/ 0) + goto yyerrorlab; + + yyerror_range[0] = yylsp[1-yylen]; + /* Do not reclaim the symbols of the rule which action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + yystate = *yyssp; + goto yyerrlab1; + + +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ + + for (;;) + { + yyn = yypact[yystate]; + if (yyn != YYPACT_NINF) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; + + yyerror_range[0] = *yylsp; + yydestruct ("Error: popping", + yystos[yystate], yyvsp, yylsp, result); + YYPOPSTACK (1); + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); + } + + *++yyvsp = yylval; + + yyerror_range[1] = yylloc; + /* Using YYLLOC is tempting, but would change the location of + the lookahead. YYLOC is available though. */ + YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2); + *++yylsp = yyloc; + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + + yystate = yyn; + goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +#if !defined(yyoverflow) || YYERROR_VERBOSE +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (&yylloc, result, YY_("memory exhausted")); + yyresult = 2; + /* Fall through. */ +#endif + +yyreturn: + if (yychar != YYEMPTY) + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval, &yylloc, result); + /* Do not reclaim the symbols of the rule which action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp, yylsp, result); + YYPOPSTACK (1); + } +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif + /* Make sure YYID is used. */ + return YYID (yyresult); +} + + + + +void yyerror(YYLTYPE* yylloc, ObExprParseResult* p, char* s, ...) +{ + // do nothing +} + +void ob_expr_utf8_parser_fatal_error(yyconst char *msg, yyscan_t yyscanner) +{ + fprintf(stderr, "FATAL ERROR:%s\n", msg); + ObExprParseResult *p = ob_expr_parser_utf8_yyget_extra(yyscanner); + if (OB_ISNULL(p)) { + fprintf(stderr, "unexpected null parse result\n"); + } else { + longjmp(p->jmp_buf_, 1);//the secord param must be non-zero value + } +} + +int ob_expr_parse_utf8_sql(ObExprParseResult* p, const char* buf, size_t len) +{ + int ret = OB_SUCCESS; + //obexprdebug = 1; + if (OB_ISNULL(p) || OB_ISNULL(buf) || OB_UNLIKELY(len <= 0)) { + ret = OB_INVALID_ARGUMENT; + // print err msg later + } else if (OB_FAIL(ob_expr_parser_utf8_yylex_init_extra(p, &(p->yyscan_info_)))) { + // print err msg later + } else { + int val = setjmp(p->jmp_buf_); + if (val) { + ret = OB_PARSER_ERR_PARSE_SQL; + } else { + ob_expr_parser_utf8_yy_scan_buffer((char *)buf, len, p->yyscan_info_); + if (OB_FAIL(ob_expr_parser_utf8_yyparse(p))) { + // print err msg later + } else { + // do nothing + } + } + } + + return ret; +} + diff --git a/src/obproxy/opsql/expr_parser/ob_expr_parser_utf8_tab.h b/src/obproxy/opsql/expr_parser/ob_expr_parser_utf8_tab.h new file mode 100644 index 0000000..fb99836 --- /dev/null +++ b/src/obproxy/opsql/expr_parser/ob_expr_parser_utf8_tab.h @@ -0,0 +1,131 @@ + +/* A Bison parser, made by GNU Bison 2.4.1. */ + +/* Skeleton interface for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. + + 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 + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + + +#ifndef YY_OBEXPR_OB_EXPR_PARSER_TAB_H_INCLUDED +# define YY_OBEXPR_OB_EXPR_PARSER_TAB_H_INCLUDED +/* Debug traces. */ +#ifndef OBEXPR_UTF8_DEBUG +# if defined YYDEBUG +#if YYDEBUG +# define OBEXPR_UTF8_DEBUG 1 +# else +# define OBEXPR_UTF8_DEBUG 0 +# endif +# else /* ! defined YYDEBUG */ +# define OBEXPR_UTF8_DEBUG 0 +# endif /* ! defined YYDEBUG */ +#endif /* ! defined OBEXPR_UTF8_DEBUG */ +#if OBEXPR_UTF8_DEBUG +extern int ob_expr_parser_utf8_yydebug; +#endif +/* Tokens. */ +#ifndef OBEXPRTOKENTYPE +# define OBEXPRTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum obexprtokentype { + DUMMY_SELECT_CLAUSE = 258, + DUMMY_INSERT_CLAUSE = 259, + WHERE = 260, + AS = 261, + VALUES = 262, + SET = 263, + END_WHERE = 264, + JOIN = 265, + AND_OP = 266, + OR_OP = 267, + IN = 268, + ON = 269, + BETWEEN = 270, + ROWID = 271, + COMP_EQ = 272, + COMP_NSEQ = 273, + COMP_GE = 274, + COMP_GT = 275, + COMP_LE = 276, + COMP_LT = 277, + COMP_NE = 278, + PLACE_HOLDER = 279, + END_P = 280, + ERROR = 281, + IGNORED_WORD = 282, + NAME_OB = 283, + STR_VAL = 284, + INT_VAL = 285, + POS_PLACE_HOLDER = 286 + }; +#endif + + + +#if ! defined OBEXPRSTYPE && ! defined OBEXPRSTYPE_IS_DECLARED +typedef union OBEXPRSTYPE +{ + + + int64_t num; + ObProxyParseString str; + ObProxyFunctionType func; + ObProxyOperatorType operator; + ObProxyTokenNode *node; + ObProxyTokenList *list; + ObProxyRelationExpr *relation; + + + +} OBEXPRSTYPE; +# define OBEXPRSTYPE_IS_TRIVIAL 1 +# define obexprstype OBEXPRSTYPE /* obsolescent; will be withdrawn */ +# define OBEXPRSTYPE_IS_DECLARED 1 +#endif + + + +#if ! defined OBEXPRLTYPE && ! defined OBEXPRLTYPE_IS_DECLARED +typedef struct OBEXPRLTYPE +{ + int first_line; + int first_column; + int last_line; + int last_column; +} OBEXPRLTYPE; +# define obexprltype OBEXPRLTYPE /* obsolescent; will be withdrawn */ +# define OBEXPRLTYPE_IS_DECLARED 1 +# define OBEXPRLTYPE_IS_TRIVIAL 1 +#endif + + + +#endif diff --git a/src/obproxy/opsql/expr_resolver/ob_expr_resolver.cpp b/src/obproxy/opsql/expr_resolver/ob_expr_resolver.cpp index 996c288..ae1669d 100644 --- a/src/obproxy/opsql/expr_resolver/ob_expr_resolver.cpp +++ b/src/obproxy/opsql/expr_resolver/ob_expr_resolver.cpp @@ -96,7 +96,7 @@ int ObExprResolver::resolve(ObExprResolverContext &ctx, ObExprResolverResult &re * for normal ps sql, placeholder_idx_ in token node means the pos of '?' * for normal pl sql, placeholder_idx_ in token node means the index of call_info.params_ * for pl sql with ps, placeholder_idx_ in call_info_node_ means the pos of '?' - * for example: ps sql = call func1(11, ?, 22, ?), + * for example: ps sql = call func1(11, ?, 22, ?), * the first sql of func1 is select * from t1 where a = :1 and b = :2 and c =:3 and d = :4 * result: * call_info_.params_[1].placeholder_idx_ = 0, call_info_.params_[3].placeholder_idx_ = 1 @@ -169,6 +169,11 @@ int ObExprResolver::resolve_token_list(ObProxyRelationExpr *relation, } } + if (OB_SUCC(ret) && ObStringTC == target_obj->get_type_class()) { + // The character set of the string parsed from the parser uses the value of the variable collation_connection + target_obj->set_collation_type(static_cast(client_info->get_collation_connection())); + } + if (OB_SUCC(ret)) { switch (func_type) { case F_COMP_EQ: diff --git a/src/obproxy/opsql/parser/gen_parser.sh b/src/obproxy/opsql/parser/gen_parser.sh index b28ac40..e0cfd92 100755 --- a/src/obproxy/opsql/parser/gen_parser.sh +++ b/src/obproxy/opsql/parser/gen_parser.sh @@ -7,9 +7,30 @@ set +x CURDIR="$(dirname $(readlink -f "$0"))" export PATH=${CURDIR}/../../../..//deps/3rd/usr/local/oceanbase/devtools/bin/:/usr/local/bin:$PATH export BISON_PKGDATADIR=${CURDIR}/../../../../deps/3rd/usr/local/oceanbase/devtools/share/bison/ +# generate oracle utf8 obproxy_parser(support multi_byte_space, multi_byte_comma, multi_byte_left_parenthesis, multi_byte_right_parenthesis) +##1.copy lex and yacc files +cat ob_proxy_parser.y > ob_proxy_parser_utf8.y +cat ob_proxy_parser.l > ob_proxy_parser_utf8.l +##2.replace name +sed "s/ob_proxy_parser_yy/ob_proxy_parser_utf8_yy/g" -i ob_proxy_parser_utf8.y +sed "s/ob_proxy_parser_yy/ob_proxy_parser_utf8_yy/g" -i ob_proxy_parser_utf8.l +sed "s/ob_proxy_parser_lex/ob_proxy_parser_utf8_lex/g" -i ob_proxy_parser_utf8.y +sed "s/ob_proxy_parser_lex/ob_proxy_parser_utf8_lex/g" -i ob_proxy_parser_utf8.l +sed "s/ob_proxy_parser_tab/ob_proxy_parser_utf8_tab/g" -i ob_proxy_parser_utf8.l +sed "s/ob_proxy_parser_fatal_error/ob_proxy_utf8_parser_fatal_error/g" -i ob_proxy_parser_utf8.y +sed "s/ob_proxy_parser_fatal_error/ob_proxy_utf8_parser_fatal_error/g" -i ob_proxy_parser_utf8.l +sed "s/obproxy_parse_sql/obproxy_parse_utf8_sql/g" -i ob_proxy_parser_utf8.y +##3.add multi_byte_space, multi_byte_comma, multi_byte_left_parenthesis, multi_byte_right_parenthesis code. +sed "s/multi_byte_space \[\\\u3000\]/multi_byte_space ([\\\xe3\][\\\x80\][\\\x80])/g" -i ob_proxy_parser_utf8.l +sed "s/multi_byte_comma \[\\\uff0c\]/multi_byte_comma ([\\\xef\][\\\xbc\][\\\x8c])/g" -i ob_proxy_parser_utf8.l +sed "s/multi_byte_left_parenthesis \[\\\uff08\]/multi_byte_left_parenthesis ([\\\xef\][\\\xbc\][\\\x88])/g" -i ob_proxy_parser_utf8.l +sed "s/multi_byte_right_parenthesis \[\\\uff09\]/multi_byte_right_parenthesis ([\\\xef\][\\\xbc\][\\\x89])/g" -i ob_proxy_parser_utf8.l +sed 's/space \[ \\t\\n\\r\\f\]/space (\[ \\t\\n\\r\\f\]|{multi_byte_space})/g' -i ob_proxy_parser_utf8.l +##4.generate oracle utf8 parser files + # run bison #bison -p obproxy -v -Werror -d ob_proxy_parser.y -o ob_proxy_parser_tab.c -bison -p obproxy -v -Werror -d ob_proxy_parser.y -o ob_proxy_parser_tab.c +bison -v -Werror -d ob_proxy_parser_utf8.y -o ob_proxy_parser_utf8_tab.c if [ $? -ne 0 ] then echo Compile error[$?], abort. @@ -17,61 +38,65 @@ then fi # format tab.h -sed "s/YY\([a-zA-Z_]*\)/OBPROXY\1/g" -i ob_proxy_parser_tab.h -sed "s/yy\([a-zA-Z_]*\)/obproxy\1/g" -i ob_proxy_parser_tab.h +sed "s/YY\([a-zA-Z_]*\)/OBPROXY\1/g" -i ob_proxy_parser_utf8_tab.h +sed "s/yy\([a-zA-Z_]*\)/obproxy\1/g" -i ob_proxy_parser_utf8_tab.h sed "/Tokens/i #ifndef YY_OBPROXY_OB_PROXY_PARSER_TAB_H_INCLUDED\n\ # define YY_OBPROXY_OB_PROXY_PARSER_TAB_H_INCLUDED\n\ /* Debug traces. */\n\ -#ifndef OBPROXYDEBUG\n\ +#ifndef OBPROXY_UTF8_DEBUG\n\ # if defined YYDEBUG\n\ #if YYDEBUG\n\ -# define OBPROXYDEBUG 1\n\ +# define OBPROXY_UTF8_DEBUG 1\n\ # else\n\ -# define OBPROXYDEBUG 0\n\ +# define OBPROXY_UTF8_DEBUG 0\n\ # endif\n\ # else /* ! defined YYDEBUG */\n\ -# define OBPROXYDEBUG 0\n\ +# define OBPROXY_UTF8_DEBUG 0\n\ # endif /* ! defined YYDEBUG */\n\ -#endif /* ! defined OBPROXYDEBUG */\n\ -#if OBPROXYDEBUG\n\ -extern int obproxydebug;\n\ -#endif" -i ob_proxy_parser_tab.h -echo "#endif" >> ob_proxy_parser_tab.h +#endif /* ! defined OBPROXY_UTF8_DEBUG */\n\ +#if OBPROXY_UTF8_DEBUG\n\ +extern int ob_proxy_parser_utf8_yydebug;\n\ +#endif" -i ob_proxy_parser_utf8_tab.h +echo "#endif" >> ob_proxy_parser_utf8_tab.h # formart tab.c -sed "/#define yyparse/i #define YYSTYPE OBPROXYSTYPE\n#define YYLTYPE OBPROXYLTYPE" -i ob_proxy_parser_tab.c -sed "/Tokens/,/Copy the second/{s/YY\([a-zA-Z_]\)/OBPROXY\1/g}" -i ob_proxy_parser_tab.c -sed "/Tokens/,/Copy the second/{s/yy\([a-zA-Z_]\)/obproxy\1/g}" -i ob_proxy_parser_tab.c -sed "s/yylex (\&yylval, \&yylloc)/yylex (\&yylval, \&yylloc, YYLEX_PARAM)/g" -i ob_proxy_parser_tab.c +sed "/#define yyparse/i #define YYSTYPE OBPROXYSTYPE\n#define YYLTYPE OBPROXYLTYPE" -i ob_proxy_parser_utf8_tab.c +sed "/Tokens/,/Copy the second/{s/YY\([a-zA-Z_]\)/OBPROXY\1/g}" -i ob_proxy_parser_utf8_tab.c +sed "/Tokens/,/Copy the second/{s/yy\([a-zA-Z_]\)/obproxy\1/g}" -i ob_proxy_parser_utf8_tab.c +sed "s/yylex (\&yylval, \&yylloc)/yylex (\&yylval, \&yylloc, YYLEX_PARAM)/g" -i ob_proxy_parser_utf8_tab.c sed "/Tokens/i #ifndef YY_OBPROXY_OB_PROXY_PARSER_TAB_H_INCLUDED\n\ # define YY_OBPROXY_OB_PROXY_PARSER_TAB_H_INCLUDED\n\ /* Debug traces. */\n\ -#ifndef OBPROXYDEBUG\n\ +#ifndef OBPROXY_UTF8_DEBUG\n\ # if defined YYDEBUG\n\ #if YYDEBUG\n\ -# define OBPROXYDEBUG 1\n\ +# define OBPROXY_UTF8_DEBUG 1\n\ # else\n\ -# define OBPROXYDEBUG 0\n\ +# define OBPROXY_UTF8_DEBUG 0\n\ # endif\n\ # else /* ! defined YYDEBUG */\n\ -# define OBPROXYDEBUG 0\n\ +# define OBPROXY_UTF8_DEBUG 0\n\ # endif /* ! defined YYDEBUG */\n\ -#endif /* ! defined OBPROXYDEBUG */\n\ -#if OBPROXYDEBUG\n\ -extern int obproxydebug;\n\ -#endif" -i ob_proxy_parser_tab.c -sed "/Copy the second/i #endif" -i ob_proxy_parser_tab.c +#endif /* ! defined OBPROXY_UTF8_DEBUG */\n\ +#if OBPROXY_UTF8_DEBUG\n\ +extern int ob_proxy_parser_utf8_yydebug;\n\ +#endif" -i ob_proxy_parser_utf8_tab.c +sed "/Copy the second/i #endif" -i ob_proxy_parser_utf8_tab.c # run flex #flex -P obproxy -Cfea -o ob_proxy_parser_lex.c ob_proxy_parser.l ob_proxy_parser_tab.h -flex -P obproxy -o ob_proxy_parser_lex.c ob_proxy_parser.l ob_proxy_parser_tab.h +flex -o ob_proxy_parser_utf8_lex.c ob_proxy_parser_utf8.l ob_proxy_parser_utf8_tab.h # format lex.h -sed "s/YYSTYPE/OBPROXYSTYPE/g" -i ob_proxy_parser_lex.h -sed "s/YYLTYPE/OBPROXYLTYPE/g" -i ob_proxy_parser_lex.h -sed "/static int yy_top_state (yyscan_t yyscanner );/d" -i ob_proxy_parser_lex.c -sed "/static int yy_top_state/,/\}/d" -i ob_proxy_parser_lex.c -sed "/\*yy_cp = '\\\0';/d" -i ob_proxy_parser_lex.c -sed "/Setup the input buffer state to scan the given bytes/,/}/{/int i/d}" -i ob_proxy_parser_lex.c -sed "/Setup the input buffer state to scan the given bytes/,/}/{/for ( i = 0; i < _yybytes_len; ++i )/d}" -i ob_proxy_parser_lex.c -sed "/Setup the input buffer state to scan the given bytes/,/}/{s/\tbuf\[i\] = yybytes\[i\]/memcpy(buf, yybytes, _yybytes_len)/g}" -i ob_proxy_parser_lex.c +sed "s/YYSTYPE/OBPROXYSTYPE/g" -i ob_proxy_parser_utf8_lex.h +sed "s/YYLTYPE/OBPROXYLTYPE/g" -i ob_proxy_parser_utf8_lex.h +sed "/static int yy_top_state (yyscan_t yyscanner );/d" -i ob_proxy_parser_utf8_lex.c +sed "/static int yy_top_state/,/\}/d" -i ob_proxy_parser_utf8_lex.c +sed "/\*yy_cp = '\\\0';/d" -i ob_proxy_parser_utf8_lex.c +sed "/Setup the input buffer state to scan the given bytes/,/}/{/int i/d}" -i ob_proxy_parser_utf8_lex.c +sed "/Setup the input buffer state to scan the given bytes/,/}/{/for ( i = 0; i < _yybytes_len; ++i )/d}" -i ob_proxy_parser_utf8_lex.c +sed "/Setup the input buffer state to scan the given bytes/,/}/{s/\tbuf\[i\] = yybytes\[i\]/memcpy(buf, yybytes, _yybytes_len)/g}" -i ob_proxy_parser_utf8_lex.c +##5.clean useless files +rm -f ob_proxy_parser_utf8.l +rm -f ob_proxy_parser_utf8.y +rm -f ob_proxy_parser_utf8.output diff --git a/src/obproxy/opsql/parser/ob_proxy_parser.h b/src/obproxy/opsql/parser/ob_proxy_parser.h index ca16a4b..97f5054 100644 --- a/src/obproxy/opsql/parser/ob_proxy_parser.h +++ b/src/obproxy/opsql/parser/ob_proxy_parser.h @@ -17,12 +17,13 @@ #include "opsql/parser/ob_proxy_parse_result.h" #include "lib/string/ob_string.h" #include "utils/ob_proxy_lib.h" +#include "lib/charset/ob_charset.h" #include #include #include -extern "C" int obproxy_parse_sql(ObProxyParseResult *p, const char *pszSql, size_t iLen); +extern "C" int obproxy_parse_utf8_sql(ObProxyParseResult *p, const char *pszSql, size_t iLen); namespace oceanbase { @@ -42,7 +43,8 @@ public: // will not be inherited, do not set to virtual ~ObProxyParser() {} - int parse(const common::ObString &sql_string, ObProxyParseResult &parse_result); + int parse(const common::ObString &sql_string, ObProxyParseResult &parse_result, + common::ObCollationType connection_collation); void free_result(ObProxyParseResult &parse_result); // the following function use ob parser int obparse(const common::ObString &sql_string, ParseResult &parse_result); @@ -184,16 +186,25 @@ inline int ObProxyParser::obparse(const common::ObString &sql_string, } inline int ObProxyParser::parse(const common::ObString &sql_string, - ObProxyParseResult &parse_result) + ObProxyParseResult &parse_result, + common::ObCollationType connection_collation) { int ret = common::OB_SUCCESS; if (0 != init_result(parse_result, sql_string.ptr())) { ret = common::OB_ERR_PARSER_INIT; PROXY_LOG(WARN, "failed to initialized parser", KERRMSGS, K(ret)); - } else if (0 != obproxy_parse_sql(&parse_result, - sql_string.ptr(), - static_cast(sql_string.length()))) { - ret = common::OB_ERR_PARSE_SQL; + } else { + switch (connection_collation) { + case 45/*CS_TYPE_UTF8MB4_GENERAL_CI*/: + case 46/*CS_TYPE_UTF8MB4_BIN*/: + default: + if (common::OB_SUCCESS != obproxy_parse_utf8_sql(&parse_result, + sql_string.ptr(), + static_cast(sql_string.length()))) { + ret = common::OB_ERR_PARSE_SQL; + } + break; + } } return ret; } diff --git a/src/obproxy/opsql/parser/ob_proxy_parser.l b/src/obproxy/opsql/parser/ob_proxy_parser.l index 1c9f1c4..6e30c5e 100644 --- a/src/obproxy/opsql/parser/ob_proxy_parser.l +++ b/src/obproxy/opsql/parser/ob_proxy_parser.l @@ -1,6 +1,7 @@ %option noyywrap nounput noinput case-insensitive %option stack noyyalloc noyyrealloc noyyfree %option reentrant bison-bridge bison-locations +%option prefix="ob_proxy_parser_yy" %option header-file="ob_proxy_parser_lex.h" %{ #define YYSTYPE OBPROXYSTYPE @@ -19,7 +20,7 @@ void store_str_with_quote(ObProxyParseQuoteType type, char* str, int64_t str_len #define SET_DML_STMT(stmt_type) \ do {\ - ObProxyParseResult *p = obproxyget_extra(yyscanner);\ + ObProxyParseResult *p = yyget_extra(yyscanner);\ if (OB_NOTNULL(p)) {\ if (OBPROXY_T_INVALID == p->cur_stmt_type_\ || OBPROXY_T_BEGIN == p->cur_stmt_type_\ @@ -31,7 +32,7 @@ do {\ #define SET_DDL_STMT(stmt_type) \ do {\ - ObProxyParseResult *p = obproxyget_extra(yyscanner);\ + ObProxyParseResult *p = yyget_extra(yyscanner);\ if (OB_NOTNULL(p)) {\ if (OBPROXY_T_INVALID == p->cur_stmt_type_\ || OBPROXY_T_BEGIN == p->cur_stmt_type_) {\ @@ -42,7 +43,7 @@ do {\ #define SET_BASIC_STMT(stmt_type) \ do {\ - ObProxyParseResult *p = obproxyget_extra(yyscanner);\ + ObProxyParseResult *p = yyget_extra(yyscanner);\ if (OB_NOTNULL(p)) {\ if (OBPROXY_T_INVALID == p->cur_stmt_type_\ || OBPROXY_T_BEGIN == p->cur_stmt_type_) {\ @@ -53,7 +54,7 @@ do {\ #define SET_ICMD_STMT(stmt_type) \ do {\ - ObProxyParseResult *p = obproxyget_extra(yyscanner);\ + ObProxyParseResult *p = yyget_extra(yyscanner);\ if (OB_NOTNULL(p) && (OBPROXY_T_INVALID == p->cur_stmt_type_ || OBPROXY_T_SHOW == p->cur_stmt_type_)) {\ p->cur_stmt_type_ = stmt_type;\ }\ @@ -62,7 +63,7 @@ do {\ #define SET_GLOBAL_SET_STMT() \ do {\ - ObProxyParseResult *p = obproxyget_extra(yyscanner);\ + ObProxyParseResult *p = yyget_extra(yyscanner);\ if (OB_NOTNULL(p) && (OBPROXY_T_SET == p->cur_stmt_type_)) {\ p->cur_stmt_type_ = OBPROXY_T_SET_GLOBAL;\ }\ @@ -79,7 +80,7 @@ do {\ errno = 0;\ yylval->num = strtoll(yytext, NULL, 10);\ if (0 != errno) {\ - ObProxyParseResult *p = obproxyget_extra(yyscanner);\ + ObProxyParseResult *p = yyget_extra(yyscanner);\ if (OB_NOTNULL(p) && OBPROXY_T_INVALID < p->cur_stmt_type_ && p->cur_stmt_type_ < OBPROXY_T_ICMD_MAX) {\ p->cmd_info_.err_type_ = OBPROXY_T_ERR_INVALID_NUM;\ } else {\ @@ -177,7 +178,7 @@ do { \ #define RETURN_SHARD_COMMENT_NAME_OB_DOT(word_type) \ do {\ - ObProxyParseResult *p = obproxyget_extra(yyscanner);\ + ObProxyParseResult *p = yyget_extra(yyscanner);\ if (OB_NOTNULL(p) && !p->has_shard_comment_) {\ p->has_shard_comment_ = true;\ }\ @@ -187,12 +188,13 @@ do {\ #define RETURN_SHARD_COMMENT(word_type) \ do {\ - ObProxyParseResult *p = obproxyget_extra(yyscanner);\ + ObProxyParseResult *p = yyget_extra(yyscanner);\ if (OB_NOTNULL(p) && !p->has_shard_comment_) {\ p->has_shard_comment_ = true;\ }\ return word_type;\ } while (0); + #define SET_HAS_ANONYMOUS_BLOCK() \ do { \ ObProxyParseResult *p = yyget_extra(yyscanner);\ @@ -211,7 +213,7 @@ do { \ #define PUSH_STATE_IF_NOT_ICMD(state) \ do {\ - ObProxyParseResult *p = obproxyget_extra(yyscanner);\ + ObProxyParseResult *p = yyget_extra(yyscanner);\ if (OB_NOTNULL(p) && OBPROXY_T_INVALID < p->cur_stmt_type_ && p->cur_stmt_type_ < OBPROXY_T_ICMD_MAX) {\ /*do nothing*/\ } else {\ @@ -221,7 +223,7 @@ do {\ #define RETURN_WITH_CALL_CHECK(key) \ do {\ - ObProxyParseResult *p = obproxyget_extra(yyscanner);\ + ObProxyParseResult *p = yyget_extra(yyscanner);\ if (OB_NOTNULL(p) && (OBPROXY_T_CALL == p->cur_stmt_type_ || OBPROXY_T_INSERT == p->cur_stmt_type_)) {\ return key;\ } else {\ @@ -249,9 +251,12 @@ do {\ %x in_old_comment_expr %x in_odp_comment_expr %x in_odp_comment_value_expr +%x in_odp_comment_value_expr_calc %x in_ignored_comment_expr %x in_dbp_comment_expr +%x in_dbp_comment_trace_expr %x in_dbp_comment_trace_value_expr +%x in_dbp_comment_trace_value_expr_calc %x comment_sq %x sq %x dq @@ -266,6 +271,11 @@ do {\ %x set_expr %x show_topology +/*following character status will be rewrite by gen_parse.sh according to connection character*/ +multi_byte_space [\u3000] +multi_byte_comma [\uff0c] +multi_byte_left_parenthesis [\uff08] +multi_byte_right_parenthesis [\uff09] space [ \t\n\r\f] identifer ([A-Za-z0-9$_]*) int_num [\-\+]?[0-9]+ @@ -317,6 +327,7 @@ btend {backtick} btdouble {backtick}{backtick} btcontent [^`]+ +comma , leftbracket \( rightbracket \) @@ -342,7 +353,7 @@ show_tables (show{space}+tables) show_create_table (show{space}+create{space}+table) show_topology (show{space}+elastic_id) show_db_version (show{space}+database_version) -select_database (select{space}+database\(\)) +select_database (select{space}+database({leftbracket}|{multi_byte_left_parenthesis})({rightbracket}|{multi_byte_right_parenthesis})) alter_proxyconfig (alter{space}+proxyconfig) alter_proxyresource (alter{space}+proxyresource) ping_proxy (ping{space}+proxy) @@ -560,6 +571,7 @@ QUERY { RETURN_NON_RESERVED_KEYWORD(QUERY); } FOUND_ROWS { SET_FOUND_ROWS(); RETURN_NON_RESERVED_KEYWORD(NAME_OB); } ROW_COUNT { SET_ROW_COUNT(); RETURN_NON_RESERVED_KEYWORD(NAME_OB); } LAST_INSERT_ID { SET_LAST_INSERT_ID(); RETURN_NON_RESERVED_KEYWORD(NAME_OB); } +{comma}|{multi_byte_comma} { return ','; } {int_num} { RETURN_INT_NUM(); } {identifer} { RETURN_NON_RESERVED_KEYWORD(NAME_OB); } {sqbegin}{identifer}{sqend} { RETURN_NON_RESERVED_KEYWORD_WITH_QUOTE(NAME_OB, OBPROXY_QUOTE_T_SINGLE); } @@ -567,8 +579,10 @@ LAST_INSERT_ID { SET_LAST_INSERT_ID(); RETURN_NON_RESERVED_KEYWORD(NAME_OB); } {btbegin}{identifer}{btend} { RETURN_NON_RESERVED_KEYWORD_WITH_QUOTE(NAME_OB, OBPROXY_QUOTE_T_BACK); } {number} { RETURN_NUMBER_VAL(); } "?" { return PLACE_HOLDER; } -[.;*-+&~|^/%,:!@=] { return yytext[0]; } -[()] { RETURN_WITH_CALL_CHECK(yytext[0]); } +[.;*-+&~|^/%:!@=] { return yytext[0]; } +{leftbracket}|{rightbracket} { RETURN_WITH_CALL_CHECK(yytext[0]); } +{multi_byte_left_parenthesis} { RETURN_WITH_CALL_CHECK('('); } +{multi_byte_right_parenthesis} { RETURN_WITH_CALL_CHECK(')'); } {whitespace} { } /* hint option */ @@ -609,10 +623,11 @@ LAST_INSERT_ID { SET_LAST_INSERT_ID(); RETURN_NON_RESERVED_KEYWORD(NAME_OB); } "global" { return GLOBAL; } "session" { return SESSION; } {int_num} { RETURN_INT_NUM(); } +{comma}|{multi_byte_comma} { return ','; } {identifer} { RETURN_NON_RESERVED_KEYWORD(NAME_OB); } {number} { RETURN_NUMBER_VAL(); } {whitespace} { } -[,@=] { return yytext[0]; } +[@=] { return yytext[0]; } <> { return END_P; } ; { POP_STATE(); PUSH_STATE(INITIAL); return yytext[0]; } @@ -650,6 +665,8 @@ LAST_INSERT_ID { SET_LAST_INSERT_ID(); RETURN_NON_RESERVED_KEYWORD(NAME_OB); } "into" { POP_STATE(); RETURN_IGNORED_WORD(); } . {} +{multi_byte_left_parenthesis} { return '('; } +{multi_byte_right_parenthesis} { return ')'; } "query_timeout" { return QUERY_TIMEOUT; } {int_num} { RETURN_INT_NUM(); } "read_consistency" { return READ_CONSISTENCY; } @@ -657,7 +674,7 @@ LAST_INSERT_ID { SET_LAST_INSERT_ID(); RETURN_NON_RESERVED_KEYWORD(NAME_OB); } STRONG { return STRONG; } FROZEN { return FROZEN; } INDEX { return INDEX; } -[()] { return yytext[0]; } +{leftbracket}|{rightbracket} { return yytext[0]; } {identifer} { RETURN_NON_RESERVED_KEYWORD(NAME_OB); } {c_cmt_end} { POP_STATE(); return HINT_END; } . {} @@ -768,9 +785,10 @@ LAST_INSERT_ID { SET_LAST_INSERT_ID(); RETURN_NON_RESERVED_KEYWORD(NAME_OB); } "trace_id" { return TRACE_ID; } "rpc_id" { return RPC_ID; } {sqbegin} { ENTER_QUOTE_STATE(comment_sq); } +{comma}|{multi_byte_comma} { return ','; } {odp_comment_identifer} { RETURN_NON_RESERVED_KEYWORD(NAME_OB); } [=] { PUSH_STATE(in_odp_comment_value_expr); return yytext[0]; } -[.,] { return yytext[0]; } +[.] { return yytext[0]; } {space} {} . { return ERROR; } {c_cmt_end} { @@ -785,9 +803,9 @@ LAST_INSERT_ID { SET_LAST_INSERT_ID(); RETURN_NON_RESERVED_KEYWORD(NAME_OB); } } {sqbegin} { ENTER_QUOTE_STATE(comment_sq); } -[,] { +{comma}|{multi_byte_comma} { POP_STATE(); - return yytext[0]; + return ','; } {c_cmt_end} { ObProxyParseResult *p = (ObProxyParseResult *)yyextra; @@ -800,7 +818,37 @@ LAST_INSERT_ID { SET_LAST_INSERT_ID(); RETURN_NON_RESERVED_KEYWORD(NAME_OB); } POP_STATE(); return COMMENT_END; } -[^,\\' \t\n\r\f*/]+ { RETURN_NON_RESERVED_KEYWORD(NAME_OB); } +{space} {} +. { + do { + PUSH_STATE(in_odp_comment_value_expr_calc) + ObProxyParseResult *p = (ObProxyParseResult *)yyextra; + if (OB_NOTNULL(p)) { + p->tmp_buf_ = yytext; + p->tmp_start_ptr_ = yytext; + p->tmp_len_ = 1; + } + } while (0); +} + +{sqbegin}|{comma}|{multi_byte_comma}|{space}|{c_cmt_end} { + POP_STATE(); + ObProxyParseResult *p = (ObProxyParseResult *)yyextra; + if (OB_NOTNULL(p) && OB_NOTNULL(p->tmp_buf_)) { + store_str(p->tmp_buf_, p->tmp_len_, p->tmp_start_ptr_ + p->tmp_len_, yyscanner); + yyless(0); + return NAME_STR; + } else { + RETURN_IGNORED_WORD(); + } +} + +. { + ObProxyParseResult *p = (ObProxyParseResult *)yyextra; + if (OB_NOTNULL(p)) { + p->tmp_len_ += yyleng; + } +} "+DBP:" { PUSH_STATE(in_dbp_comment_expr); RETURN_SHARD_COMMENT(DBP_COMMENT); } "$ROUTE" { return ROUTE_TAG; } @@ -810,9 +858,12 @@ LAST_INSERT_ID { SET_LAST_INSERT_ID(); RETURN_NON_RESERVED_KEYWORD(NAME_OB); } "table_name" { return TABLE_NAME;} "parallelism" { return PARALL; } "group_id" { return GROUP_ID; } -"TRACE" { PUSH_STATE(in_dbp_comment_trace_value_expr); return TRACE; } +"TRACE" { PUSH_STATE(in_dbp_comment_trace_expr); return TRACE; } {sqbegin} { ENTER_QUOTE_STATE(comment_sq); } -[,=(){}] { return yytext[0]; } +[={}]|{leftbracket}|{rightbracket} { return yytext[0]; } +{multi_byte_left_parenthesis} { return '('; } +{multi_byte_right_parenthesis} { return ')'; } +{comma}|{multi_byte_comma} { return ','; } {space} { } {comment_identifer} { RETURN_NON_RESERVED_KEYWORD(NAME_OB); } @@ -827,13 +878,27 @@ LAST_INSERT_ID { SET_LAST_INSERT_ID(); RETURN_NON_RESERVED_KEYWORD(NAME_OB); } return COMMENT_END; } . {return yytext[0];} +{leftbracket}|{multi_byte_left_parenthesis} { PUSH_STATE(in_dbp_comment_trace_value_expr); return '('; } +{space} {} {sqbegin} { ENTER_QUOTE_STATE(comment_sq); } -[)] { +{rightbracket}|{multi_byte_right_parenthesis} { POP_STATE(); - return yytext[0]; + POP_STATE(); + return ')'; +} +[#] { + do { + PUSH_STATE(in_dbp_comment_trace_value_expr_calc) + ObProxyParseResult *p = (ObProxyParseResult *)yyextra; + if (OB_NOTNULL(p)) { + p->tmp_buf_ = yytext; + p->tmp_start_ptr_ = yytext; + p->tmp_len_ = 1; + } + return yytext[0]; + } while (0); } -[(#] { return yytext[0]; } {c_cmt_end} { ObProxyParseResult *p = (ObProxyParseResult *)yyextra; if (OB_NOTNULL(p)) { @@ -843,9 +908,40 @@ LAST_INSERT_ID { SET_LAST_INSERT_ID(); RETURN_NON_RESERVED_KEYWORD(NAME_OB); } POP_STATE(); POP_STATE(); POP_STATE(); + POP_STATE(); return COMMENT_END; } -[^()#,\\' \t\n\r\f*/]+ { RETURN_NON_RESERVED_KEYWORD(NAME_OB); } +{space} {} +. { + do { + PUSH_STATE(in_dbp_comment_trace_value_expr_calc) + ObProxyParseResult *p = (ObProxyParseResult *)yyextra; + if (OB_NOTNULL(p)) { + p->tmp_buf_ = yytext; + p->tmp_start_ptr_ = yytext; + p->tmp_len_ = 0; + } + } while (0); +} + +{sqbegin}|[#]|{leftbracket}|{rightbracket}|{multi_byte_left_parenthesis}|{multi_byte_right_parenthesis}|{space}|{c_cmt_end} { + POP_STATE(); + ObProxyParseResult *p = (ObProxyParseResult *)yyextra; + if (OB_NOTNULL(p) && OB_NOTNULL(p->tmp_buf_)) { + store_str(p->tmp_buf_, p->tmp_len_, p->tmp_start_ptr_ + p->tmp_len_, yyscanner); + yyless(0); + return NAME_STR; + } else { + RETURN_IGNORED_WORD(); + } +} + +. { + ObProxyParseResult *p = (ObProxyParseResult *)yyextra; + if (OB_NOTNULL(p)) { + p->tmp_len_ += yyleng; + } +} /* quote */ {sqbegin} { @@ -1000,7 +1096,7 @@ LAST_INSERT_ID { SET_LAST_INSERT_ID(); RETURN_NON_RESERVED_KEYWORD(NAME_OB); } /* some useful keyword */ "FROM"{whitespace}+"DUAL" { RETURN_IGNORED_WORD_FOR_DUAL(); } "FROM" { POP_STATE(); PUSH_STATE(INITIAL); return FROM; } -{leftbracket} { PUSH_STATE(in_subquery); return yytext[0]; } +{leftbracket}|{multi_byte_left_parenthesis} { PUSH_STATE(in_subquery); return '('; } {dqbegin} { PUSH_STATE(dq); } {sqbegin} { PUSH_STATE(sq); } {btbegin} { PUSH_STATE(bt_in_expr); } @@ -1017,16 +1113,16 @@ LAST_INSERT_ID { SET_LAST_INSERT_ID(); RETURN_NON_RESERVED_KEYWORD(NAME_OB); } . { RETURN_IGNORED_WORD(); } "SELECT" { PUSH_STATE(in_expr); return SELECT; } -{leftbracket} { PUSH_STATE(in_subquery); return yytext[0]; } -{rightbracket} { POP_STATE(); return yytext[0]; } +{leftbracket}|{multi_byte_left_parenthesis} { PUSH_STATE(in_subquery); return '('; } +{rightbracket}|{multi_byte_right_parenthesis} { POP_STATE(); return ')'; } {dqbegin} { PUSH_STATE(dq); } {sqbegin} { PUSH_STATE(sq); } <> { return END_P; } {whitespace} { } . { PUSH_STATE(in_no_select_query); RETURN_IGNORED_WORD(); } -{leftbracket} { PUSH_STATE(in_subquery); return yytext[0]; } -{rightbracket} { POP_STATE(); POP_STATE(); return yytext[0]; } +{leftbracket}|{multi_byte_left_parenthesis} { PUSH_STATE(in_subquery); return '('; } +{rightbracket}|{multi_byte_right_parenthesis} { POP_STATE(); POP_STATE(); return ')'; } {dqbegin} { PUSH_STATE(dq); } {sqbegin} { PUSH_STATE(sq); } "found_rows" { SET_FOUND_ROWS(); RETURN_IGNORED_WORD(); } diff --git a/src/obproxy/opsql/parser/ob_proxy_parser.y b/src/obproxy/opsql/parser/ob_proxy_parser.y index 747657e..98e0100 100644 --- a/src/obproxy/opsql/parser/ob_proxy_parser.y +++ b/src/obproxy/opsql/parser/ob_proxy_parser.y @@ -1,5 +1,6 @@ %define api.pure %parse-param {ObProxyParseResult* result} +%name-prefix "ob_proxy_parser_yy" %locations %no-lines %verbose @@ -23,7 +24,7 @@ do {\ result->end_pos_ = result->table_info_.table_name_.end_ptr_;\ }\ } else {\ - result->end_pos_ = obproxyget_text(result->yyscan_info_);\ + result->end_pos_ = ob_proxy_parser_yyget_text(result->yyscan_info_);\ }\ YYACCEPT;\ } while (0); @@ -1129,7 +1130,7 @@ void yyerror(YYLTYPE* yylloc, ObProxyParseResult* p, char* s, ...) void ob_proxy_parser_fatal_error(yyconst char *msg, yyscan_t yyscanner) { fprintf(stderr, "FATAL ERROR:%s\n", msg); - ObProxyParseResult *p = obproxyget_extra(yyscanner); + ObProxyParseResult *p = ob_proxy_parser_yyget_extra(yyscanner); if (OB_ISNULL(p)) { fprintf(stderr, "unexpected null parse result\n"); } else { @@ -1144,15 +1145,15 @@ int obproxy_parse_sql(ObProxyParseResult* p, const char* buf, size_t len) if (OB_ISNULL(p) || OB_ISNULL(buf) || OB_UNLIKELY(len <= 0)) { ret = OB_INVALID_ARGUMENT; // print err msg later - } else if (OB_FAIL(obproxylex_init_extra(p, &(p->yyscan_info_)))) { + } else if (OB_FAIL(ob_proxy_parser_yylex_init_extra(p, &(p->yyscan_info_)))) { // print err msg later } else { int val = setjmp(p->jmp_buf_); if (val) { ret = OB_PARSER_ERR_PARSE_SQL; } else { - obproxy_scan_buffer((char *)buf, len, p->yyscan_info_); - if (OB_FAIL(obproxyparse(p))) { + ob_proxy_parser_yy_scan_buffer((char *)buf, len, p->yyscan_info_); + if (OB_FAIL(ob_proxy_parser_yyparse(p))) { // print err msg later } else { // do nothing diff --git a/src/obproxy/opsql/parser/ob_proxy_parser_utf8_lex.c b/src/obproxy/opsql/parser/ob_proxy_parser_utf8_lex.c new file mode 100644 index 0000000..1c813f2 --- /dev/null +++ b/src/obproxy/opsql/parser/ob_proxy_parser_utf8_lex.c @@ -0,0 +1,6714 @@ +#line 2 "ob_proxy_parser_utf8_lex.c" + +#line 4 "ob_proxy_parser_utf8_lex.c" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 35 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include +#include +#include +#include + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have . Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; +#endif /* ! C99 */ + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! FLEXINT_H */ + +#ifdef __cplusplus + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) + +#define YY_USE_CONST + +#endif /* defined (__STDC__) */ +#endif /* ! __cplusplus */ + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) + +/* An opaque pointer. */ +#ifndef YY_TYPEDEF_YY_SCANNER_T +#define YY_TYPEDEF_YY_SCANNER_T +typedef void* yyscan_t; +#endif + +/* For convenience, these vars (plus the bison vars far below) + are macros in the reentrant scanner. */ +#define yyin yyg->yyin_r +#define yyout yyg->yyout_r +#define yyextra yyg->yyextra_r +#define yyleng yyg->yyleng_r +#define yytext yyg->yytext_r +#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno) +#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column) +#define yy_flex_debug yyg->yy_flex_debug_r + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN yyg->yy_start = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START ((yyg->yy_start - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE ob_proxy_parser_utf8_yyrestart(yyin ,yyscanner ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#define YY_BUF_SIZE 16384 +#endif + +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + + #define YY_LESS_LINENO(n) + +/* Return all but the first "n" matched characters back to the input stream. */ +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = yyg->yy_hold_char; \ + YY_RESTORE_YY_MORE_OFFSET \ + yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via ob_proxy_parser_utf8_yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + * + * Returns the top of the stack, or NULL. + */ +#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \ + ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \ + : NULL) + +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] + +void ob_proxy_parser_utf8_yyrestart (FILE *input_file ,yyscan_t yyscanner ); +void ob_proxy_parser_utf8_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); +YY_BUFFER_STATE ob_proxy_parser_utf8_yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner ); +void ob_proxy_parser_utf8_yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); +void ob_proxy_parser_utf8_yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); +void ob_proxy_parser_utf8_yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); +void ob_proxy_parser_utf8_yypop_buffer_state (yyscan_t yyscanner ); + +static void ob_proxy_parser_utf8_yyensure_buffer_stack (yyscan_t yyscanner ); +static void ob_proxy_parser_utf8_yy_load_buffer_state (yyscan_t yyscanner ); +static void ob_proxy_parser_utf8_yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner ); + +#define YY_FLUSH_BUFFER ob_proxy_parser_utf8_yy_flush_buffer(YY_CURRENT_BUFFER ,yyscanner) + +YY_BUFFER_STATE ob_proxy_parser_utf8_yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); +YY_BUFFER_STATE ob_proxy_parser_utf8_yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); +YY_BUFFER_STATE ob_proxy_parser_utf8_yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); + +void *ob_proxy_parser_utf8_yyalloc (yy_size_t ,yyscan_t yyscanner ); +void *ob_proxy_parser_utf8_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner ); +void ob_proxy_parser_utf8_yyfree (void * ,yyscan_t yyscanner ); + +#define yy_new_buffer ob_proxy_parser_utf8_yy_create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + ob_proxy_parser_utf8_yyensure_buffer_stack (yyscanner); \ + YY_CURRENT_BUFFER_LVALUE = \ + ob_proxy_parser_utf8_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + ob_proxy_parser_utf8_yyensure_buffer_stack (yyscanner); \ + YY_CURRENT_BUFFER_LVALUE = \ + ob_proxy_parser_utf8_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* Begin user sect3 */ + +#define ob_proxy_parser_utf8_yywrap(n) 1 +#define YY_SKIP_YYWRAP + +typedef unsigned char YY_CHAR; + +typedef int yy_state_type; + +#define yytext_ptr yytext_r + +static yy_state_type yy_get_previous_state (yyscan_t yyscanner ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner); +static int yy_get_next_buffer (yyscan_t yyscanner ); +static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + yyg->yytext_ptr = yy_bp; \ + yyleng = (size_t) (yy_cp - yy_bp); \ + yyg->yy_hold_char = *yy_cp; \ + yyg->yy_c_buf_p = yy_cp; + +#define YY_NUM_RULES 319 +#define YY_END_OF_BUFFER 320 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_accept[2073] = + { 0, + 130, 130, 173, 173, 0, 0, 0, 0, 186, 186, + 214, 214, 0, 0, 0, 0, 0, 0, 242, 242, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 291, 291, 0, 0, + 0, 0, 309, 309, 313, 313, 0, 0, 152, 152, + 0, 0, 320, 318, 140, 140, 136, 266, 140, 130, + 255, 137, 136, 128, 318, 136, 136, 129, 135, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 272, 318, 318, 175, 319, 173, 172, 175, + + 175, 166, 173, 173, 173, 173, 173, 173, 175, 179, + 178, 179, 181, 181, 319, 181, 181, 181, 181, 181, + 181, 181, 181, 181, 181, 181, 181, 181, 191, 191, + 186, 191, 191, 186, 186, 191, 218, 217, 217, 214, + 212, 218, 214, 213, 214, 216, 215, 214, 214, 214, + 214, 214, 218, 218, 224, 223, 223, 220, 224, 221, + 224, 224, 226, 225, 225, 225, 226, 226, 226, 244, + 241, 241, 242, 236, 237, 244, 242, 240, 242, 242, + 242, 242, 242, 244, 244, 246, 245, 319, 319, 252, + 251, 251, 249, 247, 248, 252, 252, 252, 254, 253, + + 253, 253, 254, 254, 254, 261, 262, 319, 256, 257, + 319, 267, 268, 319, 274, 275, 277, 278, 294, 292, + 292, 282, 292, 291, 283, 281, 294, 293, 294, 291, + 291, 291, 291, 291, 284, 294, 294, 317, 317, 301, + 300, 300, 298, 300, 299, 296, 297, 301, 301, 301, + 301, 311, 310, 310, 304, 310, 309, 305, 302, 303, + 311, 309, 309, 309, 311, 311, 314, 313, 315, 313, + 162, 162, 160, 154, 154, 158, 154, 152, 157, 160, + 151, 160, 160, 150, 156, 155, 155, 152, 152, 152, + 159, 160, 160, 110, 108, 108, 108, 110, 109, 110, + + 110, 110, 140, 0, 132, 0, 140, 130, 0, 131, + 129, 0, 134, 176, 134, 129, 130, 130, 130, 39, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 8, 0, 133, 0, 0, 173, 0, 174, 166, + 166, 173, 173, 173, 173, 173, 173, 0, 0, 177, + 0, 0, 0, 201, 0, 0, 0, 0, 0, 0, + + 0, 0, 180, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 188, 0, 186, 0, 187, + 0, 190, 186, 186, 0, 189, 214, 0, 219, 214, + 214, 214, 214, 214, 214, 214, 214, 0, 0, 0, + 222, 0, 0, 0, 225, 0, 0, 242, 242, 242, + 0, 243, 242, 242, 242, 242, 242, 242, 0, 0, + 0, 0, 0, 250, 0, 0, 0, 253, 0, 0, + 261, 0, 0, 263, 0, 0, 264, 256, 0, 0, + 258, 0, 0, 259, 0, 269, 0, 0, 0, 270, + 274, 273, 277, 276, 292, 0, 292, 291, 0, 0, + + 291, 291, 291, 291, 291, 291, 0, 0, 0, 300, + 0, 300, 0, 0, 0, 0, 310, 0, 310, 309, + 0, 309, 309, 309, 0, 0, 313, 313, 0, 154, + 0, 154, 152, 150, 0, 153, 153, 150, 152, 0, + 152, 152, 152, 0, 0, 108, 0, 108, 0, 0, + 0, 0, 140, 0, 0, 134, 0, 0, 130, 49, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 37, 130, 130, 130, 130, 130, 130, 104, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 13, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 47, 130, + 130, 130, 130, 130, 130, 138, 139, 128, 173, 173, + 173, 173, 173, 173, 163, 164, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 186, 186, 214, + 214, 214, 214, 214, 214, 214, 214, 217, 213, 223, + 221, 225, 242, 242, 242, 242, 242, 242, 242, 242, + 241, 238, 239, 240, 246, 245, 251, 248, 253, 265, + 0, 265, 0, 0, 260, 0, 260, 0, 0, 271, + + 0, 271, 0, 0, 292, 0, 0, 0, 0, 291, + 291, 291, 291, 291, 291, 281, 0, 300, 0, 0, + 296, 297, 310, 0, 309, 309, 309, 302, 303, 313, + 0, 154, 0, 0, 153, 0, 0, 152, 0, 0, + 152, 152, 152, 151, 108, 0, 0, 0, 140, 140, + 140, 0, 0, 134, 0, 134, 134, 130, 130, 130, + 130, 130, 130, 14, 130, 130, 130, 130, 130, 130, + 130, 130, 43, 86, 18, 130, 130, 130, 130, 130, + 130, 130, 130, 68, 130, 130, 130, 130, 55, 121, + 130, 50, 130, 130, 130, 130, 130, 130, 65, 130, + + 130, 130, 130, 130, 130, 130, 45, 130, 130, 130, + 130, 130, 130, 130, 130, 0, 0, 7, 130, 130, + 84, 130, 130, 130, 130, 130, 130, 130, 87, 130, + 130, 130, 130, 16, 130, 46, 173, 173, 173, 173, + 173, 168, 0, 0, 0, 0, 192, 0, 0, 0, + 0, 0, 0, 186, 186, 214, 214, 214, 214, 214, + 214, 214, 214, 242, 229, 242, 242, 242, 242, 242, + 242, 0, 0, 0, 0, 0, 0, 292, 292, 292, + 0, 0, 0, 0, 291, 291, 280, 291, 291, 291, + 0, 300, 300, 300, 0, 0, 310, 310, 310, 0, + + 309, 309, 309, 312, 161, 154, 154, 154, 0, 0, + 153, 0, 153, 153, 0, 0, 152, 152, 152, 108, + 108, 108, 0, 106, 0, 140, 19, 130, 130, 32, + 9, 130, 130, 130, 130, 130, 60, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 26, 34, 130, + 130, 130, 22, 130, 0, 0, 130, 48, 130, 6, + 130, 130, 130, 36, 130, 0, 0, 130, 29, 122, + 59, 130, 130, 130, 130, 130, 130, 130, 130, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 130, + 10, 130, 63, 130, 130, 38, 130, 130, 23, 130, + + 130, 130, 40, 173, 171, 173, 173, 173, 227, 0, + 0, 0, 0, 0, 182, 0, 0, 0, 186, 184, + 214, 214, 214, 214, 214, 214, 214, 214, 242, 242, + 242, 242, 242, 242, 235, 0, 0, 265, 0, 0, + 0, 0, 260, 0, 0, 0, 0, 271, 0, 0, + 292, 0, 0, 0, 291, 291, 0, 0, 0, 0, + 291, 291, 291, 316, 300, 0, 310, 309, 309, 309, + 154, 0, 0, 152, 152, 152, 108, 107, 0, 0, + 130, 130, 52, 130, 11, 130, 130, 17, 130, 130, + 2, 130, 62, 130, 130, 130, 130, 130, 35, 130, + + 54, 3, 0, 0, 0, 130, 130, 0, 0, 0, + 130, 130, 78, 130, 0, 0, 130, 130, 21, 130, + 27, 130, 130, 130, 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 130, 76, 130, 130, 4, 130, 41, 130, + 130, 170, 173, 173, 169, 0, 0, 0, 0, 202, + 0, 0, 199, 0, 186, 214, 214, 214, 211, 214, + 214, 209, 214, 228, 242, 242, 242, 242, 242, 0, + 0, 0, 0, 0, 0, 291, 291, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 288, 291, 291, 295, + + 309, 309, 309, 0, 0, 152, 148, 152, 0, 0, + 28, 130, 30, 130, 130, 15, 57, 0, 0, 0, + 130, 25, 42, 130, 130, 130, 130, 0, 0, 0, + 0, 0, 130, 130, 0, 0, 33, 96, 130, 0, + 24, 100, 5, 130, 93, 130, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 130, 130, 130, + 0, 0, 0, 103, 130, 130, 173, 173, 0, 0, + 0, 0, 0, 0, 0, 0, 186, 214, 214, 214, + 214, 214, 214, 214, 242, 242, 242, 242, 242, 0, + + 0, 0, 291, 291, 0, 0, 0, 0, 0, 0, + 291, 291, 309, 309, 309, 0, 0, 152, 149, 0, + 130, 130, 130, 0, 0, 44, 130, 130, 130, 130, + 0, 0, 0, 0, 130, 130, 0, 0, 146, 130, + 0, 0, 0, 0, 12, 130, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 67, 130, + 20, 0, 0, 130, 61, 173, 173, 0, 0, 193, + 183, 194, 0, 197, 200, 185, 214, 214, 203, 204, + 214, 207, 210, 234, 242, 230, 242, 242, 0, 0, + + 0, 291, 291, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 291, 291, 309, 309, 309, + 0, 0, 152, 0, 82, 130, 130, 0, 0, 143, + 31, 130, 130, 130, 0, 0, 144, 0, 0, 130, + 130, 0, 0, 0, 0, 51, 0, 0, 0, 126, + 0, 0, 0, 0, 141, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 130, 0, 0, 142, 83, + 173, 173, 0, 0, 0, 214, 214, 214, 242, 242, + 242, 0, 0, 0, 291, 291, 279, 0, 0, 0, + + 0, 0, 0, 0, 279, 0, 0, 0, 0, 0, + 0, 0, 291, 286, 309, 309, 307, 0, 0, 152, + 0, 77, 66, 0, 0, 0, 0, 125, 53, 130, + 0, 0, 0, 0, 0, 0, 130, 130, 0, 0, + 0, 0, 118, 0, 0, 145, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 69, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 130, 0, 0, 0, 0, 173, 173, + 0, 196, 195, 214, 206, 205, 242, 242, 232, 0, + 0, 0, 0, 0, 291, 285, 0, 0, 0, 0, + + 0, 0, 291, 306, 309, 0, 0, 0, 0, 152, + 0, 0, 0, 0, 0, 130, 0, 0, 0, 0, + 0, 0, 130, 130, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 113, 0, 64, 0, 0, 0, 0, 173, 173, + 0, 214, 233, 242, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 279, 291, 309, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 130, 0, 0, 0, 0, 130, 56, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 70, 0, 72, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 88, 0, 0, 0, 0, 98, 0, 0, + 173, 173, 0, 214, 231, 0, 0, 0, 0, 0, + 0, 290, 0, 0, 279, 291, 309, 0, 0, 0, + 0, 147, 0, 0, 0, 0, 0, 58, 0, 0, + 0, 130, 146, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 71, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 75, 0, 0, 0, 0, 0, 94, 97, 0, 165, + 173, 0, 214, 0, 0, 0, 0, 291, 309, 0, + 0, 0, 0, 143, 0, 144, 0, 0, 0, 127, + 0, 0, 0, 0, 141, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 112, 0, + 0, 0, 0, 0, 0, 0, 102, 0, 0, 0, + 0, 99, 0, 142, 0, 173, 0, 214, 0, 0, + 289, 287, 308, 0, 0, 0, 0, 0, 0, 0, + 145, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 105, + 0, 0, 0, 0, 0, 0, 0, 92, 0, 101, + 0, 173, 198, 208, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 74, 0, 0, 0, 81, 0, 85, + 0, 95, 0, 0, 167, 0, 0, 0, 116, 0, + 0, 119, 0, 115, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 74, 0, 114, 0, 0, 89, 0, + 0, 80, 0, 0, 0, 0, 120, 0, 0, 0, + 0, 0, 74, 0, 70, 0, 0, 0, 0, 79, + + 0, 90, 0, 0, 0, 117, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 91, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 111, 0, 0, 0, 0, + 0, 0, 0, 289, 0, 0, 0, 0, 124, 73, + 0, 0, 0, 0, 73, 0, 0, 73, 0, 0, + 0, 123, 0, 74, 0, 0, 0, 0, 0, 0, + 73, 0 + } ; + +static yyconst flex_int32_t yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 2, 4, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 5, 6, 7, 8, 5, 5, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 20, 21, 1, + 22, 1, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + 1, 51, 1, 5, 52, 53, 54, 55, 56, 57, + + 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, + 78, 79, 80, 5, 80, 5, 1, 81, 1, 1, + 1, 1, 1, 1, 1, 82, 83, 1, 1, 84, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 85, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 86, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 87, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static yyconst flex_int32_t yy_meta[88] = + { 0, + 1, 2, 3, 3, 1, 4, 1, 5, 6, 1, + 1, 1, 2, 1, 7, 8, 1, 5, 5, 1, + 1, 1, 1, 1, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 9, 5, 10, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 1, + 1, 1, 1, 1, 1, 2, 1 + } ; + +static yyconst flex_int16_t yy_base[2171] = + { 0, + 0, 0, 87, 0, 172, 173, 185, 0, 272, 0, + 359, 0, 445, 449, 462, 466, 0, 0, 553, 0, + 639, 642, 651, 662, 673, 684, 441, 446, 447, 451, + 456, 461, 5403, 5402, 5401, 5400, 771, 0, 469, 470, + 857, 867, 954, 0, 1041, 1128, 476, 478, 1215, 0, + 1301, 1308, 5452, 6130, 1070, 1073, 6130, 5445, 0, 0, + 5441, 6130, 159, 6130, 164, 162, 5437, 470, 6130, 472, + 461, 479, 472, 630, 653, 435, 673, 684, 451, 678, + 462, 454, 849, 691, 455, 684, 851, 852, 850, 625, + 873, 636, 5395, 5366, 5360, 6130, 6130, 0, 6130, 470, + + 508, 523, 626, 632, 636, 676, 670, 710, 5359, 6130, + 6130, 639, 6130, 1393, 1478, 1080, 692, 1317, 1086, 6130, + 1103, 1337, 1377, 1355, 1413, 1443, 1563, 5362, 6130, 5436, + 0, 5432, 738, 860, 861, 5387, 6130, 6130, 6130, 0, + 6130, 744, 0, 6130, 0, 6130, 6130, 859, 860, 855, + 859, 1132, 5358, 5353, 6130, 6130, 6130, 6130, 746, 6130, + 5356, 5351, 6130, 6130, 6130, 6130, 752, 5354, 5349, 6130, + 6130, 6130, 859, 6130, 6130, 920, 0, 6130, 0, 865, + 886, 1053, 1044, 5352, 5347, 6130, 6130, 5350, 5345, 6130, + 6130, 6130, 6130, 6130, 6130, 921, 5347, 5342, 6130, 6130, + + 6130, 6130, 929, 5345, 5340, 0, 1469, 0, 0, 1483, + 0, 6130, 1498, 0, 0, 5371, 0, 5370, 6130, 1108, + 1324, 6130, 0, 0, 6130, 6130, 5407, 6130, 5397, 1004, + 1125, 1032, 1054, 1052, 6130, 5339, 5334, 6130, 1088, 6130, + 1332, 1428, 6130, 0, 6130, 6130, 6130, 5402, 1118, 5335, + 5330, 6130, 1440, 1466, 6130, 0, 0, 6130, 6130, 6130, + 5399, 1114, 1129, 1116, 5332, 5327, 6130, 0, 6130, 1120, + 6130, 1125, 6130, 1513, 1521, 6130, 0, 0, 6130, 629, + 6130, 930, 701, 1346, 6130, 6130, 5387, 1123, 1133, 1142, + 6130, 5328, 5322, 6130, 1528, 1537, 0, 5391, 6130, 1131, + + 1143, 5323, 1540, 5322, 6130, 5396, 0, 0, 5391, 6130, + 748, 1554, 1288, 6130, 1382, 1492, 1442, 1509, 1152, 0, + 1134, 1285, 1283, 1280, 1289, 1523, 1308, 1342, 1346, 1352, + 1383, 1533, 1411, 1535, 1556, 1428, 1483, 1503, 1519, 1516, + 1543, 1557, 1553, 1592, 1556, 1562, 1583, 1578, 1583, 1582, + 1591, 1586, 1593, 1606, 1594, 1610, 1621, 1608, 1618, 1606, + 1625, 1627, 1621, 1641, 1636, 1666, 1656, 1634, 1629, 1648, + 1634, 0, 5346, 6130, 5315, 868, 0, 930, 6130, 1041, + 1048, 1648, 1665, 1672, 1677, 1661, 1679, 1021, 1168, 6130, + 1732, 1725, 1740, 6130, 1755, 1762, 1778, 1806, 1821, 1906, + + 5312, 1332, 6130, 1840, 1855, 1847, 1884, 1900, 1895, 1952, + 1972, 1978, 1997, 1977, 5311, 6130, 5385, 0, 5381, 6130, + 1339, 6130, 1666, 1684, 5336, 6130, 0, 1422, 6130, 1674, + 1695, 1682, 1698, 1741, 1730, 1739, 1759, 5307, 5303, 1516, + 6130, 5304, 5215, 1707, 6130, 5181, 5151, 0, 1746, 1737, + 1783, 6130, 1748, 1757, 1779, 1781, 1812, 1815, 5124, 1413, + 5122, 5086, 1833, 6130, 5072, 5069, 1834, 6130, 5016, 1306, + 0, 1871, 5076, 6130, 5058, 4986, 6130, 0, 1875, 5046, + 6130, 5031, 4949, 6130, 2001, 6130, 5022, 5012, 4942, 6130, + 0, 6130, 0, 6130, 1943, 4907, 0, 0, 1993, 1989, + + 1808, 1809, 1823, 1826, 1839, 1849, 4904, 4902, 1898, 2014, + 4901, 0, 2020, 1894, 4883, 1406, 2043, 4798, 0, 0, + 2049, 1889, 1899, 1896, 4768, 1629, 0, 1972, 1976, 2052, + 4764, 0, 0, 1733, 2063, 2053, 2055, 2059, 2076, 2014, + 1986, 1995, 2026, 4755, 4751, 2099, 4750, 0, 2105, 2037, + 2052, 4749, 2112, 4741, 2105, 2103, 2112, 1811, 1920, 0, + 2061, 2061, 2057, 2071, 2079, 2109, 2100, 2100, 2101, 2102, + 2117, 2107, 2121, 2118, 2117, 2108, 2112, 2125, 2117, 2111, + 0, 2117, 2119, 2113, 2126, 2120, 2132, 0, 2128, 2141, + 2149, 2151, 2156, 2150, 2166, 2164, 4763, 2169, 2156, 2162, + + 2160, 2155, 2176, 2162, 2177, 2169, 2179, 2169, 2185, 2185, + 2172, 2190, 2180, 2178, 2182, 2176, 4746, 2193, 2250, 2180, + 2188, 2206, 2207, 2228, 2220, 2220, 2235, 2219, 2220, 2225, + 2219, 2234, 2230, 2231, 2238, 6130, 6130, 6130, 2221, 2243, + 2232, 2247, 2237, 2243, 6130, 6130, 2266, 2269, 2265, 2264, + 1185, 2267, 1347, 2294, 2270, 1397, 2297, 2268, 2279, 2291, + 2274, 2273, 4743, 2283, 2276, 4740, 2294, 6130, 6130, 6130, + 6130, 6130, 2277, 2282, 2281, 2302, 2290, 2287, 2295, 2305, + 6130, 6130, 6130, 6130, 6130, 6130, 6130, 6130, 6130, 6130, + 4700, 4679, 2360, 4594, 6130, 4663, 4652, 2363, 4570, 6130, + + 4639, 4638, 2366, 4561, 2369, 4531, 2307, 2345, 2327, 2337, + 2339, 2341, 2353, 2336, 4554, 6130, 2349, 2381, 4516, 2357, + 6130, 6130, 2385, 4515, 2352, 2347, 4543, 6130, 6130, 2355, + 2354, 2392, 4493, 2399, 2381, 2410, 1932, 1965, 2352, 2369, + 2362, 2376, 2370, 6130, 2430, 4466, 2379, 2382, 1986, 2433, + 2437, 4442, 2007, 2018, 2074, 2315, 2425, 2405, 2399, 2417, + 2407, 2416, 2414, 0, 2428, 2429, 2426, 2416, 2418, 2438, + 2415, 2421, 2424, 0, 0, 2426, 2424, 2445, 2440, 2445, + 2430, 2435, 2443, 0, 4470, 2440, 2436, 2454, 0, 2503, + 4453, 0, 2456, 2468, 2480, 2484, 2475, 2486, 0, 2475, + + 2487, 2519, 2499, 2497, 2478, 2493, 0, 2501, 2494, 2507, + 2498, 2508, 2502, 2509, 2512, 2604, 4409, 2548, 2497, 2498, + 0, 2520, 2518, 2505, 2527, 2520, 2522, 2542, 0, 2539, + 2543, 2548, 2542, 0, 2551, 0, 2552, 2534, 2535, 4418, + 2547, 0, 1366, 2574, 2572, 2578, 6130, 2044, 2587, 2563, + 2562, 2596, 2606, 4416, 2557, 2554, 2579, 2584, 2592, 2601, + 2597, 2603, 2608, 2594, 0, 2599, 2604, 4413, 2613, 2621, + 2622, 2672, 4377, 2680, 4373, 2689, 4367, 2652, 2683, 2693, + 4352, 2634, 2645, 4379, 2667, 2670, 2697, 2677, 4370, 2676, + 2667, 2705, 2711, 2707, 4340, 2679, 2715, 2718, 2721, 4335, + + 2688, 4362, 2699, 0, 6130, 2725, 2734, 2736, 4331, 2723, + 2725, 2728, 2730, 2732, 2686, 2690, 2725, 2728, 2723, 2757, + 2761, 2764, 4329, 6130, 2728, 2767, 2774, 2722, 2753, 0, + 0, 2731, 2746, 2743, 2762, 2747, 0, 2763, 2751, 2765, + 2766, 2763, 2755, 2755, 2767, 2777, 4354, 0, 4346, 2774, + 2766, 2778, 0, 2766, 2838, 4316, 2781, 0, 2773, 2847, + 2793, 2791, 2789, 0, 2793, 2850, 4295, 2796, 0, 0, + 0, 2803, 2827, 2830, 2829, 2838, 2827, 2829, 2826, 2837, + 2839, 2843, 2848, 2848, 2852, 2831, 4293, 2935, 4290, 2848, + 0, 2853, 0, 2857, 2858, 0, 2855, 2860, 0, 2846, + + 2865, 2855, 0, 2858, 0, 4312, 2887, 2884, 6130, 2879, + 2888, 2913, 2910, 2900, 2915, 2916, 2914, 2918, 2892, 0, + 2896, 2914, 4310, 2920, 4308, 2912, 2926, 4302, 2929, 4282, + 2923, 2935, 2928, 4205, 0, 2993, 2996, 3006, 3009, 4169, + 3013, 3021, 3023, 3025, 4160, 3032, 3037, 3041, 3045, 4152, + 2969, 2946, 2988, 2991, 2998, 4180, 3052, 3061, 4215, 4146, + 3006, 3013, 3013, 6130, 3016, 3013, 3069, 4170, 3025, 3030, + 3074, 3031, 3031, 3040, 3047, 3045, 3088, 6130, 3091, 4137, + 3056, 3043, 0, 3052, 0, 3056, 3057, 0, 3075, 3077, + 3118, 3084, 0, 3082, 3077, 3091, 3077, 3086, 0, 3085, + + 0, 3155, 3096, 3094, 4134, 3099, 3108, 3171, 4173, 4100, + 3098, 3113, 0, 3118, 3110, 4097, 3125, 3130, 0, 3134, + 0, 3137, 3138, 3123, 3182, 3151, 3150, 3154, 3152, 3150, + 4110, 3146, 4107, 3156, 3175, 3165, 3166, 3161, 3165, 3182, + 3184, 4072, 3171, 0, 3186, 3170, 3242, 3191, 0, 3185, + 3191, 0, 3181, 3187, 0, 3218, 3221, 3236, 3224, 4128, + 3240, 3242, 4126, 3246, 3231, 3232, 3236, 3231, 0, 3232, + 3241, 0, 3238, 0, 3239, 3245, 3239, 3242, 3243, 3282, + 3302, 3309, 3260, 3255, 3268, 3277, 3276, 3274, 3318, 3327, + 3334, 3349, 3364, 3395, 3355, 4059, 0, 3294, 3295, 6130, + + 3302, 3307, 3315, 3338, 3339, 3339, 0, 3340, 3340, 4046, + 0, 3341, 0, 3353, 3358, 0, 0, 3415, 4113, 4023, + 3364, 0, 0, 3368, 3357, 3375, 3375, 3440, 4087, 4014, + 3387, 3388, 3387, 3392, 2799, 4011, 0, 0, 3394, 3395, + 0, 0, 3444, 3401, 0, 3401, 3467, 4079, 4009, 3419, + 3420, 3403, 3413, 3412, 3433, 3435, 3425, 3430, 3433, 3448, + 3435, 3460, 3447, 3449, 3453, 3464, 3450, 3450, 3454, 3470, + 3508, 4074, 4002, 0, 3471, 3460, 3472, 3469, 3493, 3481, + 3515, 3497, 3521, 3522, 3523, 3524, 3467, 3499, 4025, 3514, + 3516, 3523, 3522, 3526, 3527, 3520, 3521, 3527, 3534, 3521, + + 3522, 3537, 3526, 3527, 3542, 3595, 3601, 3610, 3617, 3993, + 3539, 3555, 3562, 3563, 3569, 3576, 3579, 3590, 0, 3589, + 3602, 3594, 3596, 3271, 3991, 0, 3602, 3592, 3603, 3602, + 3311, 3988, 3616, 3595, 3617, 3606, 3368, 1900, 3647, 3615, + 3606, 3682, 4056, 3975, 0, 3615, 3622, 3639, 3556, 3969, + 3989, 3622, 3985, 3631, 3655, 3631, 3635, 3660, 3645, 3666, + 3672, 3675, 3658, 3680, 3683, 3686, 3676, 3675, 0, 3681, + 0, 3703, 3950, 3674, 0, 3682, 3677, 3706, 3712, 4013, + 4010, 3973, 3688, 3946, 3931, 0, 3859, 3690, 0, 0, + 3695, 0, 0, 0, 3701, 0, 3849, 3699, 3700, 3700, + + 3716, 3714, 3703, 3715, 3768, 3782, 3788, 3798, 3804, 3820, + 3834, 3868, 3885, 3895, 3813, 3724, 3715, 3717, 3740, 3755, + 3767, 3776, 3782, 3769, 0, 3780, 3777, 3743, 2068, 3854, + 0, 3787, 3802, 3809, 3765, 2929, 3863, 3827, 3804, 3822, + 3843, 3905, 3914, 3852, 3792, 0, 3854, 3866, 3761, 0, + 3878, 3868, 3914, 2969, 3932, 3877, 3878, 3886, 3890, 3904, + 3908, 3902, 3941, 3914, 3912, 3928, 3911, 3930, 3917, 3938, + 3936, 3920, 3925, 3943, 3937, 3935, 3965, 2989, 3984, 0, + 3950, 3950, 3979, 3981, 3988, 3953, 3977, 3977, 3964, 3975, + 3982, 3976, 4017, 3788, 3970, 3972, 6130, 4045, 4051, 4060, + + 4078, 4094, 4108, 4117, 4126, 4145, 4154, 4189, 4206, 4221, + 4240, 4249, 3986, 0, 3987, 3990, 0, 4028, 4168, 4027, + 4027, 0, 0, 4173, 4184, 4045, 3748, 0, 0, 4051, + 4197, 4235, 4054, 3739, 4053, 4071, 4082, 4090, 4203, 3731, + 4100, 3728, 6130, 4011, 3200, 4258, 4110, 4141, 4269, 4277, + 4164, 3713, 4190, 4196, 4237, 4221, 4230, 4232, 4238, 4297, + 3706, 4256, 4243, 4260, 4262, 4268, 4269, 4268, 4265, 4357, + 4282, 4269, 4277, 4280, 4325, 4321, 4299, 3700, 4297, 4297, + 4299, 3746, 3741, 4302, 0, 0, 4311, 4320, 0, 4317, + 4354, 4364, 3528, 4312, 4383, 0, 4389, 4432, 4449, 4459, + + 4469, 4476, 4308, 0, 4315, 4340, 4439, 4490, 3519, 4423, + 4440, 4496, 3493, 4371, 3484, 4371, 4517, 3441, 4382, 3439, + 4416, 4452, 3420, 4436, 3385, 4451, 4525, 4499, 4474, 3359, + 4466, 4491, 4549, 3347, 4494, 3331, 4513, 4500, 4518, 4499, + 4520, 4554, 4561, 3307, 3318, 4526, 3302, 4567, 4516, 4546, + 4532, 4536, 4545, 4542, 4557, 4558, 4560, 4561, 4549, 4559, + 4560, 6130, 4563, 0, 4622, 3269, 4562, 3258, 4556, 4563, + 4616, 4589, 0, 4568, 4587, 4646, 4588, 4589, 3254, 3152, + 4600, 4652, 4655, 3147, 4661, 4676, 3163, 3094, 4608, 4682, + 4624, 3062, 3047, 4690, 4699, 3021, 4638, 4653, 2980, 4643, + + 4646, 2972, 4652, 4670, 4662, 4677, 0, 4711, 4718, 2922, + 4685, 2913, 4688, 4704, 2887, 4686, 4703, 4699, 4712, 2901, + 4700, 4741, 2868, 4746, 2854, 4719, 4751, 4712, 4761, 2750, + 4728, 2739, 4732, 4731, 4725, 4734, 4743, 4737, 4733, 4735, + 4734, 4738, 6130, 4757, 4758, 4744, 4743, 6130, 2692, 4744, + 4745, 4762, 4777, 4750, 0, 4822, 4756, 2702, 2582, 4773, + 4837, 6130, 2576, 2538, 4849, 4781, 4786, 4856, 4784, 2519, + 4863, 6130, 2512, 2510, 4795, 4799, 4866, 0, 4870, 4803, + 4811, 4833, 4882, 2357, 2261, 4819, 4828, 4837, 4885, 2287, + 4891, 2173, 4840, 4894, 2081, 2075, 4852, 4897, 1961, 4864, + + 4878, 1947, 4861, 4877, 4869, 4881, 4872, 4886, 4879, 4880, + 6130, 4882, 4878, 4881, 4881, 4899, 6130, 6130, 4925, 0, + 4892, 4918, 4891, 4898, 4896, 4891, 1928, 4929, 4930, 4921, + 1897, 4931, 4923, 4970, 1855, 4991, 1851, 4927, 4942, 0, + 1847, 4994, 4927, 4949, 4998, 1825, 4952, 5010, 5013, 1812, + 4942, 4964, 5016, 1782, 4968, 1766, 4973, 4995, 6130, 4976, + 4996, 4982, 4986, 4987, 5000, 5005, 6130, 4994, 4992, 5010, + 5007, 6130, 5012, 5040, 1751, 5018, 5032, 5004, 5022, 5032, + 6130, 0, 0, 5037, 5038, 5027, 1726, 1716, 5046, 5043, + 5103, 1698, 1717, 1752, 1632, 5044, 5111, 5061, 5041, 1628, + + 1557, 5053, 5047, 5065, 1539, 5052, 5049, 5067, 5080, 6130, + 5077, 5073, 5090, 5091, 5082, 5079, 5087, 6130, 5091, 6130, + 1530, 5082, 1582, 0, 5094, 5109, 5096, 5105, 5095, 5101, + 5103, 1513, 5100, 3316, 1500, 5105, 1520, 1518, 1478, 5108, + 5101, 5103, 5116, 5178, 5127, 5119, 5128, 6130, 5133, 6130, + 5133, 6130, 5156, 5148, 0, 5150, 5160, 5154, 6130, 5165, + 5155, 6130, 5155, 6130, 1452, 1445, 5152, 5156, 5157, 5151, + 5172, 5205, 5159, 5230, 1396, 6130, 5167, 5173, 6130, 5180, + 5185, 6130, 5181, 1423, 5182, 5196, 6130, 5181, 1369, 5203, + 5208, 5209, 5242, 1375, 5247, 1291, 5197, 1280, 5219, 6130, + + 5214, 6130, 5223, 5218, 5225, 6130, 5215, 5217, 5236, 5238, + 5243, 1243, 5240, 5232, 5234, 5229, 5236, 5231, 5247, 5233, + 5250, 5251, 5252, 5245, 5246, 6130, 5292, 5257, 5315, 1257, + 5281, 1143, 1136, 5283, 5288, 6130, 5271, 5296, 5285, 5297, + 5286, 5284, 5278, 6130, 5301, 5303, 5292, 5294, 6130, 5332, + 5310, 5292, 5304, 5307, 5343, 1079, 5306, 5360, 5308, 5308, + 1032, 6130, 5332, 5371, 5323, 5324, 5340, 5338, 5352, 5332, + 5380, 6130, 5466, 5476, 5486, 5496, 5506, 5516, 5526, 5536, + 5546, 5556, 5566, 5576, 5586, 5596, 5606, 5616, 5623, 5628, + 1082, 5634, 5636, 1076, 5645, 5650, 1065, 5651, 5653, 5659, + + 898, 5666, 5676, 5686, 5696, 5706, 5716, 5725, 5734, 876, + 5744, 5754, 860, 857, 5764, 752, 5774, 5781, 5786, 749, + 5792, 5794, 742, 5803, 5808, 725, 5809, 5811, 5817, 703, + 5824, 5834, 5844, 5854, 5864, 5874, 5883, 5892, 695, 5902, + 5912, 662, 654, 5922, 652, 5932, 5942, 546, 498, 5948, + 480, 5952, 478, 5959, 5969, 5979, 5989, 5999, 6009, 6019, + 6029, 6039, 6049, 6059, 6069, 6079, 6089, 6099, 6109, 6119 + } ; + +static yyconst flex_int16_t yy_def[2171] = + { 0, + 2072, 1, 2072, 3, 2073, 2073, 2072, 7, 2072, 9, + 2072, 11, 2074, 2074, 2075, 2075, 2076, 2076, 2072, 19, + 2076, 2076, 2077, 2077, 2078, 2078, 2079, 2079, 2080, 2080, + 2081, 2081, 2082, 2082, 2083, 2083, 2072, 37, 2084, 2084, + 2085, 2085, 2072, 43, 2086, 2086, 2087, 2087, 2072, 49, + 2088, 2088, 2072, 2072, 2072, 2072, 2072, 2089, 2090, 2091, + 2092, 2072, 2072, 2072, 2072, 2072, 2072, 2091, 2072, 2091, + 2091, 2091, 2091, 2091, 2091, 2091, 2091, 2091, 2091, 2091, + 2091, 2091, 2091, 2091, 2091, 2091, 2091, 2091, 2091, 2091, + 2091, 2091, 2093, 2072, 2072, 2072, 2072, 2094, 2072, 2072, + + 2072, 2094, 2094, 2094, 2094, 2094, 2094, 2094, 2072, 2072, + 2072, 2072, 2072, 2095, 2095, 2095, 2072, 2095, 2095, 2072, + 2095, 2095, 2095, 2095, 2095, 2095, 2095, 2072, 2072, 2096, + 2097, 2098, 2072, 2097, 2097, 2099, 2072, 2072, 2072, 2100, + 2072, 2072, 2100, 2072, 2100, 2072, 2072, 2100, 2100, 2100, + 2100, 2100, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2101, 2072, 2072, 2072, 2101, 2072, 2101, 2101, + 2101, 2101, 2101, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + + 2072, 2072, 2072, 2072, 2072, 2102, 2072, 2103, 2104, 2072, + 2105, 2072, 2072, 2106, 2107, 2072, 2108, 2072, 2072, 2072, + 2072, 2072, 2109, 2110, 2072, 2072, 2072, 2072, 2072, 2110, + 2110, 2110, 2110, 2110, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2111, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2112, 2113, 2072, 2072, 2072, + 2072, 2113, 2113, 2113, 2072, 2072, 2072, 2114, 2072, 2114, + 2072, 2072, 2072, 2072, 2072, 2072, 2115, 2116, 2072, 2072, + 2072, 2072, 2072, 2116, 2072, 2072, 2072, 2116, 2116, 2116, + 2072, 2072, 2072, 2072, 2072, 2072, 2117, 2072, 2072, 2072, + + 2072, 2072, 2072, 2072, 2072, 2118, 2119, 2120, 2121, 2072, + 2072, 2072, 2072, 2072, 2072, 2120, 2120, 2120, 2120, 2120, + 2120, 2120, 2120, 2120, 2120, 2120, 2120, 2120, 2120, 2120, + 2120, 2120, 2120, 2120, 2120, 2120, 2120, 2120, 2120, 2120, + 2120, 2120, 2120, 2120, 2120, 2120, 2120, 2120, 2120, 2120, + 2120, 2120, 2120, 2120, 2120, 2120, 2120, 2120, 2120, 2120, + 2120, 2120, 2120, 2120, 2120, 2120, 2120, 2120, 2120, 2120, + 2120, 2120, 2122, 2072, 2072, 2072, 2123, 2072, 2072, 2072, + 2123, 2123, 2123, 2123, 2123, 2123, 2123, 2072, 2072, 2072, + 2124, 2124, 2124, 2072, 2124, 2124, 2124, 2124, 2124, 2124, + + 2072, 2072, 2072, 2124, 2124, 400, 2124, 2124, 400, 2124, + 2124, 2124, 2124, 400, 2072, 2072, 2125, 2126, 2127, 2072, + 2072, 2072, 2126, 2126, 2128, 2072, 2129, 2072, 2072, 2129, + 2129, 2129, 2129, 2129, 2129, 2129, 2129, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2130, 2130, 2130, + 2072, 2072, 2130, 2130, 2130, 2130, 2130, 2130, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2131, 2072, 2132, 2072, 2072, 2072, 2072, 2133, 2072, 2134, + 2072, 2072, 2072, 2072, 2072, 2072, 2135, 2072, 2072, 2072, + 2136, 2072, 2137, 2072, 2072, 2072, 2138, 2139, 2072, 2072, + + 2139, 2139, 2139, 2139, 2139, 2139, 2072, 2072, 2072, 2072, + 2072, 2140, 2072, 2072, 2072, 2072, 2072, 2072, 2141, 2142, + 2072, 2142, 2142, 2142, 2072, 2072, 2143, 2143, 2072, 2072, + 2072, 2144, 2145, 2072, 2072, 2072, 2072, 2145, 2145, 2072, + 2145, 2145, 2145, 2072, 2072, 2072, 2072, 2146, 2072, 2072, + 2072, 2072, 2147, 2072, 2072, 2072, 2072, 2072, 2148, 2148, + 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, + 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, + 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, + 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, + + 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, + 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, + 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, + 2148, 2148, 2148, 2148, 2148, 2072, 2072, 2072, 2149, 2149, + 2149, 2149, 2149, 2149, 2072, 2072, 2150, 2150, 2150, 2150, + 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2151, 2151, 2152, + 2152, 2152, 2152, 2152, 2152, 2152, 2152, 2072, 2072, 2072, + 2072, 2072, 2153, 2153, 2153, 2153, 2153, 2153, 2153, 2153, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2132, 2132, 2072, 2072, 2072, 2134, 2134, 2072, 2072, 2072, + + 2135, 2135, 2072, 2072, 2154, 2072, 2072, 2072, 2072, 2139, + 2139, 2139, 2139, 2139, 2139, 2072, 2072, 2155, 2072, 2072, + 2072, 2072, 2156, 2072, 2142, 2142, 2142, 2072, 2072, 2143, + 2072, 2157, 2072, 2072, 2072, 2072, 2072, 2145, 2072, 2072, + 2145, 2145, 2145, 2072, 2158, 2072, 2072, 2072, 2147, 2147, + 2147, 2072, 2072, 2072, 2072, 2072, 2072, 2148, 2148, 2148, + 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, + 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, + 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, + 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, + + 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, + 2148, 2148, 2148, 2148, 2148, 2072, 2072, 2148, 2148, 2148, + 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, + 2148, 2148, 2148, 2148, 2148, 2148, 2149, 2149, 2149, 2149, + 2149, 2149, 2150, 2150, 2150, 2150, 2072, 2150, 2150, 2150, + 2150, 2150, 2150, 2151, 2151, 2152, 2152, 2152, 2152, 2152, + 2152, 2152, 2152, 2153, 2153, 2153, 2153, 2153, 2153, 2153, + 2153, 2159, 2072, 2160, 2072, 2161, 2072, 2154, 2154, 2154, + 2072, 2072, 2072, 2072, 2139, 2139, 2139, 2139, 2139, 2139, + 2072, 2155, 2155, 2155, 2072, 2072, 2156, 2156, 2156, 2072, + + 2142, 2142, 2142, 2143, 2072, 2157, 2157, 2157, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2145, 2145, 2145, 2158, + 2158, 2158, 2072, 2072, 2072, 2147, 2148, 2148, 2148, 2148, + 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, + 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, + 2148, 2148, 2148, 2148, 2072, 2072, 2148, 2148, 2148, 2148, + 2148, 2148, 2148, 2148, 2148, 2072, 2072, 2148, 2148, 2148, + 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2148, + 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, + + 2148, 2148, 2148, 2149, 2149, 2149, 2149, 2149, 2072, 2150, + 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2151, 2151, + 2152, 2152, 2152, 2152, 2152, 2152, 2152, 2152, 2153, 2153, + 2153, 2153, 2153, 2153, 2153, 2159, 2159, 2159, 2159, 2072, + 2160, 2160, 2160, 2160, 2072, 2161, 2161, 2161, 2161, 2072, + 2154, 2072, 2072, 2072, 2139, 2139, 2072, 2162, 2072, 2072, + 2139, 2139, 2139, 2072, 2155, 2072, 2156, 2142, 2142, 2142, + 2157, 2072, 2072, 2145, 2145, 2145, 2158, 2072, 2072, 2072, + 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, + 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, + + 2148, 2148, 2072, 2072, 2072, 2148, 2148, 2072, 2072, 2072, + 2148, 2148, 2148, 2148, 2072, 2072, 2148, 2148, 2148, 2148, + 2148, 2148, 2148, 2148, 2148, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, + 2148, 2149, 2149, 2149, 2149, 2150, 2150, 2150, 2150, 2150, + 2150, 2150, 2150, 2150, 2151, 2152, 2152, 2152, 2152, 2152, + 2152, 2152, 2152, 2153, 2153, 2153, 2153, 2153, 2153, 2159, + 2160, 2161, 2072, 2072, 2072, 2139, 2139, 2072, 2162, 2162, + 2162, 2162, 2162, 2162, 2072, 2072, 2139, 2139, 2139, 2072, + + 2142, 2142, 2142, 2072, 2072, 2145, 2145, 2145, 2072, 2072, + 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2072, 2072, 2072, + 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2072, 2072, 2072, + 2072, 2072, 2148, 2148, 2163, 2072, 2148, 2148, 2148, 2072, + 2148, 2148, 2148, 2148, 2148, 2148, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2148, 2148, 2148, + 2072, 2072, 2072, 2148, 2148, 2148, 2149, 2149, 2150, 2150, + 2150, 2150, 2150, 2150, 2150, 2150, 2151, 2152, 2152, 2152, + 2152, 2152, 2152, 2152, 2153, 2153, 2153, 2153, 2153, 2072, + + 2072, 2072, 2139, 2139, 2072, 2162, 2162, 2162, 2164, 2072, + 2139, 2139, 2142, 2142, 2142, 2072, 2072, 2145, 2145, 2072, + 2148, 2148, 2148, 2165, 2072, 2148, 2148, 2148, 2148, 2148, + 2166, 2072, 2072, 2072, 2148, 2148, 2163, 2163, 2072, 2148, + 2072, 2072, 2072, 2072, 2148, 2148, 2072, 2072, 2167, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2148, 2148, + 2148, 2168, 2072, 2148, 2148, 2149, 2149, 2150, 2150, 2150, + 2150, 2150, 2150, 2150, 2150, 2151, 2152, 2152, 2152, 2152, + 2152, 2152, 2152, 2153, 2153, 2153, 2153, 2153, 2072, 2072, + + 2072, 2139, 2139, 2072, 2169, 2164, 2162, 2162, 2164, 2164, + 2169, 2164, 2164, 2164, 2072, 2139, 2139, 2142, 2142, 2142, + 2072, 2072, 2145, 2072, 2148, 2148, 2148, 2165, 2165, 2072, + 2148, 2148, 2148, 2148, 2166, 2166, 2072, 2072, 2072, 2148, + 2148, 2072, 2072, 2072, 2072, 2148, 2072, 2170, 2072, 2148, + 2072, 2072, 2167, 2167, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2148, 2168, 2168, 2072, 2148, + 2149, 2149, 2150, 2150, 2150, 2152, 2152, 2152, 2153, 2153, + 2153, 2072, 2072, 2072, 2139, 2139, 2072, 2169, 2169, 2169, + + 2169, 2169, 2169, 2162, 2162, 2164, 2164, 2169, 2169, 2164, + 2164, 2164, 2139, 2139, 2142, 2142, 2142, 2072, 2072, 2145, + 2072, 2148, 2148, 2072, 2072, 2072, 2072, 2148, 2148, 2148, + 2072, 2072, 2072, 2072, 2072, 2072, 2148, 2148, 2072, 2072, + 2072, 2072, 2072, 2170, 2170, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2148, 2072, 2072, 2072, 2072, 2149, 2149, + 2150, 2150, 2150, 2152, 2152, 2152, 2153, 2153, 2153, 2072, + 2072, 2072, 2072, 2072, 2139, 2139, 2169, 2169, 2169, 2164, + + 2169, 2164, 2139, 2142, 2142, 2072, 2072, 2072, 2072, 2145, + 2072, 2072, 2072, 2072, 2072, 2148, 2072, 2072, 2072, 2072, + 2072, 2072, 2148, 2148, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2148, 2072, 2072, 2072, 2072, 2149, 2149, + 2150, 2152, 2153, 2153, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2169, 2164, 2139, 2142, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + + 2148, 2072, 2072, 2072, 2072, 2148, 2148, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2149, 2149, 2150, 2152, 2153, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2169, 2139, 2142, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2148, 2072, 2072, + 2072, 2148, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2149, + 2149, 2150, 2152, 2072, 2072, 2072, 2072, 2139, 2142, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2148, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2149, 2150, 2152, 2072, 2072, + 2072, 2139, 2142, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2149, 2150, 2152, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2149, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 0, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072 + } ; + +static yyconst flex_int16_t yy_nxt[6218] = + { 0, + 54, 55, 56, 55, 57, 58, 59, 60, 61, 62, + 62, 57, 63, 64, 65, 66, 67, 68, 68, 57, + 57, 57, 69, 57, 70, 71, 72, 73, 74, 75, + 76, 77, 78, 60, 79, 80, 81, 82, 83, 84, + 85, 86, 87, 88, 89, 90, 91, 92, 60, 60, + 54, 60, 93, 70, 71, 72, 73, 74, 75, 76, + 77, 78, 60, 79, 80, 81, 82, 83, 84, 85, + 86, 87, 88, 89, 90, 91, 92, 60, 60, 54, + 54, 54, 54, 54, 54, 94, 95, 96, 96, 97, + 96, 96, 96, 96, 98, 96, 99, 99, 100, 101, + + 96, 101, 96, 96, 102, 102, 96, 96, 96, 96, + 96, 98, 98, 98, 98, 98, 103, 98, 98, 104, + 98, 98, 98, 98, 98, 98, 98, 105, 106, 107, + 98, 98, 98, 108, 98, 98, 98, 96, 98, 96, + 98, 98, 98, 98, 98, 103, 98, 98, 104, 98, + 98, 98, 98, 98, 98, 98, 105, 106, 107, 98, + 98, 98, 108, 98, 98, 98, 96, 96, 96, 96, + 96, 96, 96, 109, 111, 111, 311, 311, 312, 313, + 313, 311, 311, 112, 112, 113, 114, 115, 114, 113, + 113, 113, 116, 113, 113, 113, 117, 118, 113, 119, + + 120, 113, 116, 116, 113, 113, 113, 113, 113, 116, + 116, 116, 121, 122, 116, 123, 116, 116, 116, 116, + 116, 116, 116, 124, 125, 116, 126, 116, 127, 116, + 116, 116, 116, 116, 116, 113, 116, 113, 116, 116, + 116, 121, 122, 116, 123, 116, 116, 116, 116, 116, + 116, 116, 124, 125, 116, 126, 116, 127, 116, 116, + 116, 116, 116, 116, 113, 113, 113, 113, 113, 113, + 128, 113, 129, 129, 97, 129, 129, 130, 129, 131, + 132, 129, 129, 133, 129, 129, 129, 129, 129, 131, + 131, 129, 129, 129, 129, 129, 131, 131, 131, 131, + + 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, + 131, 134, 131, 131, 131, 135, 131, 131, 131, 131, + 131, 131, 129, 131, 136, 131, 131, 131, 131, 131, + 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, + 134, 131, 131, 131, 135, 131, 131, 131, 131, 131, + 131, 129, 129, 129, 129, 129, 129, 129, 129, 137, + 138, 139, 138, 137, 137, 137, 140, 141, 137, 137, + 142, 143, 144, 145, 146, 137, 140, 140, 137, 137, + 147, 137, 137, 140, 140, 140, 148, 149, 140, 150, + 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, + + 151, 140, 152, 140, 140, 140, 140, 140, 140, 137, + 140, 137, 140, 140, 140, 148, 149, 140, 150, 140, + 140, 140, 140, 140, 140, 140, 140, 140, 140, 151, + 140, 152, 140, 140, 140, 140, 140, 140, 137, 137, + 137, 137, 137, 137, 153, 154, 156, 157, 156, 207, + 156, 157, 156, 158, 207, 210, 159, 158, 160, 210, + 159, 213, 160, 164, 165, 164, 213, 164, 165, 164, + 166, 97, 97, 167, 166, 166, 335, 167, 97, 166, + 97, 378, 448, 342, 418, 315, 379, 316, 316, 323, + 346, 208, 347, 324, 239, 239, 208, 211, 317, 356, + + 328, 211, 377, 325, 329, 335, 214, 318, 272, 319, + 272, 214, 342, 330, 320, 321, 322, 326, 323, 346, + 327, 347, 324, 239, 239, 380, 380, 317, 356, 328, + 161, 162, 325, 329, 161, 162, 318, 272, 319, 272, + 381, 381, 330, 320, 321, 322, 326, 168, 169, 327, + 308, 168, 169, 170, 171, 172, 171, 170, 170, 170, + 173, 174, 175, 175, 176, 177, 178, 177, 170, 170, + 179, 179, 170, 170, 175, 170, 170, 179, 179, 179, + 179, 179, 179, 180, 179, 179, 179, 179, 179, 179, + 179, 179, 181, 179, 179, 182, 183, 179, 179, 179, + + 179, 179, 179, 170, 179, 170, 179, 179, 179, 179, + 179, 179, 180, 179, 179, 179, 179, 179, 179, 179, + 179, 181, 179, 179, 182, 183, 179, 179, 179, 179, + 179, 179, 175, 170, 170, 170, 170, 170, 184, 185, + 186, 186, 186, 186, 186, 186, 534, 534, 187, 368, + 389, 187, 191, 192, 191, 390, 533, 193, 527, 194, + 372, 195, 196, 191, 192, 191, 520, 382, 193, 383, + 194, 331, 195, 196, 200, 201, 200, 332, 368, 202, + 384, 202, 202, 202, 203, 200, 201, 200, 333, 372, + 202, 334, 202, 202, 202, 203, 382, 336, 383, 498, + + 331, 337, 343, 402, 385, 338, 332, 448, 403, 384, + 344, 339, 357, 386, 340, 352, 345, 333, 536, 536, + 334, 341, 358, 353, 188, 189, 336, 188, 189, 418, + 337, 343, 354, 385, 338, 355, 197, 198, 387, 344, + 339, 357, 386, 340, 352, 345, 377, 197, 198, 421, + 341, 358, 353, 308, 422, 428, 533, 440, 204, 205, + 429, 354, 441, 444, 355, 311, 311, 387, 445, 204, + 205, 219, 220, 221, 220, 219, 222, 223, 224, 225, + 226, 219, 219, 219, 219, 227, 219, 219, 224, 224, + 219, 228, 219, 219, 229, 230, 224, 224, 224, 224, + + 231, 232, 224, 224, 224, 224, 233, 224, 224, 224, + 224, 224, 234, 224, 224, 224, 224, 224, 224, 224, + 224, 219, 224, 235, 230, 224, 224, 224, 224, 231, + 232, 224, 224, 224, 224, 233, 224, 224, 224, 224, + 224, 234, 224, 224, 224, 224, 224, 224, 224, 224, + 219, 219, 219, 219, 219, 219, 236, 237, 241, 242, + 241, 527, 243, 244, 520, 245, 246, 247, 241, 242, + 241, 248, 243, 244, 348, 245, 246, 247, 349, 359, + 498, 248, 360, 363, 423, 424, 350, 365, 361, 366, + 351, 430, 367, 364, 362, 431, 432, 369, 433, 249, + + 449, 450, 448, 348, 370, 371, 453, 349, 359, 249, + 454, 360, 363, 423, 424, 350, 365, 361, 366, 351, + 430, 367, 364, 362, 431, 432, 369, 433, 249, 449, + 450, 451, 463, 370, 371, 453, 452, 464, 249, 454, + 467, 378, 250, 251, 535, 468, 379, 534, 534, 636, + 637, 638, 250, 251, 252, 253, 254, 253, 252, 255, + 256, 257, 258, 259, 260, 252, 252, 252, 261, 252, + 252, 257, 257, 252, 252, 252, 252, 252, 257, 257, + 257, 257, 257, 262, 257, 257, 257, 257, 257, 263, + 257, 257, 257, 257, 257, 264, 257, 257, 257, 257, + + 257, 257, 257, 257, 252, 257, 252, 257, 257, 257, + 257, 257, 262, 257, 257, 257, 257, 257, 263, 257, + 257, 257, 257, 257, 264, 257, 257, 257, 257, 257, + 257, 257, 257, 252, 252, 252, 252, 252, 252, 265, + 266, 97, 97, 97, 97, 97, 267, 97, 501, 269, + 97, 97, 97, 97, 97, 97, 97, 97, 380, 380, + 97, 97, 97, 97, 97, 381, 381, 504, 457, 418, + 270, 303, 303, 303, 303, 303, 303, 501, 505, 455, + 377, 2072, 2072, 2072, 456, 458, 308, 2072, 2072, 2072, + 506, 97, 2072, 97, 2072, 394, 504, 457, 2072, 270, + + 2072, 394, 645, 646, 2072, 2072, 2072, 505, 455, 495, + 495, 495, 2055, 456, 458, 2072, 509, 2072, 394, 506, + 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, + 97, 97, 97, 267, 97, 405, 269, 97, 97, 97, + 97, 97, 97, 97, 97, 509, 514, 97, 97, 97, + 97, 97, 522, 523, 524, 304, 434, 270, 304, 2061, + 435, 528, 529, 502, 405, 2072, 503, 541, 542, 436, + 543, 2072, 550, 437, 551, 514, 562, 563, 97, 389, + 97, 522, 523, 524, 390, 434, 270, 2041, 2072, 435, + 528, 529, 502, 496, 2040, 503, 541, 542, 436, 543, + + 394, 550, 437, 551, 847, 562, 563, 97, 97, 97, + 97, 97, 97, 97, 97, 273, 274, 275, 274, 273, + 276, 277, 278, 279, 273, 273, 273, 280, 281, 282, + 283, 273, 284, 284, 273, 285, 286, 273, 287, 288, + 278, 278, 278, 278, 278, 289, 278, 278, 278, 278, + 278, 278, 278, 278, 278, 278, 278, 290, 278, 278, + 278, 278, 278, 278, 278, 273, 278, 291, 288, 278, + 278, 278, 278, 278, 289, 278, 278, 278, 278, 278, + 278, 278, 278, 278, 278, 278, 290, 278, 278, 278, + 278, 278, 278, 278, 273, 273, 273, 273, 273, 273, + + 292, 293, 295, 296, 295, 313, 313, 297, 2038, 295, + 296, 295, 564, 565, 297, 298, 555, 566, 2072, 2072, + 2072, 299, 298, 1995, 567, 495, 495, 495, 299, 2072, + 300, 2072, 394, 510, 510, 510, 571, 300, 2072, 2072, + 2072, 564, 565, 402, 404, 555, 566, 301, 403, 2072, + 421, 2072, 394, 567, 301, 422, 2072, 2072, 2072, 300, + 1974, 537, 394, 538, 538, 571, 300, 2072, 572, 2072, + 394, 2012, 406, 404, 539, 575, 301, 573, 2072, 2072, + 2072, 394, 408, 301, 574, 1009, 302, 468, 468, 2072, + 576, 2072, 394, 302, 391, 391, 391, 572, 849, 556, + + 556, 406, 2072, 539, 575, 393, 573, 393, 394, 496, + 557, 408, 394, 574, 2072, 2072, 2072, 511, 407, 576, + 395, 396, 2072, 397, 577, 2072, 2011, 2072, 394, 510, + 510, 510, 398, 428, 399, 580, 400, 409, 429, 557, + 2072, 517, 517, 517, 2072, 2072, 2072, 407, 852, 395, + 396, 1964, 397, 577, 558, 2072, 558, 2072, 394, 559, + 559, 398, 2072, 399, 580, 400, 409, 517, 517, 517, + 472, 472, 472, 585, 2004, 473, 1998, 474, 401, 391, + 391, 391, 410, 475, 479, 479, 479, 721, 722, 480, + 393, 481, 393, 394, 682, 683, 684, 482, 2072, 485, + + 485, 485, 585, 486, 487, 395, 396, 315, 397, 316, + 316, 410, 488, 511, 530, 530, 530, 398, 586, 399, + 317, 400, 530, 530, 530, 518, 1934, 440, 2072, 546, + 546, 546, 441, 587, 395, 396, 1989, 397, 546, 546, + 546, 303, 303, 303, 560, 588, 398, 586, 399, 317, + 400, 518, 561, 589, 476, 553, 553, 553, 1897, 568, + 569, 578, 587, 401, 2072, 2072, 2072, 570, 483, 1969, + 590, 1968, 579, 560, 588, 2072, 581, 2072, 394, 582, + 583, 561, 589, 489, 1966, 591, 592, 411, 568, 569, + 578, 412, 593, 1891, 584, 594, 570, 394, 531, 590, + + 413, 579, 597, 598, 414, 581, 531, 599, 582, 583, + 1874, 600, 601, 547, 591, 592, 411, 602, 603, 1853, + 412, 593, 547, 584, 594, 304, 595, 604, 596, 413, + 605, 597, 598, 414, 606, 607, 599, 1848, 608, 554, + 600, 601, 609, 615, 620, 610, 602, 603, 2072, 621, + 611, 622, 616, 618, 617, 595, 604, 596, 612, 605, + 613, 619, 623, 606, 607, 624, 614, 608, 626, 631, + 633, 609, 615, 620, 610, 632, 634, 635, 621, 611, + 622, 616, 618, 617, 629, 625, 639, 612, 630, 613, + 619, 623, 640, 627, 624, 614, 628, 626, 631, 633, + + 641, 642, 643, 644, 632, 634, 635, 658, 1939, 659, + 728, 729, 1845, 629, 625, 639, 660, 630, 444, 661, + 662, 640, 627, 445, 663, 628, 2072, 2072, 2072, 641, + 642, 643, 644, 391, 391, 391, 658, 2072, 659, 2072, + 394, 2072, 2072, 2072, 393, 660, 393, 394, 661, 662, + 534, 534, 2072, 663, 2072, 394, 2072, 2072, 2072, 395, + 396, 1934, 397, 2072, 2072, 2072, 664, 2072, 1933, 2072, + 394, 398, 665, 399, 2072, 400, 2072, 394, 1932, 2072, + 2072, 2072, 666, 667, 673, 674, 675, 405, 395, 396, + 2072, 397, 2072, 394, 451, 664, 1836, 406, 676, 452, + + 398, 665, 399, 677, 400, 678, 1834, 2072, 2072, 2072, + 2072, 666, 667, 673, 674, 675, 405, 401, 2072, 407, + 2072, 394, 2072, 2072, 2072, 2072, 406, 676, 757, 757, + 409, 1921, 677, 2072, 678, 2072, 394, 679, 1935, 680, + 2072, 2072, 2072, 2072, 463, 467, 1798, 2072, 407, 464, + 468, 710, 2072, 711, 2072, 394, 2072, 2072, 2072, 409, + 410, 712, 1905, 2072, 713, 647, 679, 2072, 680, 2072, + 394, 649, 472, 472, 472, 392, 479, 479, 479, 690, + 710, 714, 711, 695, 392, 2072, 2072, 2072, 392, 410, + 712, 2072, 1901, 713, 647, 715, 2072, 648, 2072, 394, + + 649, 2072, 2072, 2072, 392, 1895, 2072, 2072, 2072, 2072, + 714, 1338, 2072, 392, 2072, 394, 1442, 392, 2072, 392, + 2072, 394, 650, 392, 715, 2072, 648, 1783, 717, 720, + 411, 1888, 392, 725, 412, 1887, 652, 559, 559, 651, + 2072, 726, 727, 413, 495, 495, 495, 414, 392, 914, + 914, 650, 392, 2072, 2072, 2072, 476, 717, 720, 411, + 483, 392, 725, 412, 2072, 652, 2072, 394, 651, 2072, + 726, 727, 413, 2072, 2072, 2072, 414, 1771, 653, 2072, + 2072, 2072, 738, 738, 2072, 2072, 2072, 394, 2072, 2072, + 2072, 2072, 2072, 394, 705, 705, 705, 654, 2072, 2072, + + 2072, 657, 485, 485, 485, 392, 700, 653, 1761, 2072, + 730, 2072, 394, 707, 392, 510, 510, 510, 392, 731, + 655, 718, 718, 718, 754, 754, 654, 1729, 496, 741, + 657, 708, 709, 742, 392, 754, 754, 2072, 739, 730, + 656, 1856, 707, 392, 517, 517, 517, 392, 731, 655, + 723, 723, 723, 530, 530, 530, 740, 2072, 741, 394, + 708, 709, 742, 2072, 732, 732, 732, 739, 743, 656, + 536, 536, 735, 735, 537, 747, 538, 538, 706, 1429, + 748, 734, 2072, 736, 1524, 740, 489, 539, 737, 758, + 737, 756, 756, 738, 738, 1013, 759, 743, 760, 511, + + 546, 546, 546, 761, 747, 719, 745, 745, 745, 748, + 734, 762, 736, 750, 553, 553, 539, 753, 758, 753, + 556, 556, 754, 754, 755, 759, 755, 760, 518, 756, + 756, 557, 761, 763, 724, 764, 765, 531, 766, 768, + 762, 769, 770, 767, 773, 771, 774, 775, 733, 772, + 776, 777, 778, 779, 780, 1724, 781, 782, 783, 784, + 557, 1722, 763, 785, 764, 765, 786, 766, 768, 787, + 769, 770, 767, 773, 771, 774, 775, 788, 772, 776, + 777, 778, 779, 780, 547, 781, 782, 783, 784, 789, + 746, 790, 785, 791, 792, 786, 793, 751, 787, 795, + + 796, 797, 798, 799, 800, 801, 788, 802, 803, 804, + 805, 806, 807, 808, 809, 810, 811, 812, 789, 813, + 790, 815, 791, 792, 1851, 793, 818, 819, 795, 796, + 797, 798, 799, 800, 801, 822, 802, 803, 804, 805, + 806, 807, 808, 809, 810, 811, 812, 820, 813, 821, + 815, 816, 816, 816, 823, 818, 819, 825, 826, 827, + 828, 829, 830, 831, 822, 824, 832, 833, 834, 836, + 837, 838, 835, 839, 840, 841, 820, 842, 821, 394, + 394, 394, 394, 823, 394, 394, 825, 826, 827, 828, + 829, 830, 831, 844, 824, 832, 833, 834, 836, 837, + + 838, 835, 839, 840, 841, 843, 842, 845, 846, 394, + 848, 854, 394, 851, 855, 856, 857, 858, 860, 861, + 863, 864, 844, 853, 865, 866, 867, 868, 869, 850, + 870, 871, 756, 756, 843, 817, 845, 846, 1847, 848, + 854, 1709, 851, 855, 856, 857, 858, 860, 861, 863, + 864, 882, 853, 865, 866, 867, 868, 869, 850, 870, + 871, 872, 872, 872, 874, 874, 874, 876, 876, 876, + 879, 705, 705, 883, 884, 885, 886, 887, 888, 889, + 882, 891, 893, 718, 718, 896, 898, 723, 723, 901, + 902, 904, 905, 907, 732, 732, 915, 916, 735, 735, + + 917, 918, 883, 884, 885, 886, 887, 888, 889, 736, + 891, 910, 919, 910, 896, 924, 911, 911, 901, 902, + 904, 905, 912, 925, 912, 915, 916, 913, 913, 917, + 918, 921, 745, 745, 750, 553, 553, 1841, 736, 2072, + 2072, 919, 757, 757, 924, 873, 927, 928, 875, 929, + 930, 877, 925, 931, 880, 932, 933, 935, 936, 937, + 934, 938, 939, 940, 941, 942, 894, 943, 944, 945, + 899, 946, 947, 948, 949, 927, 928, 908, 929, 930, + 950, 952, 931, 953, 932, 933, 935, 936, 937, 934, + 938, 939, 940, 941, 942, 954, 943, 944, 945, 958, + + 946, 947, 948, 949, 955, 955, 955, 959, 960, 950, + 952, 961, 953, 962, 963, 922, 964, 926, 751, 965, + 966, 966, 966, 968, 954, 969, 970, 971, 958, 972, + 973, 974, 975, 976, 977, 978, 959, 960, 979, 990, + 961, 991, 962, 963, 992, 964, 993, 994, 965, 988, + 988, 988, 968, 995, 969, 970, 971, 996, 972, 973, + 974, 975, 976, 977, 978, 997, 998, 979, 990, 999, + 991, 1000, 1001, 992, 1002, 993, 994, 394, 394, 1003, + 1004, 1005, 995, 1006, 1008, 1020, 996, 394, 956, 394, + 1694, 1015, 1831, 394, 997, 998, 1021, 1016, 999, 1690, + + 1000, 1001, 394, 1002, 967, 816, 816, 816, 1003, 1004, + 1005, 394, 1006, 1008, 1020, 1011, 1010, 1012, 1682, 1014, + 1015, 394, 1022, 1023, 1024, 1021, 1016, 980, 1017, 1025, + 981, 982, 1026, 989, 1018, 1027, 1028, 1029, 1030, 1031, + 1033, 983, 984, 985, 1011, 1010, 1012, 986, 1014, 1034, + 1035, 1022, 1023, 1024, 2072, 2072, 1827, 1017, 1025, 981, + 982, 1026, 1676, 1018, 1027, 1028, 1029, 1030, 1031, 1033, + 983, 984, 985, 1037, 872, 872, 986, 1052, 1034, 1035, + 1038, 1042, 874, 874, 879, 705, 705, 1053, 1043, 817, + 1047, 876, 876, 1055, 1048, 2072, 2072, 1056, 1057, 1057, + + 1057, 1061, 1063, 1058, 1064, 1066, 1052, 2072, 2072, 2072, + 2072, 1059, 893, 718, 718, 1068, 1053, 2072, 2072, 898, + 723, 723, 1055, 2072, 2072, 1070, 1056, 2072, 2072, 1072, + 1061, 1063, 1073, 1064, 1066, 907, 732, 732, 2072, 2072, + 911, 911, 911, 911, 1068, 913, 913, 913, 913, 914, + 914, 1074, 1075, 1825, 1070, 1076, 1078, 1039, 1072, 2072, + 2072, 1073, 921, 745, 745, 1044, 2072, 2072, 880, 2072, + 2072, 1081, 1665, 1051, 1049, 1079, 1079, 1079, 1082, 1083, + 1074, 1075, 1060, 1084, 1076, 1078, 1085, 1065, 1086, 1087, + 1804, 1088, 1089, 1090, 1091, 1092, 894, 1093, 1094, 1095, + + 1081, 1067, 1096, 899, 1099, 1100, 1101, 1082, 1083, 1102, + 1338, 1339, 1084, 1106, 1107, 1085, 1071, 1086, 1087, 908, + 1088, 1089, 1090, 1091, 1092, 1111, 1093, 1094, 1095, 1112, + 1802, 1096, 1113, 1099, 1100, 1101, 1114, 1117, 1102, 955, + 955, 955, 1106, 1107, 1077, 1118, 922, 750, 1108, 1108, + 1108, 966, 966, 966, 1111, 1119, 1120, 1121, 1112, 1080, + 1126, 1113, 1122, 1109, 1123, 1114, 1117, 1124, 1103, 1125, + 1128, 1129, 1130, 1131, 1118, 1127, 1132, 1104, 1133, 1143, + 1144, 1145, 1146, 1147, 1119, 1120, 1121, 1148, 1149, 1115, + 1150, 1122, 1151, 1123, 394, 1152, 1124, 1103, 1125, 1128, + + 1129, 1130, 1131, 394, 1127, 1132, 1104, 1133, 1143, 1144, + 1145, 1146, 1147, 1154, 1155, 394, 1148, 1149, 1115, 1150, + 1157, 1151, 1156, 956, 1152, 394, 1165, 1160, 394, 394, + 394, 394, 1110, 394, 1796, 967, 988, 988, 988, 1166, + 1436, 1163, 1154, 1155, 1159, 1531, 1167, 1169, 1795, 1157, + 1171, 1156, 1793, 1172, 1162, 1165, 1160, 1174, 1176, 1177, + 1178, 1134, 1135, 1136, 1158, 1137, 1161, 1633, 1166, 1164, + 1163, 2072, 2072, 1159, 1138, 1167, 1169, 1139, 1140, 1171, + 1454, 1141, 1172, 1162, 1183, 1549, 1174, 1176, 1177, 1178, + 1134, 1135, 1136, 1628, 1137, 2072, 2072, 1037, 872, 872, + + 1478, 1038, 1785, 1138, 1038, 1575, 1139, 1140, 2072, 2072, + 1141, 2072, 2072, 1183, 1038, 2072, 2072, 1038, 2072, 2072, + 989, 1043, 1042, 874, 874, 2072, 2072, 2072, 2072, 1043, + 1184, 1043, 1185, 1043, 2072, 2072, 1186, 1048, 1047, 876, + 876, 1197, 1048, 2072, 2072, 1198, 1048, 2072, 2072, 879, + 1048, 1199, 1617, 1057, 1057, 1057, 1200, 1202, 1058, 1184, + 1612, 1185, 1190, 1057, 1057, 1186, 1059, 1191, 1203, 1204, + 1197, 2072, 2072, 1205, 1198, 1192, 2072, 2072, 1206, 1188, + 1199, 1039, 1207, 1208, 1211, 1200, 1202, 1212, 1193, 1180, + 2072, 2072, 1079, 1079, 1079, 1213, 893, 1203, 1204, 1214, + + 1215, 1774, 1205, 1216, 1217, 1181, 1044, 1206, 1188, 1221, + 1222, 1207, 1208, 1211, 1223, 1224, 1212, 1193, 1225, 1218, + 1218, 1218, 1049, 1226, 1213, 1182, 1227, 1607, 1214, 1215, + 1209, 1231, 1216, 1217, 1219, 1232, 1233, 1060, 1221, 1222, + 1234, 1237, 1770, 1223, 1224, 1767, 1194, 1225, 1238, 898, + 1239, 1240, 1226, 1241, 907, 1227, 1228, 1228, 1228, 1209, + 1231, 1242, 1243, 1244, 1232, 1233, 1245, 1246, 921, 1234, + 1237, 1229, 1108, 1108, 1108, 1253, 1080, 1238, 1254, 1239, + 1240, 1255, 1241, 1247, 1247, 1247, 1256, 1109, 1258, 1250, + 1242, 1243, 1244, 1251, 1252, 1245, 1246, 1260, 1248, 1261, + + 1262, 1263, 1264, 1220, 1253, 1265, 1266, 1254, 1267, 1268, + 1255, 1545, 1269, 1270, 1766, 1256, 1627, 1258, 1250, 1274, + 1275, 1276, 1251, 1252, 1277, 1278, 1260, 1764, 1261, 1262, + 1263, 1264, 1591, 394, 1265, 1266, 394, 1267, 1268, 394, + 1230, 1269, 1270, 1271, 1271, 1271, 1279, 1280, 1274, 1275, + 1276, 394, 1282, 1277, 1278, 394, 1110, 394, 1272, 1287, + 1288, 394, 1289, 1290, 1291, 1293, 1285, 1249, 1281, 1292, + 1294, 1295, 1283, 1296, 1297, 1279, 1280, 1284, 1286, 1298, + 1299, 1282, 1429, 1430, 2072, 2072, 1300, 1301, 1287, 1288, + 1038, 1289, 1290, 1291, 1293, 1285, 1302, 1281, 1292, 1294, + + 1295, 1283, 1296, 1297, 2072, 2072, 1284, 1286, 1298, 1299, + 1043, 2072, 2072, 1303, 1048, 1300, 1301, 1304, 1305, 1190, + 1057, 1057, 1436, 1437, 1191, 1302, 1964, 1273, 1190, 1057, + 1057, 1311, 1192, 1191, 1759, 1190, 1057, 1057, 1576, 1312, + 1191, 1192, 1303, 1313, 1314, 1193, 1304, 1305, 1192, 1749, + 1190, 1057, 1057, 1728, 1193, 1191, 1309, 1309, 1309, 1315, + 1311, 1193, 1037, 1306, 1316, 1190, 1057, 1057, 1312, 1726, + 1191, 1317, 1313, 1314, 1193, 1318, 1193, 1319, 1192, 1338, + 2072, 1320, 1042, 1193, 1321, 1322, 1323, 1560, 1315, 1047, + 1193, 1193, 1326, 1316, 1327, 1328, 1190, 1057, 1057, 1329, + + 1317, 1191, 1965, 1194, 1318, 1193, 1319, 1330, 1307, 1192, + 1320, 1550, 1194, 1321, 1322, 1323, 1218, 1218, 1218, 1194, + 1193, 1326, 1193, 1327, 1328, 1333, 1334, 1715, 1329, 1335, + 1336, 1219, 1340, 1341, 1194, 1345, 1330, 1307, 1346, 1712, + 1310, 1228, 1228, 1228, 1351, 1342, 1342, 1342, 1352, 1194, + 1353, 1193, 1354, 1355, 1333, 1334, 1229, 1356, 1335, 1336, + 1343, 1340, 1341, 1357, 1345, 1539, 1358, 1346, 1247, 1247, + 1247, 1706, 1359, 1351, 1360, 1308, 1361, 1352, 1362, 1353, + 1194, 1354, 1355, 1248, 1363, 1364, 1356, 1365, 1366, 1367, + 1347, 1368, 1357, 1369, 1348, 1358, 394, 1370, 1371, 1374, + + 1220, 1359, 1375, 1360, 1376, 1361, 1377, 1362, 394, 1271, + 1271, 1271, 394, 1363, 1364, 1386, 1365, 1366, 1367, 1532, + 1368, 1702, 1369, 1348, 1272, 1230, 1370, 1371, 1374, 1344, + 394, 1375, 1379, 1376, 1378, 1377, 394, 394, 394, 394, + 1387, 1389, 1380, 1390, 1386, 1381, 1383, 1391, 1382, 1392, + 1384, 1385, 1249, 1393, 1394, 1395, 1396, 1397, 1398, 1399, + 1400, 1401, 1402, 1378, 1525, 1403, 1404, 1454, 1455, 1387, + 1389, 1380, 1390, 1699, 1381, 1383, 1391, 1382, 1392, 1384, + 1385, 1416, 1393, 1394, 1395, 1396, 1397, 1398, 1399, 1400, + 1401, 1402, 1417, 1273, 1403, 1404, 1405, 1406, 1406, 1693, + + 1418, 1191, 1190, 1057, 1057, 1419, 1420, 1191, 1680, 1306, + 1416, 1190, 1057, 1057, 1421, 1192, 1191, 1422, 1410, 1406, + 1406, 1417, 1193, 1411, 1192, 1408, 1423, 1424, 1193, 1418, + 1425, 1412, 1426, 1427, 1419, 1420, 1431, 1193, 1432, 1433, + 1434, 1438, 1439, 1421, 1413, 1440, 1422, 1441, 1443, 1443, + 1443, 1193, 1446, 1447, 1408, 1423, 1424, 1193, 1450, 1425, + 1451, 1426, 1427, 1452, 1457, 1431, 1193, 1432, 1433, 1434, + 1438, 1439, 1459, 1413, 1440, 1462, 1441, 1463, 1444, 1460, + 1407, 1446, 1447, 1342, 1342, 1342, 1194, 1450, 1464, 1451, + 1190, 1465, 1452, 1457, 1466, 1194, 1467, 1461, 1343, 1468, + + 1469, 1459, 1414, 394, 1462, 1470, 1463, 1444, 1460, 1471, + 1473, 1474, 1475, 1476, 1478, 1479, 1480, 1464, 1481, 1482, + 1465, 394, 1487, 1466, 1485, 1467, 1461, 394, 1468, 1469, + 1472, 1488, 1445, 1489, 1470, 1491, 1492, 1493, 1471, 1473, + 1474, 1475, 1476, 1494, 1484, 1480, 1495, 1481, 1482, 1496, + 1497, 1487, 1513, 1485, 1429, 2072, 394, 1483, 1514, 1472, + 1488, 394, 1489, 1515, 1491, 1492, 1493, 1344, 1516, 1499, + 1406, 1406, 1494, 1484, 1500, 1495, 1436, 2072, 1496, 1497, + 1668, 1513, 1501, 1410, 1406, 1406, 1644, 1514, 1411, 1190, + 1057, 1057, 1515, 1636, 1191, 1502, 1412, 1516, 1517, 1190, + + 1057, 1057, 1192, 1518, 1191, 1506, 1057, 1057, 1443, 1413, + 1411, 1625, 1192, 1519, 1520, 1193, 1521, 1522, 1412, 1620, + 1523, 1410, 1406, 1406, 1502, 1193, 1411, 1517, 1615, 1528, + 1529, 1413, 1518, 1505, 1412, 1508, 1057, 1057, 1413, 1594, + 1500, 1342, 1519, 1520, 1193, 1521, 1522, 1413, 1501, 1523, + 1530, 1535, 1536, 1503, 1193, 1525, 1525, 1525, 1528, 1529, + 1413, 1502, 1505, 1537, 1532, 1532, 1532, 1414, 1504, 1506, + 1057, 1057, 1542, 1194, 1411, 1538, 1413, 1545, 1546, 1530, + 1535, 1536, 1510, 1194, 1541, 1526, 1506, 1057, 1057, 1507, + 1502, 1411, 1537, 1309, 1533, 1413, 1506, 1057, 1057, 1412, + + 1490, 1411, 1543, 1547, 1538, 1414, 1539, 1539, 1539, 1412, + 1486, 1548, 1413, 1541, 1526, 1443, 1443, 1443, 1553, 1509, + 1554, 1109, 1413, 1533, 1413, 1454, 2072, 1555, 1556, 1511, + 1557, 1543, 1547, 1550, 1550, 1550, 1558, 1559, 1562, 1527, + 1548, 1413, 1560, 1560, 1560, 1444, 394, 1553, 1534, 1554, + 1563, 1413, 1564, 1507, 1565, 1566, 1555, 1556, 1511, 1557, + 1567, 394, 1568, 1551, 1569, 1558, 1559, 1562, 1570, 1571, + 1507, 1572, 1573, 1574, 1444, 1512, 1478, 2072, 1579, 1563, + 1507, 1564, 1580, 1565, 1566, 1576, 1576, 1576, 394, 1567, + 1540, 1568, 1551, 1569, 394, 1584, 394, 1570, 1571, 1445, + + 1572, 1573, 1574, 394, 1585, 1586, 1587, 1579, 1582, 1588, + 1589, 1580, 1590, 1595, 1596, 1577, 1583, 1552, 1591, 1591, + 1591, 1581, 1545, 2072, 1584, 394, 1561, 1603, 394, 1604, + 1271, 1605, 1592, 1585, 1586, 1587, 1458, 1582, 1588, 1589, + 1456, 1590, 1595, 1596, 1577, 1583, 1508, 1057, 1057, 1247, + 1581, 1500, 1499, 1406, 1406, 1449, 1603, 1500, 1604, 1501, + 1605, 1508, 1057, 1057, 1606, 1501, 1500, 1448, 1228, 1578, + 1610, 1218, 1502, 1415, 1501, 1611, 1388, 1614, 1502, 1508, + 1057, 1057, 1373, 1616, 1500, 1372, 1619, 1502, 1621, 1350, + 1349, 1108, 1597, 1606, 1332, 1508, 1057, 1057, 1331, 1610, + + 1500, 1502, 1593, 1325, 1611, 1502, 1614, 1502, 1501, 1508, + 1057, 1057, 1616, 1622, 1500, 1619, 1502, 1621, 1190, 1057, + 1057, 1502, 1501, 1191, 1324, 1623, 1079, 1190, 1057, 1057, + 1509, 1192, 1191, 1624, 1502, 1502, 1503, 1626, 1598, 1057, + 1192, 394, 1622, 394, 1193, 1509, 1506, 1057, 1057, 1631, + 1502, 1411, 988, 1193, 1623, 1506, 1057, 1057, 1259, 1412, + 1411, 1257, 1624, 1509, 1502, 1632, 1626, 1598, 1412, 1607, + 1607, 1607, 1413, 1193, 1612, 1612, 1612, 966, 1631, 1509, + 1236, 1413, 1193, 1608, 1235, 1525, 1525, 1525, 1599, 1219, + 1508, 1057, 1057, 1509, 1632, 1500, 1635, 1405, 1617, 1617, + + 1617, 1413, 1194, 1501, 1539, 1539, 1539, 1508, 1057, 1057, + 1413, 1194, 1500, 1229, 955, 1526, 1502, 1210, 1637, 1109, + 1501, 1201, 1410, 1406, 1406, 1635, 1196, 1411, 1638, 1195, + 1507, 1187, 876, 1502, 1600, 1510, 1532, 1532, 1532, 1507, + 874, 1506, 1057, 1057, 1526, 1502, 1411, 1637, 1413, 872, + 1506, 1057, 1057, 1609, 1412, 1411, 1179, 1638, 1613, 1628, + 1628, 1628, 1502, 1412, 1602, 1639, 1533, 1413, 1640, 1527, + 1633, 1633, 1633, 1641, 1509, 1642, 1413, 1413, 1550, 1550, + 1550, 1643, 1618, 1645, 1646, 1248, 1601, 1647, 1540, 1629, + 1648, 1509, 1649, 1602, 1639, 1533, 1413, 1640, 1560, 1560, + + 1560, 1650, 1641, 1651, 1642, 1413, 1414, 1652, 1551, 1661, + 1643, 1662, 1645, 1646, 394, 1663, 1647, 1664, 1629, 1648, + 1534, 1649, 1576, 1576, 1576, 1507, 1665, 1665, 1665, 1410, + 1650, 1667, 1651, 1175, 1507, 1669, 1652, 1551, 1661, 1670, + 1662, 1272, 1671, 1630, 1663, 1672, 1664, 1673, 1674, 1675, + 1681, 1687, 1577, 1173, 1634, 1591, 1591, 1591, 1688, 1170, + 1667, 1168, 1552, 1153, 1669, 1676, 1676, 1676, 1670, 1592, + 1142, 1671, 1689, 816, 1672, 1116, 1673, 1674, 1675, 1681, + 1687, 1577, 1561, 1653, 1682, 1682, 1682, 1688, 1677, 1654, + 1499, 1406, 1406, 1655, 1656, 1500, 1105, 1098, 1657, 1658, + + 1659, 1689, 1660, 1597, 1683, 1097, 1578, 1678, 1700, 745, + 1666, 732, 1653, 1069, 1701, 723, 1502, 1677, 1654, 1703, + 718, 1062, 1655, 1656, 1694, 1694, 1694, 1657, 1658, 1659, + 1054, 1660, 705, 1508, 1057, 1057, 1678, 1700, 1500, 1593, + 1607, 1607, 1607, 1701, 1695, 1502, 1501, 1050, 1703, 1679, + 1508, 1057, 1057, 1045, 1608, 1500, 1685, 1040, 1704, 1502, + 1506, 1057, 1057, 1501, 1032, 1411, 1697, 1019, 1684, 1007, + 1508, 1057, 1057, 1412, 1503, 1500, 1502, 1506, 1057, 1057, + 1705, 1698, 1411, 1501, 1707, 1685, 1413, 1704, 1502, 987, + 1412, 1690, 1690, 1690, 1708, 1697, 1502, 1612, 1612, 1612, + + 1628, 1628, 1628, 1413, 957, 1502, 1711, 1713, 1696, 1705, + 1698, 1686, 1219, 1707, 1691, 1413, 1714, 1509, 1617, 1617, + 1617, 951, 553, 1708, 1609, 1502, 1709, 1709, 1709, 1499, + 1629, 1716, 1413, 1229, 1509, 1711, 1713, 1717, 1718, 1506, + 1686, 1343, 1719, 1691, 1507, 1714, 923, 1720, 1721, 1508, + 1633, 1633, 1633, 1727, 1509, 1722, 1722, 1722, 1731, 1629, + 1716, 1507, 1724, 1724, 1724, 1248, 1717, 1718, 1729, 1729, + 1729, 1719, 1732, 909, 1733, 1692, 1720, 1721, 1734, 1737, + 1735, 1613, 1727, 1736, 1630, 1738, 1739, 1731, 1740, 1742, + 1745, 1746, 1747, 1748, 903, 900, 895, 1743, 1741, 1750, + + 1751, 1732, 1618, 1733, 1744, 890, 1752, 1734, 1737, 1735, + 1710, 881, 1736, 1754, 1738, 1739, 1755, 1740, 1742, 1745, + 1746, 1747, 1748, 1665, 1665, 1665, 1743, 1741, 1750, 1751, + 1756, 394, 1757, 1744, 1634, 1752, 1758, 1760, 1272, 1723, + 1753, 485, 1754, 702, 702, 1755, 1725, 1676, 1676, 1676, + 479, 1768, 1730, 1682, 1682, 1682, 1761, 1761, 1761, 1756, + 697, 1757, 1508, 1057, 1057, 1758, 1760, 1500, 1769, 1753, + 1677, 697, 1762, 1683, 472, 1501, 1775, 1506, 1057, 1057, + 1768, 1776, 1411, 1690, 1690, 1690, 1777, 692, 1502, 1678, + 1412, 1694, 1694, 1694, 1778, 1779, 1765, 1769, 1780, 1677, + + 1771, 1771, 1771, 1413, 1781, 1775, 1691, 1666, 692, 1782, + 1776, 1695, 1783, 1783, 1783, 1777, 1772, 1502, 1678, 1709, + 1709, 1709, 1786, 1778, 1779, 1765, 1787, 1780, 1788, 1789, + 1790, 1679, 1413, 1781, 1343, 1691, 1791, 1684, 1782, 1792, + 1763, 1794, 1722, 1722, 1722, 1797, 1509, 1724, 1724, 1724, + 1800, 1786, 1798, 1798, 1798, 1787, 1803, 1788, 1789, 1790, + 1805, 1507, 1729, 1729, 1729, 1791, 1806, 1692, 1792, 1807, + 1794, 1808, 1809, 1810, 1797, 1696, 1811, 1812, 1813, 1800, + 1814, 1815, 1816, 1817, 1773, 1803, 1818, 1819, 1820, 1805, + 1821, 862, 394, 1823, 859, 1806, 1784, 814, 1807, 1824, + + 1808, 1809, 1810, 1710, 1801, 1811, 1812, 1813, 1826, 1814, + 1815, 1816, 1817, 1828, 794, 1818, 1819, 1820, 1829, 1821, + 1822, 752, 1823, 1682, 1682, 1682, 1723, 1830, 1824, 546, + 552, 1725, 1832, 1801, 744, 530, 1799, 1826, 1761, 1761, + 1761, 1833, 1828, 1683, 544, 1838, 1730, 1829, 517, 1822, + 1508, 1057, 1057, 1839, 1762, 1500, 1830, 1694, 1694, 1694, + 1840, 1832, 1842, 1501, 1771, 1771, 1771, 1834, 1834, 1834, + 1833, 1836, 1836, 1836, 1838, 1843, 1502, 1695, 525, 1844, + 1772, 1852, 1839, 1783, 1783, 1783, 1845, 1845, 1845, 1840, + 1855, 1842, 1848, 1848, 1848, 1853, 1853, 1853, 1798, 1798, + + 1798, 1857, 1858, 1859, 1843, 1502, 1849, 1684, 1844, 1861, + 1852, 1862, 1860, 1863, 1864, 1865, 1866, 1867, 1868, 1855, + 1869, 1870, 1763, 1871, 1872, 1873, 1874, 1874, 1874, 1876, + 1857, 1858, 1859, 394, 1509, 1878, 1879, 1880, 1861, 1881, + 1862, 1696, 1863, 1864, 1865, 1866, 1867, 1868, 1773, 1869, + 1870, 1835, 1871, 1872, 1873, 1837, 1882, 1883, 1876, 1884, + 1885, 1886, 1877, 510, 1878, 1879, 1880, 1784, 1881, 1889, + 1846, 1834, 1834, 1834, 1890, 1893, 1850, 1894, 1896, 1854, + 1902, 515, 1799, 716, 495, 1882, 1883, 507, 1884, 1885, + 1886, 1877, 1836, 1836, 1836, 1891, 1891, 1891, 1889, 1845, + + 1845, 1845, 1903, 1890, 1893, 1906, 1894, 1896, 1907, 1902, + 1875, 1848, 1848, 1848, 1897, 1897, 1897, 1853, 1853, 1853, + 1908, 1909, 704, 1910, 1911, 1849, 703, 702, 1912, 699, + 1913, 1903, 1914, 1915, 1906, 1916, 1917, 1907, 1918, 1919, + 1920, 1874, 1874, 1874, 1922, 698, 1924, 394, 1925, 1908, + 1909, 1898, 1910, 1911, 697, 1835, 1899, 1912, 1904, 1913, + 1926, 1914, 1915, 1927, 1916, 1917, 694, 1918, 1919, 1920, + 1928, 1929, 693, 1922, 1923, 1924, 1837, 1925, 1930, 1892, + 1898, 1931, 1936, 1846, 692, 1899, 1937, 1904, 1938, 1926, + 1940, 1941, 1927, 1942, 1943, 1850, 689, 1944, 1900, 1928, + + 1929, 1854, 1945, 1923, 1891, 1891, 1891, 1930, 1946, 1947, + 1931, 1936, 1897, 1897, 1897, 1937, 1948, 1938, 1949, 1940, + 1941, 1950, 1942, 1943, 1951, 1875, 1944, 1952, 1953, 1954, + 1955, 1945, 1956, 1957, 1958, 1959, 1960, 1946, 1947, 1961, + 1962, 1963, 1967, 1970, 1971, 1948, 1972, 1949, 1973, 1898, + 1950, 688, 687, 1951, 1899, 1976, 1952, 1953, 1954, 1955, + 1977, 1956, 1957, 1958, 1959, 1960, 1978, 686, 1961, 1962, + 1963, 1967, 1970, 1971, 1979, 1972, 1980, 1973, 1898, 1974, + 1974, 1974, 1981, 1899, 1976, 1982, 1983, 1984, 1892, 1977, + 1985, 1986, 1987, 1988, 1990, 1978, 1900, 1991, 1992, 1993, + + 1994, 1997, 685, 1979, 681, 1980, 1995, 1995, 1995, 1999, + 2000, 1981, 2001, 2002, 1982, 1983, 1984, 2003, 2005, 1985, + 1986, 1987, 1988, 1990, 2006, 2007, 1991, 1992, 1993, 1994, + 1997, 1974, 1974, 1974, 445, 2008, 2009, 2010, 1999, 2000, + 2013, 2001, 2002, 1974, 1974, 1974, 2003, 2005, 1995, 1995, + 1995, 2014, 2015, 2006, 2007, 2016, 2017, 2018, 2019, 2020, + 2021, 672, 2022, 1975, 2008, 2009, 2010, 2023, 2024, 2013, + 2025, 2026, 2027, 2028, 2029, 2030, 2031, 2032, 2033, 2034, + 2014, 2015, 2035, 2036, 2016, 2017, 2018, 2019, 2020, 2021, + 1996, 2022, 2037, 1682, 1682, 1682, 2023, 2024, 671, 2025, + + 2026, 2027, 2028, 2029, 2030, 2031, 2032, 2033, 2034, 2039, + 2042, 2035, 2036, 1683, 2043, 1975, 1694, 1694, 1694, 2044, + 2045, 2037, 2046, 2047, 2048, 2049, 2050, 1975, 2051, 2052, + 2053, 2054, 1996, 2055, 2055, 2055, 1695, 2057, 2039, 2042, + 2058, 2059, 2060, 2043, 2055, 2055, 2055, 2062, 2044, 2045, + 2063, 2046, 2047, 2048, 2049, 2050, 2064, 2051, 2052, 2053, + 2054, 2055, 2055, 2055, 2065, 2066, 2057, 2067, 2068, 2058, + 2059, 2060, 1974, 1974, 1974, 2069, 2062, 1684, 2070, 2063, + 2071, 2055, 2055, 2055, 670, 2064, 669, 668, 426, 420, + 416, 391, 415, 2065, 2066, 303, 2067, 2068, 374, 310, + + 1696, 305, 375, 552, 2069, 549, 545, 2070, 544, 2071, + 540, 526, 525, 521, 516, 515, 513, 2056, 508, 507, + 500, 499, 494, 492, 470, 469, 466, 465, 2056, 462, + 461, 460, 459, 447, 446, 443, 442, 439, 438, 426, + 420, 416, 415, 388, 376, 2056, 375, 374, 314, 310, + 305, 2072, 218, 218, 216, 216, 1975, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2056, 110, 110, 110, 110, + 110, 110, 110, 110, 110, 110, 155, 155, 155, 155, + 155, 155, 155, 155, 155, 155, 163, 163, 163, 163, + 163, 163, 163, 163, 163, 163, 97, 97, 97, 97, + + 97, 97, 97, 97, 97, 97, 190, 190, 190, 190, + 190, 190, 190, 190, 190, 190, 199, 199, 199, 199, + 199, 199, 199, 199, 199, 199, 206, 206, 206, 206, + 206, 206, 206, 206, 206, 206, 209, 209, 209, 209, + 209, 209, 209, 209, 209, 209, 212, 212, 212, 212, + 212, 212, 212, 212, 212, 212, 215, 215, 215, 215, + 215, 215, 215, 215, 215, 215, 217, 217, 217, 217, + 217, 217, 217, 217, 217, 217, 238, 238, 238, 238, + 238, 238, 238, 238, 238, 238, 240, 240, 240, 240, + 240, 240, 240, 240, 240, 240, 268, 268, 268, 268, + + 268, 268, 268, 268, 268, 268, 271, 271, 271, 271, + 271, 271, 271, 271, 271, 271, 294, 294, 294, 294, + 294, 294, 294, 294, 294, 294, 306, 306, 307, 307, + 2072, 307, 307, 307, 307, 307, 307, 307, 309, 309, + 373, 2072, 2072, 2072, 2072, 373, 392, 392, 2072, 392, + 2072, 392, 392, 417, 417, 419, 419, 425, 2072, 2072, + 2072, 2072, 425, 427, 2072, 427, 471, 471, 471, 471, + 471, 2072, 471, 471, 2072, 471, 477, 477, 477, 477, + 477, 477, 477, 477, 477, 477, 478, 478, 478, 478, + 478, 2072, 478, 478, 2072, 478, 484, 484, 484, 484, + + 484, 484, 484, 484, 484, 484, 490, 490, 490, 490, + 490, 490, 490, 490, 490, 490, 491, 491, 491, 491, + 491, 491, 491, 491, 491, 493, 493, 493, 493, 493, + 493, 493, 493, 493, 497, 497, 2072, 497, 497, 497, + 497, 497, 497, 497, 512, 512, 2072, 512, 512, 512, + 512, 512, 512, 512, 519, 519, 2072, 519, 519, 519, + 519, 519, 519, 519, 532, 532, 2072, 532, 532, 532, + 532, 532, 532, 532, 548, 548, 2072, 548, 548, 548, + 548, 548, 548, 548, 306, 306, 307, 307, 2072, 307, + 307, 307, 307, 307, 307, 307, 309, 309, 373, 2072, + + 2072, 2072, 2072, 373, 392, 392, 2072, 392, 2072, 392, + 392, 417, 417, 419, 419, 425, 2072, 2072, 2072, 2072, + 425, 427, 2072, 427, 471, 471, 471, 471, 471, 2072, + 471, 471, 2072, 471, 691, 691, 2072, 691, 691, 691, + 691, 691, 691, 691, 478, 478, 478, 478, 478, 2072, + 478, 478, 2072, 478, 696, 696, 2072, 696, 696, 696, + 696, 696, 696, 696, 701, 701, 2072, 701, 701, 701, + 701, 701, 701, 701, 491, 491, 491, 491, 491, 491, + 491, 491, 491, 493, 493, 493, 493, 493, 493, 493, + 493, 493, 497, 497, 2072, 497, 497, 497, 497, 497, + + 497, 497, 512, 512, 2072, 512, 512, 512, 512, 512, + 512, 512, 519, 519, 2072, 519, 519, 519, 519, 519, + 519, 519, 532, 532, 2072, 532, 532, 532, 532, 532, + 532, 532, 548, 548, 2072, 548, 548, 548, 548, 548, + 548, 548, 749, 749, 749, 749, 749, 749, 749, 749, + 749, 749, 392, 2072, 2072, 392, 427, 2072, 427, 878, + 878, 878, 878, 878, 878, 878, 878, 878, 878, 892, + 892, 892, 892, 892, 892, 892, 892, 892, 892, 897, + 897, 897, 897, 897, 897, 897, 897, 897, 897, 906, + 906, 906, 906, 906, 906, 906, 906, 906, 906, 920, + + 920, 920, 920, 920, 920, 920, 920, 920, 920, 1036, + 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1041, + 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1046, + 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1189, + 1189, 1189, 1189, 1189, 1189, 1189, 1189, 1189, 1189, 1337, + 1337, 1337, 1337, 1337, 1337, 1337, 1337, 1337, 1337, 1409, + 1409, 1409, 1409, 1409, 1409, 1409, 1409, 1409, 1409, 1428, + 1428, 1428, 1428, 1428, 1428, 1428, 1428, 1428, 1428, 1435, + 1435, 1435, 1435, 1435, 1435, 1435, 1435, 1435, 1435, 1453, + 1453, 1453, 1453, 1453, 1453, 1453, 1453, 1453, 1453, 1477, + + 1477, 1477, 1477, 1477, 1477, 1477, 1477, 1477, 1477, 1498, + 1498, 1498, 1498, 1498, 1498, 1498, 1498, 1498, 1498, 1544, + 1544, 1544, 1544, 1544, 1544, 1544, 1544, 1544, 1544, 53, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072 + } ; + +static yyconst flex_int16_t yy_chk[6218] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 5, 6, 63, 63, 65, 66, + 66, 65, 65, 5, 6, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 13, 13, 13, 27, + 14, 14, 14, 13, 28, 29, 13, 14, 13, 30, + 14, 31, 14, 15, 15, 15, 32, 16, 16, 16, + 15, 39, 40, 15, 16, 15, 76, 16, 47, 16, + 48, 100, 2153, 79, 2151, 68, 100, 68, 68, 71, + 81, 27, 82, 71, 39, 40, 28, 29, 68, 85, + + 73, 30, 2149, 72, 73, 76, 31, 70, 47, 70, + 48, 32, 79, 73, 70, 70, 70, 72, 71, 81, + 72, 82, 71, 39, 40, 101, 101, 68, 85, 73, + 13, 13, 72, 73, 14, 14, 70, 47, 70, 48, + 102, 102, 73, 70, 70, 70, 72, 15, 15, 72, + 2148, 16, 16, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 21, 21, 21, 22, 22, 22, 280, 280, 21, 90, + 112, 22, 23, 23, 23, 112, 2145, 23, 2143, 23, + 92, 23, 23, 24, 24, 24, 2142, 103, 24, 104, + 24, 74, 24, 24, 25, 25, 25, 74, 90, 25, + 105, 25, 25, 25, 25, 26, 26, 26, 75, 92, + 26, 75, 26, 26, 26, 26, 103, 77, 104, 2139, + + 74, 77, 80, 117, 106, 77, 74, 2130, 117, 105, + 80, 78, 86, 107, 78, 84, 80, 75, 283, 283, + 75, 78, 86, 84, 21, 21, 77, 22, 22, 2126, + 77, 80, 84, 106, 77, 84, 23, 23, 108, 80, + 78, 86, 107, 78, 84, 80, 2123, 24, 24, 133, + 78, 86, 84, 2120, 133, 142, 2116, 159, 25, 25, + 142, 84, 159, 167, 84, 311, 311, 108, 167, 26, + 26, 37, 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, + + 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 37, 37, 41, 41, + 41, 2114, 41, 41, 2113, 41, 41, 41, 42, 42, + 42, 41, 42, 42, 83, 42, 42, 42, 83, 87, + 2110, 42, 87, 88, 134, 135, 83, 89, 87, 89, + 83, 148, 89, 88, 87, 149, 150, 91, 151, 41, + + 173, 173, 2101, 83, 91, 91, 180, 83, 87, 42, + 181, 87, 88, 134, 135, 83, 89, 87, 89, 83, + 148, 89, 88, 87, 149, 150, 91, 151, 41, 173, + 173, 176, 196, 91, 91, 180, 176, 196, 42, 181, + 203, 378, 41, 41, 282, 203, 378, 282, 282, 376, + 376, 376, 42, 42, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, + + 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 45, 45, 45, 45, 45, 45, 45, 230, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 380, 380, + 45, 45, 45, 45, 45, 381, 381, 232, 183, 2097, + 45, 55, 55, 55, 56, 56, 56, 230, 233, 182, + 2094, 116, 116, 116, 182, 183, 2091, 119, 119, 119, + 234, 45, 116, 45, 116, 116, 232, 183, 119, 45, + + 119, 119, 388, 388, 121, 121, 121, 233, 182, 220, + 220, 220, 2061, 182, 183, 121, 239, 121, 121, 234, + 45, 45, 45, 45, 45, 45, 45, 45, 46, 46, + 46, 46, 46, 46, 46, 121, 46, 46, 46, 46, + 46, 46, 46, 46, 46, 239, 249, 46, 46, 46, + 46, 46, 262, 263, 264, 55, 152, 46, 56, 2056, + 152, 270, 272, 231, 121, 116, 231, 288, 289, 152, + 290, 119, 300, 152, 301, 249, 319, 321, 46, 389, + 46, 262, 263, 264, 389, 152, 46, 2033, 121, 152, + 270, 272, 231, 220, 2032, 231, 288, 289, 152, 290, + + 651, 300, 152, 301, 651, 319, 321, 46, 46, 46, + 46, 46, 46, 46, 46, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, + + 49, 49, 51, 51, 51, 313, 313, 51, 2030, 52, + 52, 52, 322, 323, 52, 51, 313, 324, 118, 118, + 118, 51, 52, 2012, 325, 221, 221, 221, 52, 118, + 51, 118, 118, 241, 241, 241, 327, 52, 122, 122, + 122, 322, 323, 402, 118, 313, 324, 51, 402, 122, + 421, 122, 122, 325, 52, 421, 124, 124, 124, 51, + 1998, 284, 653, 284, 284, 327, 52, 124, 328, 124, + 124, 1996, 122, 118, 284, 329, 51, 328, 123, 123, + 123, 843, 124, 52, 328, 843, 51, 470, 470, 123, + 330, 123, 123, 52, 114, 114, 114, 328, 653, 315, + + 315, 122, 118, 284, 329, 114, 328, 114, 114, 221, + 315, 124, 656, 328, 125, 125, 125, 241, 123, 330, + 114, 114, 122, 114, 331, 125, 1994, 125, 125, 242, + 242, 242, 114, 428, 114, 333, 114, 125, 428, 315, + 124, 253, 253, 253, 126, 126, 126, 123, 656, 114, + 114, 1989, 114, 331, 317, 126, 317, 126, 126, 317, + 317, 114, 123, 114, 333, 114, 125, 254, 254, 254, + 207, 207, 207, 336, 1984, 207, 1975, 207, 114, 115, + 115, 115, 126, 207, 210, 210, 210, 516, 516, 210, + 115, 210, 115, 115, 460, 460, 460, 210, 125, 213, + + 213, 213, 336, 213, 213, 115, 115, 316, 115, 316, + 316, 126, 213, 242, 274, 274, 274, 115, 337, 115, + 316, 115, 275, 275, 275, 253, 1966, 440, 126, 295, + 295, 295, 440, 338, 115, 115, 1965, 115, 296, 296, + 296, 303, 303, 303, 318, 339, 115, 337, 115, 316, + 115, 254, 318, 340, 207, 312, 312, 312, 1939, 326, + 326, 332, 338, 115, 127, 127, 127, 326, 210, 1938, + 341, 1937, 332, 318, 339, 127, 334, 127, 127, 334, + 335, 318, 340, 213, 1935, 341, 341, 127, 326, 326, + 332, 127, 342, 1932, 335, 343, 326, 1923, 274, 341, + + 127, 332, 345, 346, 127, 334, 275, 347, 334, 335, + 1921, 348, 349, 295, 341, 341, 127, 350, 351, 1905, + 127, 342, 296, 335, 343, 303, 344, 352, 344, 127, + 353, 345, 346, 127, 354, 355, 347, 1901, 356, 312, + 348, 349, 356, 358, 360, 357, 350, 351, 127, 361, + 357, 362, 358, 359, 358, 344, 352, 344, 357, 353, + 357, 359, 363, 354, 355, 364, 357, 356, 365, 368, + 369, 356, 358, 360, 357, 368, 370, 371, 361, 357, + 362, 358, 359, 358, 367, 364, 382, 357, 367, 357, + 359, 363, 383, 366, 364, 357, 366, 365, 368, 369, + + 384, 385, 386, 387, 368, 370, 371, 423, 1900, 424, + 526, 526, 1895, 367, 364, 382, 430, 367, 444, 431, + 432, 383, 366, 444, 433, 366, 392, 392, 392, 384, + 385, 386, 387, 391, 391, 391, 423, 392, 424, 392, + 392, 393, 393, 393, 391, 430, 391, 391, 431, 432, + 534, 534, 393, 433, 393, 393, 395, 395, 395, 391, + 391, 1894, 391, 396, 396, 396, 434, 395, 1893, 395, + 395, 391, 435, 391, 396, 391, 396, 396, 1892, 397, + 397, 397, 436, 437, 449, 450, 453, 395, 391, 391, + 397, 391, 397, 397, 451, 434, 1888, 396, 454, 451, + + 391, 435, 391, 455, 391, 456, 1887, 398, 398, 398, + 392, 436, 437, 449, 450, 453, 395, 391, 398, 397, + 398, 398, 399, 399, 399, 393, 396, 454, 558, 558, + 398, 1875, 455, 399, 456, 399, 399, 457, 1894, 458, + 395, 404, 404, 404, 463, 467, 1856, 396, 397, 463, + 467, 501, 404, 502, 404, 404, 405, 405, 405, 398, + 399, 503, 1854, 397, 504, 404, 457, 405, 458, 405, + 405, 406, 472, 472, 472, 406, 479, 479, 479, 472, + 501, 505, 502, 479, 406, 407, 407, 407, 406, 399, + 503, 398, 1850, 504, 404, 506, 407, 405, 407, 407, + + 406, 408, 408, 408, 406, 1846, 399, 400, 400, 400, + 505, 1338, 408, 406, 408, 408, 1338, 406, 400, 409, + 400, 400, 407, 409, 506, 404, 405, 1841, 509, 514, + 400, 1837, 409, 522, 400, 1835, 409, 559, 559, 408, + 405, 523, 524, 400, 495, 495, 495, 400, 409, 737, + 737, 407, 409, 410, 410, 410, 472, 509, 514, 400, + 479, 409, 522, 400, 410, 409, 410, 410, 408, 407, + 523, 524, 400, 411, 411, 411, 400, 1831, 410, 412, + 412, 412, 738, 738, 411, 408, 411, 411, 749, 749, + 412, 400, 412, 412, 499, 499, 499, 411, 413, 413, + + 413, 414, 485, 485, 485, 414, 485, 410, 1827, 413, + 528, 413, 413, 500, 414, 510, 510, 510, 414, 529, + 412, 513, 513, 513, 753, 753, 411, 1802, 495, 541, + 414, 500, 500, 542, 414, 754, 754, 410, 540, 528, + 413, 1799, 500, 414, 517, 517, 517, 414, 529, 412, + 521, 521, 521, 530, 530, 530, 540, 411, 541, 848, + 500, 500, 542, 412, 535, 535, 535, 540, 543, 413, + 536, 536, 537, 537, 538, 550, 538, 538, 499, 1429, + 551, 536, 413, 537, 1429, 540, 485, 538, 539, 561, + 539, 755, 755, 539, 539, 848, 562, 543, 563, 510, + + 546, 546, 546, 564, 550, 513, 549, 549, 549, 551, + 536, 565, 537, 553, 553, 553, 538, 555, 561, 555, + 556, 556, 555, 555, 557, 562, 557, 563, 517, 557, + 557, 556, 564, 566, 521, 567, 568, 530, 569, 570, + 565, 571, 572, 569, 574, 573, 575, 576, 535, 573, + 577, 578, 579, 580, 582, 1796, 583, 584, 585, 586, + 556, 1795, 566, 587, 567, 568, 589, 569, 570, 590, + 571, 572, 569, 574, 573, 575, 576, 591, 573, 577, + 578, 579, 580, 582, 546, 583, 584, 585, 586, 592, + 549, 593, 587, 594, 595, 589, 596, 553, 590, 598, + + 599, 600, 601, 602, 603, 604, 591, 605, 606, 607, + 608, 609, 610, 611, 612, 613, 614, 615, 592, 616, + 593, 618, 594, 595, 1792, 596, 620, 621, 598, 599, + 600, 601, 602, 603, 604, 623, 605, 606, 607, 608, + 609, 610, 611, 612, 613, 614, 615, 622, 616, 622, + 618, 619, 619, 619, 624, 620, 621, 625, 626, 627, + 628, 629, 630, 631, 623, 624, 632, 633, 634, 635, + 639, 640, 634, 641, 642, 643, 622, 644, 622, 650, + 649, 647, 652, 624, 648, 655, 625, 626, 627, 628, + 629, 630, 631, 648, 624, 632, 633, 634, 635, 639, + + 640, 634, 641, 642, 643, 647, 644, 649, 650, 654, + 652, 658, 657, 655, 659, 660, 661, 662, 664, 665, + 667, 673, 648, 657, 674, 675, 676, 677, 678, 654, + 679, 680, 756, 756, 647, 619, 649, 650, 1790, 652, + 658, 1785, 655, 659, 660, 661, 662, 664, 665, 667, + 673, 707, 657, 674, 675, 676, 677, 678, 654, 679, + 680, 693, 693, 693, 698, 698, 698, 703, 703, 703, + 705, 705, 705, 708, 709, 710, 711, 712, 713, 714, + 707, 717, 718, 718, 718, 720, 723, 723, 723, 725, + 726, 730, 731, 732, 732, 732, 739, 740, 735, 735, + + 741, 742, 708, 709, 710, 711, 712, 713, 714, 735, + 717, 734, 743, 734, 720, 747, 734, 734, 725, 726, + 730, 731, 736, 748, 736, 739, 740, 736, 736, 741, + 742, 745, 745, 745, 750, 750, 750, 1784, 735, 751, + 751, 743, 757, 757, 747, 693, 758, 759, 698, 760, + 761, 703, 748, 762, 705, 763, 765, 766, 767, 768, + 765, 769, 770, 771, 772, 773, 718, 776, 777, 778, + 723, 779, 780, 781, 782, 758, 759, 732, 760, 761, + 783, 786, 762, 787, 763, 765, 766, 767, 768, 765, + 769, 770, 771, 772, 773, 788, 776, 777, 778, 793, + + 779, 780, 781, 782, 790, 790, 790, 794, 795, 783, + 786, 796, 787, 797, 798, 745, 800, 751, 750, 801, + 802, 802, 802, 803, 788, 804, 805, 806, 793, 808, + 809, 810, 811, 812, 813, 814, 794, 795, 815, 819, + 796, 820, 797, 798, 822, 800, 823, 824, 801, 818, + 818, 818, 803, 825, 804, 805, 806, 826, 808, 809, + 810, 811, 812, 813, 814, 827, 828, 815, 819, 830, + 820, 831, 832, 822, 833, 823, 824, 851, 850, 835, + 837, 838, 825, 839, 841, 855, 826, 845, 790, 844, + 1774, 850, 1773, 846, 827, 828, 856, 851, 830, 1770, + + 831, 832, 849, 833, 802, 816, 816, 816, 835, 837, + 838, 852, 839, 841, 855, 845, 844, 846, 1764, 849, + 850, 853, 857, 858, 859, 856, 851, 816, 852, 860, + 816, 816, 861, 818, 853, 862, 863, 864, 866, 867, + 869, 816, 816, 816, 845, 844, 846, 816, 849, 870, + 871, 857, 858, 859, 878, 878, 1763, 852, 860, 816, + 816, 861, 1759, 853, 862, 863, 864, 866, 867, 869, + 816, 816, 816, 872, 872, 872, 816, 882, 870, 871, + 872, 874, 874, 874, 879, 879, 879, 883, 874, 816, + 876, 876, 876, 885, 876, 880, 880, 886, 887, 887, + + 887, 888, 890, 887, 891, 896, 882, 892, 892, 894, + 894, 887, 893, 893, 893, 901, 883, 897, 897, 898, + 898, 898, 885, 899, 899, 903, 886, 906, 906, 915, + 888, 890, 916, 891, 896, 907, 907, 907, 908, 908, + 910, 910, 911, 911, 901, 912, 912, 913, 913, 914, + 914, 917, 918, 1758, 903, 919, 925, 872, 915, 920, + 920, 916, 921, 921, 921, 874, 922, 922, 879, 926, + 926, 928, 1749, 880, 876, 927, 927, 927, 929, 932, + 917, 918, 887, 933, 919, 925, 934, 894, 935, 936, + 1732, 938, 939, 940, 941, 942, 893, 943, 944, 945, + + 928, 899, 946, 898, 950, 951, 952, 929, 932, 954, + 1235, 1235, 933, 957, 959, 934, 908, 935, 936, 907, + 938, 939, 940, 941, 942, 961, 943, 944, 945, 962, + 1730, 946, 963, 950, 951, 952, 965, 968, 954, 955, + 955, 955, 957, 959, 922, 972, 921, 926, 960, 960, + 960, 966, 966, 966, 961, 973, 974, 975, 962, 927, + 980, 963, 976, 960, 977, 965, 968, 978, 955, 979, + 981, 982, 983, 984, 972, 980, 985, 955, 986, 990, + 992, 994, 995, 997, 973, 974, 975, 998, 1000, 966, + 1001, 976, 1002, 977, 1010, 1004, 978, 955, 979, 981, + + 982, 983, 984, 1011, 980, 985, 955, 986, 990, 992, + 994, 995, 997, 1007, 1008, 1014, 998, 1000, 966, 1001, + 1011, 1002, 1010, 955, 1004, 1013, 1019, 1014, 1012, 1017, + 1015, 1016, 960, 1018, 1725, 966, 988, 988, 988, 1021, + 1436, 1017, 1007, 1008, 1013, 1436, 1022, 1024, 1723, 1011, + 1026, 1010, 1720, 1027, 1016, 1019, 1014, 1029, 1031, 1032, + 1033, 988, 988, 988, 1012, 988, 1015, 1715, 1021, 1018, + 1017, 1051, 1051, 1013, 988, 1022, 1024, 988, 988, 1026, + 1454, 988, 1027, 1016, 1052, 1454, 1029, 1031, 1032, 1033, + 988, 988, 988, 1712, 988, 1036, 1036, 1037, 1037, 1037, + + 1478, 1036, 1710, 988, 1037, 1478, 988, 988, 1038, 1038, + 988, 1039, 1039, 1052, 1038, 1041, 1041, 1039, 1065, 1065, + 988, 1041, 1042, 1042, 1042, 1043, 1043, 1044, 1044, 1042, + 1053, 1043, 1054, 1044, 1046, 1046, 1055, 1046, 1047, 1047, + 1047, 1061, 1047, 1048, 1048, 1062, 1048, 1049, 1049, 1051, + 1049, 1063, 1702, 1057, 1057, 1057, 1066, 1069, 1057, 1053, + 1699, 1054, 1058, 1058, 1058, 1055, 1057, 1058, 1070, 1072, + 1061, 1067, 1067, 1073, 1062, 1058, 1071, 1071, 1074, 1057, + 1063, 1037, 1075, 1076, 1081, 1066, 1069, 1082, 1058, 1039, + 1077, 1077, 1079, 1079, 1079, 1084, 1065, 1070, 1072, 1086, + + 1087, 1696, 1073, 1089, 1090, 1044, 1042, 1074, 1057, 1092, + 1094, 1075, 1076, 1081, 1095, 1096, 1082, 1058, 1097, 1091, + 1091, 1091, 1047, 1098, 1084, 1049, 1100, 1693, 1086, 1087, + 1079, 1103, 1089, 1090, 1091, 1104, 1106, 1057, 1092, 1094, + 1107, 1111, 1692, 1095, 1096, 1688, 1058, 1097, 1112, 1067, + 1114, 1115, 1098, 1117, 1071, 1100, 1102, 1102, 1102, 1079, + 1103, 1118, 1120, 1122, 1104, 1106, 1123, 1124, 1077, 1107, + 1111, 1102, 1108, 1108, 1108, 1127, 1079, 1112, 1128, 1114, + 1115, 1129, 1117, 1125, 1125, 1125, 1130, 1108, 1132, 1126, + 1118, 1120, 1122, 1126, 1126, 1123, 1124, 1134, 1125, 1135, + + 1136, 1137, 1138, 1091, 1127, 1139, 1140, 1128, 1141, 1143, + 1129, 1545, 1145, 1146, 1687, 1130, 1545, 1132, 1126, 1148, + 1150, 1151, 1126, 1126, 1153, 1154, 1134, 1684, 1135, 1136, + 1137, 1138, 1680, 1156, 1139, 1140, 1157, 1141, 1143, 1159, + 1102, 1145, 1146, 1147, 1147, 1147, 1156, 1157, 1148, 1150, + 1151, 1158, 1159, 1153, 1154, 1161, 1108, 1162, 1147, 1165, + 1166, 1164, 1167, 1168, 1170, 1171, 1162, 1125, 1158, 1170, + 1173, 1175, 1161, 1176, 1177, 1156, 1157, 1161, 1164, 1178, + 1179, 1159, 1324, 1324, 1180, 1180, 1183, 1184, 1165, 1166, + 1180, 1167, 1168, 1170, 1171, 1162, 1185, 1158, 1170, 1173, + + 1175, 1161, 1176, 1177, 1181, 1181, 1161, 1164, 1178, 1179, + 1181, 1182, 1182, 1186, 1182, 1183, 1184, 1187, 1188, 1189, + 1189, 1189, 1331, 1331, 1189, 1185, 1934, 1147, 1190, 1190, + 1190, 1198, 1189, 1190, 1679, 1191, 1191, 1191, 1668, 1199, + 1191, 1190, 1186, 1201, 1202, 1189, 1187, 1188, 1191, 1666, + 1192, 1192, 1192, 1647, 1190, 1192, 1195, 1195, 1195, 1203, + 1198, 1191, 1180, 1192, 1204, 1193, 1193, 1193, 1199, 1645, + 1193, 1205, 1201, 1202, 1189, 1206, 1192, 1208, 1193, 1337, + 1337, 1209, 1181, 1190, 1212, 1214, 1215, 1644, 1203, 1182, + 1191, 1193, 1221, 1204, 1224, 1225, 1194, 1194, 1194, 1226, + + 1205, 1194, 1934, 1189, 1206, 1192, 1208, 1227, 1193, 1194, + 1209, 1636, 1190, 1212, 1214, 1215, 1218, 1218, 1218, 1191, + 1193, 1221, 1194, 1224, 1225, 1231, 1232, 1634, 1226, 1233, + 1234, 1218, 1239, 1240, 1192, 1244, 1227, 1193, 1246, 1630, + 1195, 1228, 1228, 1228, 1250, 1243, 1243, 1243, 1251, 1193, + 1252, 1194, 1253, 1254, 1231, 1232, 1228, 1255, 1233, 1234, + 1243, 1239, 1240, 1256, 1244, 1625, 1257, 1246, 1247, 1247, + 1247, 1623, 1258, 1250, 1259, 1194, 1260, 1251, 1261, 1252, + 1194, 1253, 1254, 1247, 1262, 1263, 1255, 1264, 1265, 1266, + 1247, 1267, 1256, 1268, 1247, 1257, 1280, 1269, 1270, 1275, + + 1218, 1258, 1276, 1259, 1277, 1260, 1278, 1261, 1279, 1271, + 1271, 1271, 1282, 1262, 1263, 1287, 1264, 1265, 1266, 1620, + 1267, 1618, 1268, 1247, 1271, 1228, 1269, 1270, 1275, 1243, + 1281, 1276, 1280, 1277, 1279, 1278, 1283, 1284, 1285, 1286, + 1288, 1290, 1281, 1291, 1287, 1282, 1284, 1292, 1283, 1293, + 1285, 1286, 1247, 1294, 1295, 1296, 1297, 1298, 1299, 1300, + 1301, 1302, 1303, 1279, 1615, 1304, 1305, 1349, 1349, 1288, + 1290, 1281, 1291, 1613, 1282, 1284, 1292, 1283, 1293, 1285, + 1286, 1311, 1294, 1295, 1296, 1297, 1298, 1299, 1300, 1301, + 1302, 1303, 1312, 1271, 1304, 1305, 1306, 1306, 1306, 1609, + + 1313, 1306, 1307, 1307, 1307, 1314, 1315, 1307, 1593, 1306, + 1311, 1308, 1308, 1308, 1316, 1307, 1308, 1317, 1309, 1309, + 1309, 1312, 1306, 1309, 1308, 1307, 1318, 1320, 1307, 1313, + 1321, 1309, 1322, 1323, 1314, 1315, 1327, 1308, 1328, 1329, + 1330, 1333, 1334, 1316, 1309, 1335, 1317, 1336, 1339, 1339, + 1339, 1306, 1340, 1341, 1307, 1318, 1320, 1307, 1346, 1321, + 1347, 1322, 1323, 1348, 1352, 1327, 1308, 1328, 1329, 1330, + 1333, 1334, 1354, 1309, 1335, 1356, 1336, 1357, 1339, 1355, + 1306, 1340, 1341, 1342, 1342, 1342, 1307, 1346, 1358, 1347, + 1308, 1359, 1348, 1352, 1360, 1308, 1361, 1355, 1342, 1362, + + 1363, 1354, 1309, 1383, 1356, 1364, 1357, 1339, 1355, 1365, + 1366, 1367, 1368, 1370, 1372, 1372, 1374, 1358, 1376, 1377, + 1359, 1378, 1388, 1360, 1383, 1361, 1355, 1379, 1362, 1363, + 1365, 1391, 1339, 1395, 1364, 1398, 1399, 1400, 1365, 1366, + 1367, 1368, 1370, 1401, 1379, 1374, 1402, 1376, 1377, 1403, + 1404, 1388, 1416, 1383, 1428, 1428, 1583, 1378, 1417, 1365, + 1391, 1582, 1395, 1418, 1398, 1399, 1400, 1342, 1419, 1405, + 1405, 1405, 1401, 1379, 1405, 1402, 1435, 1435, 1403, 1404, + 1578, 1416, 1405, 1406, 1406, 1406, 1561, 1417, 1406, 1407, + 1407, 1407, 1418, 1552, 1407, 1405, 1406, 1419, 1420, 1408, + + 1408, 1408, 1407, 1421, 1408, 1409, 1409, 1409, 1542, 1406, + 1409, 1540, 1408, 1422, 1423, 1407, 1424, 1426, 1409, 1534, + 1427, 1410, 1410, 1410, 1405, 1408, 1410, 1420, 1527, 1432, + 1433, 1409, 1421, 1408, 1410, 1411, 1411, 1411, 1406, 1494, + 1411, 1449, 1422, 1423, 1407, 1424, 1426, 1410, 1411, 1427, + 1434, 1438, 1439, 1405, 1408, 1430, 1430, 1430, 1432, 1433, + 1409, 1411, 1408, 1440, 1437, 1437, 1437, 1406, 1407, 1412, + 1412, 1412, 1445, 1407, 1412, 1441, 1410, 1448, 1448, 1434, + 1438, 1439, 1412, 1408, 1444, 1430, 1413, 1413, 1413, 1409, + 1411, 1413, 1440, 1415, 1437, 1412, 1414, 1414, 1414, 1413, + + 1397, 1414, 1447, 1451, 1441, 1410, 1442, 1442, 1442, 1414, + 1387, 1452, 1413, 1444, 1430, 1443, 1443, 1443, 1456, 1411, + 1457, 1442, 1414, 1437, 1412, 1453, 1453, 1458, 1459, 1413, + 1460, 1447, 1451, 1455, 1455, 1455, 1461, 1462, 1464, 1430, + 1452, 1413, 1463, 1463, 1463, 1443, 1385, 1456, 1437, 1457, + 1465, 1414, 1466, 1412, 1467, 1468, 1458, 1459, 1413, 1460, + 1469, 1384, 1470, 1455, 1471, 1461, 1462, 1464, 1472, 1473, + 1413, 1474, 1475, 1476, 1443, 1414, 1477, 1477, 1481, 1465, + 1414, 1466, 1482, 1467, 1468, 1479, 1479, 1479, 1382, 1469, + 1442, 1470, 1455, 1471, 1483, 1486, 1484, 1472, 1473, 1443, + + 1474, 1475, 1476, 1485, 1487, 1488, 1489, 1481, 1484, 1490, + 1491, 1482, 1492, 1495, 1496, 1479, 1485, 1455, 1493, 1493, + 1493, 1483, 1544, 1544, 1486, 1381, 1463, 1513, 1380, 1515, + 1373, 1516, 1493, 1487, 1488, 1489, 1353, 1484, 1490, 1491, + 1351, 1492, 1495, 1496, 1479, 1485, 1498, 1498, 1498, 1350, + 1483, 1498, 1499, 1499, 1499, 1344, 1513, 1499, 1515, 1498, + 1516, 1500, 1500, 1500, 1518, 1499, 1500, 1343, 1332, 1479, + 1520, 1325, 1498, 1310, 1500, 1521, 1289, 1526, 1499, 1501, + 1501, 1501, 1273, 1530, 1501, 1272, 1533, 1500, 1535, 1249, + 1248, 1236, 1501, 1518, 1230, 1502, 1502, 1502, 1229, 1520, + + 1502, 1498, 1493, 1220, 1521, 1501, 1526, 1499, 1502, 1503, + 1503, 1503, 1530, 1536, 1503, 1533, 1500, 1535, 1504, 1504, + 1504, 1502, 1503, 1504, 1219, 1537, 1210, 1505, 1505, 1505, + 1498, 1504, 1505, 1538, 1501, 1503, 1499, 1541, 1502, 1196, + 1505, 1163, 1536, 1160, 1504, 1500, 1506, 1506, 1506, 1547, + 1502, 1506, 1142, 1505, 1537, 1507, 1507, 1507, 1133, 1506, + 1507, 1131, 1538, 1501, 1503, 1548, 1541, 1502, 1507, 1519, + 1519, 1519, 1506, 1504, 1524, 1524, 1524, 1116, 1547, 1502, + 1110, 1507, 1505, 1519, 1109, 1525, 1525, 1525, 1503, 1524, + 1508, 1508, 1508, 1503, 1548, 1508, 1551, 1504, 1531, 1531, + + 1531, 1506, 1504, 1508, 1539, 1539, 1539, 1509, 1509, 1509, + 1507, 1505, 1509, 1531, 1105, 1525, 1508, 1080, 1553, 1539, + 1509, 1068, 1510, 1510, 1510, 1551, 1060, 1510, 1554, 1059, + 1506, 1056, 1050, 1509, 1507, 1510, 1532, 1532, 1532, 1507, + 1045, 1511, 1511, 1511, 1525, 1508, 1511, 1553, 1510, 1040, + 1512, 1512, 1512, 1519, 1511, 1512, 1034, 1554, 1524, 1546, + 1546, 1546, 1509, 1512, 1511, 1555, 1532, 1511, 1556, 1525, + 1549, 1549, 1549, 1557, 1508, 1558, 1512, 1510, 1550, 1550, + 1550, 1559, 1531, 1562, 1563, 1549, 1509, 1564, 1539, 1546, + 1565, 1509, 1566, 1511, 1555, 1532, 1511, 1556, 1560, 1560, + + 1560, 1567, 1557, 1568, 1558, 1512, 1510, 1569, 1550, 1571, + 1559, 1572, 1562, 1563, 1581, 1573, 1564, 1574, 1546, 1565, + 1532, 1566, 1576, 1576, 1576, 1511, 1575, 1575, 1575, 1512, + 1567, 1577, 1568, 1030, 1512, 1579, 1569, 1550, 1571, 1580, + 1572, 1575, 1581, 1546, 1573, 1584, 1574, 1587, 1588, 1590, + 1594, 1603, 1576, 1028, 1549, 1591, 1591, 1591, 1605, 1025, + 1577, 1023, 1550, 1006, 1579, 1592, 1592, 1592, 1580, 1591, + 989, 1581, 1606, 987, 1584, 967, 1587, 1588, 1590, 1594, + 1603, 1576, 1560, 1570, 1595, 1595, 1595, 1605, 1592, 1570, + 1597, 1597, 1597, 1570, 1570, 1597, 956, 949, 1570, 1570, + + 1570, 1606, 1570, 1597, 1595, 947, 1576, 1592, 1614, 923, + 1575, 909, 1570, 902, 1616, 900, 1597, 1592, 1570, 1619, + 895, 889, 1570, 1570, 1610, 1610, 1610, 1570, 1570, 1570, + 884, 1570, 881, 1598, 1598, 1598, 1592, 1614, 1598, 1591, + 1607, 1607, 1607, 1616, 1610, 1597, 1598, 877, 1619, 1592, + 1599, 1599, 1599, 875, 1607, 1599, 1598, 873, 1621, 1598, + 1600, 1600, 1600, 1599, 868, 1600, 1611, 854, 1595, 840, + 1601, 1601, 1601, 1600, 1597, 1601, 1599, 1602, 1602, 1602, + 1622, 1611, 1602, 1601, 1624, 1598, 1600, 1621, 1598, 817, + 1602, 1608, 1608, 1608, 1626, 1611, 1601, 1612, 1612, 1612, + + 1628, 1628, 1628, 1602, 791, 1599, 1629, 1631, 1610, 1622, + 1611, 1602, 1612, 1624, 1608, 1600, 1632, 1598, 1617, 1617, + 1617, 785, 752, 1626, 1607, 1601, 1627, 1627, 1627, 1599, + 1628, 1635, 1602, 1617, 1599, 1629, 1631, 1637, 1638, 1600, + 1602, 1627, 1639, 1608, 1600, 1632, 746, 1640, 1641, 1601, + 1633, 1633, 1633, 1646, 1601, 1642, 1642, 1642, 1649, 1628, + 1635, 1602, 1643, 1643, 1643, 1633, 1637, 1638, 1648, 1648, + 1648, 1639, 1650, 733, 1651, 1608, 1640, 1641, 1652, 1654, + 1653, 1612, 1646, 1653, 1628, 1655, 1656, 1649, 1657, 1658, + 1659, 1660, 1661, 1663, 727, 724, 719, 1658, 1657, 1667, + + 1669, 1650, 1617, 1651, 1658, 715, 1670, 1652, 1654, 1653, + 1627, 706, 1653, 1672, 1655, 1656, 1674, 1657, 1658, 1659, + 1660, 1661, 1663, 1665, 1665, 1665, 1658, 1657, 1667, 1669, + 1675, 1671, 1677, 1658, 1633, 1670, 1678, 1681, 1665, 1642, + 1671, 704, 1672, 702, 701, 1674, 1643, 1676, 1676, 1676, + 699, 1689, 1648, 1682, 1682, 1682, 1683, 1683, 1683, 1675, + 697, 1677, 1685, 1685, 1685, 1678, 1681, 1685, 1691, 1671, + 1676, 696, 1683, 1682, 694, 1685, 1697, 1686, 1686, 1686, + 1689, 1698, 1686, 1690, 1690, 1690, 1700, 692, 1685, 1676, + 1686, 1694, 1694, 1694, 1701, 1703, 1685, 1691, 1704, 1676, + + 1695, 1695, 1695, 1686, 1705, 1697, 1690, 1665, 691, 1706, + 1698, 1694, 1708, 1708, 1708, 1700, 1695, 1685, 1676, 1709, + 1709, 1709, 1711, 1701, 1703, 1685, 1713, 1704, 1714, 1716, + 1717, 1676, 1686, 1705, 1709, 1690, 1718, 1682, 1706, 1719, + 1683, 1721, 1722, 1722, 1722, 1726, 1685, 1724, 1724, 1724, + 1728, 1711, 1727, 1727, 1727, 1713, 1731, 1714, 1716, 1717, + 1733, 1686, 1729, 1729, 1729, 1718, 1734, 1690, 1719, 1735, + 1721, 1736, 1737, 1738, 1726, 1694, 1739, 1740, 1741, 1728, + 1742, 1744, 1745, 1746, 1695, 1731, 1747, 1750, 1751, 1733, + 1752, 666, 1753, 1754, 663, 1734, 1708, 617, 1735, 1757, + + 1736, 1737, 1738, 1709, 1729, 1739, 1740, 1741, 1760, 1742, + 1744, 1745, 1746, 1766, 597, 1747, 1750, 1751, 1767, 1752, + 1753, 554, 1754, 1756, 1756, 1756, 1722, 1769, 1757, 552, + 547, 1724, 1775, 1729, 545, 544, 1727, 1760, 1761, 1761, + 1761, 1776, 1766, 1756, 531, 1780, 1729, 1767, 525, 1753, + 1765, 1765, 1765, 1781, 1761, 1765, 1769, 1768, 1768, 1768, + 1782, 1775, 1786, 1765, 1771, 1771, 1771, 1777, 1777, 1777, + 1776, 1779, 1779, 1779, 1780, 1787, 1765, 1768, 518, 1788, + 1771, 1793, 1781, 1783, 1783, 1783, 1789, 1789, 1789, 1782, + 1797, 1786, 1791, 1791, 1791, 1794, 1794, 1794, 1798, 1798, + + 1798, 1800, 1801, 1803, 1787, 1765, 1791, 1756, 1788, 1804, + 1793, 1805, 1803, 1806, 1807, 1808, 1808, 1809, 1810, 1797, + 1812, 1813, 1761, 1814, 1815, 1816, 1819, 1819, 1819, 1821, + 1800, 1801, 1803, 1822, 1765, 1823, 1824, 1825, 1804, 1826, + 1805, 1768, 1806, 1807, 1808, 1808, 1809, 1810, 1771, 1812, + 1813, 1777, 1814, 1815, 1816, 1779, 1828, 1829, 1821, 1830, + 1832, 1833, 1822, 515, 1823, 1824, 1825, 1783, 1826, 1838, + 1789, 1834, 1834, 1834, 1839, 1843, 1791, 1844, 1847, 1794, + 1851, 511, 1798, 508, 507, 1828, 1829, 496, 1830, 1832, + 1833, 1822, 1836, 1836, 1836, 1842, 1842, 1842, 1838, 1845, + + 1845, 1845, 1852, 1839, 1843, 1855, 1844, 1847, 1857, 1851, + 1819, 1848, 1848, 1848, 1849, 1849, 1849, 1853, 1853, 1853, + 1858, 1860, 489, 1861, 1862, 1848, 488, 487, 1863, 483, + 1864, 1852, 1865, 1866, 1855, 1868, 1869, 1857, 1870, 1871, + 1873, 1874, 1874, 1874, 1876, 482, 1878, 1877, 1879, 1858, + 1860, 1849, 1861, 1862, 480, 1834, 1849, 1863, 1853, 1864, + 1880, 1865, 1866, 1884, 1868, 1869, 476, 1870, 1871, 1873, + 1885, 1886, 475, 1876, 1877, 1878, 1836, 1879, 1889, 1842, + 1849, 1890, 1896, 1845, 473, 1849, 1898, 1853, 1899, 1880, + 1902, 1903, 1884, 1904, 1906, 1848, 469, 1907, 1849, 1885, + + 1886, 1853, 1908, 1877, 1891, 1891, 1891, 1889, 1909, 1911, + 1890, 1896, 1897, 1897, 1897, 1898, 1912, 1899, 1913, 1902, + 1903, 1914, 1904, 1906, 1915, 1874, 1907, 1916, 1917, 1919, + 1922, 1908, 1925, 1926, 1927, 1928, 1929, 1909, 1911, 1930, + 1931, 1933, 1936, 1940, 1941, 1912, 1942, 1913, 1943, 1897, + 1914, 466, 465, 1915, 1897, 1945, 1916, 1917, 1919, 1922, + 1946, 1925, 1926, 1927, 1928, 1929, 1947, 462, 1930, 1931, + 1933, 1936, 1940, 1941, 1949, 1942, 1951, 1943, 1897, 1944, + 1944, 1944, 1953, 1897, 1945, 1954, 1956, 1957, 1891, 1946, + 1958, 1960, 1961, 1963, 1967, 1947, 1897, 1968, 1969, 1970, + + 1971, 1973, 461, 1949, 459, 1951, 1972, 1972, 1972, 1977, + 1978, 1953, 1980, 1981, 1954, 1956, 1957, 1983, 1985, 1958, + 1960, 1961, 1963, 1967, 1986, 1988, 1968, 1969, 1970, 1971, + 1973, 1974, 1974, 1974, 447, 1990, 1991, 1992, 1977, 1978, + 1997, 1980, 1981, 1993, 1993, 1993, 1983, 1985, 1995, 1995, + 1995, 1999, 2001, 1986, 1988, 2003, 2004, 2005, 2007, 2008, + 2009, 446, 2010, 1944, 1990, 1991, 1992, 2011, 2013, 1997, + 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, + 1999, 2001, 2024, 2025, 2003, 2004, 2005, 2007, 2008, 2009, + 1972, 2010, 2028, 2027, 2027, 2027, 2011, 2013, 443, 2014, + + 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2031, + 2034, 2024, 2025, 2027, 2035, 1974, 2029, 2029, 2029, 2037, + 2038, 2028, 2039, 2040, 2041, 2042, 2043, 1993, 2045, 2046, + 2047, 2048, 1995, 2050, 2050, 2050, 2029, 2051, 2031, 2034, + 2052, 2053, 2054, 2035, 2055, 2055, 2055, 2057, 2037, 2038, + 2059, 2039, 2040, 2041, 2042, 2043, 2060, 2045, 2046, 2047, + 2048, 2058, 2058, 2058, 2063, 2065, 2051, 2066, 2067, 2052, + 2053, 2054, 2064, 2064, 2064, 2068, 2057, 2027, 2069, 2059, + 2070, 2071, 2071, 2071, 442, 2060, 439, 438, 425, 419, + 417, 415, 401, 2063, 2065, 375, 2066, 2067, 373, 309, + + 2029, 306, 304, 302, 2068, 298, 293, 2069, 292, 2070, + 287, 266, 265, 261, 251, 250, 248, 2050, 237, 236, + 229, 227, 218, 216, 205, 204, 198, 197, 2055, 189, + 188, 185, 184, 169, 168, 162, 161, 154, 153, 136, + 132, 130, 128, 109, 95, 2058, 94, 93, 67, 61, + 58, 53, 36, 35, 34, 33, 2064, 0, 0, 0, + 0, 0, 0, 0, 0, 2071, 2073, 2073, 2073, 2073, + 2073, 2073, 2073, 2073, 2073, 2073, 2074, 2074, 2074, 2074, + 2074, 2074, 2074, 2074, 2074, 2074, 2075, 2075, 2075, 2075, + 2075, 2075, 2075, 2075, 2075, 2075, 2076, 2076, 2076, 2076, + + 2076, 2076, 2076, 2076, 2076, 2076, 2077, 2077, 2077, 2077, + 2077, 2077, 2077, 2077, 2077, 2077, 2078, 2078, 2078, 2078, + 2078, 2078, 2078, 2078, 2078, 2078, 2079, 2079, 2079, 2079, + 2079, 2079, 2079, 2079, 2079, 2079, 2080, 2080, 2080, 2080, + 2080, 2080, 2080, 2080, 2080, 2080, 2081, 2081, 2081, 2081, + 2081, 2081, 2081, 2081, 2081, 2081, 2082, 2082, 2082, 2082, + 2082, 2082, 2082, 2082, 2082, 2082, 2083, 2083, 2083, 2083, + 2083, 2083, 2083, 2083, 2083, 2083, 2084, 2084, 2084, 2084, + 2084, 2084, 2084, 2084, 2084, 2084, 2085, 2085, 2085, 2085, + 2085, 2085, 2085, 2085, 2085, 2085, 2086, 2086, 2086, 2086, + + 2086, 2086, 2086, 2086, 2086, 2086, 2087, 2087, 2087, 2087, + 2087, 2087, 2087, 2087, 2087, 2087, 2088, 2088, 2088, 2088, + 2088, 2088, 2088, 2088, 2088, 2088, 2089, 2089, 2090, 2090, + 0, 2090, 2090, 2090, 2090, 2090, 2090, 2090, 2092, 2092, + 2093, 0, 0, 0, 0, 2093, 2095, 2095, 0, 2095, + 0, 2095, 2095, 2096, 2096, 2098, 2098, 2099, 0, 0, + 0, 0, 2099, 2100, 0, 2100, 2102, 2102, 2102, 2102, + 2102, 0, 2102, 2102, 0, 2102, 2103, 2103, 2103, 2103, + 2103, 2103, 2103, 2103, 2103, 2103, 2104, 2104, 2104, 2104, + 2104, 0, 2104, 2104, 0, 2104, 2105, 2105, 2105, 2105, + + 2105, 2105, 2105, 2105, 2105, 2105, 2106, 2106, 2106, 2106, + 2106, 2106, 2106, 2106, 2106, 2106, 2107, 2107, 2107, 2107, + 2107, 2107, 2107, 2107, 2107, 2108, 2108, 2108, 2108, 2108, + 2108, 2108, 2108, 2108, 2109, 2109, 0, 2109, 2109, 2109, + 2109, 2109, 2109, 2109, 2111, 2111, 0, 2111, 2111, 2111, + 2111, 2111, 2111, 2111, 2112, 2112, 0, 2112, 2112, 2112, + 2112, 2112, 2112, 2112, 2115, 2115, 0, 2115, 2115, 2115, + 2115, 2115, 2115, 2115, 2117, 2117, 0, 2117, 2117, 2117, + 2117, 2117, 2117, 2117, 2118, 2118, 2119, 2119, 0, 2119, + 2119, 2119, 2119, 2119, 2119, 2119, 2121, 2121, 2122, 0, + + 0, 0, 0, 2122, 2124, 2124, 0, 2124, 0, 2124, + 2124, 2125, 2125, 2127, 2127, 2128, 0, 0, 0, 0, + 2128, 2129, 0, 2129, 2131, 2131, 2131, 2131, 2131, 0, + 2131, 2131, 0, 2131, 2132, 2132, 0, 2132, 2132, 2132, + 2132, 2132, 2132, 2132, 2133, 2133, 2133, 2133, 2133, 0, + 2133, 2133, 0, 2133, 2134, 2134, 0, 2134, 2134, 2134, + 2134, 2134, 2134, 2134, 2135, 2135, 0, 2135, 2135, 2135, + 2135, 2135, 2135, 2135, 2136, 2136, 2136, 2136, 2136, 2136, + 2136, 2136, 2136, 2137, 2137, 2137, 2137, 2137, 2137, 2137, + 2137, 2137, 2138, 2138, 0, 2138, 2138, 2138, 2138, 2138, + + 2138, 2138, 2140, 2140, 0, 2140, 2140, 2140, 2140, 2140, + 2140, 2140, 2141, 2141, 0, 2141, 2141, 2141, 2141, 2141, + 2141, 2141, 2144, 2144, 0, 2144, 2144, 2144, 2144, 2144, + 2144, 2144, 2146, 2146, 0, 2146, 2146, 2146, 2146, 2146, + 2146, 2146, 2147, 2147, 2147, 2147, 2147, 2147, 2147, 2147, + 2147, 2147, 2150, 0, 0, 2150, 2152, 0, 2152, 2154, + 2154, 2154, 2154, 2154, 2154, 2154, 2154, 2154, 2154, 2155, + 2155, 2155, 2155, 2155, 2155, 2155, 2155, 2155, 2155, 2156, + 2156, 2156, 2156, 2156, 2156, 2156, 2156, 2156, 2156, 2157, + 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2158, + + 2158, 2158, 2158, 2158, 2158, 2158, 2158, 2158, 2158, 2159, + 2159, 2159, 2159, 2159, 2159, 2159, 2159, 2159, 2159, 2160, + 2160, 2160, 2160, 2160, 2160, 2160, 2160, 2160, 2160, 2161, + 2161, 2161, 2161, 2161, 2161, 2161, 2161, 2161, 2161, 2162, + 2162, 2162, 2162, 2162, 2162, 2162, 2162, 2162, 2162, 2163, + 2163, 2163, 2163, 2163, 2163, 2163, 2163, 2163, 2163, 2164, + 2164, 2164, 2164, 2164, 2164, 2164, 2164, 2164, 2164, 2165, + 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2166, + 2166, 2166, 2166, 2166, 2166, 2166, 2166, 2166, 2166, 2167, + 2167, 2167, 2167, 2167, 2167, 2167, 2167, 2167, 2167, 2168, + + 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2169, + 2169, 2169, 2169, 2169, 2169, 2169, 2169, 2169, 2169, 2170, + 2170, 2170, 2170, 2170, 2170, 2170, 2170, 2170, 2170, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + + 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, + 2072, 2072, 2072, 2072, 2072, 2072, 2072 + } ; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET +#line 1 "ob_proxy_parser_utf8.l" +#define YY_NO_INPUT 1 +#line 7 "ob_proxy_parser_utf8.l" +#define YYSTYPE OBPROXYSTYPE +#define YYLTYPE OBPROXYLTYPE +#include +#include "opsql/ob_proxy_parse_define.h" +#include "opsql/ob_proxy_parse_malloc.h" +#include "opsql/parser/ob_proxy_parse_result.h" +#include "opsql/parser/ob_proxy_parser_utf8_tab.h" +extern void ob_proxy_utf8_parser_fatal_error(yyconst char *msg, yyscan_t yyscanner); +void update_stmt_type(ObProxyBasicStmtType type, void *yyscanner); +void store_str(char* str, int64_t str_len, char* end_ptr, void *yyscanner); +void store_str_with_quote(ObProxyParseQuoteType type, char* str, int64_t str_len, char* end_ptr, void *yyscanner); + +#define YY_FATAL_ERROR(msg) ob_proxy_utf8_parser_fatal_error(msg, yyscanner) + +#define SET_DML_STMT(stmt_type) \ +do {\ + ObProxyParseResult *p = ob_proxy_parser_utf8_yyget_extra(yyscanner);\ + if (OB_NOTNULL(p)) {\ + if (OBPROXY_T_INVALID == p->cur_stmt_type_\ + || OBPROXY_T_BEGIN == p->cur_stmt_type_\ + || OBPROXY_T_SET == p->cur_stmt_type_) {\ + p->cur_stmt_type_ = stmt_type;\ + }\ + }\ +} while (0); + +#define SET_DDL_STMT(stmt_type) \ +do {\ + ObProxyParseResult *p = ob_proxy_parser_utf8_yyget_extra(yyscanner);\ + if (OB_NOTNULL(p)) {\ + if (OBPROXY_T_INVALID == p->cur_stmt_type_\ + || OBPROXY_T_BEGIN == p->cur_stmt_type_) {\ + p->cur_stmt_type_ = stmt_type;\ + }\ + }\ +} while (0); + +#define SET_BASIC_STMT(stmt_type) \ +do {\ + ObProxyParseResult *p = ob_proxy_parser_utf8_yyget_extra(yyscanner);\ + if (OB_NOTNULL(p)) {\ + if (OBPROXY_T_INVALID == p->cur_stmt_type_\ + || OBPROXY_T_BEGIN == p->cur_stmt_type_) {\ + p->cur_stmt_type_ = stmt_type;\ + }\ + }\ +} while (0); + +#define SET_ICMD_STMT(stmt_type) \ +do {\ + ObProxyParseResult *p = ob_proxy_parser_utf8_yyget_extra(yyscanner);\ + if (OB_NOTNULL(p) && (OBPROXY_T_INVALID == p->cur_stmt_type_ || OBPROXY_T_SHOW == p->cur_stmt_type_)) {\ + p->cur_stmt_type_ = stmt_type;\ + }\ + store_str(yytext, yyleng, yytext + yyleng, yyscanner);\ +} while (0); + +#define SET_GLOBAL_SET_STMT() \ +do {\ + ObProxyParseResult *p = ob_proxy_parser_utf8_yyget_extra(yyscanner);\ + if (OB_NOTNULL(p) && (OBPROXY_T_SET == p->cur_stmt_type_)) {\ + p->cur_stmt_type_ = OBPROXY_T_SET_GLOBAL;\ + }\ +} while (0); + +#define RETURN_NON_RESERVED_KEYWORD(word_type) \ + { store_str(yytext, yyleng, yytext + yyleng, yyscanner); return word_type; } + +#define RETURN_NON_RESERVED_KEYWORD_WITH_QUOTE(word_type, quote_type) \ + { store_str_with_quote(quote_type, yytext + 1, yyleng - 2, yytext + yyleng, yyscanner); return word_type; } + +#define RETURN_INT_NUM() \ +do {\ + errno = 0;\ + yylval->num = strtoll(yytext, NULL, 10);\ + if (0 != errno) {\ + ObProxyParseResult *p = ob_proxy_parser_utf8_yyget_extra(yyscanner);\ + if (OB_NOTNULL(p) && OBPROXY_T_INVALID < p->cur_stmt_type_ && p->cur_stmt_type_ < OBPROXY_T_ICMD_MAX) {\ + p->cmd_info_.err_type_ = OBPROXY_T_ERR_INVALID_NUM;\ + } else {\ + yylval->num = 0;\ + }\ + }\ + return INT_NUM;\ +} while (0); + +#define RETURN_COMMENT_INT_NUM() \ +do {\ + errno = 0;\ + yylval->num = strtoll(yytext, NULL, 10);\ + if (0 != errno) {\ + store_str(yytext, yyleng, yytext + yyleng, yyscanner);\ + return NAME_OB;\ + }\ + return INT_NUM;\ +} while (0); + +#define RETURN_NUMBER_VAL() \ + { store_str(yytext, yyleng, yytext + yyleng, yyscanner); return NUMBER_VAL; } + +#define RETURN_COL_NAME(word_type) \ +do { \ + ObProxyParseResult *p = ob_proxy_parser_utf8_yyget_extra(yyscanner);\ + if (OB_NOTNULL(p)) {\ + if (!p->has_ignored_word_) {\ + if (p->col_name_.str_len_ > 0) {\ + p->has_ignored_word_ = true;\ + } else {\ + p->col_name_.str_ = yytext;\ + p->col_name_.end_ptr_ = yytext + yyleng;\ + p->col_name_.str_len_ = yyleng;\ + return word_type;\ + }\ + }\ + }\ +} while (0); + +#define RETURN_IGNORED_WORD() \ +do { \ + ObProxyParseResult *p = ob_proxy_parser_utf8_yyget_extra(yyscanner);\ + if (OB_NOTNULL(p)) {\ + p->has_ignored_word_ = true;\ + if (IN_TRANS_PARSE_MODE == p->parse_mode_) {\ + return ERROR;\ + }\ + }\ +} while (0); + +#define RETURN_IGNORED_WORD_FOR_DUAL() \ +do { \ + ObProxyParseResult *p = ob_proxy_parser_utf8_yyget_extra(yyscanner);\ + if (OB_NOTNULL(p)) {\ + p->has_ignored_word_ = true;\ + p->is_dual_request_ = true; \ + if (IN_TRANS_PARSE_MODE == p->parse_mode_) {\ + return ERROR;\ + }\ + }\ +} while (0); + +#define SET_LAST_INSERT_ID() \ +do { \ + ObProxyParseResult *p = ob_proxy_parser_utf8_yyget_extra(yyscanner);\ + if (OB_NOTNULL(p)) {\ + p->has_last_insert_id_ = true;\ + }\ +} while (0); + +#define SET_FOUND_ROWS() \ +do { \ + ObProxyParseResult *p = ob_proxy_parser_utf8_yyget_extra(yyscanner);\ + if (OB_NOTNULL(p)) {\ + p->has_found_rows_ = true;\ + }\ +} while (0); + +#define SET_ROW_COUNT() \ +do { \ + ObProxyParseResult *p = ob_proxy_parser_utf8_yyget_extra(yyscanner);\ + if (OB_NOTNULL(p)) {\ + p->has_row_count_ = true;\ + }\ +} while (0); + +#define SET_HAS_EXPLAIN() \ +do { \ + ObProxyParseResult *p = ob_proxy_parser_utf8_yyget_extra(yyscanner);\ + if (OB_NOTNULL(p)) {\ + p->has_explain_ = true;\ + }\ +} while (0); + +#define RETURN_SHARD_COMMENT_NAME_OB_DOT(word_type) \ +do {\ + ObProxyParseResult *p = ob_proxy_parser_utf8_yyget_extra(yyscanner);\ + if (OB_NOTNULL(p) && !p->has_shard_comment_) {\ + p->has_shard_comment_ = true;\ + }\ + store_str(yytext, yyleng - 1, yytext + yyleng - 1, yyscanner);\ + return word_type;\ +} while (0); + +#define RETURN_SHARD_COMMENT(word_type) \ +do {\ + ObProxyParseResult *p = ob_proxy_parser_utf8_yyget_extra(yyscanner);\ + if (OB_NOTNULL(p) && !p->has_shard_comment_) {\ + p->has_shard_comment_ = true;\ + }\ + return word_type;\ +} while (0); + +#define SET_HAS_ANONYMOUS_BLOCK() \ +do { \ + ObProxyParseResult *p = ob_proxy_parser_utf8_yyget_extra(yyscanner);\ + if (OB_NOTNULL(p)) {\ + if (OBPROXY_T_INVALID == p->cur_stmt_type_) {\ + p->has_anonymous_block_ = true;\ + } \ + }\ +} while (0); + +#define PUSH_STATE(state) \ + { yy_push_state(state, yyscanner); } + +#define POP_STATE(state) \ + { yy_pop_state(yyscanner); } + +#define PUSH_STATE_IF_NOT_ICMD(state) \ +do {\ + ObProxyParseResult *p = ob_proxy_parser_utf8_yyget_extra(yyscanner);\ + if (OB_NOTNULL(p) && OBPROXY_T_INVALID < p->cur_stmt_type_ && p->cur_stmt_type_ < OBPROXY_T_ICMD_MAX) {\ + /*do nothing*/\ + } else {\ + yy_push_state(state, yyscanner);\ + }\ +} while (0); + +#define RETURN_WITH_CALL_CHECK(key) \ +do {\ + ObProxyParseResult *p = ob_proxy_parser_utf8_yyget_extra(yyscanner);\ + if (OB_NOTNULL(p) && (OBPROXY_T_CALL == p->cur_stmt_type_ || OBPROXY_T_INSERT == p->cur_stmt_type_)) {\ + return key;\ + } else {\ + PUSH_STATE(INITIAL); \ + RETURN_IGNORED_WORD();\ + }\ +} while (0); + +#define ENTER_QUOTE_STATE(state) \ +do {\ + PUSH_STATE(state); \ + ObProxyParseResult *p = (ObProxyParseResult *)yyextra; \ + if (OB_NOTNULL(p)) { \ + p->tmp_buf_ = (yytext + 1); \ + p->tmp_start_ptr_ = yytext; \ + p->tmp_len_ = 0; \ + }\ +} while (0); + + + + + + + + + + + + + + + + + + + + + + + + + + +/*following character status will be rewrite by gen_parse.sh according to connection character*/ +#line 2774 "ob_proxy_parser_utf8_lex.c" + +#define INITIAL 0 +#define hint 1 +#define in_c_comment 2 +#define in_comment_expr 3 +#define in_old_comment_expr 4 +#define in_odp_comment_expr 5 +#define in_odp_comment_value_expr 6 +#define in_odp_comment_value_expr_calc 7 +#define in_ignored_comment_expr 8 +#define in_dbp_comment_expr 9 +#define in_dbp_comment_trace_expr 10 +#define in_dbp_comment_trace_value_expr 11 +#define in_dbp_comment_trace_value_expr_calc 12 +#define comment_sq 13 +#define sq 14 +#define dq 15 +#define bt 16 +#define bt_in_expr 17 +#define in_expr 18 +#define in_anonymous_block 19 +#define in_subquery 20 +#define in_no_select_query 21 +#define prepare 22 +#define insert_all_expr 23 +#define set_expr 24 +#define show_topology 25 + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +/* Holds the entire state of the reentrant scanner. */ +struct yyguts_t + { + + /* User-defined. Not touched by flex. */ + YY_EXTRA_TYPE yyextra_r; + + /* The rest are the same as the globals declared in the non-reentrant scanner. */ + FILE *yyin_r, *yyout_r; + size_t yy_buffer_stack_top; /**< index of top of stack. */ + size_t yy_buffer_stack_max; /**< capacity of stack. */ + YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ + char yy_hold_char; + int yy_n_chars; + int yyleng_r; + char *yy_c_buf_p; + int yy_init; + int yy_start; + int yy_did_buffer_switch_on_eof; + int yy_start_stack_ptr; + int yy_start_stack_depth; + int *yy_start_stack; + yy_state_type yy_last_accepting_state; + char* yy_last_accepting_cpos; + + int yylineno_r; + int yy_flex_debug_r; + + char *yytext_r; + int yy_more_flag; + int yy_more_len; + + YYSTYPE * yylval_r; + + YYLTYPE * yylloc_r; + + }; /* end struct yyguts_t */ + +static int yy_init_globals (yyscan_t yyscanner ); + + /* This must go here because YYSTYPE and YYLTYPE are included + * from bison output in section 1.*/ + # define yylval yyg->yylval_r + + # define yylloc yyg->yylloc_r + +int ob_proxy_parser_utf8_yylex_init (yyscan_t* scanner); + +int ob_proxy_parser_utf8_yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner); + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int ob_proxy_parser_utf8_yylex_destroy (yyscan_t yyscanner ); + +int ob_proxy_parser_utf8_yyget_debug (yyscan_t yyscanner ); + +void ob_proxy_parser_utf8_yyset_debug (int debug_flag ,yyscan_t yyscanner ); + +YY_EXTRA_TYPE ob_proxy_parser_utf8_yyget_extra (yyscan_t yyscanner ); + +void ob_proxy_parser_utf8_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); + +FILE *ob_proxy_parser_utf8_yyget_in (yyscan_t yyscanner ); + +void ob_proxy_parser_utf8_yyset_in (FILE * in_str ,yyscan_t yyscanner ); + +FILE *ob_proxy_parser_utf8_yyget_out (yyscan_t yyscanner ); + +void ob_proxy_parser_utf8_yyset_out (FILE * out_str ,yyscan_t yyscanner ); + +int ob_proxy_parser_utf8_yyget_leng (yyscan_t yyscanner ); + +char *ob_proxy_parser_utf8_yyget_text (yyscan_t yyscanner ); + +int ob_proxy_parser_utf8_yyget_lineno (yyscan_t yyscanner ); + +void ob_proxy_parser_utf8_yyset_lineno (int line_number ,yyscan_t yyscanner ); + +YYSTYPE * ob_proxy_parser_utf8_yyget_lval (yyscan_t yyscanner ); + +void ob_proxy_parser_utf8_yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner ); + + YYLTYPE *ob_proxy_parser_utf8_yyget_lloc (yyscan_t yyscanner ); + + void ob_proxy_parser_utf8_yyset_lloc (YYLTYPE * yylloc_param ,yyscan_t yyscanner ); + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int ob_proxy_parser_utf8_yywrap (yyscan_t yyscanner ); +#else +extern int ob_proxy_parser_utf8_yywrap (yyscan_t yyscanner ); +#endif +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner); +#endif + +#ifndef YY_NO_INPUT + +#ifdef __cplusplus +static int yyinput (yyscan_t yyscanner ); +#else +static int input (yyscan_t yyscanner ); +#endif + +#endif + + static void yy_push_state (int new_state ,yyscan_t yyscanner); + + static void yy_pop_state (yyscan_t yyscanner ); + + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#define YY_READ_BUF_SIZE 8192 +#endif + +/* Copy whatever the last rule matched to the standard output. */ +#ifndef ECHO +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO fwrite( yytext, yyleng, 1, yyout ) +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + int n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + } \ + }\ +\ + +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner) +#endif + +/* end tables serialization structures and prototypes */ + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 + +extern int ob_proxy_parser_utf8_yylex \ + (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner); + +#define YY_DECL int ob_proxy_parser_utf8_yylex \ + (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner) +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK break; +#endif + +#define YY_RULE_SETUP \ + YY_USER_ACTION + +/** The main scanner function which does all the work. + */ +YY_DECL +{ + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + +#line 365 "ob_proxy_parser_utf8.l" + + + /* basic dml stmt: */ +#line 3048 "ob_proxy_parser_utf8_lex.c" + + yylval = yylval_param; + + yylloc = yylloc_param; + + if ( !yyg->yy_init ) + { + yyg->yy_init = 1; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! yyg->yy_start ) + yyg->yy_start = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! YY_CURRENT_BUFFER ) { + ob_proxy_parser_utf8_yyensure_buffer_stack (yyscanner); + YY_CURRENT_BUFFER_LVALUE = + ob_proxy_parser_utf8_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); + } + + ob_proxy_parser_utf8_yy_load_buffer_state(yyscanner ); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = yyg->yy_c_buf_p; + + /* Support of yytext. */ + *yy_cp = yyg->yy_hold_char; + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = yyg->yy_start; +yy_match: + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { + yyg->yy_last_accepting_state = yy_current_state; + yyg->yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 2073 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 6130 ); + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = yyg->yy_last_accepting_cpos; + yy_current_state = yyg->yy_last_accepting_state; + yy_act = yy_accept[yy_current_state]; + } + + YY_DO_BEFORE_ACTION; + +do_action: /* This label is used only to access EOF actions. */ + + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = yyg->yy_hold_char; + yy_cp = yyg->yy_last_accepting_cpos; + yy_current_state = yyg->yy_last_accepting_state; + goto yy_find_action; + +case 1: +YY_RULE_SETUP +#line 368 "ob_proxy_parser_utf8.l" +{ SET_DML_STMT(OBPROXY_T_SELECT); PUSH_STATE(in_expr); return SELECT; } + YY_BREAK +case 2: +YY_RULE_SETUP +#line 369 "ob_proxy_parser_utf8.l" +{ SET_DML_STMT(OBPROXY_T_DELETE); PUSH_STATE_IF_NOT_ICMD(in_expr); return DELETE; } + YY_BREAK +case 3: +YY_RULE_SETUP +#line 370 "ob_proxy_parser_utf8.l" +{ SET_DML_STMT(OBPROXY_T_INSERT); return INSERT; } + YY_BREAK +case 4: +YY_RULE_SETUP +#line 371 "ob_proxy_parser_utf8.l" +{ SET_DML_STMT(OBPROXY_T_UPDATE); return UPDATE; } + YY_BREAK +case 5: +YY_RULE_SETUP +#line 372 "ob_proxy_parser_utf8.l" +{ SET_DML_STMT(OBPROXY_T_REPLACE); return REPLACE; } + YY_BREAK +case 6: +YY_RULE_SETUP +#line 373 "ob_proxy_parser_utf8.l" +{ SET_DML_STMT(OBPROXY_T_MERGE); return MERGE; } + YY_BREAK +case 7: +YY_RULE_SETUP +#line 374 "ob_proxy_parser_utf8.l" +{ SET_BASIC_STMT(OBPROXY_T_SHOW); return SHOW; } + YY_BREAK +case 8: +YY_RULE_SETUP +#line 375 "ob_proxy_parser_utf8.l" +{ RETURN_NON_RESERVED_KEYWORD(XA); } + YY_BREAK +/* if begin is for starting transaction, will set has_anonymous_block = false in yacc */ +case 9: +YY_RULE_SETUP +#line 377 "ob_proxy_parser_utf8.l" +{ SET_HAS_ANONYMOUS_BLOCK(); RETURN_NON_RESERVED_KEYWORD(BEGI); } + YY_BREAK +case 10: +YY_RULE_SETUP +#line 378 "ob_proxy_parser_utf8.l" +{ RETURN_NON_RESERVED_KEYWORD(START); } + YY_BREAK +case 11: +YY_RULE_SETUP +#line 379 "ob_proxy_parser_utf8.l" +{ SET_BASIC_STMT(OBPROXY_T_COMMIT); RETURN_IGNORED_WORD(); } + YY_BREAK +case 12: +YY_RULE_SETUP +#line 380 "ob_proxy_parser_utf8.l" +{ SET_BASIC_STMT(OBPROXY_T_ROLLBACK); RETURN_IGNORED_WORD(); } + YY_BREAK +case 13: +YY_RULE_SETUP +#line 381 "ob_proxy_parser_utf8.l" +{ SET_BASIC_STMT(OBPROXY_T_SET); PUSH_STATE_IF_NOT_ICMD(set_expr); return SET; } + YY_BREAK +case 14: +YY_RULE_SETUP +#line 382 "ob_proxy_parser_utf8.l" +{ SET_BASIC_STMT(OBPROXY_T_CALL); return CALL; } + YY_BREAK +case 15: +YY_RULE_SETUP +#line 383 "ob_proxy_parser_utf8.l" +{ SET_HAS_ANONYMOUS_BLOCK(); PUSH_STATE(in_anonymous_block); } + YY_BREAK +case 16: +YY_RULE_SETUP +#line 384 "ob_proxy_parser_utf8.l" +{ ObProxyParseResult *p = ob_proxy_parser_utf8_yyget_extra(yyscanner); + if (OB_NOTNULL(p)) { + if (OBPROXY_T_INSERT == p->cur_stmt_type_) + PUSH_STATE(insert_all_expr); + } + return WHEN; } + YY_BREAK +/* basic ddl stmt */ +case 17: +YY_RULE_SETUP +#line 392 "ob_proxy_parser_utf8.l" +{ return CREATE; } + YY_BREAK +case 18: +YY_RULE_SETUP +#line 393 "ob_proxy_parser_utf8.l" +{ return DROP; } + YY_BREAK +case 19: +YY_RULE_SETUP +#line 394 "ob_proxy_parser_utf8.l" +{ return ALTER; } + YY_BREAK +case 20: +YY_RULE_SETUP +#line 395 "ob_proxy_parser_utf8.l" +{ return TRUNCATE; } + YY_BREAK +case 21: +YY_RULE_SETUP +#line 396 "ob_proxy_parser_utf8.l" +{ return RENAME; } + YY_BREAK +case 22: +YY_RULE_SETUP +#line 397 "ob_proxy_parser_utf8.l" +{ return INDEX; } + YY_BREAK +/* ps stmt */ +case 23: +YY_RULE_SETUP +#line 400 "ob_proxy_parser_utf8.l" +{ return USING; } + YY_BREAK +case 24: +YY_RULE_SETUP +#line 401 "ob_proxy_parser_utf8.l" +{ PUSH_STATE(prepare); return PREPARE; } + YY_BREAK +case 25: +YY_RULE_SETUP +#line 402 "ob_proxy_parser_utf8.l" +{ return EXECUTE; } + YY_BREAK +/* oracle ddl stmt */ +case 26: +YY_RULE_SETUP +#line 405 "ob_proxy_parser_utf8.l" +{ return GRANT; } + YY_BREAK +case 27: +YY_RULE_SETUP +#line 406 "ob_proxy_parser_utf8.l" +{ return REVOKE; } + YY_BREAK +case 28: +YY_RULE_SETUP +#line 407 "ob_proxy_parser_utf8.l" +{ return ANALYZE; } + YY_BREAK +case 29: +YY_RULE_SETUP +#line 408 "ob_proxy_parser_utf8.l" +{ return PURGE; } + YY_BREAK +case 30: +YY_RULE_SETUP +#line 409 "ob_proxy_parser_utf8.l" +{ return COMMENT; } + YY_BREAK +case 31: +YY_RULE_SETUP +#line 410 "ob_proxy_parser_utf8.l" +{ RETURN_NON_RESERVED_KEYWORD(FLASHBACK); } + YY_BREAK +case 32: +YY_RULE_SETUP +#line 411 "ob_proxy_parser_utf8.l" +{ RETURN_NON_RESERVED_KEYWORD(AUDIT); } + YY_BREAK +case 33: +YY_RULE_SETUP +#line 412 "ob_proxy_parser_utf8.l" +{ RETURN_NON_RESERVED_KEYWORD(NOAUDIT); } + YY_BREAK +case 34: +YY_RULE_SETUP +#line 414 "ob_proxy_parser_utf8.l" +{ return GROUP;} + YY_BREAK +case 35: +YY_RULE_SETUP +#line 415 "ob_proxy_parser_utf8.l" +{ return HAVING;} + YY_BREAK +case 36: +YY_RULE_SETUP +#line 416 "ob_proxy_parser_utf8.l" +{ return ORDER;} + YY_BREAK +case 37: +YY_RULE_SETUP +#line 417 "ob_proxy_parser_utf8.l" +{ return FOR;} + YY_BREAK +case 38: +YY_RULE_SETUP +#line 418 "ob_proxy_parser_utf8.l" +{ return UNION;} + YY_BREAK +case 39: +YY_RULE_SETUP +#line 419 "ob_proxy_parser_utf8.l" +{ return AS; } + YY_BREAK +case 40: +YY_RULE_SETUP +#line 420 "ob_proxy_parser_utf8.l" +{ return WHERE; } + YY_BREAK +case 41: +YY_RULE_SETUP +#line 421 "ob_proxy_parser_utf8.l" +{ return VALUES; } + YY_BREAK +case 42: +YY_RULE_SETUP +#line 422 "ob_proxy_parser_utf8.l" +{ SET_HAS_EXPLAIN(); return EXPLAIN; } + YY_BREAK +case 43: +YY_RULE_SETUP +#line 423 "ob_proxy_parser_utf8.l" +{ SET_HAS_EXPLAIN(); return DESC; } + YY_BREAK +case 44: +YY_RULE_SETUP +#line 424 "ob_proxy_parser_utf8.l" +{ SET_HAS_EXPLAIN(); return DESCRIBE; } + YY_BREAK +/*change from non_reserved to reserved according https://dev.mysql.com/doc/refman/5.6/en/keywords.html*/ +case 45: +YY_RULE_SETUP +#line 426 "ob_proxy_parser_utf8.l" +{ return READ; } + YY_BREAK +case 46: +YY_RULE_SETUP +#line 427 "ob_proxy_parser_utf8.l" +{ return WITH; } + YY_BREAK +case 47: +YY_RULE_SETUP +#line 428 "ob_proxy_parser_utf8.l" +{ return USE; } + YY_BREAK +case 48: +YY_RULE_SETUP +#line 429 "ob_proxy_parser_utf8.l" +{ return LIMIT; } + YY_BREAK +case 49: +YY_RULE_SETUP +#line 430 "ob_proxy_parser_utf8.l" +{ return ALL; } + YY_BREAK +case 50: +YY_RULE_SETUP +#line 431 "ob_proxy_parser_utf8.l" +{ return LIKE; } + YY_BREAK +case 51: +YY_RULE_SETUP +#line 432 "ob_proxy_parser_utf8.l" +{ return PARTITION; } + YY_BREAK +case 52: +YY_RULE_SETUP +#line 433 "ob_proxy_parser_utf8.l" +{ return BINARY; } + YY_BREAK +case 53: +YY_RULE_SETUP +#line 434 "ob_proxy_parser_utf8.l" +{ return GROUP_NAME; } + YY_BREAK +/* to make bison easy, do not return these reserved keyword in non strict mode */ +case 54: +YY_RULE_SETUP +#line 437 "ob_proxy_parser_utf8.l" +{ RETURN_IGNORED_WORD(); } + YY_BREAK +case 55: +YY_RULE_SETUP +#line 438 "ob_proxy_parser_utf8.l" +{ RETURN_IGNORED_WORD(); } + YY_BREAK +case 56: +YY_RULE_SETUP +#line 439 "ob_proxy_parser_utf8.l" +{ RETURN_IGNORED_WORD(); } + YY_BREAK +case 57: +YY_RULE_SETUP +#line 440 "ob_proxy_parser_utf8.l" +{ RETURN_IGNORED_WORD(); } + YY_BREAK +case 58: +YY_RULE_SETUP +#line 441 "ob_proxy_parser_utf8.l" +{ RETURN_IGNORED_WORD(); } + YY_BREAK +/* no reserved keyword , don't forget to add these keyword in .y */ +/*refer: https://dev.mysql.com/doc/refman/5.6/en/keywords.html*/ +case 59: +YY_RULE_SETUP +#line 445 "ob_proxy_parser_utf8.l" +{ RETURN_NON_RESERVED_KEYWORD(QUICK); } + YY_BREAK +case 60: +YY_RULE_SETUP +#line 446 "ob_proxy_parser_utf8.l" +{ RETURN_NON_RESERVED_KEYWORD(COUNT); } + YY_BREAK +case 61: +YY_RULE_SETUP +#line 447 "ob_proxy_parser_utf8.l" +{ RETURN_NON_RESERVED_KEYWORD(WARNINGS); } + YY_BREAK +case 62: +YY_RULE_SETUP +#line 448 "ob_proxy_parser_utf8.l" +{ RETURN_NON_RESERVED_KEYWORD(ERRORS); } + YY_BREAK +case 63: +YY_RULE_SETUP +#line 449 "ob_proxy_parser_utf8.l" +{ RETURN_NON_RESERVED_KEYWORD(TRACE); } + YY_BREAK +case 64: +YY_RULE_SETUP +#line 450 "ob_proxy_parser_utf8.l" +{ RETURN_NON_RESERVED_KEYWORD(TRANSACTION); } + YY_BREAK +case 65: +YY_RULE_SETUP +#line 452 "ob_proxy_parser_utf8.l" +{ RETURN_NON_RESERVED_KEYWORD(ONLY); } + YY_BREAK +case 66: +YY_RULE_SETUP +#line 454 "ob_proxy_parser_utf8.l" +{ RETURN_NON_RESERVED_KEYWORD(CONSISTENT); } + YY_BREAK +case 67: +YY_RULE_SETUP +#line 455 "ob_proxy_parser_utf8.l" +{ RETURN_NON_RESERVED_KEYWORD(SNAPSHOT); } + YY_BREAK +case 68: +YY_RULE_SETUP +#line 457 "ob_proxy_parser_utf8.l" +{ RETURN_NON_RESERVED_KEYWORD(HELP); } + YY_BREAK +/*set names*/ +case 69: +/* rule 69 can match eol */ +YY_RULE_SETUP +#line 461 "ob_proxy_parser_utf8.l" +{ SET_BASIC_STMT(OBPROXY_T_SET_NAMES); return SET_NAMES; } + YY_BREAK +/*set charset*/ +case 70: +/* rule 70 can match eol */ +YY_RULE_SETUP +#line 463 "ob_proxy_parser_utf8.l" +{ SET_BASIC_STMT(OBPROXY_T_SET_CHARSET); return SET_CHARSET; } + YY_BREAK +/*set passwd*/ +case 71: +/* rule 71 can match eol */ +YY_RULE_SETUP +#line 465 "ob_proxy_parser_utf8.l" +{ SET_BASIC_STMT(OBPROXY_T_SET_PASSWORD); return SET_PASSWORD; } + YY_BREAK +/*set default*/ +case 72: +/* rule 72 can match eol */ +YY_RULE_SETUP +#line 467 "ob_proxy_parser_utf8.l" +{ SET_BASIC_STMT(OBPROXY_T_SET_DEFAULT); return SET_DEFAULT; } + YY_BREAK +case 73: +/* rule 73 can match eol */ +YY_RULE_SETUP +#line 469 "ob_proxy_parser_utf8.l" +{ SET_BASIC_STMT(OBPROXY_T_SET_OB_READ_CONSISTENCY); return SET_OB_READ_CONSISTENCY; } + YY_BREAK +case 74: +/* rule 74 can match eol */ +YY_RULE_SETUP +#line 470 "ob_proxy_parser_utf8.l" +{ SET_BASIC_STMT(OBPROXY_T_SET_TX_READ_ONLY); return SET_TX_READ_ONLY; } + YY_BREAK +/*internal cmd*/ +/*show net*/ +case 75: +/* rule 75 can match eol */ +YY_RULE_SETUP +#line 474 "ob_proxy_parser_utf8.l" +{ SET_ICMD_STMT(OBPROXY_T_ICMD_SHOW_NET); return SHOW_PROXYNET; } + YY_BREAK +case 76: +YY_RULE_SETUP +#line 475 "ob_proxy_parser_utf8.l" +{ RETURN_NON_RESERVED_KEYWORD(THREAD); } + YY_BREAK +case 77: +YY_RULE_SETUP +#line 476 "ob_proxy_parser_utf8.l" +{ RETURN_NON_RESERVED_KEYWORD(CONNECTION); } + YY_BREAK +case 78: +YY_RULE_SETUP +#line 478 "ob_proxy_parser_utf8.l" +{ RETURN_NON_RESERVED_KEYWORD(OFFSET); } + YY_BREAK +/*show session*/ +case 79: +/* rule 79 can match eol */ +YY_RULE_SETUP +#line 481 "ob_proxy_parser_utf8.l" +{ SET_ICMD_STMT(OBPROXY_T_ICMD_SHOW_GLOBAL_SESSION); return SHOW_GLOBALSESSION; } + YY_BREAK +case 80: +/* rule 80 can match eol */ +YY_RULE_SETUP +#line 482 "ob_proxy_parser_utf8.l" +{ SET_ICMD_STMT(OBPROXY_T_ICMD_SHOW_SESSION); return SHOW_PROXYSESSION; } + YY_BREAK +case 81: +/* rule 81 can match eol */ +YY_RULE_SETUP +#line 483 "ob_proxy_parser_utf8.l" +{ SET_ICMD_STMT(OBPROXY_T_ICMD_SHOW_PROCESSLIST); return SHOW_PROCESSLIST; } + YY_BREAK +case 82: +YY_RULE_SETUP +#line 484 "ob_proxy_parser_utf8.l" +{ RETURN_NON_RESERVED_KEYWORD(ATTRIBUTE); } + YY_BREAK +case 83: +YY_RULE_SETUP +#line 485 "ob_proxy_parser_utf8.l" +{ RETURN_NON_RESERVED_KEYWORD(VARIABLES); } + YY_BREAK +case 84: +YY_RULE_SETUP +#line 487 "ob_proxy_parser_utf8.l" +{ RETURN_NON_RESERVED_KEYWORD(STAT); } + YY_BREAK +/*show config*/ +case 85: +/* rule 85 can match eol */ +YY_RULE_SETUP +#line 490 "ob_proxy_parser_utf8.l" +{ SET_ICMD_STMT(OBPROXY_T_ICMD_SHOW_CONFIG); return SHOW_PROXYCONFIG; } + YY_BREAK +case 86: +YY_RULE_SETUP +#line 492 "ob_proxy_parser_utf8.l" +{ RETURN_NON_RESERVED_KEYWORD(DIFF); } + YY_BREAK +case 87: +YY_RULE_SETUP +#line 493 "ob_proxy_parser_utf8.l" +{ RETURN_NON_RESERVED_KEYWORD(USER); } + YY_BREAK +/*show sm*/ +case 88: +/* rule 88 can match eol */ +YY_RULE_SETUP +#line 496 "ob_proxy_parser_utf8.l" +{ SET_ICMD_STMT(OBPROXY_T_ICMD_SHOW_SM); return SHOW_PROXYSM; } + YY_BREAK +/*show cluster*/ +case 89: +/* rule 89 can match eol */ +YY_RULE_SETUP +#line 499 "ob_proxy_parser_utf8.l" +{ SET_ICMD_STMT(OBPROXY_T_ICMD_SHOW_CLUSTER); return SHOW_PROXYCLUSTER; } + YY_BREAK +/*show resource*/ +case 90: +/* rule 90 can match eol */ +YY_RULE_SETUP +#line 502 "ob_proxy_parser_utf8.l" +{ SET_ICMD_STMT(OBPROXY_T_ICMD_SHOW_RESOURCE); return SHOW_PROXYRESOURCE; } + YY_BREAK +/*show congestion*/ +case 91: +/* rule 91 can match eol */ +YY_RULE_SETUP +#line 505 "ob_proxy_parser_utf8.l" +{ SET_ICMD_STMT(OBPROXY_T_ICMD_SHOW_CONGESTION); return SHOW_PROXYCONGESTION; } + YY_BREAK +/*show route*/ +case 92: +/* rule 92 can match eol */ +YY_RULE_SETUP +#line 508 "ob_proxy_parser_utf8.l" +{ SET_ICMD_STMT(OBPROXY_T_ICMD_SHOW_ROUTE); return SHOW_PROXYROUTE; } + YY_BREAK +case 93: +YY_RULE_SETUP +#line 510 "ob_proxy_parser_utf8.l" +{ RETURN_NON_RESERVED_KEYWORD(ROUTINE); } + YY_BREAK +/*show vip*/ +case 94: +/* rule 94 can match eol */ +YY_RULE_SETUP +#line 513 "ob_proxy_parser_utf8.l" +{ SET_ICMD_STMT(OBPROXY_T_ICMD_SHOW_VIP); return SHOW_PROXYVIP; } + YY_BREAK +/*show memory*/ +case 95: +/* rule 95 can match eol */ +YY_RULE_SETUP +#line 516 "ob_proxy_parser_utf8.l" +{ SET_ICMD_STMT(OBPROXY_T_ICMD_SHOW_MEMORY); return SHOW_PROXYMEMORY; } + YY_BREAK +case 96: +YY_RULE_SETUP +#line 517 "ob_proxy_parser_utf8.l" +{ RETURN_NON_RESERVED_KEYWORD(OBJPOOL); } + YY_BREAK +/*show sqlaudit*/ +case 97: +/* rule 97 can match eol */ +YY_RULE_SETUP +#line 520 "ob_proxy_parser_utf8.l" +{ SET_ICMD_STMT(OBPROXY_T_ICMD_SHOW_SQLAUDIT); return SHOW_SQLAUDIT; } + YY_BREAK +/*show warnlog*/ +case 98: +/* rule 98 can match eol */ +YY_RULE_SETUP +#line 523 "ob_proxy_parser_utf8.l" +{ SET_ICMD_STMT(OBPROXY_T_ICMD_SHOW_WARNLOG); return SHOW_WARNLOG; } + YY_BREAK +/*show stat*/ +case 99: +/* rule 99 can match eol */ +YY_RULE_SETUP +#line 526 "ob_proxy_parser_utf8.l" +{ SET_ICMD_STMT(OBPROXY_T_ICMD_SHOW_STAT); return SHOW_PROXYSTAT; } + YY_BREAK +case 100: +YY_RULE_SETUP +#line 527 "ob_proxy_parser_utf8.l" +{ RETURN_NON_RESERVED_KEYWORD(REFRESH); } + YY_BREAK +/*show trace*/ +case 101: +/* rule 101 can match eol */ +YY_RULE_SETUP +#line 530 "ob_proxy_parser_utf8.l" +{ SET_ICMD_STMT(OBPROXY_T_ICMD_SHOW_TRACE); return SHOW_PROXYTRACE; } + YY_BREAK +/*show info*/ +case 102: +/* rule 102 can match eol */ +YY_RULE_SETUP +#line 533 "ob_proxy_parser_utf8.l" +{ SET_ICMD_STMT(OBPROXY_T_ICMD_SHOW_INFO); return SHOW_PROXYINFO; } + YY_BREAK +case 103: +YY_RULE_SETUP +#line 534 "ob_proxy_parser_utf8.l" +{ RETURN_NON_RESERVED_KEYWORD(UPGRADE); } + YY_BREAK +case 104: +YY_RULE_SETUP +#line 535 "ob_proxy_parser_utf8.l" +{ RETURN_NON_RESERVED_KEYWORD(IDC); } + YY_BREAK +case 105: +/* rule 105 can match eol */ +YY_RULE_SETUP +#line 537 "ob_proxy_parser_utf8.l" +{ SET_BASIC_STMT(OBPROXY_T_SHOW); PUSH_STATE(show_topology); return SHOW_TOPOLOGY; } + YY_BREAK +case 106: +YY_RULE_SETUP +#line 538 "ob_proxy_parser_utf8.l" +{ POP_STATE(); PUSH_STATE(INITIAL); return FROM; } + YY_BREAK +case 107: +YY_RULE_SETUP +#line 539 "ob_proxy_parser_utf8.l" +{ POP_STATE(); PUSH_STATE(INITIAL); return WHERE; } + YY_BREAK +case YY_STATE_EOF(show_topology): +#line 540 "ob_proxy_parser_utf8.l" +{ return END_P; } + YY_BREAK +case 108: +/* rule 108 can match eol */ +YY_RULE_SETUP +#line 541 "ob_proxy_parser_utf8.l" +{ } + YY_BREAK +case 109: +YY_RULE_SETUP +#line 542 "ob_proxy_parser_utf8.l" +{ POP_STATE(); PUSH_STATE(INITIAL); return yytext[0]; } + YY_BREAK +case 110: +YY_RULE_SETUP +#line 543 "ob_proxy_parser_utf8.l" +{ return ERROR; } + YY_BREAK +case 111: +/* rule 111 can match eol */ +YY_RULE_SETUP +#line 545 "ob_proxy_parser_utf8.l" +{ SET_BASIC_STMT(OBPROXY_T_SHOW); return SHOW_DB_VERSION; } + YY_BREAK +case 112: +/* rule 112 can match eol */ +YY_RULE_SETUP +#line 546 "ob_proxy_parser_utf8.l" +{ SET_BASIC_STMT(OBPROXY_T_SHOW); return SHOW_DATABASES; } + YY_BREAK +case 113: +/* rule 113 can match eol */ +YY_RULE_SETUP +#line 547 "ob_proxy_parser_utf8.l" +{ SET_BASIC_STMT(OBPROXY_T_SHOW); return SHOW_TABLES; } + YY_BREAK +case 114: +/* rule 114 can match eol */ +YY_RULE_SETUP +#line 548 "ob_proxy_parser_utf8.l" +{ SET_BASIC_STMT(OBPROXY_T_SHOW); return SHOW_CREATE_TABLE; } + YY_BREAK +case 115: +/* rule 115 can match eol */ +YY_RULE_SETUP +#line 549 "ob_proxy_parser_utf8.l" +{ SET_DML_STMT(OBPROXY_T_SELECT); return SELECT_DATABASE; } + YY_BREAK +/*alter config*/ +case 116: +/* rule 116 can match eol */ +YY_RULE_SETUP +#line 552 "ob_proxy_parser_utf8.l" +{ SET_ICMD_STMT(OBPROXY_T_ICMD_ALTER_CONFIG); return ALTER_PROXYCONFIG; } + YY_BREAK +/*alter resource*/ +case 117: +/* rule 117 can match eol */ +YY_RULE_SETUP +#line 555 "ob_proxy_parser_utf8.l" +{ SET_ICMD_STMT(OBPROXY_T_ICMD_ALTER_RESOURCE); return ALTER_PROXYRESOURCE; } + YY_BREAK +/*ping proxy*/ +case 118: +/* rule 118 can match eol */ +YY_RULE_SETUP +#line 558 "ob_proxy_parser_utf8.l" +{ SET_ICMD_STMT(OBPROXY_T_PING_PROXY); return PING_PROXY; } + YY_BREAK +/*kill*/ +case 119: +/* rule 119 can match eol */ +YY_RULE_SETUP +#line 561 "ob_proxy_parser_utf8.l" +{ SET_ICMD_STMT(OBPROXY_T_ICMD_KILL_SESSION); return KILL_PROXYSESSION; } + YY_BREAK +case 120: +/* rule 120 can match eol */ +YY_RULE_SETUP +#line 562 "ob_proxy_parser_utf8.l" +{ SET_ICMD_STMT(OBPROXY_T_ICMD_KILL_GLOBAL_SESSION); return KILL_GLOBALSESSION; } + YY_BREAK +case 121: +YY_RULE_SETUP +#line 563 "ob_proxy_parser_utf8.l" +{ SET_ICMD_STMT(OBPROXY_T_ICMD_KILL_MYSQL); return KILL; } + YY_BREAK +case 122: +YY_RULE_SETUP +#line 564 "ob_proxy_parser_utf8.l" +{ RETURN_NON_RESERVED_KEYWORD(QUERY); } + YY_BREAK +/* obproxy_route_addr */ +case 123: +/* rule 123 can match eol */ +YY_RULE_SETUP +#line 567 "ob_proxy_parser_utf8.l" +{ return SELECT_OBPROXY_ROUTE_ADDR; } + YY_BREAK +case 124: +/* rule 124 can match eol */ +YY_RULE_SETUP +#line 568 "ob_proxy_parser_utf8.l" +{ return SET_OBPROXY_ROUTE_ADDR; } + YY_BREAK +/* identifer */ +case 125: +YY_RULE_SETUP +#line 571 "ob_proxy_parser_utf8.l" +{ SET_FOUND_ROWS(); RETURN_NON_RESERVED_KEYWORD(NAME_OB); } + YY_BREAK +case 126: +YY_RULE_SETUP +#line 572 "ob_proxy_parser_utf8.l" +{ SET_ROW_COUNT(); RETURN_NON_RESERVED_KEYWORD(NAME_OB); } + YY_BREAK +case 127: +YY_RULE_SETUP +#line 573 "ob_proxy_parser_utf8.l" +{ SET_LAST_INSERT_ID(); RETURN_NON_RESERVED_KEYWORD(NAME_OB); } + YY_BREAK +case 128: +YY_RULE_SETUP +#line 574 "ob_proxy_parser_utf8.l" +{ return ','; } + YY_BREAK +case 129: +YY_RULE_SETUP +#line 575 "ob_proxy_parser_utf8.l" +{ RETURN_INT_NUM(); } + YY_BREAK +case 130: +YY_RULE_SETUP +#line 576 "ob_proxy_parser_utf8.l" +{ RETURN_NON_RESERVED_KEYWORD(NAME_OB); } + YY_BREAK +case 131: +YY_RULE_SETUP +#line 577 "ob_proxy_parser_utf8.l" +{ RETURN_NON_RESERVED_KEYWORD_WITH_QUOTE(NAME_OB, OBPROXY_QUOTE_T_SINGLE); } + YY_BREAK +case 132: +YY_RULE_SETUP +#line 578 "ob_proxy_parser_utf8.l" +{ RETURN_NON_RESERVED_KEYWORD_WITH_QUOTE(NAME_OB, OBPROXY_QUOTE_T_DOUBLE); } + YY_BREAK +case 133: +YY_RULE_SETUP +#line 579 "ob_proxy_parser_utf8.l" +{ RETURN_NON_RESERVED_KEYWORD_WITH_QUOTE(NAME_OB, OBPROXY_QUOTE_T_BACK); } + YY_BREAK +case 134: +YY_RULE_SETUP +#line 580 "ob_proxy_parser_utf8.l" +{ RETURN_NUMBER_VAL(); } + YY_BREAK +case 135: +YY_RULE_SETUP +#line 581 "ob_proxy_parser_utf8.l" +{ return PLACE_HOLDER; } + YY_BREAK +case 136: +YY_RULE_SETUP +#line 582 "ob_proxy_parser_utf8.l" +{ return yytext[0]; } + YY_BREAK +case 137: +YY_RULE_SETUP +#line 583 "ob_proxy_parser_utf8.l" +{ RETURN_WITH_CALL_CHECK(yytext[0]); } + YY_BREAK +case 138: +YY_RULE_SETUP +#line 584 "ob_proxy_parser_utf8.l" +{ RETURN_WITH_CALL_CHECK('('); } + YY_BREAK +case 139: +YY_RULE_SETUP +#line 585 "ob_proxy_parser_utf8.l" +{ RETURN_WITH_CALL_CHECK(')'); } + YY_BREAK +case 140: +/* rule 140 can match eol */ +YY_RULE_SETUP +#line 586 "ob_proxy_parser_utf8.l" +{ } + YY_BREAK +/* hint option */ +case 141: +/* rule 141 can match eol */ +YY_RULE_SETUP +#line 589 "ob_proxy_parser_utf8.l" +{ + PUSH_STATE(in_expr); + PUSH_STATE(hint); + SET_BASIC_STMT(OBPROXY_T_SELECT); + return SELECT_HINT_BEGIN; +} + YY_BREAK +case 142: +/* rule 142 can match eol */ +YY_RULE_SETUP +#line 595 "ob_proxy_parser_utf8.l" +{ + PUSH_STATE(hint); + SET_BASIC_STMT(OBPROXY_T_UPDATE); + return UPDATE_HINT_BEGIN; +} + YY_BREAK +case 143: +/* rule 143 can match eol */ +YY_RULE_SETUP +#line 600 "ob_proxy_parser_utf8.l" +{ + PUSH_STATE(in_expr); + PUSH_STATE(hint); + SET_BASIC_STMT(OBPROXY_T_DELETE); + return DELETE_HINT_BEGIN; +} + YY_BREAK +case 144: +/* rule 144 can match eol */ +YY_RULE_SETUP +#line 606 "ob_proxy_parser_utf8.l" +{ + PUSH_STATE(hint); + SET_BASIC_STMT(OBPROXY_T_INSERT); + return INSERT_HINT_BEGIN; +} + YY_BREAK +case 145: +/* rule 145 can match eol */ +YY_RULE_SETUP +#line 611 "ob_proxy_parser_utf8.l" +{ + PUSH_STATE(hint); + SET_BASIC_STMT(OBPROXY_T_REPLACE); + return REPLACE_HINT_BEGIN; +} + YY_BREAK +case 146: +/* rule 146 can match eol */ +YY_RULE_SETUP +#line 616 "ob_proxy_parser_utf8.l" +{ + PUSH_STATE(hint); + SET_BASIC_STMT(OBPROXY_T_MERGE); + return MERGE_HINT_BEGIN; +} + YY_BREAK +case 147: +/* rule 147 can match eol */ +YY_RULE_SETUP +#line 622 "ob_proxy_parser_utf8.l" +{ return AUTOCOMMIT_0; } + YY_BREAK +case 148: +YY_RULE_SETUP +#line 623 "ob_proxy_parser_utf8.l" +{ return GLOBAL; } + YY_BREAK +case 149: +YY_RULE_SETUP +#line 624 "ob_proxy_parser_utf8.l" +{ return SESSION; } + YY_BREAK +case 150: +YY_RULE_SETUP +#line 625 "ob_proxy_parser_utf8.l" +{ RETURN_INT_NUM(); } + YY_BREAK +case 151: +YY_RULE_SETUP +#line 626 "ob_proxy_parser_utf8.l" +{ return ','; } + YY_BREAK +case 152: +YY_RULE_SETUP +#line 627 "ob_proxy_parser_utf8.l" +{ RETURN_NON_RESERVED_KEYWORD(NAME_OB); } + YY_BREAK +case 153: +YY_RULE_SETUP +#line 628 "ob_proxy_parser_utf8.l" +{ RETURN_NUMBER_VAL(); } + YY_BREAK +case 154: +/* rule 154 can match eol */ +YY_RULE_SETUP +#line 629 "ob_proxy_parser_utf8.l" +{ } + YY_BREAK +case 155: +YY_RULE_SETUP +#line 630 "ob_proxy_parser_utf8.l" +{ return yytext[0]; } + YY_BREAK +case YY_STATE_EOF(set_expr): +#line 631 "ob_proxy_parser_utf8.l" +{ return END_P; } + YY_BREAK +case 156: +YY_RULE_SETUP +#line 632 "ob_proxy_parser_utf8.l" +{ POP_STATE(); PUSH_STATE(INITIAL); return yytext[0]; } + YY_BREAK +case 157: +YY_RULE_SETUP +#line 634 "ob_proxy_parser_utf8.l" +{ + PUSH_STATE(sq); + ObProxyParseResult *p = (ObProxyParseResult *)yyextra; + if (OB_NOTNULL(p)) { + p->tmp_buf_ = (yytext + 1); + p->tmp_start_ptr_ = yytext; + p->tmp_len_ = 0; + } +} + YY_BREAK +case 158: +YY_RULE_SETUP +#line 644 "ob_proxy_parser_utf8.l" +{ + PUSH_STATE(dq); + ObProxyParseResult *p = (ObProxyParseResult *)yyextra; + if (OB_NOTNULL(p)) { + p->tmp_buf_ = (yytext + 1); + p->tmp_start_ptr_ = yytext; + p->tmp_len_ = 0; + } +} + YY_BREAK +case 159: +YY_RULE_SETUP +#line 654 "ob_proxy_parser_utf8.l" +{ + PUSH_STATE(bt); + ObProxyParseResult *p = (ObProxyParseResult *)yyextra; + if (NULL != p) { + p->tmp_buf_ = (char *)obproxy_parse_malloc(OBPROXY_MAX_NAME_LENGTH, p->malloc_pool_); + p->tmp_start_ptr_ = yytext; + p->tmp_len_ = 0; + } +} + YY_BREAK +case 160: +YY_RULE_SETUP +#line 663 "ob_proxy_parser_utf8.l" +{ return ERROR; } + YY_BREAK +case 161: +YY_RULE_SETUP +#line 665 "ob_proxy_parser_utf8.l" +{ POP_STATE(); RETURN_IGNORED_WORD(); } + YY_BREAK +case 162: +YY_RULE_SETUP +#line 666 "ob_proxy_parser_utf8.l" +{} + YY_BREAK +case 163: +YY_RULE_SETUP +#line 668 "ob_proxy_parser_utf8.l" +{ return '('; } + YY_BREAK +case 164: +YY_RULE_SETUP +#line 669 "ob_proxy_parser_utf8.l" +{ return ')'; } + YY_BREAK +case 165: +YY_RULE_SETUP +#line 670 "ob_proxy_parser_utf8.l" +{ return QUERY_TIMEOUT; } + YY_BREAK +case 166: +YY_RULE_SETUP +#line 671 "ob_proxy_parser_utf8.l" +{ RETURN_INT_NUM(); } + YY_BREAK +case 167: +YY_RULE_SETUP +#line 672 "ob_proxy_parser_utf8.l" +{ return READ_CONSISTENCY; } + YY_BREAK +case 168: +YY_RULE_SETUP +#line 673 "ob_proxy_parser_utf8.l" +{ return WEAK; } + YY_BREAK +case 169: +YY_RULE_SETUP +#line 674 "ob_proxy_parser_utf8.l" +{ return STRONG; } + YY_BREAK +case 170: +YY_RULE_SETUP +#line 675 "ob_proxy_parser_utf8.l" +{ return FROZEN; } + YY_BREAK +case 171: +YY_RULE_SETUP +#line 676 "ob_proxy_parser_utf8.l" +{ return INDEX; } + YY_BREAK +case 172: +YY_RULE_SETUP +#line 677 "ob_proxy_parser_utf8.l" +{ return yytext[0]; } + YY_BREAK +case 173: +YY_RULE_SETUP +#line 678 "ob_proxy_parser_utf8.l" +{ RETURN_NON_RESERVED_KEYWORD(NAME_OB); } + YY_BREAK +case 174: +YY_RULE_SETUP +#line 679 "ob_proxy_parser_utf8.l" +{ POP_STATE(); return HINT_END; } + YY_BREAK +case 175: +YY_RULE_SETUP +#line 680 "ob_proxy_parser_utf8.l" +{} + YY_BREAK +/* comment */ +case 176: +YY_RULE_SETUP +#line 683 "ob_proxy_parser_utf8.l" +{ + PUSH_STATE(in_c_comment); + ObProxyParseResult *p = (ObProxyParseResult *)yyextra; + if (OB_NOTNULL(p)) { + if (OBPROXY_T_INVALID == p->cur_stmt_type_) { + if (NULL == p->comment_begin_) { + p->comment_begin_ = yytext; + } + PUSH_STATE(in_comment_expr); + return COMMENT_BEGIN; + } + } +} + YY_BREAK +case 177: +YY_RULE_SETUP +#line 697 "ob_proxy_parser_utf8.l" +{ POP_STATE(); } + YY_BREAK +case 178: +/* rule 178 can match eol */ +YY_RULE_SETUP +#line 698 "ob_proxy_parser_utf8.l" +{} + YY_BREAK +case 179: +YY_RULE_SETUP +#line 699 "ob_proxy_parser_utf8.l" +{} + YY_BREAK +case 180: +YY_RULE_SETUP +#line 701 "ob_proxy_parser_utf8.l" +{ + ObProxyParseResult *p = (ObProxyParseResult *)yyextra; + if (OB_NOTNULL(p)) { + p->comment_end_ = yytext + 2; + } + POP_STATE(); + POP_STATE(); + return COMMENT_END; +} + YY_BREAK +case 181: +YY_RULE_SETUP +#line 711 "ob_proxy_parser_utf8.l" +{ PUSH_STATE(in_old_comment_expr); } + YY_BREAK +case 182: +/* rule 182 can match eol */ +YY_RULE_SETUP +#line 712 "ob_proxy_parser_utf8.l" +{ + PUSH_STATE(in_old_comment_expr); + ObProxyParseResult *p = (ObProxyParseResult *)yyextra; + if (OB_NOTNULL(p)) { + p->simple_route_info_.table_start_ptr_ = yytext; + return ROUTE_TABLE; + } +} + YY_BREAK +case 183: +/* rule 183 can match eol */ +YY_RULE_SETUP +#line 721 "ob_proxy_parser_utf8.l" +{ + PUSH_STATE(in_old_comment_expr); + ObProxyParseResult *p = (ObProxyParseResult *)yyextra; + if (OB_NOTNULL(p)) { + if (OBPROXY_T_INVALID == p->cur_stmt_type_) { + p->simple_route_info_.part_key_start_ptr_ = yytext; + return ROUTE_PART_KEY; + } + } +} + YY_BREAK +case 184: +YY_RULE_SETUP +#line 732 "ob_proxy_parser_utf8.l" +{ + ObProxyParseResult *p = (ObProxyParseResult *)yyextra; + if (OB_NOTNULL(p)) { + p->simple_route_info_.table_start_ptr_ = yytext; + return ROUTE_TABLE; + } +} + YY_BREAK +case 185: +YY_RULE_SETUP +#line 740 "ob_proxy_parser_utf8.l" +{ + ObProxyParseResult *p = (ObProxyParseResult *)yyextra; + if (OB_NOTNULL(p)) { + if (OBPROXY_T_INVALID == p->cur_stmt_type_) { + p->simple_route_info_.part_key_start_ptr_ = yytext; + return ROUTE_PART_KEY; + } + } +} + YY_BREAK +case 186: +YY_RULE_SETUP +#line 750 "ob_proxy_parser_utf8.l" +{ RETURN_NON_RESERVED_KEYWORD(NAME_OB); } + YY_BREAK +case 187: +YY_RULE_SETUP +#line 751 "ob_proxy_parser_utf8.l" +{ RETURN_NON_RESERVED_KEYWORD_WITH_QUOTE(NAME_OB, OBPROXY_QUOTE_T_SINGLE); } + YY_BREAK +case 188: +YY_RULE_SETUP +#line 752 "ob_proxy_parser_utf8.l" +{ RETURN_NON_RESERVED_KEYWORD_WITH_QUOTE(NAME_OB, OBPROXY_QUOTE_T_DOUBLE); } + YY_BREAK +case 189: +YY_RULE_SETUP +#line 753 "ob_proxy_parser_utf8.l" +{ RETURN_NON_RESERVED_KEYWORD_WITH_QUOTE(NAME_OB, OBPROXY_QUOTE_T_BACK); } + YY_BREAK +case 190: +YY_RULE_SETUP +#line 754 "ob_proxy_parser_utf8.l" +{ + ObProxyParseResult *p = (ObProxyParseResult *)yyextra; + if (OB_NOTNULL(p)) { + p->comment_end_ = yytext + 2; + } + POP_STATE(); + POP_STATE(); + POP_STATE(); + return COMMENT_END; +} + YY_BREAK +case 191: +YY_RULE_SETUP +#line 764 "ob_proxy_parser_utf8.l" +{} + YY_BREAK +case 192: +YY_RULE_SETUP +#line 766 "ob_proxy_parser_utf8.l" +{ PUSH_STATE(in_odp_comment_expr); RETURN_SHARD_COMMENT(ODP_COMMENT); } + YY_BREAK +case 193: +/* rule 193 can match eol */ +YY_RULE_SETUP +#line 767 "ob_proxy_parser_utf8.l" +{ PUSH_STATE(in_odp_comment_expr); RETURN_SHARD_COMMENT(GROUP_ID); } + YY_BREAK +case 194: +/* rule 194 can match eol */ +YY_RULE_SETUP +#line 768 "ob_proxy_parser_utf8.l" +{ PUSH_STATE(in_odp_comment_expr); RETURN_SHARD_COMMENT(TABLE_ID); } + YY_BREAK +case 195: +/* rule 195 can match eol */ +YY_RULE_SETUP +#line 769 "ob_proxy_parser_utf8.l" +{ PUSH_STATE(in_odp_comment_expr); RETURN_SHARD_COMMENT(TABLE_NAME); } + YY_BREAK +case 196: +/* rule 196 can match eol */ +YY_RULE_SETUP +#line 770 "ob_proxy_parser_utf8.l" +{ PUSH_STATE(in_odp_comment_expr); RETURN_SHARD_COMMENT(ELASTIC_ID); } + YY_BREAK +case 197: +/* rule 197 can match eol */ +YY_RULE_SETUP +#line 771 "ob_proxy_parser_utf8.l" +{ PUSH_STATE(in_odp_comment_expr); RETURN_SHARD_COMMENT(TESTLOAD); } + YY_BREAK +case 198: +/* rule 198 can match eol */ +YY_RULE_SETUP +#line 772 "ob_proxy_parser_utf8.l" +{ PUSH_STATE(in_odp_comment_expr); RETURN_SHARD_COMMENT(DISASTER_STATUS); } + YY_BREAK +case 199: +/* rule 199 can match eol */ +YY_RULE_SETUP +#line 773 "ob_proxy_parser_utf8.l" +{ PUSH_STATE(in_odp_comment_expr); RETURN_SHARD_COMMENT(TNT_ID); } + YY_BREAK +case 200: +/* rule 200 can match eol */ +YY_RULE_SETUP +#line 774 "ob_proxy_parser_utf8.l" +{ PUSH_STATE(in_odp_comment_expr); RETURN_SHARD_COMMENT(TRACE_ID); } + YY_BREAK +case 201: +/* rule 201 can match eol */ +YY_RULE_SETUP +#line 775 "ob_proxy_parser_utf8.l" +{ PUSH_STATE(in_odp_comment_expr); RETURN_SHARD_COMMENT_NAME_OB_DOT(NAME_OB_DOT); } + YY_BREAK +case 202: +/* rule 202 can match eol */ +YY_RULE_SETUP +#line 776 "ob_proxy_parser_utf8.l" +{ PUSH_STATE(in_odp_comment_expr); RETURN_SHARD_COMMENT(RPC_ID); } + YY_BREAK +case 203: +YY_RULE_SETUP +#line 778 "ob_proxy_parser_utf8.l" +{ return GROUP_ID; } + YY_BREAK +case 204: +YY_RULE_SETUP +#line 779 "ob_proxy_parser_utf8.l" +{ return TABLE_ID; } + YY_BREAK +case 205: +YY_RULE_SETUP +#line 780 "ob_proxy_parser_utf8.l" +{ return TABLE_NAME; } + YY_BREAK +case 206: +YY_RULE_SETUP +#line 781 "ob_proxy_parser_utf8.l" +{ return ELASTIC_ID; } + YY_BREAK +case 207: +YY_RULE_SETUP +#line 782 "ob_proxy_parser_utf8.l" +{ return TESTLOAD; } + YY_BREAK +case 208: +YY_RULE_SETUP +#line 783 "ob_proxy_parser_utf8.l" +{ return DISASTER_STATUS; } + YY_BREAK +case 209: +YY_RULE_SETUP +#line 784 "ob_proxy_parser_utf8.l" +{ return TNT_ID; } + YY_BREAK +case 210: +YY_RULE_SETUP +#line 785 "ob_proxy_parser_utf8.l" +{ return TRACE_ID; } + YY_BREAK +case 211: +YY_RULE_SETUP +#line 786 "ob_proxy_parser_utf8.l" +{ return RPC_ID; } + YY_BREAK +case 212: +YY_RULE_SETUP +#line 787 "ob_proxy_parser_utf8.l" +{ ENTER_QUOTE_STATE(comment_sq); } + YY_BREAK +case 213: +YY_RULE_SETUP +#line 788 "ob_proxy_parser_utf8.l" +{ return ','; } + YY_BREAK +case 214: +YY_RULE_SETUP +#line 789 "ob_proxy_parser_utf8.l" +{ RETURN_NON_RESERVED_KEYWORD(NAME_OB); } + YY_BREAK +case 215: +YY_RULE_SETUP +#line 790 "ob_proxy_parser_utf8.l" +{ PUSH_STATE(in_odp_comment_value_expr); return yytext[0]; } + YY_BREAK +case 216: +YY_RULE_SETUP +#line 791 "ob_proxy_parser_utf8.l" +{ return yytext[0]; } + YY_BREAK +case 217: +/* rule 217 can match eol */ +YY_RULE_SETUP +#line 792 "ob_proxy_parser_utf8.l" +{} + YY_BREAK +case 218: +YY_RULE_SETUP +#line 793 "ob_proxy_parser_utf8.l" +{ return ERROR; } + YY_BREAK +case 219: +YY_RULE_SETUP +#line 794 "ob_proxy_parser_utf8.l" +{ + ObProxyParseResult *p = (ObProxyParseResult *)yyextra; + if (OB_NOTNULL(p)) { + p->comment_end_ = yytext + 2; + } + POP_STATE(); + POP_STATE(); + POP_STATE(); + return COMMENT_END; +} + YY_BREAK +case 220: +YY_RULE_SETUP +#line 805 "ob_proxy_parser_utf8.l" +{ ENTER_QUOTE_STATE(comment_sq); } + YY_BREAK +case 221: +YY_RULE_SETUP +#line 806 "ob_proxy_parser_utf8.l" +{ + POP_STATE(); + return ','; +} + YY_BREAK +case 222: +YY_RULE_SETUP +#line 810 "ob_proxy_parser_utf8.l" +{ + ObProxyParseResult *p = (ObProxyParseResult *)yyextra; + if (OB_NOTNULL(p)) { + p->comment_end_ = yytext + 2; + } + POP_STATE(); + POP_STATE(); + POP_STATE(); + POP_STATE(); + return COMMENT_END; +} + YY_BREAK +case 223: +/* rule 223 can match eol */ +YY_RULE_SETUP +#line 821 "ob_proxy_parser_utf8.l" +{} + YY_BREAK +case 224: +YY_RULE_SETUP +#line 822 "ob_proxy_parser_utf8.l" +{ + do { + PUSH_STATE(in_odp_comment_value_expr_calc) + ObProxyParseResult *p = (ObProxyParseResult *)yyextra; + if (OB_NOTNULL(p)) { + p->tmp_buf_ = yytext; + p->tmp_start_ptr_ = yytext; + p->tmp_len_ = 1; + } + } while (0); +} + YY_BREAK +case 225: +/* rule 225 can match eol */ +YY_RULE_SETUP +#line 834 "ob_proxy_parser_utf8.l" +{ + POP_STATE(); + ObProxyParseResult *p = (ObProxyParseResult *)yyextra; + if (OB_NOTNULL(p) && OB_NOTNULL(p->tmp_buf_)) { + store_str(p->tmp_buf_, p->tmp_len_, p->tmp_start_ptr_ + p->tmp_len_, yyscanner); + yyless(0); + return NAME_STR; + } else { + RETURN_IGNORED_WORD(); + } +} + YY_BREAK +case 226: +YY_RULE_SETUP +#line 846 "ob_proxy_parser_utf8.l" +{ + ObProxyParseResult *p = (ObProxyParseResult *)yyextra; + if (OB_NOTNULL(p)) { + p->tmp_len_ += yyleng; + } +} + YY_BREAK +case 227: +YY_RULE_SETUP +#line 853 "ob_proxy_parser_utf8.l" +{ PUSH_STATE(in_dbp_comment_expr); RETURN_SHARD_COMMENT(DBP_COMMENT); } + YY_BREAK +case 228: +YY_RULE_SETUP +#line 854 "ob_proxy_parser_utf8.l" +{ return ROUTE_TAG; } + YY_BREAK +case 229: +YY_RULE_SETUP +#line 855 "ob_proxy_parser_utf8.l" +{ return SYS_TAG; } + YY_BREAK +case 230: +YY_RULE_SETUP +#line 856 "ob_proxy_parser_utf8.l" +{ return SCAN_ALL; } + YY_BREAK +case 231: +YY_RULE_SETUP +#line 857 "ob_proxy_parser_utf8.l" +{ return SHARD_KEY; } + YY_BREAK +case 232: +YY_RULE_SETUP +#line 858 "ob_proxy_parser_utf8.l" +{ return TABLE_NAME;} + YY_BREAK +case 233: +YY_RULE_SETUP +#line 859 "ob_proxy_parser_utf8.l" +{ return PARALL; } + YY_BREAK +case 234: +YY_RULE_SETUP +#line 860 "ob_proxy_parser_utf8.l" +{ return GROUP_ID; } + YY_BREAK +case 235: +YY_RULE_SETUP +#line 861 "ob_proxy_parser_utf8.l" +{ PUSH_STATE(in_dbp_comment_trace_expr); return TRACE; } + YY_BREAK +case 236: +YY_RULE_SETUP +#line 862 "ob_proxy_parser_utf8.l" +{ ENTER_QUOTE_STATE(comment_sq); } + YY_BREAK +case 237: +YY_RULE_SETUP +#line 863 "ob_proxy_parser_utf8.l" +{ return yytext[0]; } + YY_BREAK +case 238: +YY_RULE_SETUP +#line 864 "ob_proxy_parser_utf8.l" +{ return '('; } + YY_BREAK +case 239: +YY_RULE_SETUP +#line 865 "ob_proxy_parser_utf8.l" +{ return ')'; } + YY_BREAK +case 240: +YY_RULE_SETUP +#line 866 "ob_proxy_parser_utf8.l" +{ return ','; } + YY_BREAK +case 241: +/* rule 241 can match eol */ +YY_RULE_SETUP +#line 867 "ob_proxy_parser_utf8.l" +{ } + YY_BREAK +case 242: +YY_RULE_SETUP +#line 868 "ob_proxy_parser_utf8.l" +{ RETURN_NON_RESERVED_KEYWORD(NAME_OB); } + YY_BREAK +case 243: +YY_RULE_SETUP +#line 870 "ob_proxy_parser_utf8.l" +{ + ObProxyParseResult *p = (ObProxyParseResult *)yyextra; + if (OB_NOTNULL(p)) { + p->comment_end_ = yytext + 2; + } + POP_STATE(); + POP_STATE(); + POP_STATE(); + return COMMENT_END; +} + YY_BREAK +case 244: +YY_RULE_SETUP +#line 880 "ob_proxy_parser_utf8.l" +{return yytext[0];} + YY_BREAK +case 245: +YY_RULE_SETUP +#line 881 "ob_proxy_parser_utf8.l" +{ PUSH_STATE(in_dbp_comment_trace_value_expr); return '('; } + YY_BREAK +case 246: +/* rule 246 can match eol */ +YY_RULE_SETUP +#line 882 "ob_proxy_parser_utf8.l" +{} + YY_BREAK +case 247: +YY_RULE_SETUP +#line 884 "ob_proxy_parser_utf8.l" +{ ENTER_QUOTE_STATE(comment_sq); } + YY_BREAK +case 248: +YY_RULE_SETUP +#line 885 "ob_proxy_parser_utf8.l" +{ + POP_STATE(); + POP_STATE(); + return ')'; +} + YY_BREAK +case 249: +YY_RULE_SETUP +#line 890 "ob_proxy_parser_utf8.l" +{ + do { + PUSH_STATE(in_dbp_comment_trace_value_expr_calc) + ObProxyParseResult *p = (ObProxyParseResult *)yyextra; + if (OB_NOTNULL(p)) { + p->tmp_buf_ = yytext; + p->tmp_start_ptr_ = yytext; + p->tmp_len_ = 1; + } + return yytext[0]; + } while (0); +} + YY_BREAK +case 250: +YY_RULE_SETUP +#line 902 "ob_proxy_parser_utf8.l" +{ + ObProxyParseResult *p = (ObProxyParseResult *)yyextra; + if (OB_NOTNULL(p)) { + p->comment_end_ = yytext + 2; + } + POP_STATE(); + POP_STATE(); + POP_STATE(); + POP_STATE(); + POP_STATE(); + return COMMENT_END; +} + YY_BREAK +case 251: +/* rule 251 can match eol */ +YY_RULE_SETUP +#line 914 "ob_proxy_parser_utf8.l" +{} + YY_BREAK +case 252: +YY_RULE_SETUP +#line 915 "ob_proxy_parser_utf8.l" +{ + do { + PUSH_STATE(in_dbp_comment_trace_value_expr_calc) + ObProxyParseResult *p = (ObProxyParseResult *)yyextra; + if (OB_NOTNULL(p)) { + p->tmp_buf_ = yytext; + p->tmp_start_ptr_ = yytext; + p->tmp_len_ = 0; + } + } while (0); +} + YY_BREAK +case 253: +/* rule 253 can match eol */ +YY_RULE_SETUP +#line 927 "ob_proxy_parser_utf8.l" +{ + POP_STATE(); + ObProxyParseResult *p = (ObProxyParseResult *)yyextra; + if (OB_NOTNULL(p) && OB_NOTNULL(p->tmp_buf_)) { + store_str(p->tmp_buf_, p->tmp_len_, p->tmp_start_ptr_ + p->tmp_len_, yyscanner); + yyless(0); + return NAME_STR; + } else { + RETURN_IGNORED_WORD(); + } +} + YY_BREAK +case 254: +YY_RULE_SETUP +#line 939 "ob_proxy_parser_utf8.l" +{ + ObProxyParseResult *p = (ObProxyParseResult *)yyextra; + if (OB_NOTNULL(p)) { + p->tmp_len_ += yyleng; + } +} + YY_BREAK +/* quote */ +case 255: +YY_RULE_SETUP +#line 947 "ob_proxy_parser_utf8.l" +{ + PUSH_STATE(sq); + ObProxyParseResult *p = (ObProxyParseResult *)yyextra; + if (OB_NOTNULL(p)) { + p->tmp_buf_ = (yytext + 1); + p->tmp_start_ptr_ = yytext; + p->tmp_len_ = 0; + } +} + YY_BREAK +case 256: +/* rule 256 can match eol */ +YY_RULE_SETUP +#line 957 "ob_proxy_parser_utf8.l" +{ + ObProxyParseResult *p = (ObProxyParseResult *)yyextra; + if (OB_NOTNULL(p)) { + p->tmp_len_ += yyleng; + } +} + YY_BREAK +case 257: +YY_RULE_SETUP +#line 964 "ob_proxy_parser_utf8.l" +{ + POP_STATE(); + ObProxyParseResult *p = (ObProxyParseResult *)yyextra; + if (OB_NOTNULL(p) + && OBPROXY_T_INVALID < p->cur_stmt_type_ + && (p->cur_stmt_type_ < OBPROXY_T_ICMD_MAX + || OBPROXY_T_CALL == p->cur_stmt_type_ + || OBPROXY_T_SET == p->cur_stmt_type_) + && OB_NOTNULL(p->tmp_buf_)) { + store_str_with_quote(OBPROXY_QUOTE_T_SINGLE, p->tmp_buf_, p->tmp_len_, p->tmp_start_ptr_ + p->tmp_len_ + 2, yyscanner); + return NAME_OB; + } else { + RETURN_IGNORED_WORD(); + } +} + YY_BREAK +case 258: +YY_RULE_SETUP +#line 980 "ob_proxy_parser_utf8.l" +{} + YY_BREAK +case 259: +/* rule 259 can match eol */ +YY_RULE_SETUP +#line 981 "ob_proxy_parser_utf8.l" +{} + YY_BREAK +case 260: +/* rule 260 can match eol */ +YY_RULE_SETUP +#line 982 "ob_proxy_parser_utf8.l" +{} + YY_BREAK +case YY_STATE_EOF(sq): +#line 983 "ob_proxy_parser_utf8.l" +{ return ERROR; } + YY_BREAK +/* comment sq return name_str */ +case 261: +/* rule 261 can match eol */ +YY_RULE_SETUP +#line 986 "ob_proxy_parser_utf8.l" +{ + ObProxyParseResult *p = (ObProxyParseResult *)yyextra; + if (OB_NOTNULL(p)) { + p->tmp_len_ += yyleng; + } +} + YY_BREAK +case 262: +YY_RULE_SETUP +#line 993 "ob_proxy_parser_utf8.l" +{ + POP_STATE(); + ObProxyParseResult *p = (ObProxyParseResult *)yyextra; + if (OB_NOTNULL(p) && OB_NOTNULL(p->tmp_buf_)) { + store_str(p->tmp_buf_, p->tmp_len_, p->tmp_start_ptr_ + p->tmp_len_ + 2, yyscanner); + return NAME_STR;; + } else { + RETURN_IGNORED_WORD(); + } +} + YY_BREAK +case 263: +YY_RULE_SETUP +#line 1004 "ob_proxy_parser_utf8.l" +{} + YY_BREAK +case 264: +/* rule 264 can match eol */ +YY_RULE_SETUP +#line 1005 "ob_proxy_parser_utf8.l" +{} + YY_BREAK +case 265: +/* rule 265 can match eol */ +YY_RULE_SETUP +#line 1006 "ob_proxy_parser_utf8.l" +{} + YY_BREAK +case YY_STATE_EOF(comment_sq): +#line 1007 "ob_proxy_parser_utf8.l" +{ return ERROR; } + YY_BREAK +/* dquote */ +case 266: +YY_RULE_SETUP +#line 1010 "ob_proxy_parser_utf8.l" +{ + PUSH_STATE(dq); + ObProxyParseResult *p = (ObProxyParseResult *)yyextra; + if (OB_NOTNULL(p)) { + p->tmp_buf_ = (yytext + 1); + p->tmp_start_ptr_ = yytext; + p->tmp_len_ = 0; + } +} + YY_BREAK +case 267: +/* rule 267 can match eol */ +YY_RULE_SETUP +#line 1020 "ob_proxy_parser_utf8.l" +{ + ObProxyParseResult *p = (ObProxyParseResult *)yyextra; + if (OB_NOTNULL(p)) { + p->tmp_len_ += yyleng; + } +} + YY_BREAK +case 268: +YY_RULE_SETUP +#line 1027 "ob_proxy_parser_utf8.l" +{ + POP_STATE(); + ObProxyParseResult *p = (ObProxyParseResult *)yyextra; + if (OB_NOTNULL(p) + && OBPROXY_T_INVALID < p->cur_stmt_type_ + && (p->cur_stmt_type_ < OBPROXY_T_ICMD_MAX + || OBPROXY_T_CALL == p->cur_stmt_type_ + || OBPROXY_T_SET == p->cur_stmt_type_) + && OB_NOTNULL(p->tmp_buf_)) { + store_str_with_quote(OBPROXY_QUOTE_T_DOUBLE, p->tmp_buf_, p->tmp_len_, p->tmp_start_ptr_ + p->tmp_len_ + 2, yyscanner); + return NAME_OB; + } else { + RETURN_IGNORED_WORD(); + } +} + YY_BREAK +case 269: +YY_RULE_SETUP +#line 1043 "ob_proxy_parser_utf8.l" +{} + YY_BREAK +case 270: +/* rule 270 can match eol */ +YY_RULE_SETUP +#line 1044 "ob_proxy_parser_utf8.l" +{} + YY_BREAK +case 271: +/* rule 271 can match eol */ +YY_RULE_SETUP +#line 1045 "ob_proxy_parser_utf8.l" +{} + YY_BREAK +case YY_STATE_EOF(dq): +#line 1046 "ob_proxy_parser_utf8.l" +{ return ERROR; } + YY_BREAK +/* backtick */ +case 272: +YY_RULE_SETUP +#line 1050 "ob_proxy_parser_utf8.l" +{ + PUSH_STATE(bt); + ObProxyParseResult *p = (ObProxyParseResult *)yyextra; + if (NULL != p) { + p->tmp_buf_ = (char *)obproxy_parse_malloc(OBPROXY_MAX_NAME_LENGTH, p->malloc_pool_); + p->tmp_start_ptr_ = yytext; + p->tmp_len_ = 0; + } +} + YY_BREAK +case 273: +YY_RULE_SETUP +#line 1060 "ob_proxy_parser_utf8.l" +{ + ObProxyParseResult *p = (ObProxyParseResult *)yyextra; + if (NULL != p && NULL != p->tmp_buf_ && p->tmp_len_ + 1 < OBPROXY_MAX_NAME_LENGTH) { + p->tmp_buf_[p->tmp_len_++] = '`'; + } +} + YY_BREAK +case 274: +/* rule 274 can match eol */ +YY_RULE_SETUP +#line 1067 "ob_proxy_parser_utf8.l" +{ + ObProxyParseResult *p = (ObProxyParseResult *)yyextra; + if (NULL != p && NULL != p->tmp_buf_ && p->tmp_len_ + yyleng < OBPROXY_MAX_NAME_LENGTH) { + memcpy(p->tmp_buf_ + p->tmp_len_, yytext, yyleng); + p->tmp_len_ += yyleng; + } +} + YY_BREAK +case 275: +YY_RULE_SETUP +#line 1075 "ob_proxy_parser_utf8.l" +{ + POP_STATE(); + ObProxyParseResult *p = (ObProxyParseResult *)yyextra; + if (NULL != p && NULL != p->tmp_buf_) { + yylval->str.str_ = obproxy_parse_strndup(p->tmp_buf_, p->tmp_len_, p->malloc_pool_); + yylval->str.str_len_ = p->tmp_len_; + yylval->str.end_ptr_ = p->tmp_start_ptr_ + p->tmp_len_ + 2; + yylval->str.quote_type_ = OBPROXY_QUOTE_T_BACK; + } + return NAME_OB; +} + YY_BREAK +case YY_STATE_EOF(bt): +#line 1087 "ob_proxy_parser_utf8.l" +{ + return ERROR; +} + YY_BREAK +case 276: +YY_RULE_SETUP +#line 1091 "ob_proxy_parser_utf8.l" +{} + YY_BREAK +case 277: +/* rule 277 can match eol */ +YY_RULE_SETUP +#line 1092 "ob_proxy_parser_utf8.l" +{} + YY_BREAK +case 278: +YY_RULE_SETUP +#line 1093 "ob_proxy_parser_utf8.l" +{ POP_STATE(); RETURN_IGNORED_WORD(); } + YY_BREAK +case YY_STATE_EOF(bt_in_expr): +#line 1094 "ob_proxy_parser_utf8.l" +{ return ERROR; } + YY_BREAK +/* some useful keyword */ +case 279: +/* rule 279 can match eol */ +YY_RULE_SETUP +#line 1097 "ob_proxy_parser_utf8.l" +{ RETURN_IGNORED_WORD_FOR_DUAL(); } + YY_BREAK +case 280: +YY_RULE_SETUP +#line 1098 "ob_proxy_parser_utf8.l" +{ POP_STATE(); PUSH_STATE(INITIAL); return FROM; } + YY_BREAK +case 281: +YY_RULE_SETUP +#line 1099 "ob_proxy_parser_utf8.l" +{ PUSH_STATE(in_subquery); return '('; } + YY_BREAK +case 282: +YY_RULE_SETUP +#line 1100 "ob_proxy_parser_utf8.l" +{ PUSH_STATE(dq); } + YY_BREAK +case 283: +YY_RULE_SETUP +#line 1101 "ob_proxy_parser_utf8.l" +{ PUSH_STATE(sq); } + YY_BREAK +case 284: +YY_RULE_SETUP +#line 1102 "ob_proxy_parser_utf8.l" +{ PUSH_STATE(bt_in_expr); } + YY_BREAK +case 285: +YY_RULE_SETUP +#line 1103 "ob_proxy_parser_utf8.l" +{ SET_FOUND_ROWS(); RETURN_IGNORED_WORD(); } + YY_BREAK +case 286: +YY_RULE_SETUP +#line 1104 "ob_proxy_parser_utf8.l" +{ SET_ROW_COUNT(); RETURN_IGNORED_WORD(); } + YY_BREAK +case 287: +YY_RULE_SETUP +#line 1105 "ob_proxy_parser_utf8.l" +{ SET_LAST_INSERT_ID(); RETURN_IGNORED_WORD(); } + YY_BREAK +case 288: +YY_RULE_SETUP +#line 1106 "ob_proxy_parser_utf8.l" +{ SET_GLOBAL_SET_STMT(); RETURN_IGNORED_WORD(); } + YY_BREAK +case 289: +/* rule 289 can match eol */ +YY_RULE_SETUP +#line 1107 "ob_proxy_parser_utf8.l" +{ RETURN_COL_NAME(TX_READ_ONLY); } + YY_BREAK +case 290: +/* rule 290 can match eol */ +YY_RULE_SETUP +#line 1108 "ob_proxy_parser_utf8.l" +{ return AUTOCOMMIT_0; } + YY_BREAK +case 291: +YY_RULE_SETUP +#line 1109 "ob_proxy_parser_utf8.l" +{ RETURN_IGNORED_WORD(); } + YY_BREAK +case YY_STATE_EOF(in_expr): +#line 1110 "ob_proxy_parser_utf8.l" +{ return END_P; } + YY_BREAK +case 292: +/* rule 292 can match eol */ +YY_RULE_SETUP +#line 1111 "ob_proxy_parser_utf8.l" +{ } + YY_BREAK +case 293: +YY_RULE_SETUP +#line 1112 "ob_proxy_parser_utf8.l" +{ POP_STATE(); PUSH_STATE(INITIAL); return yytext[0]; } + YY_BREAK +case 294: +YY_RULE_SETUP +#line 1113 "ob_proxy_parser_utf8.l" +{ RETURN_IGNORED_WORD(); } + YY_BREAK +case 295: +YY_RULE_SETUP +#line 1115 "ob_proxy_parser_utf8.l" +{ PUSH_STATE(in_expr); return SELECT; } + YY_BREAK +case 296: +YY_RULE_SETUP +#line 1116 "ob_proxy_parser_utf8.l" +{ PUSH_STATE(in_subquery); return '('; } + YY_BREAK +case 297: +YY_RULE_SETUP +#line 1117 "ob_proxy_parser_utf8.l" +{ POP_STATE(); return ')'; } + YY_BREAK +case 298: +YY_RULE_SETUP +#line 1118 "ob_proxy_parser_utf8.l" +{ PUSH_STATE(dq); } + YY_BREAK +case 299: +YY_RULE_SETUP +#line 1119 "ob_proxy_parser_utf8.l" +{ PUSH_STATE(sq); } + YY_BREAK +case YY_STATE_EOF(in_subquery): +#line 1120 "ob_proxy_parser_utf8.l" +{ return END_P; } + YY_BREAK +case 300: +/* rule 300 can match eol */ +YY_RULE_SETUP +#line 1121 "ob_proxy_parser_utf8.l" +{ } + YY_BREAK +case 301: +YY_RULE_SETUP +#line 1122 "ob_proxy_parser_utf8.l" +{ PUSH_STATE(in_no_select_query); RETURN_IGNORED_WORD(); } + YY_BREAK +case 302: +YY_RULE_SETUP +#line 1124 "ob_proxy_parser_utf8.l" +{ PUSH_STATE(in_subquery); return '('; } + YY_BREAK +case 303: +YY_RULE_SETUP +#line 1125 "ob_proxy_parser_utf8.l" +{ POP_STATE(); POP_STATE(); return ')'; } + YY_BREAK +case 304: +YY_RULE_SETUP +#line 1126 "ob_proxy_parser_utf8.l" +{ PUSH_STATE(dq); } + YY_BREAK +case 305: +YY_RULE_SETUP +#line 1127 "ob_proxy_parser_utf8.l" +{ PUSH_STATE(sq); } + YY_BREAK +case 306: +YY_RULE_SETUP +#line 1128 "ob_proxy_parser_utf8.l" +{ SET_FOUND_ROWS(); RETURN_IGNORED_WORD(); } + YY_BREAK +case 307: +YY_RULE_SETUP +#line 1129 "ob_proxy_parser_utf8.l" +{ SET_ROW_COUNT(); RETURN_IGNORED_WORD(); } + YY_BREAK +case 308: +YY_RULE_SETUP +#line 1130 "ob_proxy_parser_utf8.l" +{ SET_LAST_INSERT_ID(); RETURN_IGNORED_WORD(); } + YY_BREAK +case 309: +YY_RULE_SETUP +#line 1131 "ob_proxy_parser_utf8.l" +{ RETURN_IGNORED_WORD(); } + YY_BREAK +case YY_STATE_EOF(in_no_select_query): +#line 1132 "ob_proxy_parser_utf8.l" +{ return END_P; } + YY_BREAK +case 310: +/* rule 310 can match eol */ +YY_RULE_SETUP +#line 1133 "ob_proxy_parser_utf8.l" +{ } + YY_BREAK +case 311: +YY_RULE_SETUP +#line 1134 "ob_proxy_parser_utf8.l" +{ RETURN_IGNORED_WORD(); } + YY_BREAK +case 312: +YY_RULE_SETUP +#line 1136 "ob_proxy_parser_utf8.l" +{ return FROM; } + YY_BREAK +case 313: +YY_RULE_SETUP +#line 1137 "ob_proxy_parser_utf8.l" +{ RETURN_NON_RESERVED_KEYWORD(NAME_OB); } + YY_BREAK +case 314: +YY_RULE_SETUP +#line 1138 "ob_proxy_parser_utf8.l" +{ POP_STATE(); } + YY_BREAK +case 315: +YY_RULE_SETUP +#line 1139 "ob_proxy_parser_utf8.l" +{ POP_STATE(); } + YY_BREAK +case 316: +YY_RULE_SETUP +#line 1141 "ob_proxy_parser_utf8.l" +{ POP_STATE(); return BEGI;} + YY_BREAK +case 317: +YY_RULE_SETUP +#line 1142 "ob_proxy_parser_utf8.l" +{} + YY_BREAK +case YY_STATE_EOF(INITIAL): +case YY_STATE_EOF(hint): +case YY_STATE_EOF(in_c_comment): +case YY_STATE_EOF(in_comment_expr): +case YY_STATE_EOF(in_old_comment_expr): +case YY_STATE_EOF(in_odp_comment_expr): +case YY_STATE_EOF(in_odp_comment_value_expr): +case YY_STATE_EOF(in_odp_comment_value_expr_calc): +case YY_STATE_EOF(in_ignored_comment_expr): +case YY_STATE_EOF(in_dbp_comment_expr): +case YY_STATE_EOF(in_dbp_comment_trace_expr): +case YY_STATE_EOF(in_dbp_comment_trace_value_expr): +case YY_STATE_EOF(in_dbp_comment_trace_value_expr_calc): +case YY_STATE_EOF(in_anonymous_block): +case YY_STATE_EOF(prepare): +case YY_STATE_EOF(insert_all_expr): +#line 1144 "ob_proxy_parser_utf8.l" +{ return END_P; } + YY_BREAK +case 318: +YY_RULE_SETUP +#line 1145 "ob_proxy_parser_utf8.l" +{ RETURN_IGNORED_WORD(); } + YY_BREAK +case 319: +YY_RULE_SETUP +#line 1146 "ob_proxy_parser_utf8.l" +ECHO; + YY_BREAK +#line 5233 "ob_proxy_parser_utf8_lex.c" + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = yyg->yy_hold_char; + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * ob_proxy_parser_utf8_yylex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( yyscanner ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner); + + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++yyg->yy_c_buf_p; + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = yyg->yy_c_buf_p; + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( yyscanner ) ) + { + case EOB_ACT_END_OF_FILE: + { + yyg->yy_did_buffer_switch_on_eof = 0; + + if ( ob_proxy_parser_utf8_yywrap(yyscanner ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! yyg->yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + yyg->yy_c_buf_p = + yyg->yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( yyscanner ); + + yy_cp = yyg->yy_c_buf_p; + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + yyg->yy_c_buf_p = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars]; + + yy_current_state = yy_get_previous_state( yyscanner ); + + yy_cp = yyg->yy_c_buf_p; + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ +} /* end of ob_proxy_parser_utf8_yylex */ + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ +static int yy_get_next_buffer (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = yyg->yytext_ptr; + register int number_to_move, i; + int ret_val; + + if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0; + + else + { + int num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + + int yy_c_buf_p_offset = + (int) (yyg->yy_c_buf_p - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + ob_proxy_parser_utf8_yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + yyg->yy_n_chars, (size_t) num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + if ( yyg->yy_n_chars == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + ob_proxy_parser_utf8_yyrestart(yyin ,yyscanner); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) ob_proxy_parser_utf8_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + } + + yyg->yy_n_chars += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + + yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +} + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + + static yy_state_type yy_get_previous_state (yyscan_t yyscanner) +{ + register yy_state_type yy_current_state; + register char *yy_cp; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + yy_current_state = yyg->yy_start; + + for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + yyg->yy_last_accepting_state = yy_current_state; + yyg->yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 2073 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + } + + return yy_current_state; +} + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner) +{ + register int yy_is_jam; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */ + register char *yy_cp = yyg->yy_c_buf_p; + + register YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + yyg->yy_last_accepting_state = yy_current_state; + yyg->yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 2073 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 2072); + + return yy_is_jam ? 0 : yy_current_state; +} + +#ifndef YY_NO_INPUT +#ifdef __cplusplus + static int yyinput (yyscan_t yyscanner) +#else + static int input (yyscan_t yyscanner) +#endif + +{ + int c; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + *yyg->yy_c_buf_p = yyg->yy_hold_char; + + if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) + /* This was really a NUL. */ + *yyg->yy_c_buf_p = '\0'; + + else + { /* need more input */ + int offset = yyg->yy_c_buf_p - yyg->yytext_ptr; + ++yyg->yy_c_buf_p; + + switch ( yy_get_next_buffer( yyscanner ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + ob_proxy_parser_utf8_yyrestart(yyin ,yyscanner); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( ob_proxy_parser_utf8_yywrap(yyscanner ) ) + return EOF; + + if ( ! yyg->yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(yyscanner); +#else + return input(yyscanner); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + yyg->yy_c_buf_p = yyg->yytext_ptr + offset; + break; + } + } + } + + c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */ + *yyg->yy_c_buf_p = '\0'; /* preserve yytext */ + yyg->yy_hold_char = *++yyg->yy_c_buf_p; + + return c; +} +#endif /* ifndef YY_NO_INPUT */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * @param yyscanner The scanner object. + * @note This function does not reset the start condition to @c INITIAL . + */ + void ob_proxy_parser_utf8_yyrestart (FILE * input_file , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if ( ! YY_CURRENT_BUFFER ){ + ob_proxy_parser_utf8_yyensure_buffer_stack (yyscanner); + YY_CURRENT_BUFFER_LVALUE = + ob_proxy_parser_utf8_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); + } + + ob_proxy_parser_utf8_yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner); + ob_proxy_parser_utf8_yy_load_buffer_state(yyscanner ); +} + +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * @param yyscanner The scanner object. + */ + void ob_proxy_parser_utf8_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* TODO. We should be able to replace this entire function body + * with + * ob_proxy_parser_utf8_yypop_buffer_state(); + * ob_proxy_parser_utf8_yypush_buffer_state(new_buffer); + */ + ob_proxy_parser_utf8_yyensure_buffer_stack (yyscanner); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *yyg->yy_c_buf_p = yyg->yy_hold_char; + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + ob_proxy_parser_utf8_yy_load_buffer_state(yyscanner ); + + /* We don't actually know whether we did this switch during + * EOF (ob_proxy_parser_utf8_yywrap()) processing, but the only time this flag + * is looked at is after ob_proxy_parser_utf8_yywrap() is called, so it's safe + * to go ahead and always set it. + */ + yyg->yy_did_buffer_switch_on_eof = 1; +} + +static void ob_proxy_parser_utf8_yy_load_buffer_state (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + yyg->yy_hold_char = *yyg->yy_c_buf_p; +} + +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * @param yyscanner The scanner object. + * @return the allocated buffer state. + */ + YY_BUFFER_STATE ob_proxy_parser_utf8_yy_create_buffer (FILE * file, int size , yyscan_t yyscanner) +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) ob_proxy_parser_utf8_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in ob_proxy_parser_utf8_yy_create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) ob_proxy_parser_utf8_yyalloc(b->yy_buf_size + 2 ,yyscanner ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in ob_proxy_parser_utf8_yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + ob_proxy_parser_utf8_yy_init_buffer(b,file ,yyscanner); + + return b; +} + +/** Destroy the buffer. + * @param b a buffer created with ob_proxy_parser_utf8_yy_create_buffer() + * @param yyscanner The scanner object. + */ + void ob_proxy_parser_utf8_yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if ( ! b ) + return; + + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + ob_proxy_parser_utf8_yyfree((void *) b->yy_ch_buf ,yyscanner ); + + ob_proxy_parser_utf8_yyfree((void *) b ,yyscanner ); +} + +#ifndef __cplusplus +extern int isatty (int ); +#endif /* __cplusplus */ + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a ob_proxy_parser_utf8_yyrestart() or at EOF. + */ + static void ob_proxy_parser_utf8_yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner) + +{ + int oerrno = errno; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + ob_proxy_parser_utf8_yy_flush_buffer(b ,yyscanner); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + /* If b is the current buffer, then ob_proxy_parser_utf8_yy_init_buffer was _probably_ + * called from ob_proxy_parser_utf8_yyrestart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; + + errno = oerrno; +} + +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * @param yyscanner The scanner object. + */ + void ob_proxy_parser_utf8_yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == YY_CURRENT_BUFFER ) + ob_proxy_parser_utf8_yy_load_buffer_state(yyscanner ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * @param yyscanner The scanner object. + */ +void ob_proxy_parser_utf8_yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if (new_buffer == NULL) + return; + + ob_proxy_parser_utf8_yyensure_buffer_stack(yyscanner); + + /* This block is copied from ob_proxy_parser_utf8_yy_switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *yyg->yy_c_buf_p = yyg->yy_hold_char; + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + yyg->yy_buffer_stack_top++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from ob_proxy_parser_utf8_yy_switch_to_buffer. */ + ob_proxy_parser_utf8_yy_load_buffer_state(yyscanner ); + yyg->yy_did_buffer_switch_on_eof = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * @param yyscanner The scanner object. + */ +void ob_proxy_parser_utf8_yypop_buffer_state (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if (!YY_CURRENT_BUFFER) + return; + + ob_proxy_parser_utf8_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner); + YY_CURRENT_BUFFER_LVALUE = NULL; + if (yyg->yy_buffer_stack_top > 0) + --yyg->yy_buffer_stack_top; + + if (YY_CURRENT_BUFFER) { + ob_proxy_parser_utf8_yy_load_buffer_state(yyscanner ); + yyg->yy_did_buffer_switch_on_eof = 1; + } +} + +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void ob_proxy_parser_utf8_yyensure_buffer_stack (yyscan_t yyscanner) +{ + int num_to_alloc; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (!yyg->yy_buffer_stack) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; + yyg->yy_buffer_stack = (struct yy_buffer_state**)ob_proxy_parser_utf8_yyalloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + , yyscanner); + if ( ! yyg->yy_buffer_stack ) + YY_FATAL_ERROR( "out of dynamic memory in ob_proxy_parser_utf8_yyensure_buffer_stack()" ); + + memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + yyg->yy_buffer_stack_max = num_to_alloc; + yyg->yy_buffer_stack_top = 0; + return; + } + + if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = yyg->yy_buffer_stack_max + grow_size; + yyg->yy_buffer_stack = (struct yy_buffer_state**)ob_proxy_parser_utf8_yyrealloc + (yyg->yy_buffer_stack, + num_to_alloc * sizeof(struct yy_buffer_state*) + , yyscanner); + if ( ! yyg->yy_buffer_stack ) + YY_FATAL_ERROR( "out of dynamic memory in ob_proxy_parser_utf8_yyensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*)); + yyg->yy_buffer_stack_max = num_to_alloc; + } +} + +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * @param yyscanner The scanner object. + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE ob_proxy_parser_utf8_yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) +{ + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) ob_proxy_parser_utf8_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in ob_proxy_parser_utf8_yy_scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + ob_proxy_parser_utf8_yy_switch_to_buffer(b ,yyscanner ); + + return b; +} + +/** Setup the input buffer state to scan a string. The next call to ob_proxy_parser_utf8_yylex() will + * scan from a @e copy of @a str. + * @param yystr a NUL-terminated string to scan + * @param yyscanner The scanner object. + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * ob_proxy_parser_utf8_yy_scan_bytes() instead. + */ +YY_BUFFER_STATE ob_proxy_parser_utf8_yy_scan_string (yyconst char * yystr , yyscan_t yyscanner) +{ + + return ob_proxy_parser_utf8_yy_scan_bytes(yystr,strlen(yystr) ,yyscanner); +} + +/** Setup the input buffer state to scan the given bytes. The next call to ob_proxy_parser_utf8_yylex() will + * scan from a @e copy of @a bytes. + * @param bytes the byte buffer to scan + * @param len the number of bytes in the buffer pointed to by @a bytes. + * @param yyscanner The scanner object. + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE ob_proxy_parser_utf8_yy_scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner) +{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = _yybytes_len + 2; + buf = (char *) ob_proxy_parser_utf8_yyalloc(n ,yyscanner ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in ob_proxy_parser_utf8_yy_scan_bytes()" ); + + memcpy(buf, yybytes, _yybytes_len); + + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + + b = ob_proxy_parser_utf8_yy_scan_buffer(buf,n ,yyscanner); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in ob_proxy_parser_utf8_yy_scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; +} + + static void yy_push_state (int new_state , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if ( yyg->yy_start_stack_ptr >= yyg->yy_start_stack_depth ) + { + yy_size_t new_size; + + yyg->yy_start_stack_depth += YY_START_STACK_INCR; + new_size = yyg->yy_start_stack_depth * sizeof( int ); + + if ( ! yyg->yy_start_stack ) + yyg->yy_start_stack = (int *) ob_proxy_parser_utf8_yyalloc(new_size ,yyscanner ); + + else + yyg->yy_start_stack = (int *) ob_proxy_parser_utf8_yyrealloc((void *) yyg->yy_start_stack,new_size ,yyscanner ); + + if ( ! yyg->yy_start_stack ) + YY_FATAL_ERROR( "out of memory expanding start-condition stack" ); + } + + yyg->yy_start_stack[yyg->yy_start_stack_ptr++] = YY_START; + + BEGIN(new_state); +} + + static void yy_pop_state (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if ( --yyg->yy_start_stack_ptr < 0 ) + YY_FATAL_ERROR( "start-condition stack underflow" ); + + BEGIN(yyg->yy_start_stack[yyg->yy_start_stack_ptr]); +} + + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner) +{ + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); +} + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + yytext[yyleng] = yyg->yy_hold_char; \ + yyg->yy_c_buf_p = yytext + yyless_macro_arg; \ + yyg->yy_hold_char = *yyg->yy_c_buf_p; \ + *yyg->yy_c_buf_p = '\0'; \ + yyleng = yyless_macro_arg; \ + } \ + while ( 0 ) + +/* Accessor methods (get/set functions) to struct members. */ + +/** Get the user-defined data for this scanner. + * @param yyscanner The scanner object. + */ +YY_EXTRA_TYPE ob_proxy_parser_utf8_yyget_extra (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyextra; +} + +/** Get the current line number. + * @param yyscanner The scanner object. + */ +int ob_proxy_parser_utf8_yyget_lineno (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (! YY_CURRENT_BUFFER) + return 0; + + return yylineno; +} + +/** Get the current column number. + * @param yyscanner The scanner object. + */ +int ob_proxy_parser_utf8_yyget_column (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (! YY_CURRENT_BUFFER) + return 0; + + return yycolumn; +} + +/** Get the input stream. + * @param yyscanner The scanner object. + */ +FILE *ob_proxy_parser_utf8_yyget_in (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyin; +} + +/** Get the output stream. + * @param yyscanner The scanner object. + */ +FILE *ob_proxy_parser_utf8_yyget_out (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyout; +} + +/** Get the length of the current token. + * @param yyscanner The scanner object. + */ +int ob_proxy_parser_utf8_yyget_leng (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyleng; +} + +/** Get the current token. + * @param yyscanner The scanner object. + */ + +char *ob_proxy_parser_utf8_yyget_text (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yytext; +} + +/** Set the user-defined data. This data is never touched by the scanner. + * @param user_defined The data to be associated with this scanner. + * @param yyscanner The scanner object. + */ +void ob_proxy_parser_utf8_yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyextra = user_defined ; +} + +/** Set the current line number. + * @param line_number + * @param yyscanner The scanner object. + */ +void ob_proxy_parser_utf8_yyset_lineno (int line_number , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* lineno is only valid if an input buffer exists. */ + if (! YY_CURRENT_BUFFER ) + yy_fatal_error( "ob_proxy_parser_utf8_yyset_lineno called with no buffer" , yyscanner); + + yylineno = line_number; +} + +/** Set the current column. + * @param line_number + * @param yyscanner The scanner object. + */ +void ob_proxy_parser_utf8_yyset_column (int column_no , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* column is only valid if an input buffer exists. */ + if (! YY_CURRENT_BUFFER ) + yy_fatal_error( "ob_proxy_parser_utf8_yyset_column called with no buffer" , yyscanner); + + yycolumn = column_no; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param in_str A readable stream. + * @param yyscanner The scanner object. + * @see ob_proxy_parser_utf8_yy_switch_to_buffer + */ +void ob_proxy_parser_utf8_yyset_in (FILE * in_str , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyin = in_str ; +} + +void ob_proxy_parser_utf8_yyset_out (FILE * out_str , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyout = out_str ; +} + +int ob_proxy_parser_utf8_yyget_debug (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yy_flex_debug; +} + +void ob_proxy_parser_utf8_yyset_debug (int bdebug , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yy_flex_debug = bdebug ; +} + +/* Accessor methods for yylval and yylloc */ + +YYSTYPE * ob_proxy_parser_utf8_yyget_lval (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yylval; +} + +void ob_proxy_parser_utf8_yyset_lval (YYSTYPE * yylval_param , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yylval = yylval_param; +} + +YYLTYPE *ob_proxy_parser_utf8_yyget_lloc (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yylloc; +} + +void ob_proxy_parser_utf8_yyset_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yylloc = yylloc_param; +} + +/* User-visible API */ + +/* ob_proxy_parser_utf8_yylex_init is special because it creates the scanner itself, so it is + * the ONLY reentrant function that doesn't take the scanner as the last argument. + * That's why we explicitly handle the declaration, instead of using our macros. + */ + +int ob_proxy_parser_utf8_yylex_init(yyscan_t* ptr_yy_globals) + +{ + if (ptr_yy_globals == NULL){ + errno = EINVAL; + return 1; + } + + *ptr_yy_globals = (yyscan_t) ob_proxy_parser_utf8_yyalloc ( sizeof( struct yyguts_t ), NULL ); + + if (*ptr_yy_globals == NULL){ + errno = ENOMEM; + return 1; + } + + /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */ + memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); + + return yy_init_globals ( *ptr_yy_globals ); +} + +/* ob_proxy_parser_utf8_yylex_init_extra has the same functionality as ob_proxy_parser_utf8_yylex_init, but follows the + * convention of taking the scanner as the last argument. Note however, that + * this is a *pointer* to a scanner, as it will be allocated by this call (and + * is the reason, too, why this function also must handle its own declaration). + * The user defined value in the first argument will be available to ob_proxy_parser_utf8_yyalloc in + * the yyextra field. + */ + +int ob_proxy_parser_utf8_yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals ) + +{ + struct yyguts_t dummy_yyguts; + + ob_proxy_parser_utf8_yyset_extra (yy_user_defined, &dummy_yyguts); + + if (ptr_yy_globals == NULL){ + errno = EINVAL; + return 1; + } + + *ptr_yy_globals = (yyscan_t) ob_proxy_parser_utf8_yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); + + if (*ptr_yy_globals == NULL){ + errno = ENOMEM; + return 1; + } + + /* By setting to 0xAA, we expose bugs in + yy_init_globals. Leave at 0x00 for releases. */ + memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); + + ob_proxy_parser_utf8_yyset_extra (yy_user_defined, *ptr_yy_globals); + + return yy_init_globals ( *ptr_yy_globals ); +} + +static int yy_init_globals (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from ob_proxy_parser_utf8_yylex_destroy(), so don't allocate here. + */ + + yyg->yy_buffer_stack = 0; + yyg->yy_buffer_stack_top = 0; + yyg->yy_buffer_stack_max = 0; + yyg->yy_c_buf_p = (char *) 0; + yyg->yy_init = 0; + yyg->yy_start = 0; + + yyg->yy_start_stack_ptr = 0; + yyg->yy_start_stack_depth = 0; + yyg->yy_start_stack = NULL; + +/* Defined in main.c */ +#ifdef YY_STDINIT + yyin = stdin; + yyout = stdout; +#else + yyin = (FILE *) 0; + yyout = (FILE *) 0; +#endif + + /* For future reference: Set errno on error, since we are called by + * ob_proxy_parser_utf8_yylex_init() + */ + return 0; +} + +/* ob_proxy_parser_utf8_yylex_destroy is for both reentrant and non-reentrant scanners. */ +int ob_proxy_parser_utf8_yylex_destroy (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + ob_proxy_parser_utf8_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner ); + YY_CURRENT_BUFFER_LVALUE = NULL; + ob_proxy_parser_utf8_yypop_buffer_state(yyscanner); + } + + /* Destroy the stack itself. */ + ob_proxy_parser_utf8_yyfree(yyg->yy_buffer_stack ,yyscanner); + yyg->yy_buffer_stack = NULL; + + /* Destroy the start condition stack. */ + ob_proxy_parser_utf8_yyfree(yyg->yy_start_stack ,yyscanner ); + yyg->yy_start_stack = NULL; + + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * ob_proxy_parser_utf8_yylex() is called, initialization will occur. */ + yy_init_globals( yyscanner); + + /* Destroy the main struct (reentrant only). */ + ob_proxy_parser_utf8_yyfree ( yyscanner , yyscanner ); + yyscanner = NULL; + return 0; +} + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner) +{ + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) +{ + register int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; +} +#endif + +#define YYTABLES_NAME "yytables" + +#line 1146 "ob_proxy_parser_utf8.l" + + +inline void *ob_proxy_parser_utf8_yyalloc(size_t bytes,void *yyscanner) +{ + void *ptr_ret = NULL; + ObProxyParseResult *p = ob_proxy_parser_utf8_yyget_extra(yyscanner); + if (OB_ISNULL(p)) { + // print err into msg buffer later + } else { + ptr_ret = obproxy_parse_malloc(bytes, p->malloc_pool_); + } + return ptr_ret; +} + +inline void *ob_proxy_parser_utf8_yyrealloc (void *ptr, size_t bytes, void *yyscanner) +{ + void *ptr_ret = NULL; + ObProxyParseResult *p = ob_proxy_parser_utf8_yyget_extra(yyscanner); + if (OB_ISNULL(p)) { + // print err into msg buffer later + } else { + ptr_ret = obproxy_parse_realloc(ptr, bytes, p->malloc_pool_); + } + return ptr_ret; + +} + +inline void ob_proxy_parser_utf8_yyfree(void *ptr,void *yyscanner) +{ + // Do nothing -- we leave it to the garbage collector. + obproxy_parse_free(ptr); +} + +inline void update_stmt_type(ObProxyBasicStmtType type, void *yyscanner) +{ + ObProxyParseResult *p = ob_proxy_parser_utf8_yyget_extra(yyscanner); + if (OB_ISNULL(p)) { + // print err into msg buffer later + } else { + // we only update the cur_stmt_type_ at the first time + if (OBPROXY_T_INVALID == p->cur_stmt_type_) { + p->cur_stmt_type_ = type; + } else { + // do nothing + } + } +} + +inline void store_str(char* str, int64_t str_len, char* end_ptr, void *yyscanner) +{ + YYSTYPE *lval = ob_proxy_parser_utf8_yyget_lval(yyscanner); + if (OB_ISNULL(lval)) { + // do nothing + } else { + lval->str.str_ = str; + lval->str.end_ptr_ = end_ptr; + lval->str.str_len_ = str_len; + lval->str.quote_type_ = OBPROXY_QUOTE_T_INVALID; + } +} + +inline void store_str_with_quote(ObProxyParseQuoteType type, char* str, int64_t str_len, char* end_ptr, void *yyscanner) +{ + YYSTYPE *lval = ob_proxy_parser_utf8_yyget_lval(yyscanner); + if (OB_ISNULL(lval)) { + // do nothing + } else { + lval->str.str_ = str; + lval->str.end_ptr_ = end_ptr; + lval->str.str_len_ = str_len; + lval->str.quote_type_ = type; + } +} + +/* A Bison parser, made by GNU Bison 2.4.1. */ + +/* Skeleton interface for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. + + 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 + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + + +#ifndef YY_OBPROXY_OB_PROXY_PARSER_TAB_H_INCLUDED +# define YY_OBPROXY_OB_PROXY_PARSER_TAB_H_INCLUDED +/* Debug traces. */ +#ifndef OBPROXY_UTF8_DEBUG +# if defined YYDEBUG +#if YYDEBUG +# define OBPROXY_UTF8_DEBUG 1 +# else +# define OBPROXY_UTF8_DEBUG 0 +# endif +# else /* ! defined YYDEBUG */ +# define OBPROXY_UTF8_DEBUG 0 +# endif /* ! defined YYDEBUG */ +#endif /* ! defined OBPROXY_UTF8_DEBUG */ +#if OBPROXY_UTF8_DEBUG +extern int ob_proxy_parser_utf8_yydebug; +#endif +/* Tokens. */ +#ifndef OBPROXYTOKENTYPE +# define OBPROXYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum obproxytokentype { + DUMMY_WHERE_CLAUSE = 258, + DUMMY_INSERT_CLAUSE = 259, + SELECT = 260, + DELETE = 261, + INSERT = 262, + UPDATE = 263, + REPLACE = 264, + MERGE = 265, + SHOW = 266, + SET = 267, + CALL = 268, + CREATE = 269, + DROP = 270, + ALTER = 271, + TRUNCATE = 272, + RENAME = 273, + GRANT = 274, + REVOKE = 275, + ANALYZE = 276, + PURGE = 277, + COMMENT = 278, + FROM = 279, + DUAL = 280, + PREPARE = 281, + EXECUTE = 282, + USING = 283, + SELECT_HINT_BEGIN = 284, + UPDATE_HINT_BEGIN = 285, + DELETE_HINT_BEGIN = 286, + INSERT_HINT_BEGIN = 287, + REPLACE_HINT_BEGIN = 288, + MERGE_HINT_BEGIN = 289, + HINT_END = 290, + COMMENT_BEGIN = 291, + COMMENT_END = 292, + ROUTE_TABLE = 293, + ROUTE_PART_KEY = 294, + QUERY_TIMEOUT = 295, + READ_CONSISTENCY = 296, + WEAK = 297, + STRONG = 298, + FROZEN = 299, + PLACE_HOLDER = 300, + END_P = 301, + ERROR = 302, + WHEN = 303, + FLASHBACK = 304, + AUDIT = 305, + NOAUDIT = 306, + BEGI = 307, + START = 308, + TRANSACTION = 309, + READ = 310, + ONLY = 311, + WITH = 312, + CONSISTENT = 313, + SNAPSHOT = 314, + INDEX = 315, + XA = 316, + WARNINGS = 317, + ERRORS = 318, + TRACE = 319, + QUICK = 320, + COUNT = 321, + AS = 322, + WHERE = 323, + VALUES = 324, + ORDER = 325, + GROUP = 326, + HAVING = 327, + INTO = 328, + UNION = 329, + FOR = 330, + TX_READ_ONLY = 331, + AUTOCOMMIT_0 = 332, + SELECT_OBPROXY_ROUTE_ADDR = 333, + SET_OBPROXY_ROUTE_ADDR = 334, + NAME_OB_DOT = 335, + NAME_OB = 336, + EXPLAIN = 337, + DESC = 338, + DESCRIBE = 339, + NAME_STR = 340, + USE = 341, + HELP = 342, + SET_NAMES = 343, + SET_CHARSET = 344, + SET_PASSWORD = 345, + SET_DEFAULT = 346, + SET_OB_READ_CONSISTENCY = 347, + SET_TX_READ_ONLY = 348, + GLOBAL = 349, + SESSION = 350, + NUMBER_VAL = 351, + GROUP_ID = 352, + TABLE_ID = 353, + ELASTIC_ID = 354, + TESTLOAD = 355, + ODP_COMMENT = 356, + TNT_ID = 357, + DISASTER_STATUS = 358, + TRACE_ID = 359, + RPC_ID = 360, + DBP_COMMENT = 361, + ROUTE_TAG = 362, + SYS_TAG = 363, + TABLE_NAME = 364, + SCAN_ALL = 365, + PARALL = 366, + SHARD_KEY = 367, + INT_NUM = 368, + SHOW_PROXYNET = 369, + THREAD = 370, + CONNECTION = 371, + LIMIT = 372, + OFFSET = 373, + SHOW_PROCESSLIST = 374, + SHOW_PROXYSESSION = 375, + SHOW_GLOBALSESSION = 376, + ATTRIBUTE = 377, + VARIABLES = 378, + ALL = 379, + STAT = 380, + SHOW_PROXYCONFIG = 381, + DIFF = 382, + USER = 383, + LIKE = 384, + SHOW_PROXYSM = 385, + SHOW_PROXYCLUSTER = 386, + SHOW_PROXYRESOURCE = 387, + SHOW_PROXYCONGESTION = 388, + SHOW_PROXYROUTE = 389, + PARTITION = 390, + ROUTINE = 391, + SHOW_PROXYVIP = 392, + SHOW_PROXYMEMORY = 393, + OBJPOOL = 394, + SHOW_SQLAUDIT = 395, + SHOW_WARNLOG = 396, + SHOW_PROXYSTAT = 397, + REFRESH = 398, + SHOW_PROXYTRACE = 399, + SHOW_PROXYINFO = 400, + BINARY = 401, + UPGRADE = 402, + IDC = 403, + SHOW_TOPOLOGY = 404, + GROUP_NAME = 405, + SHOW_DB_VERSION = 406, + SHOW_DATABASES = 407, + SHOW_TABLES = 408, + SELECT_DATABASE = 409, + SHOW_CREATE_TABLE = 410, + ALTER_PROXYCONFIG = 411, + ALTER_PROXYRESOURCE = 412, + PING_PROXY = 413, + KILL_PROXYSESSION = 414, + KILL_GLOBALSESSION = 415, + KILL = 416, + QUERY = 417 + }; +#endif + + + +#if ! defined OBPROXYSTYPE && ! defined OBPROXYSTYPE_IS_DECLARED +typedef union OBPROXYSTYPE +{ + + + int64_t num; + ObProxyParseString str; + ObProxyCallParseNode *node; + ObShardColumnNode *shard_node; + ObProxySetVarNode *var_node; + + + +} OBPROXYSTYPE; +# define OBPROXYSTYPE_IS_TRIVIAL 1 +# define obproxystype OBPROXYSTYPE /* obsolescent; will be withdrawn */ +# define OBPROXYSTYPE_IS_DECLARED 1 +#endif + + + +#if ! defined OBPROXYLTYPE && ! defined OBPROXYLTYPE_IS_DECLARED +typedef struct OBPROXYLTYPE +{ + int first_line; + int first_column; + int last_line; + int last_column; +} OBPROXYLTYPE; +# define obproxyltype OBPROXYLTYPE /* obsolescent; will be withdrawn */ +# define OBPROXYLTYPE_IS_DECLARED 1 +# define OBPROXYLTYPE_IS_TRIVIAL 1 +#endif + + + +#endif + diff --git a/src/obproxy/opsql/parser/ob_proxy_parser_utf8_lex.h b/src/obproxy/opsql/parser/ob_proxy_parser_utf8_lex.h new file mode 100644 index 0000000..d1f33dc --- /dev/null +++ b/src/obproxy/opsql/parser/ob_proxy_parser_utf8_lex.h @@ -0,0 +1,370 @@ +#ifndef ob_proxy_parser_utf8_yyHEADER_H +#define ob_proxy_parser_utf8_yyHEADER_H 1 +#define ob_proxy_parser_utf8_yyIN_HEADER 1 + +#line 6 "ob_proxy_parser_utf8_lex.h" + +#line 8 "ob_proxy_parser_utf8_lex.h" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 35 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include +#include +#include +#include + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have . Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; +#endif /* ! C99 */ + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! FLEXINT_H */ + +#ifdef __cplusplus + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) + +#define YY_USE_CONST + +#endif /* defined (__STDC__) */ +#endif /* ! __cplusplus */ + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + +/* An opaque pointer. */ +#ifndef YY_TYPEDEF_YY_SCANNER_T +#define YY_TYPEDEF_YY_SCANNER_T +typedef void* yyscan_t; +#endif + +/* For convenience, these vars (plus the bison vars far below) + are macros in the reentrant scanner. */ +#define yyin yyg->yyin_r +#define yyout yyg->yyout_r +#define yyextra yyg->yyextra_r +#define yyleng yyg->yyleng_r +#define yytext yyg->yytext_r +#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno) +#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column) +#define yy_flex_debug yyg->yy_flex_debug_r + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#define YY_BUF_SIZE 16384 +#endif + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +void ob_proxy_parser_utf8_yyrestart (FILE *input_file ,yyscan_t yyscanner ); +void ob_proxy_parser_utf8_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); +YY_BUFFER_STATE ob_proxy_parser_utf8_yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner ); +void ob_proxy_parser_utf8_yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); +void ob_proxy_parser_utf8_yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); +void ob_proxy_parser_utf8_yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); +void ob_proxy_parser_utf8_yypop_buffer_state (yyscan_t yyscanner ); + +YY_BUFFER_STATE ob_proxy_parser_utf8_yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); +YY_BUFFER_STATE ob_proxy_parser_utf8_yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); +YY_BUFFER_STATE ob_proxy_parser_utf8_yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); + +void *ob_proxy_parser_utf8_yyalloc (yy_size_t ,yyscan_t yyscanner ); +void *ob_proxy_parser_utf8_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner ); +void ob_proxy_parser_utf8_yyfree (void * ,yyscan_t yyscanner ); + +/* Begin user sect3 */ + +#define ob_proxy_parser_utf8_yywrap(n) 1 +#define YY_SKIP_YYWRAP + +#define yytext_ptr yytext_r + +#ifdef YY_HEADER_EXPORT_START_CONDITIONS +#define INITIAL 0 +#define hint 1 +#define in_c_comment 2 +#define in_comment_expr 3 +#define in_old_comment_expr 4 +#define in_odp_comment_expr 5 +#define in_odp_comment_value_expr 6 +#define in_odp_comment_value_expr_calc 7 +#define in_ignored_comment_expr 8 +#define in_dbp_comment_expr 9 +#define in_dbp_comment_trace_expr 10 +#define in_dbp_comment_trace_value_expr 11 +#define in_dbp_comment_trace_value_expr_calc 12 +#define comment_sq 13 +#define sq 14 +#define dq 15 +#define bt 16 +#define bt_in_expr 17 +#define in_expr 18 +#define in_anonymous_block 19 +#define in_subquery 20 +#define in_no_select_query 21 +#define prepare 22 +#define insert_all_expr 23 +#define set_expr 24 +#define show_topology 25 + +#endif + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +int ob_proxy_parser_utf8_yylex_init (yyscan_t* scanner); + +int ob_proxy_parser_utf8_yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner); + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int ob_proxy_parser_utf8_yylex_destroy (yyscan_t yyscanner ); + +int ob_proxy_parser_utf8_yyget_debug (yyscan_t yyscanner ); + +void ob_proxy_parser_utf8_yyset_debug (int debug_flag ,yyscan_t yyscanner ); + +YY_EXTRA_TYPE ob_proxy_parser_utf8_yyget_extra (yyscan_t yyscanner ); + +void ob_proxy_parser_utf8_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); + +FILE *ob_proxy_parser_utf8_yyget_in (yyscan_t yyscanner ); + +void ob_proxy_parser_utf8_yyset_in (FILE * in_str ,yyscan_t yyscanner ); + +FILE *ob_proxy_parser_utf8_yyget_out (yyscan_t yyscanner ); + +void ob_proxy_parser_utf8_yyset_out (FILE * out_str ,yyscan_t yyscanner ); + +int ob_proxy_parser_utf8_yyget_leng (yyscan_t yyscanner ); + +char *ob_proxy_parser_utf8_yyget_text (yyscan_t yyscanner ); + +int ob_proxy_parser_utf8_yyget_lineno (yyscan_t yyscanner ); + +void ob_proxy_parser_utf8_yyset_lineno (int line_number ,yyscan_t yyscanner ); + +OBPROXYSTYPE * ob_proxy_parser_utf8_yyget_lval (yyscan_t yyscanner ); + +void ob_proxy_parser_utf8_yyset_lval (OBPROXYSTYPE * yylval_param ,yyscan_t yyscanner ); + + OBPROXYLTYPE *ob_proxy_parser_utf8_yyget_lloc (yyscan_t yyscanner ); + + void ob_proxy_parser_utf8_yyset_lloc (OBPROXYLTYPE * yylloc_param ,yyscan_t yyscanner ); + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int ob_proxy_parser_utf8_yywrap (yyscan_t yyscanner ); +#else +extern int ob_proxy_parser_utf8_yywrap (yyscan_t yyscanner ); +#endif +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner); +#endif + +#ifndef YY_NO_INPUT + +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#define YY_READ_BUF_SIZE 8192 +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 + +extern int ob_proxy_parser_utf8_yylex \ + (OBPROXYSTYPE * yylval_param,OBPROXYLTYPE * yylloc_param ,yyscan_t yyscanner); + +#define YY_DECL int ob_proxy_parser_utf8_yylex \ + (OBPROXYSTYPE * yylval_param, OBPROXYLTYPE * yylloc_param , yyscan_t yyscanner) +#endif /* !YY_DECL */ + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + +#undef YY_NEW_FILE +#undef YY_FLUSH_BUFFER +#undef yy_set_bol +#undef yy_new_buffer +#undef yy_set_interactive +#undef YY_DO_BEFORE_ACTION + +#ifdef YY_DECL_IS_OURS +#undef YY_DECL_IS_OURS +#undef YY_DECL +#endif + +#line 1146 "ob_proxy_parser_utf8.l" + + +#line 369 "ob_proxy_parser_utf8_lex.h" +#undef ob_proxy_parser_utf8_yyIN_HEADER +#endif /* ob_proxy_parser_utf8_yyHEADER_H */ diff --git a/src/obproxy/opsql/parser/ob_proxy_parser_utf8_tab.c b/src/obproxy/opsql/parser/ob_proxy_parser_utf8_tab.c new file mode 100644 index 0000000..d900685 --- /dev/null +++ b/src/obproxy/opsql/parser/ob_proxy_parser_utf8_tab.c @@ -0,0 +1,4397 @@ + +/* A Bison parser, made by GNU Bison 2.4.1. */ + +/* Skeleton implementation for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. + + 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 + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Bison version. */ +#define YYBISON_VERSION "2.4.1" + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 1 + +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + +/* Using locations. */ +#define YYLSP_NEEDED 1 + +/* Substitute the variable and function names. */ +#define YYSTYPE OBPROXYSTYPE +#define YYLTYPE OBPROXYLTYPE +#define yyparse ob_proxy_parser_utf8_yyparse +#define yylex ob_proxy_parser_utf8_yylex +#define yyerror ob_proxy_parser_utf8_yyerror +#define yylval ob_proxy_parser_utf8_yylval +#define yychar ob_proxy_parser_utf8_yychar +#define yydebug ob_proxy_parser_utf8_yydebug +#define yynerrs ob_proxy_parser_utf8_yynerrs +#define yylloc ob_proxy_parser_utf8_yylloc + +/* Copy the first part of user declarations. */ + + +#include +#include "opsql/ob_proxy_parse_define.h" +#include "opsql/parser/ob_proxy_parse_result.h" + +#define HANDLE_ACCEPT() \ +do {\ + if (result->stmt_count_ > 1) {\ + result->stmt_type_ = OBPROXY_T_MULTI_STMT;\ + }\ + if (NULL != result->end_pos_) {\ + } else if (NULL != result->table_info_.table_name_.str_ && result->table_info_.table_name_.str_len_ > 0) {\ + if (NULL != result->part_name_.str_ && result->part_name_.str_len_ > 0) {\ + result->end_pos_ = result->part_name_.end_ptr_;\ + } else if (NULL != result->table_info_.alias_name_.str_ && result->table_info_.alias_name_.str_len_ > 0) {\ + result->end_pos_ = result->table_info_.alias_name_.end_ptr_;\ + } else {\ + result->end_pos_ = result->table_info_.table_name_.end_ptr_;\ + }\ + } else {\ + result->end_pos_ = ob_proxy_parser_utf8_yyget_text(result->yyscan_info_);\ + }\ + YYACCEPT;\ +} while (0); + +static inline void handle_stmt_end(ObProxyParseResult* result) +{ + // no need to judge NULL + if (result->has_ignored_word_) { + switch (result->cur_stmt_type_) { + // these stmt should match exactly, + // so if we have ignored word we should reset type + case OBPROXY_T_SELECT_TX_RO: + result->stmt_type_ = OBPROXY_T_SELECT; + break; + case OBPROXY_T_SET_AC_0: + result->stmt_type_ = OBPROXY_T_OTHERS; + break; + case OBPROXY_T_BEGIN: + result->stmt_type_ = OBPROXY_T_OTHERS; + break; + case OBPROXY_T_SHOW_TRACE: + result->stmt_type_ = OBPROXY_T_OTHERS; + break; + case OBPROXY_T_SELECT_ROUTE_ADDR: + result->stmt_type_ = OBPROXY_T_OTHERS; + break; + case OBPROXY_T_SET_ROUTE_ADDR: + result->stmt_type_ = OBPROXY_T_OTHERS; + break; + default: + result->stmt_type_ = result->cur_stmt_type_; + break; + } + } else { + result->stmt_type_ = result->cur_stmt_type_; + } + + if (OBPROXY_T_TEXT_PS_PREPARE == result->text_ps_inner_stmt_type_) { + ObProxyBasicStmtType tmp_type = result->cur_stmt_type_; + result->stmt_type_ = OBPROXY_T_TEXT_PS_PREPARE; + result->text_ps_inner_stmt_type_ = tmp_type; + } + + result->cur_stmt_type_ = OBPROXY_T_INVALID; + result->stmt_count_++; +} + +#define UPDATE_ALIAS_NAME(name) \ + /* only support select and update with alias name */ \ + /* insert into ... select also have alias name */ \ + if (NULL != result && (OBPROXY_T_SELECT == result->cur_stmt_type_ || OBPROXY_T_UPDATE == result->cur_stmt_type_ \ + || OBPROXY_T_INSERT == result->cur_stmt_type_ || OBPROXY_T_MERGE == result->cur_stmt_type_)) { \ + result->table_info_.alias_name_ = name; \ + } \ + +#define HANDLE_ERROR_ACCEPT() \ +do {\ + result->has_ignored_word_ = true;\ + if ((OBPROXY_T_INVALID < result->cur_stmt_type_ && result->cur_stmt_type_ < OBPROXY_T_ICMD_MAX) || (OBPROXY_T_PING_PROXY == result->cur_stmt_type_)) {\ + result->cmd_info_.err_type_ = OBPROXY_T_ERR_PARSE;\ + }\ + result->sub_stmt_type_ = OBPROXY_T_SUB_INVALID;\ + handle_stmt_end(result);\ + HANDLE_ACCEPT();\ +} while (0); + +#define SET_ICMD_SUB_TYPE(sub_type) \ +do {\ + result->cmd_info_.sub_type_ = sub_type;\ +} while (0); + +#define SET_ICMD_SUB_AND_ONE_ID(sub_type, id) \ +do {\ + result->cmd_info_.sub_type_ = sub_type;\ + result->cmd_info_.integer_[0] = id;\ +} while (0); + +#define SET_ICMD_SUB_AND_TWO_ID(sub_type, id, id_two) \ +do {\ + result->cmd_info_.sub_type_ = sub_type;\ + result->cmd_info_.integer_[0] = id;\ + result->cmd_info_.integer_[1] = id_two;\ +} while (0); + +#define SET_ICMD_SUB_AND_ONE_STRING(sub_type, string) \ +do {\ + result->cmd_info_.sub_type_ = sub_type;\ + result->cmd_info_.string_[0] = string;\ +} while (0); + +#define SET_ICMD_ONE_STRING(string) \ +do {\ + result->cmd_info_.string_[0] = string;\ +} while (0); + +#define SET_ICMD_TWO_STRING(string, string_two) \ +do {\ + result->cmd_info_.string_[0] = string;\ + result->cmd_info_.string_[1] = string_two;\ +} while (0); + +#define SET_ICMD_SECOND_STRING(string) \ +do {\ + result->cmd_info_.string_[1] = string;\ +} while (0); + +#define SET_ICMD_CONFIG_INT_VALUE(string, integer) \ +do {\ + result->cmd_info_.sub_type_ = OBPROXY_T_SUB_CONFIG_INT_VAULE;\ + result->cmd_info_.string_[0] = string;\ + result->cmd_info_.integer_[0] = integer;\ +} while (0); + +#define SET_ICMD_TYPE_STRING_INT_VALUE(sub_type, string, integer) \ +do {\ + result->cmd_info_.sub_type_ = sub_type;\ + result->cmd_info_.string_[0] = string;\ + result->cmd_info_.integer_[0] = integer;\ +} while (0); + +#define SET_ICMD_ONE_ID(id) \ +do {\ + result->cmd_info_.integer_[0] = id;\ +} while (0); + +#define SET_ICMD_TWO_ID(id, id_two) \ +do {\ + result->cmd_info_.integer_[0] = id;\ + result->cmd_info_.integer_[1] = id_two;\ +} while (0); + +#define SET_ICMD_SECOND_ID(id) \ +do {\ + result->cmd_info_.integer_[1] = id;\ +} while (0); + +#define SET_READ_CONSISTENCY(read_consistency_type) \ +do {\ + if (OBPROXY_READ_CONSISTENCY_INVALID == result->read_consistency_type_) {\ + result->read_consistency_type_ = read_consistency_type;\ + }\ +} while (0); + +#define add_call_node(call_parse_info, call_node) \ +do { \ + if (NULL != call_parse_info.tail_) {\ + call_parse_info.tail_->next_ = call_node;\ + call_parse_info.tail_ = call_node;\ + } else {\ + call_parse_info.head_ = call_node;\ + call_parse_info.tail_ = call_node;\ + }\ + ++call_parse_info.node_count_;\ +} while(0) + +#define malloc_call_node(call_node, type) \ +do { \ + if (OB_ISNULL(call_node = ((ObProxyCallParseNode *)obproxy_parse_malloc(sizeof(ObProxyCallParseNode), result->malloc_pool_)))) { \ + YYABORT; \ + } else { \ + call_node->type_ = type; \ + call_node->next_ = NULL; \ + } \ +} while(0) \ + +#define add_text_ps_execute_node(text_ps_execute_parse_info, execute_parse_node) \ +do { \ + if (NULL != text_ps_execute_parse_info.tail_) {\ + text_ps_execute_parse_info.tail_->next_ = execute_parse_node;\ + text_ps_execute_parse_info.tail_ = execute_parse_node;\ + } else {\ + text_ps_execute_parse_info.head_ = execute_parse_node;\ + text_ps_execute_parse_info.tail_ = execute_parse_node;\ + }\ + ++text_ps_execute_parse_info.node_count_;\ +} while(0) + +#define malloc_execute_parse_node(execute_parse_node) \ +do { \ + if (OB_ISNULL(execute_parse_node = ((ObProxyTextPsExecuteParseNode *)obproxy_parse_malloc(sizeof(ObProxyTextPsExecuteParseNode), result->malloc_pool_)))) { \ + YYABORT; \ + } else { \ + execute_parse_node->next_ = NULL; \ + } \ +} while(0) \ + +#define malloc_shard_column_node(col_node, tb_name, col_name, col_type) \ +do { \ + if (OB_ISNULL(col_node = ((ObShardColumnNode *)obproxy_parse_malloc(sizeof(ObShardColumnNode), result->malloc_pool_)))) { \ + YYABORT; \ + } \ + col_node->tb_name_ = tb_name;\ + col_node->col_name_ = col_name;\ + col_node->type_ = col_type;\ +} while(0) + +#define add_shard_column_node(route_info, col_node) \ +do { \ + col_node->next_ = NULL;\ + if (NULL != route_info.tail_) {\ + route_info.tail_->next_ = col_node;\ + route_info.tail_ = col_node;\ + } else {\ + route_info.head_ = col_node;\ + route_info.tail_ = col_node;\ + }\ + ++route_info.node_count_;\ +} while(0) + +#define add_hint_index(route_info, index_tb_name) \ +do { \ + if (route_info.index_count_ >=0 && route_info.index_count_ < OBPROXY_MAX_HINT_INDEX_COUNT) {\ + route_info.index_tb_name_[route_info.index_count_] = index_tb_name; \ + }\ +} while(0) + +#define malloc_set_var_node(var_node, value_type) \ +do { \ + if (OB_ISNULL(var_node = ((ObProxySetVarNode *)obproxy_parse_malloc(sizeof(ObProxySetVarNode), result->malloc_pool_)))) { \ + YYABORT; \ + } \ + var_node->value_type_ = value_type;\ + var_node->next_ = NULL;\ +} while(0) + +#define add_set_var_node(set_info, var_node, name, type) \ +do { \ + var_node->name_ = name; \ + var_node->type_ = type; \ + if (NULL != set_info.tail_) {\ + set_info.tail_->next_ = var_node;\ + set_info.tail_ = var_node;\ + } else {\ + set_info.head_ = var_node;\ + set_info.tail_ = var_node;\ + }\ + ++set_info.node_count_;\ +} while(0) + + + + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 0 +#endif + +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE 0 +#endif + + +#ifndef YY_OBPROXY_OB_PROXY_PARSER_TAB_H_INCLUDED +# define YY_OBPROXY_OB_PROXY_PARSER_TAB_H_INCLUDED +/* Debug traces. */ +#ifndef OBPROXY_UTF8_DEBUG +# if defined YYDEBUG +#if YYDEBUG +# define OBPROXY_UTF8_DEBUG 1 +# else +# define OBPROXY_UTF8_DEBUG 0 +# endif +# else /* ! defined YYDEBUG */ +# define OBPROXY_UTF8_DEBUG 0 +# endif /* ! defined YYDEBUG */ +#endif /* ! defined OBPROXY_UTF8_DEBUG */ +#if OBPROXY_UTF8_DEBUG +extern int ob_proxy_parser_utf8_yydebug; +#endif +/* Tokens. */ +#ifndef OBPROXYTOKENTYPE +# define OBPROXYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum obproxytokentype { + DUMMY_WHERE_CLAUSE = 258, + DUMMY_INSERT_CLAUSE = 259, + SELECT = 260, + DELETE = 261, + INSERT = 262, + UPDATE = 263, + REPLACE = 264, + MERGE = 265, + SHOW = 266, + SET = 267, + CALL = 268, + CREATE = 269, + DROP = 270, + ALTER = 271, + TRUNCATE = 272, + RENAME = 273, + GRANT = 274, + REVOKE = 275, + ANALYZE = 276, + PURGE = 277, + COMMENT = 278, + FROM = 279, + DUAL = 280, + PREPARE = 281, + EXECUTE = 282, + USING = 283, + SELECT_HINT_BEGIN = 284, + UPDATE_HINT_BEGIN = 285, + DELETE_HINT_BEGIN = 286, + INSERT_HINT_BEGIN = 287, + REPLACE_HINT_BEGIN = 288, + MERGE_HINT_BEGIN = 289, + HINT_END = 290, + COMMENT_BEGIN = 291, + COMMENT_END = 292, + ROUTE_TABLE = 293, + ROUTE_PART_KEY = 294, + QUERY_TIMEOUT = 295, + READ_CONSISTENCY = 296, + WEAK = 297, + STRONG = 298, + FROZEN = 299, + PLACE_HOLDER = 300, + END_P = 301, + ERROR = 302, + WHEN = 303, + FLASHBACK = 304, + AUDIT = 305, + NOAUDIT = 306, + BEGI = 307, + START = 308, + TRANSACTION = 309, + READ = 310, + ONLY = 311, + WITH = 312, + CONSISTENT = 313, + SNAPSHOT = 314, + INDEX = 315, + XA = 316, + WARNINGS = 317, + ERRORS = 318, + TRACE = 319, + QUICK = 320, + COUNT = 321, + AS = 322, + WHERE = 323, + VALUES = 324, + ORDER = 325, + GROUP = 326, + HAVING = 327, + INTO = 328, + UNION = 329, + FOR = 330, + TX_READ_ONLY = 331, + AUTOCOMMIT_0 = 332, + SELECT_OBPROXY_ROUTE_ADDR = 333, + SET_OBPROXY_ROUTE_ADDR = 334, + NAME_OB_DOT = 335, + NAME_OB = 336, + EXPLAIN = 337, + DESC = 338, + DESCRIBE = 339, + NAME_STR = 340, + USE = 341, + HELP = 342, + SET_NAMES = 343, + SET_CHARSET = 344, + SET_PASSWORD = 345, + SET_DEFAULT = 346, + SET_OB_READ_CONSISTENCY = 347, + SET_TX_READ_ONLY = 348, + GLOBAL = 349, + SESSION = 350, + NUMBER_VAL = 351, + GROUP_ID = 352, + TABLE_ID = 353, + ELASTIC_ID = 354, + TESTLOAD = 355, + ODP_COMMENT = 356, + TNT_ID = 357, + DISASTER_STATUS = 358, + TRACE_ID = 359, + RPC_ID = 360, + DBP_COMMENT = 361, + ROUTE_TAG = 362, + SYS_TAG = 363, + TABLE_NAME = 364, + SCAN_ALL = 365, + PARALL = 366, + SHARD_KEY = 367, + INT_NUM = 368, + SHOW_PROXYNET = 369, + THREAD = 370, + CONNECTION = 371, + LIMIT = 372, + OFFSET = 373, + SHOW_PROCESSLIST = 374, + SHOW_PROXYSESSION = 375, + SHOW_GLOBALSESSION = 376, + ATTRIBUTE = 377, + VARIABLES = 378, + ALL = 379, + STAT = 380, + SHOW_PROXYCONFIG = 381, + DIFF = 382, + USER = 383, + LIKE = 384, + SHOW_PROXYSM = 385, + SHOW_PROXYCLUSTER = 386, + SHOW_PROXYRESOURCE = 387, + SHOW_PROXYCONGESTION = 388, + SHOW_PROXYROUTE = 389, + PARTITION = 390, + ROUTINE = 391, + SHOW_PROXYVIP = 392, + SHOW_PROXYMEMORY = 393, + OBJPOOL = 394, + SHOW_SQLAUDIT = 395, + SHOW_WARNLOG = 396, + SHOW_PROXYSTAT = 397, + REFRESH = 398, + SHOW_PROXYTRACE = 399, + SHOW_PROXYINFO = 400, + BINARY = 401, + UPGRADE = 402, + IDC = 403, + SHOW_TOPOLOGY = 404, + GROUP_NAME = 405, + SHOW_DB_VERSION = 406, + SHOW_DATABASES = 407, + SHOW_TABLES = 408, + SELECT_DATABASE = 409, + SHOW_CREATE_TABLE = 410, + ALTER_PROXYCONFIG = 411, + ALTER_PROXYRESOURCE = 412, + PING_PROXY = 413, + KILL_PROXYSESSION = 414, + KILL_GLOBALSESSION = 415, + KILL = 416, + QUERY = 417 + }; +#endif + + + +#if ! defined OBPROXYSTYPE && ! defined OBPROXYSTYPE_IS_DECLARED +typedef union OBPROXYSTYPE +{ + + + int64_t num; + ObProxyParseString str; + ObProxyCallParseNode *node; + ObShardColumnNode *shard_node; + ObProxySetVarNode *var_node; + + + +} OBPROXYSTYPE; +# define OBPROXYSTYPE_IS_TRIVIAL 1 +# define obproxystype OBPROXYSTYPE /* obsolescent; will be withdrawn */ +# define OBPROXYSTYPE_IS_DECLARED 1 +#endif + +#if ! defined OBPROXYLTYPE && ! defined OBPROXYLTYPE_IS_DECLARED +typedef struct OBPROXYLTYPE +{ + int first_line; + int first_column; + int last_line; + int last_column; +} OBPROXYLTYPE; +# define obproxyltype OBPROXYLTYPE /* obsolescent; will be withdrawn */ +# define OBPROXYLTYPE_IS_DECLARED 1 +# define OBPROXYLTYPE_IS_TRIVIAL 1 +#endif + + +#endif +/* Copy the second part of user declarations. */ + + +#include "ob_proxy_parser_utf8_lex.h" +#define YYLEX_PARAM result->yyscan_info_ +extern void yyerror(YYLTYPE* yylloc, ObProxyParseResult* p, char* s,...); +extern void *obproxy_parse_malloc(const size_t nbyte, void *malloc_pool); + + + +#ifdef short +# undef short +#endif + +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; +#endif + +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#elif (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +typedef signed char yytype_int8; +#else +typedef short int yytype_int8; +#endif + +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; +#endif + +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; +#endif + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int +# endif +#endif + +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + +#ifndef YY_ +# if YYENABLE_NLS +# if ENABLE_NLS +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_(msgid) dgettext ("bison-runtime", msgid) +# endif +# endif +# ifndef YY_ +# define YY_(msgid) msgid +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(e) ((void) (e)) +#else +# define YYUSE(e) /* empty */ +#endif + +/* Identity function, used to suppress warnings about constant conditions. */ +#ifndef lint +# define YYID(n) (n) +#else +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static int +YYID (int yyi) +#else +static int +YYID (yyi) + int yyi; +#endif +{ + return yyi; +} +#endif + +#if ! defined yyoverflow || YYERROR_VERBOSE + +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include /* INFRINGES ON USER NAME SPACE */ +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined _STDLIB_H \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# endif +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ + + +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \ + && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; + YYLTYPE yyls_alloc; +}; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ + + 2 * YYSTACK_GAP_MAXIMUM) + +/* Copy COUNT objects from FROM to TO. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# else +# define YYCOPY(To, From, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (YYID (0)) +# endif +# endif + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (YYID (0)) + +#endif + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 298 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 1404 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 174 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 126 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 420 +/* YYNRULES -- Number of states. */ +#define YYNSTATES 672 + +/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 417 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +static const yytype_uint8 yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 172, 2, 2, 2, 2, + 167, 168, 173, 2, 165, 2, 169, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 163, + 2, 166, 2, 2, 164, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 170, 2, 171, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, + 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, + 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, + 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, + 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, + 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, + 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, + 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, + 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, + 155, 156, 157, 158, 159, 160, 161, 162 +}; + +#if YYDEBUG +/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in + YYRHS. */ +static const yytype_uint16 yyprhs[] = +{ + 0, 0, 3, 5, 7, 9, 12, 15, 18, 22, + 24, 27, 31, 33, 35, 37, 39, 41, 43, 45, + 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, + 67, 69, 71, 73, 75, 77, 79, 81, 85, 88, + 91, 94, 97, 100, 103, 106, 109, 112, 115, 118, + 121, 123, 125, 127, 129, 131, 133, 135, 137, 139, + 141, 143, 145, 147, 149, 151, 154, 159, 163, 166, + 169, 174, 176, 178, 180, 182, 184, 186, 188, 190, + 192, 195, 197, 199, 201, 202, 205, 206, 208, 211, + 217, 221, 224, 228, 230, 232, 234, 236, 238, 240, + 242, 244, 246, 248, 251, 254, 256, 258, 262, 268, + 276, 278, 282, 284, 286, 288, 290, 292, 294, 300, + 302, 306, 312, 313, 315, 319, 321, 323, 325, 328, + 332, 334, 336, 339, 341, 344, 348, 352, 354, 356, + 358, 359, 363, 365, 369, 373, 379, 382, 385, 390, + 393, 396, 400, 402, 407, 414, 419, 425, 432, 437, + 441, 443, 445, 447, 449, 452, 456, 462, 469, 476, + 483, 490, 497, 505, 512, 519, 526, 533, 542, 551, + 552, 555, 558, 561, 563, 567, 569, 574, 579, 583, + 590, 595, 600, 607, 611, 613, 617, 618, 622, 626, + 630, 634, 638, 642, 646, 650, 654, 658, 664, 668, + 669, 671, 672, 674, 676, 678, 680, 683, 685, 688, + 690, 693, 696, 700, 701, 703, 706, 708, 711, 713, + 716, 719, 720, 723, 728, 730, 735, 741, 743, 748, + 753, 759, 760, 762, 764, 766, 767, 769, 773, 777, + 780, 782, 784, 786, 788, 790, 792, 794, 796, 798, + 800, 802, 804, 806, 808, 810, 812, 814, 816, 818, + 820, 822, 824, 826, 827, 830, 835, 840, 841, 844, + 845, 848, 851, 853, 855, 859, 862, 866, 871, 873, + 876, 877, 880, 884, 887, 890, 893, 894, 897, 901, + 904, 908, 911, 915, 919, 924, 926, 929, 932, 936, + 939, 942, 943, 945, 947, 950, 953, 957, 960, 962, + 965, 967, 970, 973, 976, 979, 980, 982, 986, 992, + 995, 999, 1002, 1003, 1005, 1008, 1011, 1014, 1017, 1022, + 1028, 1034, 1038, 1040, 1043, 1047, 1051, 1054, 1057, 1061, + 1065, 1066, 1069, 1071, 1075, 1079, 1083, 1084, 1086, 1088, + 1092, 1095, 1099, 1102, 1105, 1107, 1108, 1111, 1116, 1119, + 1121, 1125, 1128, 1133, 1137, 1143, 1145, 1147, 1149, 1151, + 1153, 1155, 1157, 1159, 1161, 1163, 1165, 1167, 1169, 1171, + 1173, 1175, 1177, 1179, 1181, 1183, 1185, 1187, 1189, 1191, + 1193, 1195, 1197, 1199, 1201, 1203, 1205, 1207, 1209, 1211, + 1213, 1215, 1217, 1219, 1221, 1223, 1225, 1227, 1229, 1231, + 1233 +}; + +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const yytype_int16 yyrhs[] = +{ + 175, 0, -1, 176, -1, 1, -1, 177, -1, 176, + 177, -1, 178, 46, -1, 178, 163, -1, 178, 163, + 46, -1, 163, -1, 163, 46, -1, 52, 178, 163, + -1, 179, -1, 218, -1, 223, -1, 219, -1, 220, + -1, 221, -1, 180, -1, 181, -1, 288, -1, 253, + -1, 195, -1, 254, -1, 292, -1, 293, -1, 201, + -1, 202, -1, 203, -1, 204, -1, 205, -1, 206, + -1, 207, -1, 182, -1, 187, -1, 222, -1, 294, + -1, 241, 192, 191, -1, 189, 179, -1, 189, 218, + -1, 189, 220, -1, 189, 221, -1, 189, 219, -1, + 189, 222, -1, 227, 179, -1, 227, 218, -1, 227, + 220, -1, 227, 221, -1, 227, 219, -1, 227, 222, + -1, 183, -1, 188, -1, 14, -1, 15, -1, 16, + -1, 17, -1, 18, -1, 179, -1, 218, -1, 219, + -1, 221, -1, 220, -1, 294, -1, 207, -1, 222, + -1, 164, 81, -1, 185, 165, 164, 81, -1, 26, + 299, 24, -1, 186, 184, -1, 27, 299, -1, 27, + 299, 28, 185, -1, 19, -1, 20, -1, 21, -1, + 22, -1, 49, -1, 23, -1, 50, -1, 51, -1, + 190, -1, 190, 81, -1, 82, -1, 83, -1, 84, + -1, -1, 24, 214, -1, -1, 211, -1, 5, 76, + -1, 5, 76, 192, 24, 214, -1, 5, 76, 211, + -1, 12, 77, -1, 12, 77, 211, -1, 193, -1, + 194, -1, 199, -1, 200, -1, 196, -1, 198, -1, + 197, -1, 154, -1, 152, -1, 153, -1, 155, 208, + -1, 190, 208, -1, 151, -1, 149, -1, 149, 24, + 81, -1, 149, 68, 150, 166, 81, -1, 149, 24, + 81, 68, 150, 166, 81, -1, 78, -1, 79, 166, + 113, -1, 88, -1, 89, -1, 90, -1, 91, -1, + 92, -1, 93, -1, 13, 208, 167, 209, 168, -1, + 299, -1, 299, 169, 299, -1, 299, 169, 299, 169, + 299, -1, -1, 210, -1, 209, 165, 210, -1, 81, + -1, 113, -1, 96, -1, 164, 81, -1, 164, 164, + 81, -1, 45, -1, 212, -1, 211, 212, -1, 213, + -1, 167, 168, -1, 167, 179, 168, -1, 167, 211, + 168, -1, 296, -1, 215, -1, 179, -1, -1, 167, + 217, 168, -1, 81, -1, 217, 165, 81, -1, 244, + 297, 295, -1, 244, 297, 295, 216, 215, -1, 246, + 214, -1, 242, 214, -1, 243, 252, 24, 214, -1, + 247, 297, -1, 12, 224, -1, 225, 165, 224, -1, + 225, -1, 164, 81, 166, 226, -1, 164, 164, 94, + 81, 166, 226, -1, 94, 81, 166, 226, -1, 164, + 164, 81, 166, 226, -1, 164, 164, 95, 81, 166, + 226, -1, 95, 81, 166, 226, -1, 81, 166, 226, + -1, 81, -1, 113, -1, 96, -1, 228, -1, 228, + 227, -1, 36, 229, 37, -1, 36, 101, 237, 236, + 37, -1, 36, 98, 166, 240, 236, 37, -1, 36, + 109, 166, 240, 236, 37, -1, 36, 97, 166, 240, + 236, 37, -1, 36, 99, 166, 240, 236, 37, -1, + 36, 100, 166, 240, 236, 37, -1, 36, 80, 81, + 166, 239, 236, 37, -1, 36, 104, 166, 238, 236, + 37, -1, 36, 105, 166, 238, 236, 37, -1, 36, + 102, 166, 240, 236, 37, -1, 36, 103, 166, 240, + 236, 37, -1, 36, 106, 107, 166, 170, 231, 171, + 37, -1, 36, 106, 108, 166, 170, 233, 171, 37, + -1, -1, 229, 230, -1, 38, 81, -1, 39, 81, + -1, 81, -1, 232, 165, 231, -1, 232, -1, 97, + 167, 240, 168, -1, 109, 167, 240, 168, -1, 110, + 167, 168, -1, 110, 167, 111, 166, 240, 168, -1, + 112, 167, 234, 168, -1, 64, 167, 238, 168, -1, + 64, 167, 238, 172, 238, 168, -1, 235, 165, 234, + -1, 235, -1, 81, 166, 240, -1, -1, 236, 165, + 237, -1, 97, 166, 240, -1, 98, 166, 240, -1, + 109, 166, 240, -1, 99, 166, 240, -1, 100, 166, + 240, -1, 104, 166, 238, -1, 105, 166, 238, -1, + 102, 166, 240, -1, 103, 166, 240, -1, 81, 169, + 81, 166, 239, -1, 81, 166, 239, -1, -1, 240, + -1, -1, 240, -1, 81, -1, 85, -1, 5, -1, + 29, 248, -1, 8, -1, 30, 248, -1, 6, -1, + 31, 248, -1, 7, 245, -1, 32, 248, 245, -1, + -1, 124, -1, 124, 48, -1, 9, -1, 33, 248, + -1, 10, -1, 34, 248, -1, 249, 35, -1, -1, + 250, 249, -1, 40, 167, 113, 168, -1, 113, -1, + 41, 167, 251, 168, -1, 60, 167, 81, 81, 168, + -1, 81, -1, 81, 167, 113, 168, -1, 81, 167, + 81, 168, -1, 81, 167, 81, 81, 168, -1, -1, + 42, -1, 43, -1, 44, -1, -1, 65, -1, 11, + 287, 62, -1, 11, 287, 63, -1, 11, 64, -1, + 258, -1, 260, -1, 261, -1, 264, -1, 262, -1, + 266, -1, 267, -1, 268, -1, 269, -1, 271, -1, + 272, -1, 273, -1, 274, -1, 275, -1, 277, -1, + 278, -1, 280, -1, 281, -1, 282, -1, 283, -1, + 284, -1, 285, -1, 286, -1, -1, 117, 113, -1, + 117, 113, 165, 113, -1, 117, 113, 118, 113, -1, + -1, 129, 81, -1, -1, 129, 81, -1, 114, 259, + -1, 115, -1, 116, -1, 116, 113, 255, -1, 126, + 256, -1, 126, 127, 256, -1, 126, 127, 128, 256, + -1, 119, -1, 121, 263, -1, -1, 122, 81, -1, + 122, 129, 81, -1, 122, 124, -1, 129, 81, -1, + 120, 265, -1, -1, 122, 256, -1, 122, 113, 256, + -1, 125, 256, -1, 125, 113, 256, -1, 123, 256, + -1, 123, 113, 256, -1, 123, 124, 256, -1, 123, + 124, 113, 256, -1, 130, -1, 130, 113, -1, 131, + 256, -1, 131, 148, 256, -1, 132, 256, -1, 133, + 270, -1, -1, 81, -1, 124, -1, 124, 81, -1, + 134, 257, -1, 134, 136, 257, -1, 134, 135, -1, + 137, -1, 137, 81, -1, 138, -1, 138, 139, -1, + 140, 255, -1, 140, 113, -1, 141, 276, -1, -1, + 113, -1, 113, 165, 113, -1, 113, 165, 113, 165, + 81, -1, 142, 256, -1, 142, 143, 256, -1, 144, + 279, -1, -1, 113, -1, 113, 113, -1, 145, 146, + -1, 145, 147, -1, 145, 148, -1, 156, 12, 81, + 166, -1, 156, 12, 81, 166, 81, -1, 156, 12, + 81, 166, 113, -1, 157, 6, 81, -1, 158, -1, + 159, 113, -1, 159, 113, 113, -1, 160, 81, 113, + -1, 160, 81, -1, 161, 113, -1, 161, 116, 113, + -1, 161, 162, 113, -1, -1, 66, 173, -1, 52, + -1, 53, 54, 289, -1, 61, 52, 81, -1, 61, + 53, 81, -1, -1, 290, -1, 291, -1, 290, 165, + 291, -1, 55, 56, -1, 57, 58, 59, -1, 86, + 81, -1, 87, 81, -1, 81, -1, -1, 135, 81, + -1, 135, 167, 81, 168, -1, 297, 295, -1, 299, + -1, 299, 169, 299, -1, 299, 299, -1, 299, 169, + 299, 299, -1, 299, 67, 299, -1, 299, 169, 299, + 67, 299, -1, 53, -1, 61, -1, 52, -1, 54, + -1, 58, -1, 63, -1, 62, -1, 66, -1, 65, + -1, 64, -1, 115, -1, 116, -1, 118, -1, 122, + -1, 123, -1, 125, -1, 127, -1, 128, -1, 139, + -1, 143, -1, 147, -1, 148, -1, 162, -1, 97, + -1, 98, -1, 99, -1, 100, -1, 150, -1, 101, + -1, 102, -1, 103, -1, 104, -1, 105, -1, 106, + -1, 107, -1, 108, -1, 109, -1, 111, -1, 110, + -1, 112, -1, 60, -1, 49, -1, 50, -1, 51, + -1, 81, -1, 298, -1 +}; + +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +static const yytype_uint16 yyrline[] = +{ + 0, 337, 337, 338, 340, 341, 343, 344, 345, 346, + 347, 348, 350, 351, 352, 353, 354, 355, 356, 357, + 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, + 368, 369, 370, 371, 372, 373, 374, 376, 378, 379, + 380, 381, 382, 383, 385, 386, 387, 388, 389, 390, + 392, 393, 395, 396, 397, 398, 399, 401, 402, 403, + 404, 405, 406, 407, 408, 410, 417, 425, 431, 434, + 439, 445, 446, 447, 448, 449, 450, 451, 452, 454, + 455, 457, 458, 459, 461, 462, 464, 465, 467, 468, + 469, 471, 472, 474, 475, 476, 477, 478, 480, 481, + 482, 483, 484, 485, 486, 492, 494, 495, 500, 505, + 512, 515, 521, 522, 523, 524, 525, 526, 529, 531, + 535, 540, 548, 551, 556, 561, 566, 571, 576, 581, + 586, 594, 595, 597, 599, 600, 601, 603, 604, 606, + 608, 609, 611, 612, 614, 618, 619, 620, 621, 622, + 627, 629, 630, 632, 636, 640, 644, 648, 652, 656, + 660, 665, 670, 676, 677, 679, 680, 681, 682, 683, + 684, 685, 686, 692, 693, 694, 695, 696, 697, 699, + 700, 702, 703, 704, 706, 707, 709, 714, 719, 720, + 721, 723, 724, 726, 727, 729, 737, 738, 740, 741, + 742, 743, 744, 745, 746, 747, 748, 749, 755, 757, + 758, 760, 761, 763, 764, 766, 767, 768, 769, 770, + 771, 772, 773, 775, 776, 777, 779, 780, 781, 782, + 783, 784, 785, 787, 788, 789, 790, 795, 796, 797, + 798, 800, 801, 802, 803, 805, 806, 809, 810, 811, + 814, 815, 816, 817, 818, 819, 820, 821, 822, 823, + 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, + 834, 835, 836, 841, 843, 847, 852, 860, 861, 865, + 866, 869, 871, 872, 873, 877, 878, 879, 883, 885, + 887, 888, 889, 890, 891, 894, 896, 897, 898, 899, + 900, 901, 902, 903, 904, 908, 909, 913, 914, 919, + 922, 924, 925, 926, 927, 931, 932, 933, 937, 938, + 942, 943, 947, 948, 951, 953, 954, 955, 956, 960, + 961, 964, 966, 967, 968, 972, 973, 974, 978, 979, + 980, 984, 988, 992, 993, 997, 998, 1002, 1003, 1004, + 1007, 1008, 1011, 1015, 1016, 1017, 1019, 1020, 1022, 1023, + 1026, 1027, 1030, 1036, 1039, 1041, 1042, 1043, 1045, 1050, + 1053, 1057, 1061, 1066, 1070, 1076, 1077, 1078, 1079, 1080, + 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, + 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, + 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, + 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1121, + 1122 +}; +#endif + +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "$end", "error", "$undefined", "DUMMY_WHERE_CLAUSE", + "DUMMY_INSERT_CLAUSE", "SELECT", "DELETE", "INSERT", "UPDATE", "REPLACE", + "MERGE", "SHOW", "SET", "CALL", "CREATE", "DROP", "ALTER", "TRUNCATE", + "RENAME", "GRANT", "REVOKE", "ANALYZE", "PURGE", "COMMENT", "FROM", + "DUAL", "PREPARE", "EXECUTE", "USING", "SELECT_HINT_BEGIN", + "UPDATE_HINT_BEGIN", "DELETE_HINT_BEGIN", "INSERT_HINT_BEGIN", + "REPLACE_HINT_BEGIN", "MERGE_HINT_BEGIN", "HINT_END", "COMMENT_BEGIN", + "COMMENT_END", "ROUTE_TABLE", "ROUTE_PART_KEY", "QUERY_TIMEOUT", + "READ_CONSISTENCY", "WEAK", "STRONG", "FROZEN", "PLACE_HOLDER", "END_P", + "ERROR", "WHEN", "FLASHBACK", "AUDIT", "NOAUDIT", "BEGI", "START", + "TRANSACTION", "READ", "ONLY", "WITH", "CONSISTENT", "SNAPSHOT", "INDEX", + "XA", "WARNINGS", "ERRORS", "TRACE", "QUICK", "COUNT", "AS", "WHERE", + "VALUES", "ORDER", "GROUP", "HAVING", "INTO", "UNION", "FOR", + "TX_READ_ONLY", "AUTOCOMMIT_0", "SELECT_OBPROXY_ROUTE_ADDR", + "SET_OBPROXY_ROUTE_ADDR", "NAME_OB_DOT", "NAME_OB", "EXPLAIN", "DESC", + "DESCRIBE", "NAME_STR", "USE", "HELP", "SET_NAMES", "SET_CHARSET", + "SET_PASSWORD", "SET_DEFAULT", "SET_OB_READ_CONSISTENCY", + "SET_TX_READ_ONLY", "GLOBAL", "SESSION", "NUMBER_VAL", "GROUP_ID", + "TABLE_ID", "ELASTIC_ID", "TESTLOAD", "ODP_COMMENT", "TNT_ID", + "DISASTER_STATUS", "TRACE_ID", "RPC_ID", "DBP_COMMENT", "ROUTE_TAG", + "SYS_TAG", "TABLE_NAME", "SCAN_ALL", "PARALL", "SHARD_KEY", "INT_NUM", + "SHOW_PROXYNET", "THREAD", "CONNECTION", "LIMIT", "OFFSET", + "SHOW_PROCESSLIST", "SHOW_PROXYSESSION", "SHOW_GLOBALSESSION", + "ATTRIBUTE", "VARIABLES", "ALL", "STAT", "SHOW_PROXYCONFIG", "DIFF", + "USER", "LIKE", "SHOW_PROXYSM", "SHOW_PROXYCLUSTER", + "SHOW_PROXYRESOURCE", "SHOW_PROXYCONGESTION", "SHOW_PROXYROUTE", + "PARTITION", "ROUTINE", "SHOW_PROXYVIP", "SHOW_PROXYMEMORY", "OBJPOOL", + "SHOW_SQLAUDIT", "SHOW_WARNLOG", "SHOW_PROXYSTAT", "REFRESH", + "SHOW_PROXYTRACE", "SHOW_PROXYINFO", "BINARY", "UPGRADE", "IDC", + "SHOW_TOPOLOGY", "GROUP_NAME", "SHOW_DB_VERSION", "SHOW_DATABASES", + "SHOW_TABLES", "SELECT_DATABASE", "SHOW_CREATE_TABLE", + "ALTER_PROXYCONFIG", "ALTER_PROXYRESOURCE", "PING_PROXY", + "KILL_PROXYSESSION", "KILL_GLOBALSESSION", "KILL", "QUERY", "';'", "'@'", + "','", "'='", "'('", "')'", "'.'", "'{'", "'}'", "'#'", "'*'", "$accept", + "root", "sql_stmts", "sql_stmt", "stmt", "select_stmt", "explain_stmt", + "comment_stmt", "ddl_stmt", "mysql_ddl_stmt", "text_ps_from_stmt", + "text_ps_using_var_list", "text_ps_prepare_stmt", "text_ps_stmt", + "oracle_ddl_stmt", "explain_or_desc_stmt", "explain_or_desc", "opt_from", + "select_expr_list", "select_tx_read_only_stmt", "set_autocommit_0_stmt", + "hooked_stmt", "shard_special_stmt", "show_db_version_stmt", + "show_es_id_stmt", "select_obproxy_route_addr_stmt", + "set_obproxy_route_addr_stmt", "set_names_stmt", "set_charset_stmt", + "set_password_stmt", "set_default_stmt", "set_ob_read_consistency_stmt", + "set_tx_read_only_stmt", "call_stmt", "routine_name_stmt", + "call_expr_list", "call_expr", "expr_list", "expr", "clause", "fromlist", + "sub_query", "opt_column_list", "column_list", "insert_stmt", + "replace_stmt", "update_stmt", "delete_stmt", "merge_stmt", "set_stmt", + "set_expr_list", "set_expr", "set_var_value", "comment_expr_list", + "comment_expr", "comment_list", "comment", "dbp_comment_list", + "dbp_comment", "dbp_sys_comment", "dbp_kv_comment_list", + "dbp_kv_comment", "odp_comment_list", "odp_comment", + "tracer_right_string_val", "name_right_string_val", "right_string_val", + "select_with_opt_hint", "update_with_opt_hint", "delete_with_opt_hint", + "insert_with_opt_hint", "insert_all_when", "replace_with_opt_hint", + "merge_with_opt_hint", "hint_list_with_end", "hint_list", "hint", + "opt_read_consistency", "opt_quick", "show_stmt", "icmd_stmt", + "opt_limit", "opt_like", "opt_large_like", "show_proxynet", + "opt_show_net", "show_proxyconfig", "show_processlist", + "show_globalsession", "opt_show_global_session", "show_proxysession", + "opt_show_session", "show_proxysm", "show_proxycluster", + "show_proxyresource", "show_proxycongestion", "opt_show_congestion", + "show_proxyroute", "show_proxyvip", "show_proxymemory", "show_sqlaudit", + "show_warnlog", "opt_show_warnlog", "show_proxystat", "show_proxytrace", + "opt_show_trace", "show_proxyinfo", "alter_proxyconfig", + "alter_proxyresource", "ping_proxy", "kill_proxysession", + "kill_globalsession", "kill_mysql", "opt_count", "begin_stmt", + "opt_transaction_characteristics", "transaction_characteristics", + "transaction_characteristic", "use_db_stmt", "help_stmt", "other_stmt", + "partition_factor", "table_references", "table_factor", + "non_reserved_keyword", "var_name", 0 +}; +#endif + +# ifdef YYPRINT +/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to + token YYLEX-NUM. */ +static const yytype_uint16 yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, + 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, + 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, + 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, + 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, + 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, + 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, + 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, + 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, + 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, + 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, + 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, + 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, + 415, 416, 417, 59, 64, 44, 61, 40, 41, 46, + 123, 125, 35, 42 +}; +# endif + +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint16 yyr1[] = +{ + 0, 174, 175, 175, 176, 176, 177, 177, 177, 177, + 177, 177, 178, 178, 178, 178, 178, 178, 178, 178, + 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, + 178, 178, 178, 178, 178, 178, 178, 179, 180, 180, + 180, 180, 180, 180, 181, 181, 181, 181, 181, 181, + 182, 182, 183, 183, 183, 183, 183, 184, 184, 184, + 184, 184, 184, 184, 184, 185, 185, 186, 187, 187, + 187, 188, 188, 188, 188, 188, 188, 188, 188, 189, + 189, 190, 190, 190, 191, 191, 192, 192, 193, 193, + 193, 194, 194, 195, 195, 195, 195, 195, 196, 196, + 196, 196, 196, 196, 196, 197, 198, 198, 198, 198, + 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, + 208, 208, 209, 209, 209, 210, 210, 210, 210, 210, + 210, 211, 211, 212, 213, 213, 213, 214, 214, 215, + 216, 216, 217, 217, 218, 218, 219, 220, 221, 222, + 223, 224, 224, 225, 225, 225, 225, 225, 225, 225, + 226, 226, 226, 227, 227, 228, 228, 228, 228, 228, + 228, 228, 228, 228, 228, 228, 228, 228, 228, 229, + 229, 230, 230, 230, 231, 231, 232, 232, 232, 232, + 232, 233, 233, 234, 234, 235, 236, 236, 237, 237, + 237, 237, 237, 237, 237, 237, 237, 237, 237, 238, + 238, 239, 239, 240, 240, 241, 241, 242, 242, 243, + 243, 244, 244, 245, 245, 245, 246, 246, 247, 247, + 248, 249, 249, 250, 250, 250, 250, 250, 250, 250, + 250, 251, 251, 251, 251, 252, 252, 253, 253, 253, + 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, + 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, + 254, 254, 254, 255, 255, 255, 255, 256, 256, 257, + 257, 258, 259, 259, 259, 260, 260, 260, 261, 262, + 263, 263, 263, 263, 263, 264, 265, 265, 265, 265, + 265, 265, 265, 265, 265, 266, 266, 267, 267, 268, + 269, 270, 270, 270, 270, 271, 271, 271, 272, 272, + 273, 273, 274, 274, 275, 276, 276, 276, 276, 277, + 277, 278, 279, 279, 279, 280, 280, 280, 281, 281, + 281, 282, 283, 284, 284, 285, 285, 286, 286, 286, + 287, 287, 288, 288, 288, 288, 289, 289, 290, 290, + 291, 291, 292, 293, 294, 295, 295, 295, 296, 297, + 297, 297, 297, 297, 297, 298, 298, 298, 298, 298, + 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, + 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, + 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, + 298, 298, 298, 298, 298, 298, 298, 298, 298, 299, + 299 +}; + +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 1, 1, 1, 2, 2, 2, 3, 1, + 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 3, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 2, 4, 3, 2, 2, + 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 1, 1, 1, 0, 2, 0, 1, 2, 5, + 3, 2, 3, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 2, 2, 1, 1, 3, 5, 7, + 1, 3, 1, 1, 1, 1, 1, 1, 5, 1, + 3, 5, 0, 1, 3, 1, 1, 1, 2, 3, + 1, 1, 2, 1, 2, 3, 3, 1, 1, 1, + 0, 3, 1, 3, 3, 5, 2, 2, 4, 2, + 2, 3, 1, 4, 6, 4, 5, 6, 4, 3, + 1, 1, 1, 1, 2, 3, 5, 6, 6, 6, + 6, 6, 7, 6, 6, 6, 6, 8, 8, 0, + 2, 2, 2, 1, 3, 1, 4, 4, 3, 6, + 4, 4, 6, 3, 1, 3, 0, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 5, 3, 0, + 1, 0, 1, 1, 1, 1, 2, 1, 2, 1, + 2, 2, 3, 0, 1, 2, 1, 2, 1, 2, + 2, 0, 2, 4, 1, 4, 5, 1, 4, 4, + 5, 0, 1, 1, 1, 0, 1, 3, 3, 2, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 0, 2, 4, 4, 0, 2, 0, + 2, 2, 1, 1, 3, 2, 3, 4, 1, 2, + 0, 2, 3, 2, 2, 2, 0, 2, 3, 2, + 3, 2, 3, 3, 4, 1, 2, 2, 3, 2, + 2, 0, 1, 1, 2, 2, 3, 2, 1, 2, + 1, 2, 2, 2, 2, 0, 1, 3, 5, 2, + 3, 2, 0, 1, 2, 2, 2, 2, 4, 5, + 5, 3, 1, 2, 3, 3, 2, 2, 3, 3, + 0, 2, 1, 3, 3, 3, 0, 1, 1, 3, + 2, 3, 2, 2, 1, 0, 2, 4, 2, 1, + 3, 2, 4, 3, 5, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1 +}; + +/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state + STATE-NUM when YYTABLE doesn't specify something else to do. Zero + means the default is an error. */ +static const yytype_uint16 yydefact[] = +{ + 0, 3, 215, 219, 223, 217, 226, 228, 350, 0, + 0, 52, 53, 54, 55, 56, 71, 72, 73, 74, + 76, 0, 0, 231, 231, 231, 231, 231, 231, 179, + 75, 77, 78, 352, 0, 0, 110, 0, 364, 81, + 82, 83, 0, 0, 112, 113, 114, 115, 116, 117, + 0, 288, 296, 290, 277, 305, 277, 277, 311, 279, + 318, 320, 273, 325, 277, 332, 0, 106, 105, 101, + 102, 100, 0, 0, 0, 342, 0, 0, 0, 9, + 0, 2, 4, 0, 12, 18, 19, 33, 50, 0, + 34, 51, 0, 79, 93, 94, 22, 97, 99, 98, + 95, 96, 26, 27, 28, 29, 30, 31, 32, 13, + 15, 16, 17, 35, 14, 0, 163, 86, 0, 245, + 0, 0, 0, 21, 23, 250, 251, 252, 254, 253, + 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 20, 24, + 25, 36, 88, 224, 221, 249, 0, 0, 91, 0, + 0, 0, 0, 150, 152, 416, 417, 418, 377, 375, + 378, 379, 415, 376, 381, 380, 384, 383, 382, 419, + 398, 399, 400, 401, 403, 404, 405, 406, 407, 408, + 409, 410, 411, 413, 412, 414, 385, 386, 387, 388, + 389, 390, 391, 392, 393, 394, 395, 396, 402, 397, + 0, 420, 119, 0, 69, 0, 0, 0, 237, 234, + 216, 0, 231, 218, 220, 223, 227, 229, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 352, 0, 356, 0, 0, 0, 362, 363, 282, + 283, 281, 277, 277, 277, 295, 0, 0, 289, 277, + 0, 285, 306, 277, 307, 309, 312, 313, 310, 0, + 317, 279, 315, 319, 321, 323, 0, 322, 326, 324, + 277, 329, 333, 331, 335, 336, 337, 0, 0, 103, + 0, 0, 343, 346, 347, 0, 0, 10, 1, 5, + 6, 7, 215, 57, 68, 63, 58, 59, 61, 60, + 64, 62, 38, 39, 42, 40, 41, 43, 80, 104, + 44, 45, 48, 46, 47, 49, 164, 0, 84, 87, + 131, 133, 139, 147, 138, 137, 365, 369, 246, 0, + 365, 146, 149, 0, 90, 225, 351, 247, 248, 92, + 0, 0, 0, 0, 0, 0, 122, 0, 67, 0, + 0, 241, 0, 0, 230, 232, 222, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 196, 0, 0, 209, 209, 0, 0, 0, + 165, 0, 0, 183, 180, 11, 0, 0, 353, 357, + 358, 354, 355, 111, 273, 277, 297, 277, 277, 301, + 277, 299, 291, 293, 0, 294, 277, 286, 278, 308, + 314, 280, 316, 274, 0, 330, 334, 107, 0, 0, + 341, 344, 345, 348, 349, 8, 134, 0, 0, 0, + 37, 132, 0, 368, 0, 0, 371, 0, 140, 0, + 160, 162, 161, 159, 0, 0, 0, 0, 0, 0, + 151, 130, 125, 127, 126, 0, 0, 123, 120, 0, + 70, 0, 242, 243, 244, 0, 0, 0, 0, 211, + 213, 214, 196, 196, 196, 196, 211, 0, 0, 0, + 0, 0, 0, 0, 209, 209, 0, 0, 196, 196, + 196, 210, 196, 0, 0, 196, 181, 182, 360, 0, + 0, 284, 298, 302, 277, 303, 300, 292, 287, 0, + 0, 327, 0, 0, 338, 135, 136, 85, 366, 0, + 373, 370, 148, 0, 0, 89, 155, 158, 153, 0, + 0, 0, 128, 0, 0, 118, 0, 65, 0, 233, + 235, 0, 0, 239, 238, 196, 212, 0, 0, 0, + 0, 208, 0, 198, 199, 201, 202, 205, 206, 203, + 204, 200, 166, 0, 0, 0, 0, 0, 0, 0, + 0, 361, 359, 304, 276, 275, 0, 0, 108, 339, + 340, 0, 0, 372, 142, 0, 145, 156, 0, 0, + 129, 124, 121, 0, 236, 240, 0, 169, 167, 170, + 171, 211, 197, 175, 176, 173, 174, 0, 0, 0, + 0, 0, 185, 0, 0, 168, 328, 0, 367, 374, + 0, 141, 154, 157, 66, 172, 207, 0, 0, 0, + 0, 0, 0, 209, 0, 109, 143, 0, 0, 0, + 188, 0, 0, 194, 177, 184, 0, 178, 186, 187, + 0, 0, 190, 0, 191, 209, 0, 195, 193, 0, + 189, 192 +}; + +/* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int16 yydefgoto[] = +{ + -1, 80, 81, 82, 83, 332, 85, 86, 87, 88, + 304, 470, 89, 90, 91, 92, 93, 440, 328, 94, + 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, + 105, 106, 107, 108, 210, 466, 467, 329, 330, 331, + 333, 334, 534, 595, 109, 110, 111, 112, 113, 114, + 163, 164, 453, 115, 116, 240, 394, 621, 622, 624, + 652, 653, 497, 382, 500, 555, 501, 117, 118, 119, + 120, 154, 121, 122, 220, 221, 222, 475, 339, 123, + 124, 277, 261, 272, 125, 251, 126, 127, 128, 258, + 129, 255, 130, 131, 132, 133, 268, 134, 135, 136, + 137, 138, 279, 139, 140, 283, 141, 142, 143, 144, + 145, 146, 147, 157, 148, 398, 399, 400, 149, 150, + 151, 443, 335, 336, 211, 337 +}; + +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +#define YYPACT_NINF -466 +static const yytype_int16 yypact[] = +{ + 359, -466, 27, -466, 23, -466, -466, -466, 61, -35, + 1139, -466, -466, -466, -466, -466, -466, -466, -466, -466, + -466, 1139, 1139, 36, 36, 36, 36, 36, 36, 135, + -466, -466, -466, 809, 78, 56, -466, 77, -466, -466, + -466, -466, 85, 97, -466, -466, -466, -466, -466, -466, + 86, -466, 166, 54, 28, 83, -63, 118, -20, -17, + 168, 129, 107, 171, 76, 190, 150, 25, -466, -466, + -466, -466, 1139, 282, 307, -466, 201, 234, -62, 270, + 317, 534, -466, 12, -466, -466, -466, -466, -466, 180, + -466, -466, 221, 1242, -466, -466, -466, -466, -466, -466, + -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, + -466, -466, -466, -466, -466, 221, 283, 151, 651, 255, + 1139, 651, 1139, -466, -466, -466, -466, -466, -466, -466, + -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, + -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, + -466, -466, -16, 274, -466, -466, 152, 212, 151, 157, + 243, 245, -36, -466, 163, -466, -466, -466, -466, -466, + -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, + -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, + -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, + -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, + 169, -466, 161, 309, 306, 170, 172, 173, 174, -466, + -466, 300, 36, -466, -466, 23, -466, -466, 261, 177, + 178, 179, 182, 167, 183, 185, 188, 191, 200, 193, + 26, -466, 175, 247, 265, 275, 249, -466, -466, -466, + 250, -466, -8, -45, 87, -466, -42, 277, -466, 181, + 302, -466, -466, 118, -466, -466, -466, 303, -466, 313, + -466, 258, -466, -466, -466, -466, 284, -466, 231, -466, + 118, -466, 285, -466, -466, -466, -466, 318, 251, -466, + 319, 321, 290, 291, -466, 292, 293, -466, -466, -466, + -466, 361, -466, -466, -466, -466, -466, -466, -466, -466, + -466, -466, -466, -466, -466, -466, -466, -466, 4, -466, + -466, -466, -466, -466, -466, -466, -466, 2, 389, 151, + -466, -466, -466, -466, -466, -466, 279, 922, -466, 391, + 279, -466, -466, 392, -4, -466, -466, -466, -466, 151, + 30, 252, 256, 259, 192, -25, 10, 1139, -466, 260, + 304, 257, 338, -3, -466, -466, -466, 262, -14, -14, + -14, -14, 124, 263, 264, 266, 267, 273, 278, 287, + 288, 289, -466, -14, -14, -14, -14, 294, 295, -14, + -466, 340, 342, -466, -466, -466, 370, 369, -466, 271, + -466, -466, -466, -466, 314, 118, -466, 118, 93, -466, + 118, -466, -466, -466, 375, -466, 118, -466, -466, -466, + -466, -466, -466, -66, 344, -466, -466, 390, 296, 297, + -466, -466, -466, -466, -466, -466, -466, 298, 144, 651, + -466, -466, -54, -466, 1139, 1139, -466, 651, -23, 651, + -466, -466, -466, -466, 30, 30, 30, 299, 383, 386, + -466, -466, -466, -466, -466, -34, 94, -466, 301, 387, + 310, 308, -466, -466, -466, 315, 388, -46, 316, -14, + -466, -466, -466, -466, -466, -466, -14, 393, -14, -14, + -14, -14, -14, -14, -14, -14, -14, -15, -466, -466, + -466, -466, -466, 311, 312, -466, -466, -466, -466, 412, + 247, -466, -466, -466, 118, -466, -466, -466, -466, 364, + 373, 322, 345, 407, 35, -466, -466, -466, -466, 413, + -466, 1036, -466, 417, 52, -466, -466, -466, -466, 30, + 336, 339, -466, 425, 10, -466, 1139, -466, 343, -466, + -466, 341, 355, -466, -466, -466, -466, -13, -12, -11, + -7, -466, 358, -466, -466, -466, -466, -466, -466, -466, + -466, -466, -466, 167, -5, -1, 0, 3, 148, 408, + 6, -466, -466, -466, -466, -466, 444, 360, -466, -466, + -466, 362, 1139, -466, -466, 127, -466, -466, 30, 30, + -466, -466, -466, 446, -466, -466, 7, -466, -466, -466, + -466, -14, -466, -466, -466, -466, -466, 365, 366, 367, + 368, 357, 372, 371, 398, -466, -466, 448, -466, -466, + 450, -466, -466, -466, -466, -466, -466, -14, -14, -70, + 477, 522, 148, -14, 525, -466, -466, 403, 404, 409, + -466, 410, 405, 414, -466, -466, 74, -466, -466, -466, + -14, -14, -466, 477, -466, -14, 406, -466, -466, 420, + -466, -466 +}; + +/* YYPGOTO[NTERM-NUM]. */ +static const yytype_int16 yypgoto[] = +{ + -466, -466, -466, 496, 545, 5, -466, -466, -466, -466, + -466, -466, -466, -466, -466, -466, -466, -466, 428, -466, + -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, + -466, -466, -466, 492, 8, -466, 45, -148, -296, -466, + -118, 57, -466, -466, 67, 88, 92, 102, 103, -466, + 235, -466, -437, 476, -466, -466, -466, -49, -466, -466, + -69, -466, -410, 24, -380, -465, -355, -466, -466, -466, + -466, 374, -466, -466, 253, 376, -466, -466, -466, -466, + -466, 196, -55, 325, -466, -466, -466, -466, -466, -466, + -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, + -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, + -466, -466, -466, -466, -466, -466, -466, 91, -466, -466, + 513, 268, -466, 101, -466, -10 +}; + +/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule which + number is the opposite. If zero, do what YYDEFACT says. + If YYTABLE_NINF, syntax error. */ +#define YYTABLE_NINF -420 +static const yytype_int16 yytable[] = +{ + 212, 264, 265, 341, 344, 84, 502, 302, -86, 281, + 349, 213, 214, 482, 483, 484, 485, 536, 537, 538, + -87, 561, 572, -144, 607, 608, 609, 528, 498, 499, + 610, 23, 613, 441, 505, 552, 614, 615, 84, 412, + 616, 649, 158, 625, 635, 353, 159, 542, 441, 287, + -419, 294, 519, 441, 295, 461, 159, 302, 300, 160, + 161, 266, 212, 390, 391, 392, 260, 480, 407, 160, + 161, 481, 557, 558, 559, 560, 215, 216, 477, 408, + 289, 23, 413, 212, 260, 263, 84, 414, 574, 575, + 576, 462, 577, 288, 303, 580, 217, 312, 650, 520, + 296, 319, 597, 152, 267, 405, 463, 393, 244, 245, + 478, 450, 269, 529, 569, 570, 589, 218, 270, 271, + 320, 260, 553, 464, 556, 155, 451, 156, 354, 162, + 543, 556, 243, 563, 564, 565, 566, 567, 568, 162, + -144, 571, 441, 452, 533, 606, 636, 153, 590, 219, + 573, 327, 573, 573, 573, 259, 306, 260, 573, 313, + 573, 632, 633, 327, 573, 573, 247, -419, 573, 327, + 436, 573, 573, -419, 465, 301, 256, 307, 248, 438, + 314, 308, 321, 257, 315, 302, 3, 4, 5, 6, + 7, 309, 310, 10, 316, 317, 262, 406, 409, 411, + 410, 249, 250, 322, 417, 260, 514, 323, 419, 23, + 24, 25, 26, 27, 28, 228, 260, 324, 325, 280, + 275, 340, 260, 342, 276, 425, 302, 3, 4, 5, + 6, 7, 229, 230, 231, 232, 233, 234, 235, 236, + 237, 238, 664, 246, 239, 617, 665, 260, 372, 273, + 23, 24, 25, 26, 27, 28, 556, 618, 619, 544, + 620, 38, 545, 656, 373, 374, 375, 376, 274, 377, + 378, 379, 380, 457, 347, 348, 381, 223, 224, 225, + 226, 227, 647, 648, 278, 669, 458, 459, 252, 253, + 486, 254, 630, 487, 290, 631, 284, 285, 286, 472, + 473, 474, 396, 282, 397, 666, 667, 387, 388, 416, + 260, 327, 526, 291, 292, 293, 297, 298, 327, 29, + 338, 527, 345, 350, 351, 346, 352, 446, 355, 532, + 357, 535, 437, 358, 359, 364, 356, 360, 395, 361, + 362, 363, 367, 368, 369, 370, 401, 468, 371, 383, + 512, 384, 513, 515, 385, 516, 402, 386, 415, 389, + 1, 518, 403, 404, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 418, 420, 21, 22, 269, 23, 24, + 25, 26, 27, 28, 421, 29, 424, 423, 426, 427, + 429, 428, 430, 431, 432, 433, 434, 435, 30, 31, + 32, 33, 34, 439, 442, 447, 449, 471, 454, 476, + 35, 506, 455, 507, 469, 456, 508, 509, 479, 488, + 489, 276, 490, 491, 530, 531, 510, 36, 37, 492, + 38, 39, 40, 41, 493, 42, 43, 44, 45, 46, + 47, 48, 49, 494, 495, 496, 517, 521, 522, 583, + 503, 504, 523, 524, 540, 539, 525, 541, 547, 551, + 546, 581, 623, 50, 562, 548, 549, 584, 51, 52, + 53, 578, 579, 550, 554, 54, 585, 586, 588, 55, + 56, 57, 58, 59, 591, 587, 60, 61, 594, 62, + 63, 64, 598, 65, 66, 599, 600, 603, 67, 604, + 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, + 78, 593, 79, 605, 611, 626, 627, 634, 641, 645, + 628, 646, 637, 638, 639, 640, 602, 642, 643, 2, + 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 651, 654, + 21, 22, 657, 23, 24, 25, 26, 27, 28, 644, + 29, 658, 659, 662, 670, 660, 661, 299, 242, 663, + 343, 305, 629, 30, 31, 32, 33, 34, 671, 601, + 460, 596, 326, 655, 668, 35, 422, 612, 365, 366, + 511, 582, 311, 0, 0, 0, 0, 0, 448, 0, + 0, 0, 36, 37, 0, 38, 39, 40, 41, 0, + 42, 43, 44, 45, 46, 47, 48, 49, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 50, 0, + 0, 0, 0, 51, 52, 53, 302, 0, 0, 0, + 54, 0, 0, 0, 55, 56, 57, 58, 59, 0, + 0, 60, 61, 0, 62, 63, 64, 0, 65, 66, + 23, 0, 0, 67, 0, 68, 69, 70, 71, 72, + 73, 74, 75, 76, 77, 78, 0, 79, 0, 0, + 165, 166, 167, 168, 169, 170, 0, 0, 0, 171, + 0, 172, 173, 174, 175, 176, 177, 178, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 179, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 180, 181, + 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, + 192, 193, 194, 195, 0, 0, 196, 197, 0, 198, + 0, 0, 0, 199, 200, 0, 201, 0, 202, 203, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 204, 0, 0, 0, 205, 0, 0, 0, 206, 207, + 0, 208, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 209, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 0, 0, 21, 22, 0, 23, 24, + 25, 26, 27, 28, 0, 29, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 30, 31, + 32, 241, 34, 0, 0, 0, 0, 0, 0, 0, + 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 36, 37, 0, + 38, 39, 40, 41, 0, 42, 43, 44, 45, 46, + 47, 48, 49, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 50, 0, 0, 0, 0, 51, 52, + 53, 0, 0, 0, 0, 54, 0, 0, 0, 55, + 56, 57, 58, 59, 0, 0, 60, 61, 0, 62, + 63, 64, 0, 65, 66, 0, 0, 0, 67, 0, + 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, + 78, 165, 166, 167, 168, 169, 170, 0, 0, 0, + 171, 0, 172, 173, 174, 175, 176, 177, 178, 444, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 179, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 180, + 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, + 191, 192, 193, 194, 195, 0, 0, 196, 197, 0, + 198, 0, 0, 0, 199, 200, 0, 201, 0, 202, + 203, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 204, 0, 0, 0, 205, 0, 0, 0, 206, + 207, 0, 208, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 209, 165, 166, 167, 168, 169, + 170, 445, 0, 0, 171, 0, 172, 173, 174, 175, + 176, 177, 178, 592, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 179, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 180, 181, 182, 183, 184, 185, 186, + 187, 188, 189, 190, 191, 192, 193, 194, 195, 0, + 0, 196, 197, 0, 198, 0, 0, 0, 199, 200, + 0, 201, 0, 202, 203, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 204, 0, 0, 0, 205, + 0, 0, 0, 206, 207, 0, 208, 0, 165, 166, + 167, 168, 169, 170, 0, 0, 0, 171, 209, 172, + 173, 174, 175, 176, 177, 178, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 179, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 180, 181, 182, 183, + 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, + 194, 195, 0, 0, 196, 197, 0, 198, 0, 0, + 0, 199, 200, 0, 201, 0, 202, 203, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 204, 0, + 0, 0, 205, 0, 0, 0, 206, 207, 0, 208, + 0, 165, 166, 167, 168, 169, 170, 0, 0, 0, + 171, 209, 172, 173, 174, 175, 176, 177, 178, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 318, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 180, + 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, + 191, 192, 193, 194, 195, 0, 0, 196, 197, 0, + 198, 0, 0, 0, 199, 200, 0, 201, 0, 202, + 203, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 204, 0, 0, 0, 205, 0, 0, 0, 206, + 207, 0, 208, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 209 +}; + +static const yytype_int16 yycheck[] = +{ + 10, 56, 57, 121, 152, 0, 386, 5, 24, 64, + 158, 21, 22, 368, 369, 370, 371, 454, 455, 456, + 24, 486, 37, 46, 37, 37, 37, 81, 383, 384, + 37, 29, 37, 329, 389, 81, 37, 37, 33, 81, + 37, 111, 77, 37, 37, 81, 81, 81, 344, 24, + 46, 113, 118, 349, 116, 45, 81, 5, 46, 94, + 95, 81, 72, 37, 38, 39, 129, 81, 113, 94, + 95, 85, 482, 483, 484, 485, 40, 41, 81, 124, + 72, 29, 124, 93, 129, 148, 81, 129, 498, 499, + 500, 81, 502, 68, 89, 505, 60, 92, 168, 165, + 162, 93, 539, 76, 124, 113, 96, 81, 52, 53, + 113, 81, 129, 167, 494, 495, 81, 81, 135, 136, + 115, 129, 168, 113, 479, 64, 96, 66, 164, 164, + 164, 486, 54, 488, 489, 490, 491, 492, 493, 164, + 163, 496, 438, 113, 167, 555, 611, 124, 113, 113, + 165, 167, 165, 165, 165, 127, 89, 129, 165, 92, + 165, 598, 599, 167, 165, 165, 81, 163, 165, 167, + 168, 165, 165, 169, 164, 163, 122, 89, 81, 327, + 92, 89, 115, 129, 92, 5, 6, 7, 8, 9, + 10, 89, 89, 13, 92, 92, 113, 252, 253, 254, + 113, 115, 116, 115, 259, 129, 113, 115, 263, 29, + 30, 31, 32, 33, 34, 80, 129, 115, 115, 143, + 113, 120, 129, 122, 117, 280, 5, 6, 7, 8, + 9, 10, 97, 98, 99, 100, 101, 102, 103, 104, + 105, 106, 168, 166, 109, 97, 172, 129, 81, 81, + 29, 30, 31, 32, 33, 34, 611, 109, 110, 165, + 112, 81, 168, 643, 97, 98, 99, 100, 139, 102, + 103, 104, 105, 81, 62, 63, 109, 24, 25, 26, + 27, 28, 637, 638, 113, 665, 94, 95, 122, 123, + 166, 125, 165, 169, 12, 168, 146, 147, 148, 42, + 43, 44, 55, 113, 57, 660, 661, 107, 108, 128, + 129, 167, 168, 6, 113, 81, 46, 0, 167, 36, + 65, 439, 48, 166, 81, 173, 81, 337, 165, 447, + 169, 449, 327, 24, 28, 35, 167, 167, 163, 167, + 167, 167, 81, 166, 166, 166, 81, 357, 166, 166, + 405, 166, 407, 408, 166, 410, 81, 166, 81, 166, + 1, 416, 113, 113, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 81, 81, 26, 27, 129, 29, 30, + 31, 32, 33, 34, 81, 36, 165, 113, 113, 81, + 81, 150, 81, 113, 113, 113, 113, 46, 49, 50, + 51, 52, 53, 24, 135, 24, 24, 113, 166, 81, + 61, 81, 166, 81, 164, 166, 56, 58, 166, 166, + 166, 117, 166, 166, 444, 445, 165, 78, 79, 166, + 81, 82, 83, 84, 166, 86, 87, 88, 89, 90, + 91, 92, 93, 166, 166, 166, 81, 113, 68, 514, + 166, 166, 166, 166, 81, 166, 168, 81, 81, 81, + 169, 59, 64, 114, 81, 165, 168, 113, 119, 120, + 121, 170, 170, 168, 168, 126, 113, 165, 81, 130, + 131, 132, 133, 134, 81, 150, 137, 138, 81, 140, + 141, 142, 166, 144, 145, 166, 81, 164, 149, 168, + 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, + 161, 531, 163, 168, 166, 81, 166, 81, 171, 81, + 168, 81, 167, 167, 167, 167, 546, 165, 167, 5, + 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 81, 37, + 26, 27, 37, 29, 30, 31, 32, 33, 34, 171, + 36, 168, 168, 168, 168, 166, 166, 81, 33, 165, + 152, 89, 592, 49, 50, 51, 52, 53, 168, 544, + 355, 534, 116, 642, 663, 61, 271, 573, 222, 225, + 404, 510, 89, -1, -1, -1, -1, -1, 340, -1, + -1, -1, 78, 79, -1, 81, 82, 83, 84, -1, + 86, 87, 88, 89, 90, 91, 92, 93, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 114, -1, + -1, -1, -1, 119, 120, 121, 5, -1, -1, -1, + 126, -1, -1, -1, 130, 131, 132, 133, 134, -1, + -1, 137, 138, -1, 140, 141, 142, -1, 144, 145, + 29, -1, -1, 149, -1, 151, 152, 153, 154, 155, + 156, 157, 158, 159, 160, 161, -1, 163, -1, -1, + 49, 50, 51, 52, 53, 54, -1, -1, -1, 58, + -1, 60, 61, 62, 63, 64, 65, 66, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 81, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 97, 98, + 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, + 109, 110, 111, 112, -1, -1, 115, 116, -1, 118, + -1, -1, -1, 122, 123, -1, 125, -1, 127, 128, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 139, -1, -1, -1, 143, -1, -1, -1, 147, 148, + -1, 150, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 162, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, -1, -1, 26, 27, -1, 29, 30, + 31, 32, 33, 34, -1, 36, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 49, 50, + 51, 52, 53, -1, -1, -1, -1, -1, -1, -1, + 61, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 78, 79, -1, + 81, 82, 83, 84, -1, 86, 87, 88, 89, 90, + 91, 92, 93, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 114, -1, -1, -1, -1, 119, 120, + 121, -1, -1, -1, -1, 126, -1, -1, -1, 130, + 131, 132, 133, 134, -1, -1, 137, 138, -1, 140, + 141, 142, -1, 144, 145, -1, -1, -1, 149, -1, + 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, + 161, 49, 50, 51, 52, 53, 54, -1, -1, -1, + 58, -1, 60, 61, 62, 63, 64, 65, 66, 67, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 81, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 97, + 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, + 108, 109, 110, 111, 112, -1, -1, 115, 116, -1, + 118, -1, -1, -1, 122, 123, -1, 125, -1, 127, + 128, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 139, -1, -1, -1, 143, -1, -1, -1, 147, + 148, -1, 150, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 162, 49, 50, 51, 52, 53, + 54, 169, -1, -1, 58, -1, 60, 61, 62, 63, + 64, 65, 66, 67, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 81, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 97, 98, 99, 100, 101, 102, 103, + 104, 105, 106, 107, 108, 109, 110, 111, 112, -1, + -1, 115, 116, -1, 118, -1, -1, -1, 122, 123, + -1, 125, -1, 127, 128, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 139, -1, -1, -1, 143, + -1, -1, -1, 147, 148, -1, 150, -1, 49, 50, + 51, 52, 53, 54, -1, -1, -1, 58, 162, 60, + 61, 62, 63, 64, 65, 66, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 81, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 97, 98, 99, 100, + 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, + 111, 112, -1, -1, 115, 116, -1, 118, -1, -1, + -1, 122, 123, -1, 125, -1, 127, 128, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 139, -1, + -1, -1, 143, -1, -1, -1, 147, 148, -1, 150, + -1, 49, 50, 51, 52, 53, 54, -1, -1, -1, + 58, 162, 60, 61, 62, 63, 64, 65, 66, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 81, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 97, + 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, + 108, 109, 110, 111, 112, -1, -1, 115, 116, -1, + 118, -1, -1, -1, 122, 123, -1, 125, -1, 127, + 128, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 139, -1, -1, -1, 143, -1, -1, -1, 147, + 148, -1, 150, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 162 +}; + +/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const yytype_uint16 yystos[] = +{ + 0, 1, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 26, 27, 29, 30, 31, 32, 33, 34, 36, + 49, 50, 51, 52, 53, 61, 78, 79, 81, 82, + 83, 84, 86, 87, 88, 89, 90, 91, 92, 93, + 114, 119, 120, 121, 126, 130, 131, 132, 133, 134, + 137, 138, 140, 141, 142, 144, 145, 149, 151, 152, + 153, 154, 155, 156, 157, 158, 159, 160, 161, 163, + 175, 176, 177, 178, 179, 180, 181, 182, 183, 186, + 187, 188, 189, 190, 193, 194, 195, 196, 197, 198, + 199, 200, 201, 202, 203, 204, 205, 206, 207, 218, + 219, 220, 221, 222, 223, 227, 228, 241, 242, 243, + 244, 246, 247, 253, 254, 258, 260, 261, 262, 264, + 266, 267, 268, 269, 271, 272, 273, 274, 275, 277, + 278, 280, 281, 282, 283, 284, 285, 286, 288, 292, + 293, 294, 76, 124, 245, 64, 66, 287, 77, 81, + 94, 95, 164, 224, 225, 49, 50, 51, 52, 53, + 54, 58, 60, 61, 62, 63, 64, 65, 66, 81, + 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, + 107, 108, 109, 110, 111, 112, 115, 116, 118, 122, + 123, 125, 127, 128, 139, 143, 147, 148, 150, 162, + 208, 298, 299, 299, 299, 40, 41, 60, 81, 113, + 248, 249, 250, 248, 248, 248, 248, 248, 80, 97, + 98, 99, 100, 101, 102, 103, 104, 105, 106, 109, + 229, 52, 178, 54, 52, 53, 166, 81, 81, 115, + 116, 259, 122, 123, 125, 265, 122, 129, 263, 127, + 129, 256, 113, 148, 256, 256, 81, 124, 270, 129, + 135, 136, 257, 81, 139, 113, 117, 255, 113, 276, + 143, 256, 113, 279, 146, 147, 148, 24, 68, 208, + 12, 6, 113, 81, 113, 116, 162, 46, 0, 177, + 46, 163, 5, 179, 184, 207, 218, 219, 220, 221, + 222, 294, 179, 218, 219, 220, 221, 222, 81, 208, + 179, 218, 219, 220, 221, 222, 227, 167, 192, 211, + 212, 213, 179, 214, 215, 296, 297, 299, 65, 252, + 297, 214, 297, 192, 211, 48, 173, 62, 63, 211, + 166, 81, 81, 81, 164, 165, 167, 169, 24, 28, + 167, 167, 167, 167, 35, 249, 245, 81, 166, 166, + 166, 166, 81, 97, 98, 99, 100, 102, 103, 104, + 105, 109, 237, 166, 166, 166, 166, 107, 108, 166, + 37, 38, 39, 81, 230, 163, 55, 57, 289, 290, + 291, 81, 81, 113, 113, 113, 256, 113, 124, 256, + 113, 256, 81, 124, 129, 81, 128, 256, 81, 256, + 81, 81, 257, 113, 165, 256, 113, 81, 150, 81, + 81, 113, 113, 113, 113, 46, 168, 179, 211, 24, + 191, 212, 135, 295, 67, 169, 299, 24, 295, 24, + 81, 96, 113, 226, 166, 166, 166, 81, 94, 95, + 224, 45, 81, 96, 113, 164, 209, 210, 299, 164, + 185, 113, 42, 43, 44, 251, 81, 81, 113, 166, + 81, 85, 240, 240, 240, 240, 166, 169, 166, 166, + 166, 166, 166, 166, 166, 166, 166, 236, 240, 240, + 238, 240, 238, 166, 166, 240, 81, 81, 56, 58, + 165, 255, 256, 256, 113, 256, 256, 81, 256, 118, + 165, 113, 68, 166, 166, 168, 168, 214, 81, 167, + 299, 299, 214, 167, 216, 214, 226, 226, 226, 166, + 81, 81, 81, 164, 165, 168, 169, 81, 165, 168, + 168, 81, 81, 168, 168, 239, 240, 236, 236, 236, + 236, 239, 81, 240, 240, 240, 240, 240, 240, 238, + 238, 240, 37, 165, 236, 236, 236, 236, 170, 170, + 236, 59, 291, 256, 113, 113, 165, 150, 81, 81, + 113, 81, 67, 299, 81, 217, 215, 226, 166, 166, + 81, 210, 299, 164, 168, 168, 236, 37, 37, 37, + 37, 166, 237, 37, 37, 37, 37, 97, 109, 110, + 112, 231, 232, 64, 233, 37, 81, 166, 168, 299, + 165, 168, 226, 226, 81, 37, 239, 167, 167, 167, + 167, 171, 165, 167, 171, 81, 81, 240, 240, 111, + 168, 81, 234, 235, 37, 231, 238, 37, 168, 168, + 166, 166, 168, 165, 168, 172, 240, 240, 234, 238, + 168, 168 +}; + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + + +/* Like YYERROR except do call yyerror. This remains here temporarily + to ease the transition to the new meaning of YYERROR, for GCC. + Once GCC version 2 has supplanted version 1, this can go. */ + +#define YYFAIL goto yyerrlab + +#define YYRECOVERING() (!!yyerrstatus) + +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + yytoken = YYTRANSLATE (yychar); \ + YYPOPSTACK (1); \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (&yylloc, result, YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ +while (YYID (0)) + + +#define YYTERROR 1 +#define YYERRCODE 256 + + +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ + +#define YYRHSLOC(Rhs, K) ((Rhs)[K]) +#ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (YYID (N)) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ + while (YYID (0)) +#endif + + +/* YY_LOCATION_PRINT -- Print the location on the stream. + This macro was not mandated originally: define only if we know + we won't break user code: when these are the locations we know. */ + +#ifndef YY_LOCATION_PRINT +# if YYLTYPE_IS_TRIVIAL +# define YY_LOCATION_PRINT(File, Loc) \ + fprintf (File, "%d.%d-%d.%d", \ + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) +# else +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +# endif +#endif + + +/* YYLEX -- calling `yylex' with the right arguments. */ + +#ifdef YYLEX_PARAM +# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) +#else +# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) +#endif + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (YYID (0)) + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value, Location, result); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (YYID (0)) + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, ObProxyParseResult* result) +#else +static void +yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, result) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; + YYLTYPE const * const yylocationp; + ObProxyParseResult* result; +#endif +{ + if (!yyvaluep) + return; + YYUSE (yylocationp); + YYUSE (result); +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# else + YYUSE (yyoutput); +# endif + switch (yytype) + { + default: + break; + } +} + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, ObProxyParseResult* result) +#else +static void +yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp, result) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; + YYLTYPE const * const yylocationp; + ObProxyParseResult* result; +#endif +{ + if (yytype < YYNTOKENS) + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + + YY_LOCATION_PRINT (yyoutput, *yylocationp); + YYFPRINTF (yyoutput, ": "); + yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, result); + YYFPRINTF (yyoutput, ")"); +} + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +#else +static void +yy_stack_print (yybottom, yytop) + yytype_int16 *yybottom; + yytype_int16 *yytop; +#endif +{ + YYFPRINTF (stderr, "Stack now"); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (YYID (0)) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, ObProxyParseResult* result) +#else +static void +yy_reduce_print (yyvsp, yylsp, yyrule, result) + YYSTYPE *yyvsp; + YYLTYPE *yylsp; + int yyrule; + ObProxyParseResult* result; +#endif +{ + int yynrhs = yyr2[yyrule]; + int yyi; + unsigned long int yylno = yyrline[yyrule]; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], + &(yyvsp[(yyi + 1) - (yynrhs)]) + , &(yylsp[(yyi + 1) - (yynrhs)]) , result); + YYFPRINTF (stderr, "\n"); + } +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyvsp, yylsp, Rule, result); \ +} while (YYID (0)) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !YYDEBUG */ + + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH 10000 +#endif + + + +#if YYERROR_VERBOSE + +# ifndef yystrlen +# if defined __GLIBC__ && defined _STRING_H +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static YYSIZE_T +yystrlen (const char *yystr) +#else +static YYSIZE_T +yystrlen (yystr) + const char *yystr; +#endif +{ + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) + continue; + return yylen; +} +# endif +# endif + +# ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static char * +yystpcpy (char *yydest, const char *yysrc) +#else +static char * +yystpcpy (yydest, yysrc) + char *yydest; + const char *yysrc; +#endif +{ + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + YYSIZE_T yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (! yyres) + return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +/* Copy into YYRESULT an error message about the unexpected token + YYCHAR while in state YYSTATE. Return the number of bytes copied, + including the terminating null byte. If YYRESULT is null, do not + copy anything; just return the number of bytes that would be + copied. As a special case, return 0 if an ordinary "syntax error" + message will do. Return YYSIZE_MAXIMUM if overflow occurs during + size calculation. */ +static YYSIZE_T +yysyntax_error (char *yyresult, int yystate, int yychar) +{ + int yyn = yypact[yystate]; + + if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) + return 0; + else + { + int yytype = YYTRANSLATE (yychar); + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + int yysize_overflow = 0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + int yyx; + +# if 0 + /* This is so xgettext sees the translatable formats that are + constructed on the fly. */ + YY_("syntax error, unexpected %s"); + YY_("syntax error, unexpected %s, expecting %s"); + YY_("syntax error, unexpected %s, expecting %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); +# endif + char *yyfmt; + char const *yyf; + static char const yyunexpected[] = "syntax error, unexpected %s"; + static char const yyexpecting[] = ", expecting %s"; + static char const yyor[] = " or %s"; + char yyformat[sizeof yyunexpected + + sizeof yyexpecting - 1 + + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) + * (sizeof yyor - 1))]; + char const *yyprefix = yyexpecting; + + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yycount = 1; + + yyarg[0] = yytname[yytype]; + yyfmt = yystpcpy (yyformat, yyunexpected); + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + yyformat[sizeof yyunexpected - 1] = '\0'; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + yyfmt = yystpcpy (yyfmt, yyprefix); + yyprefix = yyor; + } + + yyf = YY_(yyformat); + yysize1 = yysize + yystrlen (yyf); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + + if (yysize_overflow) + return YYSIZE_MAXIMUM; + + if (yyresult) + { + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + char *yyp = yyresult; + int yyi = 0; + while ((*yyp = *yyf) != '\0') + { + if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyf += 2; + } + else + { + yyp++; + yyf++; + } + } + } + return yysize; + } +} +#endif /* YYERROR_VERBOSE */ + + +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, ObProxyParseResult* result) +#else +static void +yydestruct (yymsg, yytype, yyvaluep, yylocationp, result) + const char *yymsg; + int yytype; + YYSTYPE *yyvaluep; + YYLTYPE *yylocationp; + ObProxyParseResult* result; +#endif +{ + YYUSE (yyvaluep); + YYUSE (yylocationp); + YYUSE (result); + + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + + switch (yytype) + { + + default: + break; + } +} + +/* Prevent warnings from -Wmissing-prototypes. */ +#ifdef YYPARSE_PARAM +#if defined __STDC__ || defined __cplusplus +int yyparse (void *YYPARSE_PARAM); +#else +int yyparse (); +#endif +#else /* ! YYPARSE_PARAM */ +#if defined __STDC__ || defined __cplusplus +int yyparse (ObProxyParseResult* result); +#else +int yyparse (); +#endif +#endif /* ! YYPARSE_PARAM */ + + + + + +/*-------------------------. +| yyparse or yypush_parse. | +`-------------------------*/ + +#ifdef YYPARSE_PARAM +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (void *YYPARSE_PARAM) +#else +int +yyparse (YYPARSE_PARAM) + void *YYPARSE_PARAM; +#endif +#else /* ! YYPARSE_PARAM */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (ObProxyParseResult* result) +#else +int +yyparse (result) + ObProxyParseResult* result; +#endif +#endif +{ +/* The lookahead symbol. */ +int yychar; + +/* The semantic value of the lookahead symbol. */ +YYSTYPE yylval; + +/* Location data for the lookahead symbol. */ +YYLTYPE yylloc; + + /* Number of syntax errors so far. */ + int yynerrs; + + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + + /* The stacks and their tools: + `yyss': related to states. + `yyvs': related to semantic values. + `yyls': related to locations. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; + + /* The location stack. */ + YYLTYPE yylsa[YYINITDEPTH]; + YYLTYPE *yyls; + YYLTYPE *yylsp; + + /* The locations where the error started and ended. */ + YYLTYPE yyerror_range[2]; + + YYSIZE_T yystacksize; + + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken; + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + YYLTYPE yyloc; + +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) + + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; + + yytoken = 0; + yyss = yyssa; + yyvs = yyvsa; + yyls = yylsa; + yystacksize = YYINITDEPTH; + + YYDPRINTF ((stderr, "Starting parse\n")); + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + + /* Initialize stack pointers. + Waste one element of value and location stack + so that they stay on the same level as the state stack. + The wasted elements are never initialized. */ + yyssp = yyss; + yyvsp = yyvs; + yylsp = yyls; + +#if YYLTYPE_IS_TRIVIAL + /* Initialize the default location before parsing starts. */ + yylloc.first_line = yylloc.last_line = 1; + yylloc.first_column = yylloc.last_column = 1; +#endif + + goto yysetstate; + +/*------------------------------------------------------------. +| yynewstate -- Push a new state, which is found in yystate. | +`------------------------------------------------------------*/ + yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. So pushing a state here evens the stacks. */ + yyssp++; + + yysetstate: + *yyssp = yystate; + + if (yyss + yystacksize - 1 <= yyssp) + { + /* Get the current used size of the three stacks, in elements. */ + YYSIZE_T yysize = yyssp - yyss + 1; + +#ifdef yyoverflow + { + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; + YYLTYPE *yyls1 = yyls; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yyls1, yysize * sizeof (*yylsp), + &yystacksize); + + yyls = yyls1; + yyss = yyss1; + yyvs = yyvs1; + } +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyexhaustedlab; +# else + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + goto yyexhaustedlab; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); + YYSTACK_RELOCATE (yyls_alloc, yyls); +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif +#endif /* no yyoverflow */ + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; + yylsp = yyls + yysize - 1; + + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + + if (yystate == YYFINAL) + YYACCEPT; + + goto yybackup; + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: + + /* Do appropriate processing given the current state. Read a + lookahead token if we need one and don't already have one. */ + + /* First try to decide what to do without reference to lookahead token. */ + yyn = yypact[yystate]; + if (yyn == YYPACT_NINF) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = YYLEX; + } + + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + goto yydefault; + yyn = yytable[yyn]; + if (yyn <= 0) + { + if (yyn == 0 || yyn == YYTABLE_NINF) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + /* Shift the lookahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the shifted token. */ + yychar = YYEMPTY; + + yystate = yyn; + *++yyvsp = yylval; + *++yylsp = yylloc; + goto yynewstate; + + +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ +yyreduce: + /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; + + /* If YYLEN is nonzero, implement the default value of the action: + `$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + + /* Default location. */ + YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 2: + + { HANDLE_ACCEPT(); ;} + break; + + case 3: + + { HANDLE_ERROR_ACCEPT(); ;} + break; + + case 6: + + { handle_stmt_end(result); HANDLE_ACCEPT(); ;} + break; + + case 7: + + { handle_stmt_end(result); ;} + break; + + case 8: + + { handle_stmt_end(result); HANDLE_ACCEPT(); ;} + break; + + case 9: + + { handle_stmt_end(result); ;} + break; + + case 10: + + { handle_stmt_end(result); HANDLE_ACCEPT(); ;} + break; + + case 11: + + { handle_stmt_end(result); ;} + break; + + case 12: + + {;} + break; + + case 13: + + {;} + break; + + case 14: + + {;} + break; + + case 15: + + {;} + break; + + case 16: + + {;} + break; + + case 17: + + {;} + break; + + case 18: + + {;} + break; + + case 19: + + {;} + break; + + case 20: + + {;} + break; + + case 21: + + {;} + break; + + case 22: + + {;} + break; + + case 23: + + {;} + break; + + case 24: + + {;} + break; + + case 25: + + {;} + break; + + case 26: + + {;} + break; + + case 27: + + {;} + break; + + case 28: + + {;} + break; + + case 29: + + {;} + break; + + case 30: + + {;} + break; + + case 31: + + {;} + break; + + case 32: + + {;} + break; + + case 33: + + {;} + break; + + case 34: + + {;} + break; + + case 35: + + {;} + break; + + case 36: + + { result->cur_stmt_type_ = OBPROXY_T_OTHERS; ;} + break; + + case 52: + + { result->cur_stmt_type_ = OBPROXY_T_CREATE; ;} + break; + + case 53: + + { result->cur_stmt_type_ = OBPROXY_T_DROP; ;} + break; + + case 54: + + { result->cur_stmt_type_ = OBPROXY_T_ALTER; ;} + break; + + case 55: + + { result->cur_stmt_type_ = OBPROXY_T_TRUNCATE; ;} + break; + + case 56: + + { result->cur_stmt_type_ = OBPROXY_T_RENAME; ;} + break; + + case 57: + + {;} + break; + + case 58: + + {;} + break; + + case 59: + + {;} + break; + + case 60: + + {;} + break; + + case 61: + + {;} + break; + + case 62: + + {;} + break; + + case 63: + + {;} + break; + + case 64: + + {;} + break; + + case 65: + + { + ObProxyTextPsExecuteParseNode *node = NULL; + malloc_execute_parse_node(node); + node->str_value_ = (yyvsp[(2) - (2)].str); + add_text_ps_execute_node(result->text_ps_execute_parse_info_, node); + ;} + break; + + case 66: + + { + ObProxyTextPsExecuteParseNode *node = NULL; + malloc_execute_parse_node(node); + node->str_value_ = (yyvsp[(4) - (4)].str); + add_text_ps_execute_node(result->text_ps_execute_parse_info_, node); + ;} + break; + + case 67: + + { + result->text_ps_inner_stmt_type_ = OBPROXY_T_TEXT_PS_PREPARE; + result->text_ps_name_ = (yyvsp[(2) - (3)].str); + ;} + break; + + case 68: + + { + ;} + break; + + case 69: + + { + result->cur_stmt_type_ = OBPROXY_T_TEXT_PS_EXECUTE; + result->text_ps_name_ = (yyvsp[(2) - (2)].str); + ;} + break; + + case 70: + + { + result->cur_stmt_type_ = OBPROXY_T_TEXT_PS_EXECUTE; + result->text_ps_name_ = (yyvsp[(2) - (4)].str); + ;} + break; + + case 71: + + { result->cur_stmt_type_ = OBPROXY_T_GRANT; ;} + break; + + case 72: + + { result->cur_stmt_type_ = OBPROXY_T_REVOKE; ;} + break; + + case 73: + + { result->cur_stmt_type_ = OBPROXY_T_ANALYZE; ;} + break; + + case 74: + + { result->cur_stmt_type_ = OBPROXY_T_PURGE; ;} + break; + + case 75: + + { result->cur_stmt_type_ = OBPROXY_T_FLASHBACK; ;} + break; + + case 76: + + { result->cur_stmt_type_ = OBPROXY_T_COMMENT; ;} + break; + + case 77: + + { result->cur_stmt_type_ = OBPROXY_T_AUDIT; ;} + break; + + case 78: + + { result->cur_stmt_type_ = OBPROXY_T_NOAUDIT; ;} + break; + + case 81: + + {;} + break; + + case 82: + + {;} + break; + + case 83: + + {;} + break; + + case 88: + + { result->cur_stmt_type_ = OBPROXY_T_SELECT_TX_RO; ;} + break; + + case 91: + + { result->cur_stmt_type_ = OBPROXY_T_SET_AC_0; ;} + break; + + case 93: + + {;} + break; + + case 94: + + {;} + break; + + case 95: + + {;} + break; + + case 96: + + {;} + break; + + case 97: + + {;} + break; + + case 98: + + {;} + break; + + case 99: + + {;} + break; + + case 100: + + { result->sub_stmt_type_ = OBPROXY_T_SUB_SELECT_DATABASE; ;} + break; + + case 101: + + { result->sub_stmt_type_ = OBPROXY_T_SUB_SHOW_DATABASES; ;} + break; + + case 102: + + { result->sub_stmt_type_ = OBPROXY_T_SUB_SHOW_TABLES; ;} + break; + + case 103: + + { result->sub_stmt_type_ = OBPROXY_T_SUB_SHOW_CREATE_TABLE; ;} + break; + + case 104: + + { + result->cur_stmt_type_ = OBPROXY_T_DESC; + result->sub_stmt_type_ = OBPROXY_T_SUB_DESC_TABLE; + ;} + break; + + case 105: + + { result->sub_stmt_type_ = OBPROXY_T_SUB_SHOW_DB_VERSION; ;} + break; + + case 106: + + { result->sub_stmt_type_ = OBPROXY_T_SUB_SHOW_TOPOLOGY; ;} + break; + + case 107: + + { + SET_ICMD_ONE_STRING((yyvsp[(3) - (3)].str)); + result->sub_stmt_type_ = OBPROXY_T_SUB_SHOW_TOPOLOGY; + ;} + break; + + case 108: + + { + SET_ICMD_SECOND_STRING((yyvsp[(5) - (5)].str)); + result->sub_stmt_type_ = OBPROXY_T_SUB_SHOW_TOPOLOGY; + ;} + break; + + case 109: + + { + SET_ICMD_ONE_STRING((yyvsp[(3) - (7)].str)); + SET_ICMD_SECOND_STRING((yyvsp[(7) - (7)].str)); + result->sub_stmt_type_ = OBPROXY_T_SUB_SHOW_TOPOLOGY; + ;} + break; + + case 110: + + { result->cur_stmt_type_ = OBPROXY_T_SELECT_ROUTE_ADDR; ;} + break; + + case 111: + + { + result->cur_stmt_type_ = OBPROXY_T_SET_ROUTE_ADDR; + result->cmd_info_.integer_[0] = (yyvsp[(3) - (3)].num); + ;} + break; + + case 112: + + {;} + break; + + case 113: + + {;} + break; + + case 114: + + {;} + break; + + case 115: + + {;} + break; + + case 116: + + {;} + break; + + case 117: + + {;} + break; + + case 119: + + { + result->table_info_.table_name_ = (yyvsp[(1) - (1)].str); + ;} + break; + + case 120: + + { + result->table_info_.package_name_ = (yyvsp[(1) - (3)].str); + result->table_info_.table_name_ = (yyvsp[(3) - (3)].str); + ;} + break; + + case 121: + + { + result->table_info_.database_name_ = (yyvsp[(1) - (5)].str); + result->table_info_.package_name_ = (yyvsp[(3) - (5)].str); + result->table_info_.table_name_ = (yyvsp[(5) - (5)].str); + ;} + break; + + case 122: + + { + result->call_parse_info_.node_count_ = 0; + ;} + break; + + case 123: + + { + result->call_parse_info_.node_count_ = 0; + add_call_node(result->call_parse_info_, (yyvsp[(1) - (1)].node)); + ;} + break; + + case 124: + + { + add_call_node(result->call_parse_info_, (yyvsp[(3) - (3)].node)); + ;} + break; + + case 125: + + { + malloc_call_node((yyval.node), CALL_TOKEN_STR_VAL); + (yyval.node)->str_value_ = (yyvsp[(1) - (1)].str); + ;} + break; + + case 126: + + { + malloc_call_node((yyval.node), CALL_TOKEN_INT_VAL); + (yyval.node)->int_value_ = (yyvsp[(1) - (1)].num); + ;} + break; + + case 127: + + { + malloc_call_node((yyval.node), CALL_TOKEN_NUMBER_VAL); + (yyval.node)->str_value_ = (yyvsp[(1) - (1)].str); + ;} + break; + + case 128: + + { + malloc_call_node((yyval.node), CALL_TOKEN_USER_VAR); + (yyval.node)->str_value_ = (yyvsp[(2) - (2)].str); + ;} + break; + + case 129: + + { + malloc_call_node((yyval.node), CALL_TOKEN_SYS_VAR); + (yyval.node)->str_value_ = (yyvsp[(3) - (3)].str); + ;} + break; + + case 130: + + { + result->placeholder_list_idx_++; + malloc_call_node((yyval.node), CALL_TOKEN_PLACE_HOLDER); + (yyval.node)->placeholder_idx_ = result->placeholder_list_idx_ - 1; + ;} + break; + + case 144: + + { + handle_stmt_end(result); + HANDLE_ACCEPT(); + ;} + break; + + case 149: + + { + handle_stmt_end(result); + HANDLE_ACCEPT(); + ;} + break; + + case 153: + + { + add_set_var_node(result->set_parse_info_, (yyvsp[(4) - (4)].var_node), (yyvsp[(2) - (4)].str), SET_VAR_USER); + ;} + break; + + case 154: + + { + add_set_var_node(result->set_parse_info_, (yyvsp[(6) - (6)].var_node), (yyvsp[(4) - (6)].str), SET_VAR_SYS); + ;} + break; + + case 155: + + { + add_set_var_node(result->set_parse_info_, (yyvsp[(4) - (4)].var_node), (yyvsp[(2) - (4)].str), SET_VAR_SYS); + ;} + break; + + case 156: + + { + add_set_var_node(result->set_parse_info_, (yyvsp[(5) - (5)].var_node), (yyvsp[(3) - (5)].str), SET_VAR_SYS); + ;} + break; + + case 157: + + { + add_set_var_node(result->set_parse_info_, (yyvsp[(6) - (6)].var_node), (yyvsp[(4) - (6)].str), SET_VAR_SYS); + ;} + break; + + case 158: + + { + add_set_var_node(result->set_parse_info_, (yyvsp[(4) - (4)].var_node), (yyvsp[(2) - (4)].str), SET_VAR_SYS); + ;} + break; + + case 159: + + { + add_set_var_node(result->set_parse_info_, (yyvsp[(3) - (3)].var_node), (yyvsp[(1) - (3)].str), SET_VAR_SYS); + ;} + break; + + case 160: + + { + malloc_set_var_node((yyval.var_node), SET_VALUE_TYPE_STR); + (yyval.var_node)->str_value_ = (yyvsp[(1) - (1)].str); + ;} + break; + + case 161: + + { + malloc_set_var_node((yyval.var_node), SET_VALUE_TYPE_INT); + (yyval.var_node)->int_value_ = (yyvsp[(1) - (1)].num); + ;} + break; + + case 162: + + { + malloc_set_var_node((yyval.var_node), SET_VALUE_TYPE_NUMBER); + (yyval.var_node)->str_value_ = (yyvsp[(1) - (1)].str); + ;} + break; + + case 165: + + {;} + break; + + case 166: + + {;} + break; + + case 167: + + { result->dbmesh_route_info_.tb_idx_str_ = (yyvsp[(4) - (6)].str); ;} + break; + + case 168: + + { result->dbmesh_route_info_.table_name_str_ = (yyvsp[(4) - (6)].str); ;} + break; + + case 169: + + { result->dbmesh_route_info_.group_idx_str_ = (yyvsp[(4) - (6)].str); ;} + break; + + case 170: + + { result->dbmesh_route_info_.es_idx_str_ = (yyvsp[(4) - (6)].str); ;} + break; + + case 171: + + { result->dbmesh_route_info_.testload_str_ = (yyvsp[(4) - (6)].str); ;} + break; + + case 172: + + { + malloc_shard_column_node((yyval.shard_node), (yyvsp[(2) - (7)].str), (yyvsp[(3) - (7)].str), DBMESH_TOKEN_STR_VAL); + (yyval.shard_node)->col_str_value_ = (yyvsp[(5) - (7)].str); + add_shard_column_node(result->dbmesh_route_info_, (yyval.shard_node)); + ;} + break; + + case 173: + + { result->trace_id_ = (yyvsp[(4) - (6)].str); ;} + break; + + case 174: + + { result->rpc_id_ = (yyvsp[(4) - (6)].str); ;} + break; + + case 175: + + { result->dbmesh_route_info_.tnt_id_str_ = (yyvsp[(4) - (6)].str); ;} + break; + + case 176: + + { result->dbmesh_route_info_.disaster_status_str_ = (yyvsp[(4) - (6)].str); ;} + break; + + case 177: + + {;} + break; + + case 178: + + {;} + break; + + case 179: + + {;} + break; + + case 181: + + { result->has_simple_route_info_ = true; result->simple_route_info_.table_name_ = (yyvsp[(2) - (2)].str); ;} + break; + + case 182: + + { result->simple_route_info_.part_key_ = (yyvsp[(2) - (2)].str); ;} + break; + + case 186: + + { + result->dbp_route_info_.has_group_info_ = true; + result->dbp_route_info_.group_idx_str_ = (yyvsp[(3) - (4)].str); + ;} + break; + + case 187: + + { + result->dbp_route_info_.has_group_info_ = true; + result->dbp_route_info_.table_name_ = (yyvsp[(3) - (4)].str); + ;} + break; + + case 188: + + { result->dbp_route_info_.scan_all_ = true; ;} + break; + + case 189: + + { result->dbp_route_info_.scan_all_ = true; ;} + break; + + case 190: + + {result->dbp_route_info_.has_shard_key_ = true;;} + break; + + case 191: + + { result->trace_id_ = (yyvsp[(3) - (4)].str); ;} + break; + + case 192: + + { result->trace_id_ = (yyvsp[(3) - (6)].str); result->rpc_id_ = (yyvsp[(5) - (6)].str); ;} + break; + + case 193: + + {;} + break; + + case 195: + + { + if (result->dbp_route_info_.shard_key_count_ < OBPROXY_MAX_DBP_SHARD_KEY_NUM) { + result->dbp_route_info_.shard_key_infos_[result->dbp_route_info_.shard_key_count_].left_str_ = (yyvsp[(1) - (3)].str); + result->dbp_route_info_.shard_key_infos_[result->dbp_route_info_.shard_key_count_].right_str_ = (yyvsp[(3) - (3)].str); + ++result->dbp_route_info_.shard_key_count_; + } + ;} + break; + + case 198: + + { result->dbmesh_route_info_.group_idx_str_ = (yyvsp[(3) - (3)].str); ;} + break; + + case 199: + + { result->dbmesh_route_info_.tb_idx_str_ = (yyvsp[(3) - (3)].str); ;} + break; + + case 200: + + { result->dbmesh_route_info_.table_name_str_ = (yyvsp[(3) - (3)].str); ;} + break; + + case 201: + + { result->dbmesh_route_info_.es_idx_str_ = (yyvsp[(3) - (3)].str); ;} + break; + + case 202: + + { result->dbmesh_route_info_.testload_str_ = (yyvsp[(3) - (3)].str); ;} + break; + + case 203: + + { result->trace_id_ = (yyvsp[(3) - (3)].str); ;} + break; + + case 204: + + { result->rpc_id_ = (yyvsp[(3) - (3)].str); ;} + break; + + case 205: + + { result->dbmesh_route_info_.tnt_id_str_ = (yyvsp[(3) - (3)].str); ;} + break; + + case 206: + + { result->dbmesh_route_info_.disaster_status_str_ = (yyvsp[(3) - (3)].str); ;} + break; + + case 207: + + { + malloc_shard_column_node((yyval.shard_node), (yyvsp[(1) - (5)].str), (yyvsp[(3) - (5)].str), DBMESH_TOKEN_STR_VAL); + (yyval.shard_node)->col_str_value_ = (yyvsp[(5) - (5)].str); + add_shard_column_node(result->dbmesh_route_info_, (yyval.shard_node)); + ;} + break; + + case 208: + + {;} + break; + + case 209: + + { (yyval.str).str_ = NULL; (yyval.str).str_len_ = 0; ;} + break; + + case 211: + + { (yyval.str).str_ = NULL; (yyval.str).str_len_ = 0; ;} + break; + + case 233: + + { result->query_timeout_ = (yyvsp[(3) - (4)].num); ;} + break; + + case 234: + + {;} + break; + + case 236: + + { + add_hint_index(result->dbmesh_route_info_, (yyvsp[(3) - (5)].str)); + result->dbmesh_route_info_.index_count_++; + ;} + break; + + case 237: + + {;} + break; + + case 238: + + {;} + break; + + case 239: + + {;} + break; + + case 240: + + {;} + break; + + case 241: + + {;} + break; + + case 242: + + { SET_READ_CONSISTENCY(OBPROXY_READ_CONSISTENCY_WEAK); ;} + break; + + case 243: + + { SET_READ_CONSISTENCY(OBPROXY_READ_CONSISTENCY_STRONG); ;} + break; + + case 244: + + { SET_READ_CONSISTENCY(OBPROXY_READ_CONSISTENCY_FROZEN); ;} + break; + + case 247: + + { result->cur_stmt_type_ = OBPROXY_T_SHOW_WARNINGS; ;} + break; + + case 248: + + { result->cur_stmt_type_ = OBPROXY_T_SHOW_ERRORS; ;} + break; + + case 249: + + { result->cur_stmt_type_ = OBPROXY_T_SHOW_TRACE; ;} + break; + + case 273: + + { +;} + break; + + case 274: + + { + result->cmd_info_.integer_[2] = (yyvsp[(2) - (2)].num);/*row*/ +;} + break; + + case 275: + + { + result->cmd_info_.integer_[1] = (yyvsp[(2) - (4)].num);/*offset*/ + result->cmd_info_.integer_[2] = (yyvsp[(4) - (4)].num);/*row*/ +;} + break; + + case 276: + + { + result->cmd_info_.integer_[1] = (yyvsp[(4) - (4)].num);/*offset*/ + result->cmd_info_.integer_[2] = (yyvsp[(2) - (4)].num);/*row*/ +;} + break; + + case 277: + + {;} + break; + + case 278: + + { result->cmd_info_.string_[0] = (yyvsp[(2) - (2)].str);;} + break; + + case 279: + + {;} + break; + + case 280: + + { result->cmd_info_.string_[1] = (yyvsp[(2) - (2)].str);;} + break; + + case 282: + + { SET_ICMD_SUB_TYPE(OBPROXY_T_SUB_NET_THREAD); ;} + break; + + case 283: + + { SET_ICMD_SUB_TYPE(OBPROXY_T_SUB_NET_CONNECTION); ;} + break; + + case 284: + + { SET_ICMD_SUB_AND_ONE_ID(OBPROXY_T_SUB_NET_CONNECTION, (yyvsp[(2) - (3)].num)); ;} + break; + + case 285: + + {;} + break; + + case 286: + + { SET_ICMD_SUB_TYPE(OBPROXY_T_SUB_CONFIG_DIFF); ;} + break; + + case 287: + + { SET_ICMD_SUB_TYPE(OBPROXY_T_SUB_CONFIG_DIFF_USER); ;} + break; + + case 288: + + { SET_ICMD_SUB_TYPE(OBPROXY_T_SUB_SESSION_LIST); ;} + break; + + case 290: + + {SET_ICMD_SUB_TYPE(OBPROXY_T_SUB_GLOBAL_SESSION_LIST);;} + break; + + case 291: + + {SET_ICMD_SUB_AND_ONE_STRING(OBPROXY_T_SUB_GLOBAL_SESSION_LIST_INFO, (yyvsp[(2) - (2)].str));;} + break; + + case 292: + + {SET_ICMD_SUB_AND_ONE_STRING(OBPROXY_T_SUB_GLOBAL_SESSION_LIST_LIKE, (yyvsp[(3) - (3)].str));;} + break; + + case 293: + + {SET_ICMD_SUB_TYPE(OBPROXY_T_SUB_GLOBAL_SESSION_LIST_INFO_ALL);;} + break; + + case 294: + + {result->cmd_info_.string_[0] = (yyvsp[(2) - (2)].str);;} + break; + + case 296: + + { SET_ICMD_SUB_TYPE(OBPROXY_T_SUB_SESSION_LIST_INTERNAL); ;} + break; + + case 297: + + { SET_ICMD_SUB_TYPE(OBPROXY_T_SUB_SESSION_ATTRIBUTE); ;} + break; + + case 298: + + { SET_ICMD_SUB_AND_ONE_ID(OBPROXY_T_SUB_SESSION_ATTRIBUTE, (yyvsp[(2) - (3)].num)); ;} + break; + + case 299: + + { SET_ICMD_SUB_TYPE(OBPROXY_T_SUB_SESSION_STAT); ;} + break; + + case 300: + + { SET_ICMD_SUB_AND_ONE_ID(OBPROXY_T_SUB_SESSION_STAT, (yyvsp[(2) - (3)].num)); ;} + break; + + case 301: + + { SET_ICMD_SUB_TYPE(OBPROXY_T_SUB_SESSION_VARIABLES_LOCAL); ;} + break; + + case 302: + + { SET_ICMD_SUB_AND_ONE_ID(OBPROXY_T_SUB_SESSION_VARIABLES_LOCAL, (yyvsp[(2) - (3)].num)); ;} + break; + + case 303: + + { SET_ICMD_SUB_TYPE(OBPROXY_T_SUB_SESSION_VARIABLES_ALL); ;} + break; + + case 304: + + { SET_ICMD_SUB_AND_ONE_ID(OBPROXY_T_SUB_SESSION_VARIABLES_ALL, (yyvsp[(3) - (4)].num)); ;} + break; + + case 305: + + {;} + break; + + case 306: + + { SET_ICMD_ONE_ID((yyvsp[(2) - (2)].num)); ;} + break; + + case 307: + + {;} + break; + + case 308: + + { SET_ICMD_SUB_TYPE(OBPROXY_T_SUB_INFO_IDC); ;} + break; + + case 309: + + {;} + break; + + case 311: + + {;} + break; + + case 312: + + { SET_ICMD_ONE_STRING((yyvsp[(1) - (1)].str)); ;} + break; + + case 313: + + { SET_ICMD_SUB_TYPE(OBPROXY_T_SUB_CONGEST_ALL);;} + break; + + case 314: + + { SET_ICMD_SUB_AND_ONE_STRING(OBPROXY_T_SUB_CONGEST_ALL, (yyvsp[(2) - (2)].str));;} + break; + + case 315: + + {;} + break; + + case 316: + + { SET_ICMD_SUB_TYPE(OBPROXY_T_SUB_ROUTE_ROUTINE); ;} + break; + + case 317: + + { SET_ICMD_SUB_TYPE(OBPROXY_T_SUB_ROUTE_PARTITION); ;} + break; + + case 318: + + {;} + break; + + case 319: + + { SET_ICMD_ONE_STRING((yyvsp[(2) - (2)].str)); ;} + break; + + case 320: + + {;} + break; + + case 321: + + { SET_ICMD_SUB_TYPE(OBPROXY_T_SUB_MEMORY_OBJPOOL); ;} + break; + + case 322: + + { SET_ICMD_SUB_TYPE(OBPROXY_T_SUB_SQLAUDIT_AUDIT_ID); ;} + break; + + case 323: + + { SET_ICMD_SUB_AND_ONE_ID(OBPROXY_T_SUB_SQLAUDIT_SM_ID, (yyvsp[(2) - (2)].num)); ;} + break; + + case 325: + + {;} + break; + + case 326: + + { SET_ICMD_SECOND_ID((yyvsp[(1) - (1)].num)); ;} + break; + + case 327: + + { SET_ICMD_TWO_ID((yyvsp[(3) - (3)].num), (yyvsp[(1) - (3)].num)); ;} + break; + + case 328: + + { SET_ICMD_TWO_ID((yyvsp[(3) - (5)].num), (yyvsp[(1) - (5)].num)); SET_ICMD_ONE_STRING((yyvsp[(5) - (5)].str)); ;} + break; + + case 329: + + {;} + break; + + case 330: + + { SET_ICMD_SUB_TYPE(OBPROXY_T_SUB_STAT_REFRESH); ;} + break; + + case 332: + + {;} + break; + + case 333: + + { SET_ICMD_ONE_ID((yyvsp[(1) - (1)].num)); ;} + break; + + case 334: + + { SET_ICMD_SUB_AND_TWO_ID(OBPROXY_T_SUB_TRACE_LIMIT, (yyvsp[(1) - (2)].num),(yyvsp[(2) - (2)].num)); ;} + break; + + case 335: + + { SET_ICMD_SUB_TYPE(OBPROXY_T_SUB_INFO_BINARY); ;} + break; + + case 336: + + { SET_ICMD_SUB_TYPE(OBPROXY_T_SUB_INFO_UPGRADE); ;} + break; + + case 337: + + { SET_ICMD_SUB_TYPE(OBPROXY_T_SUB_INFO_IDC); ;} + break; + + case 338: + + { SET_ICMD_ONE_STRING((yyvsp[(3) - (4)].str)); ;} + break; + + case 339: + + { SET_ICMD_TWO_STRING((yyvsp[(3) - (5)].str), (yyvsp[(5) - (5)].str)); ;} + break; + + case 340: + + { SET_ICMD_CONFIG_INT_VALUE((yyvsp[(3) - (5)].str), (yyvsp[(5) - (5)].num)); ;} + break; + + case 341: + + { SET_ICMD_ONE_STRING((yyvsp[(3) - (3)].str)); ;} + break; + + case 342: + + {;} + break; + + case 343: + + { SET_ICMD_SUB_AND_ONE_ID(OBPROXY_T_SUB_KILL_CS, (yyvsp[(2) - (2)].num)); ;} + break; + + case 344: + + { SET_ICMD_SUB_AND_TWO_ID(OBPROXY_T_SUB_KILL_SS, (yyvsp[(2) - (3)].num), (yyvsp[(3) - (3)].num)); ;} + break; + + case 345: + + {SET_ICMD_TYPE_STRING_INT_VALUE(OBPROXY_T_SUB_KILL_GLOBAL_SS_ID, (yyvsp[(2) - (3)].str),(yyvsp[(3) - (3)].num));;} + break; + + case 346: + + {SET_ICMD_SUB_AND_ONE_STRING(OBPROXY_T_SUB_KILL_GLOBAL_SS_DBKEY, (yyvsp[(2) - (2)].str));;} + break; + + case 347: + + { SET_ICMD_SUB_AND_ONE_ID(OBPROXY_T_SUB_KILL_CONNECTION, (yyvsp[(2) - (2)].num)); ;} + break; + + case 348: + + { SET_ICMD_SUB_AND_ONE_ID(OBPROXY_T_SUB_KILL_CONNECTION, (yyvsp[(3) - (3)].num)); ;} + break; + + case 349: + + { SET_ICMD_SUB_AND_ONE_ID(OBPROXY_T_SUB_KILL_QUERY, (yyvsp[(3) - (3)].num)); ;} + break; + + case 352: + + { + result->has_anonymous_block_ = false ; + result->cur_stmt_type_ = OBPROXY_T_BEGIN; + ;} + break; + + case 353: + + { result->cur_stmt_type_ = OBPROXY_T_BEGIN; ;} + break; + + case 354: + + { result->cur_stmt_type_ = OBPROXY_T_BEGIN; ;} + break; + + case 355: + + { result->cur_stmt_type_ = OBPROXY_T_BEGIN; ;} + break; + + case 362: + + { + result->cur_stmt_type_ = OBPROXY_T_USE_DB; + result->table_info_.database_name_ = (yyvsp[(2) - (2)].str); + ;} + break; + + case 363: + + { result->cur_stmt_type_ = OBPROXY_T_HELP; ;} + break; + + case 365: + + {;} + break; + + case 366: + + { result->part_name_ = (yyvsp[(2) - (2)].str); ;} + break; + + case 367: + + { result->part_name_ = (yyvsp[(3) - (4)].str); ;} + break; + + case 368: + + { + handle_stmt_end(result); + HANDLE_ACCEPT(); + ;} + break; + + case 369: + + { + result->table_info_.table_name_ = (yyvsp[(1) - (1)].str); + ;} + break; + + case 370: + + { + result->table_info_.database_name_ = (yyvsp[(1) - (3)].str); + result->table_info_.table_name_ = (yyvsp[(3) - (3)].str); + ;} + break; + + case 371: + + { + UPDATE_ALIAS_NAME((yyvsp[(2) - (2)].str)); + result->table_info_.table_name_ = (yyvsp[(1) - (2)].str); + ;} + break; + + case 372: + + { + UPDATE_ALIAS_NAME((yyvsp[(4) - (4)].str)); + result->table_info_.database_name_ = (yyvsp[(1) - (4)].str); + result->table_info_.table_name_ = (yyvsp[(3) - (4)].str); + ;} + break; + + case 373: + + { + UPDATE_ALIAS_NAME((yyvsp[(3) - (3)].str)); + result->table_info_.table_name_ = (yyvsp[(1) - (3)].str); + ;} + break; + + case 374: + + { + UPDATE_ALIAS_NAME((yyvsp[(5) - (5)].str)); + result->table_info_.database_name_ = (yyvsp[(1) - (5)].str); + result->table_info_.table_name_ = (yyvsp[(3) - (5)].str); + ;} + break; + + + + default: break; + } + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + + *++yyvsp = yyval; + *++yylsp = yyloc; + + /* Now `shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTOKENS]; + + goto yynewstate; + + +/*------------------------------------. +| yyerrlab -- here on detecting error | +`------------------------------------*/ +yyerrlab: + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; +#if ! YYERROR_VERBOSE + yyerror (&yylloc, result, YY_("syntax error")); +#else + { + YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); + if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) + { + YYSIZE_T yyalloc = 2 * yysize; + if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) + yyalloc = YYSTACK_ALLOC_MAXIMUM; + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yyalloc); + if (yymsg) + yymsg_alloc = yyalloc; + else + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + } + } + + if (0 < yysize && yysize <= yymsg_alloc) + { + (void) yysyntax_error (yymsg, yystate, yychar); + yyerror (&yylloc, result, yymsg); + } + else + { + yyerror (&yylloc, result, YY_("syntax error")); + if (yysize != 0) + goto yyexhaustedlab; + } + } +#endif + } + + yyerror_range[0] = yylloc; + + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + if (yychar <= YYEOF) + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } + else + { + yydestruct ("Error: discarding", + yytoken, &yylval, &yylloc, result); + yychar = YYEMPTY; + } + } + + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; + + +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (/*CONSTCOND*/ 0) + goto yyerrorlab; + + yyerror_range[0] = yylsp[1-yylen]; + /* Do not reclaim the symbols of the rule which action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + yystate = *yyssp; + goto yyerrlab1; + + +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ + + for (;;) + { + yyn = yypact[yystate]; + if (yyn != YYPACT_NINF) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; + + yyerror_range[0] = *yylsp; + yydestruct ("Error: popping", + yystos[yystate], yyvsp, yylsp, result); + YYPOPSTACK (1); + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); + } + + *++yyvsp = yylval; + + yyerror_range[1] = yylloc; + /* Using YYLLOC is tempting, but would change the location of + the lookahead. YYLOC is available though. */ + YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2); + *++yylsp = yyloc; + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + + yystate = yyn; + goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +#if !defined(yyoverflow) || YYERROR_VERBOSE +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (&yylloc, result, YY_("memory exhausted")); + yyresult = 2; + /* Fall through. */ +#endif + +yyreturn: + if (yychar != YYEMPTY) + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval, &yylloc, result); + /* Do not reclaim the symbols of the rule which action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp, yylsp, result); + YYPOPSTACK (1); + } +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif + /* Make sure YYID is used. */ + return YYID (yyresult); +} + + + + + +void yyerror(YYLTYPE* yylloc, ObProxyParseResult* p, char* s, ...) +{ + // do nothing +} + +void ob_proxy_utf8_parser_fatal_error(yyconst char *msg, yyscan_t yyscanner) +{ + fprintf(stderr, "FATAL ERROR:%s\n", msg); + ObProxyParseResult *p = ob_proxy_parser_utf8_yyget_extra(yyscanner); + if (OB_ISNULL(p)) { + fprintf(stderr, "unexpected null parse result\n"); + } else { + longjmp(p->jmp_buf_, 1);//the secord param must be non-zero value + } +} + +int obproxy_parse_utf8_sql(ObProxyParseResult* p, const char* buf, size_t len) +{ + int ret = OB_SUCCESS; + //obproxydebug = 1; + if (OB_ISNULL(p) || OB_ISNULL(buf) || OB_UNLIKELY(len <= 0)) { + ret = OB_INVALID_ARGUMENT; + // print err msg later + } else if (OB_FAIL(ob_proxy_parser_utf8_yylex_init_extra(p, &(p->yyscan_info_)))) { + // print err msg later + } else { + int val = setjmp(p->jmp_buf_); + if (val) { + ret = OB_PARSER_ERR_PARSE_SQL; + } else { + ob_proxy_parser_utf8_yy_scan_buffer((char *)buf, len, p->yyscan_info_); + if (OB_FAIL(ob_proxy_parser_utf8_yyparse(p))) { + // print err msg later + } else { + // do nothing + } + } + } + + return ret; +} + diff --git a/src/obproxy/opsql/parser/ob_proxy_parser_utf8_tab.h b/src/obproxy/opsql/parser/ob_proxy_parser_utf8_tab.h new file mode 100644 index 0000000..3e9ba4a --- /dev/null +++ b/src/obproxy/opsql/parser/ob_proxy_parser_utf8_tab.h @@ -0,0 +1,260 @@ + +/* A Bison parser, made by GNU Bison 2.4.1. */ + +/* Skeleton interface for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. + + 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 + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + + +#ifndef YY_OBPROXY_OB_PROXY_PARSER_TAB_H_INCLUDED +# define YY_OBPROXY_OB_PROXY_PARSER_TAB_H_INCLUDED +/* Debug traces. */ +#ifndef OBPROXY_UTF8_DEBUG +# if defined YYDEBUG +#if YYDEBUG +# define OBPROXY_UTF8_DEBUG 1 +# else +# define OBPROXY_UTF8_DEBUG 0 +# endif +# else /* ! defined YYDEBUG */ +# define OBPROXY_UTF8_DEBUG 0 +# endif /* ! defined YYDEBUG */ +#endif /* ! defined OBPROXY_UTF8_DEBUG */ +#if OBPROXY_UTF8_DEBUG +extern int ob_proxy_parser_utf8_yydebug; +#endif +/* Tokens. */ +#ifndef OBPROXYTOKENTYPE +# define OBPROXYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum obproxytokentype { + DUMMY_WHERE_CLAUSE = 258, + DUMMY_INSERT_CLAUSE = 259, + SELECT = 260, + DELETE = 261, + INSERT = 262, + UPDATE = 263, + REPLACE = 264, + MERGE = 265, + SHOW = 266, + SET = 267, + CALL = 268, + CREATE = 269, + DROP = 270, + ALTER = 271, + TRUNCATE = 272, + RENAME = 273, + GRANT = 274, + REVOKE = 275, + ANALYZE = 276, + PURGE = 277, + COMMENT = 278, + FROM = 279, + DUAL = 280, + PREPARE = 281, + EXECUTE = 282, + USING = 283, + SELECT_HINT_BEGIN = 284, + UPDATE_HINT_BEGIN = 285, + DELETE_HINT_BEGIN = 286, + INSERT_HINT_BEGIN = 287, + REPLACE_HINT_BEGIN = 288, + MERGE_HINT_BEGIN = 289, + HINT_END = 290, + COMMENT_BEGIN = 291, + COMMENT_END = 292, + ROUTE_TABLE = 293, + ROUTE_PART_KEY = 294, + QUERY_TIMEOUT = 295, + READ_CONSISTENCY = 296, + WEAK = 297, + STRONG = 298, + FROZEN = 299, + PLACE_HOLDER = 300, + END_P = 301, + ERROR = 302, + WHEN = 303, + FLASHBACK = 304, + AUDIT = 305, + NOAUDIT = 306, + BEGI = 307, + START = 308, + TRANSACTION = 309, + READ = 310, + ONLY = 311, + WITH = 312, + CONSISTENT = 313, + SNAPSHOT = 314, + INDEX = 315, + XA = 316, + WARNINGS = 317, + ERRORS = 318, + TRACE = 319, + QUICK = 320, + COUNT = 321, + AS = 322, + WHERE = 323, + VALUES = 324, + ORDER = 325, + GROUP = 326, + HAVING = 327, + INTO = 328, + UNION = 329, + FOR = 330, + TX_READ_ONLY = 331, + AUTOCOMMIT_0 = 332, + SELECT_OBPROXY_ROUTE_ADDR = 333, + SET_OBPROXY_ROUTE_ADDR = 334, + NAME_OB_DOT = 335, + NAME_OB = 336, + EXPLAIN = 337, + DESC = 338, + DESCRIBE = 339, + NAME_STR = 340, + USE = 341, + HELP = 342, + SET_NAMES = 343, + SET_CHARSET = 344, + SET_PASSWORD = 345, + SET_DEFAULT = 346, + SET_OB_READ_CONSISTENCY = 347, + SET_TX_READ_ONLY = 348, + GLOBAL = 349, + SESSION = 350, + NUMBER_VAL = 351, + GROUP_ID = 352, + TABLE_ID = 353, + ELASTIC_ID = 354, + TESTLOAD = 355, + ODP_COMMENT = 356, + TNT_ID = 357, + DISASTER_STATUS = 358, + TRACE_ID = 359, + RPC_ID = 360, + DBP_COMMENT = 361, + ROUTE_TAG = 362, + SYS_TAG = 363, + TABLE_NAME = 364, + SCAN_ALL = 365, + PARALL = 366, + SHARD_KEY = 367, + INT_NUM = 368, + SHOW_PROXYNET = 369, + THREAD = 370, + CONNECTION = 371, + LIMIT = 372, + OFFSET = 373, + SHOW_PROCESSLIST = 374, + SHOW_PROXYSESSION = 375, + SHOW_GLOBALSESSION = 376, + ATTRIBUTE = 377, + VARIABLES = 378, + ALL = 379, + STAT = 380, + SHOW_PROXYCONFIG = 381, + DIFF = 382, + USER = 383, + LIKE = 384, + SHOW_PROXYSM = 385, + SHOW_PROXYCLUSTER = 386, + SHOW_PROXYRESOURCE = 387, + SHOW_PROXYCONGESTION = 388, + SHOW_PROXYROUTE = 389, + PARTITION = 390, + ROUTINE = 391, + SHOW_PROXYVIP = 392, + SHOW_PROXYMEMORY = 393, + OBJPOOL = 394, + SHOW_SQLAUDIT = 395, + SHOW_WARNLOG = 396, + SHOW_PROXYSTAT = 397, + REFRESH = 398, + SHOW_PROXYTRACE = 399, + SHOW_PROXYINFO = 400, + BINARY = 401, + UPGRADE = 402, + IDC = 403, + SHOW_TOPOLOGY = 404, + GROUP_NAME = 405, + SHOW_DB_VERSION = 406, + SHOW_DATABASES = 407, + SHOW_TABLES = 408, + SELECT_DATABASE = 409, + SHOW_CREATE_TABLE = 410, + ALTER_PROXYCONFIG = 411, + ALTER_PROXYRESOURCE = 412, + PING_PROXY = 413, + KILL_PROXYSESSION = 414, + KILL_GLOBALSESSION = 415, + KILL = 416, + QUERY = 417 + }; +#endif + + + +#if ! defined OBPROXYSTYPE && ! defined OBPROXYSTYPE_IS_DECLARED +typedef union OBPROXYSTYPE +{ + + + int64_t num; + ObProxyParseString str; + ObProxyCallParseNode *node; + ObShardColumnNode *shard_node; + ObProxySetVarNode *var_node; + + + +} OBPROXYSTYPE; +# define OBPROXYSTYPE_IS_TRIVIAL 1 +# define obproxystype OBPROXYSTYPE /* obsolescent; will be withdrawn */ +# define OBPROXYSTYPE_IS_DECLARED 1 +#endif + + + +#if ! defined OBPROXYLTYPE && ! defined OBPROXYLTYPE_IS_DECLARED +typedef struct OBPROXYLTYPE +{ + int first_line; + int first_column; + int last_line; + int last_column; +} OBPROXYLTYPE; +# define obproxyltype OBPROXYLTYPE /* obsolescent; will be withdrawn */ +# define OBPROXYLTYPE_IS_DECLARED 1 +# define OBPROXYLTYPE_IS_TRIVIAL 1 +#endif + + + +#endif diff --git a/src/obproxy/proxy/client/ob_client_utils.cpp b/src/obproxy/proxy/client/ob_client_utils.cpp index 11e132c..9852909 100644 --- a/src/obproxy/proxy/client/ob_client_utils.cpp +++ b/src/obproxy/proxy/client/ob_client_utils.cpp @@ -282,6 +282,9 @@ void ObClientReuqestInfo::reset_names() user_name_.reset(); database_name_.reset(); password_.reset(); + password0_.reset(); + password1_.reset(); + using_password_num_ = -1; } void ObClientReuqestInfo::reset_sql() @@ -302,7 +305,8 @@ int64_t ObClientReuqestInfo::to_string(char *buf, const int64_t buf_len) const int ObClientReuqestInfo::set_names(const ObString &user_name, const ObString &password, - const ObString &database_name) + const ObString &database_name, + const ObString &password1) { int ret = OB_SUCCESS; if (user_name.empty()) { @@ -310,7 +314,7 @@ int ObClientReuqestInfo::set_names(const ObString &user_name, LOG_WARN("user_name can not be NULL", K(user_name), K(ret)); } else { reset_names(); - int64_t total_len = user_name.length() + password.length() + database_name.length(); + int64_t total_len = user_name.length() + password.length() + password1.length() + database_name.length(); if (OB_ISNULL(name_ = static_cast(op_fixed_mem_alloc(total_len)))) { ret = OB_ALLOCATE_MEMORY_FAILED; LOG_WARN("fail to allocate mem", "alloc size", total_len, K(ret)); @@ -324,8 +328,19 @@ int ObClientReuqestInfo::set_names(const ObString &user_name, if (!password.empty()) { MEMCPY(name_ + pos, password.ptr(), password.length()); password_.assign_ptr(name_ + pos, password.length()); + password0_ = password_; pos += password.length(); } + + if (!password1.empty()) { + MEMCPY(name_ + pos, password1.ptr(), password1.length()); + password1_.assign_ptr(name_ + pos, password1.length()); + pos += password1.length(); + } + + if (!password.empty() && !password1.empty()) { + using_password_num_ = 0; + } if (!database_name.empty()) { MEMCPY(name_ + pos, database_name.ptr(), database_name.length()); diff --git a/src/obproxy/proxy/client/ob_client_utils.h b/src/obproxy/proxy/client/ob_client_utils.h index 2301b27..a8aa347 100644 --- a/src/obproxy/proxy/client/ob_client_utils.h +++ b/src/obproxy/proxy/client/ob_client_utils.h @@ -155,6 +155,7 @@ class ObClientReuqestInfo public: ObClientReuqestInfo() : user_name_(), database_name_(), password_(), + password0_(), password1_(), using_password_num_(-1), request_param_(), name_(NULL), name_len_(0), need_skip_stage2_(false) {} ~ObClientReuqestInfo() { reset(); } @@ -168,12 +169,28 @@ public: bool is_need_skip_stage2() { return need_skip_stage2_;} int set_names(const common::ObString &user_name, const common::ObString &password, - const common::ObString &database_name); + const common::ObString &database_name, + const common::ObString &password1 = ""); int set_request_param(const ObMysqlRequestParam &request_param); const common::ObString &get_user_name() const { return user_name_; } const common::ObString &get_database_name() const { return database_name_; } const common::ObString &get_password() const { return password_; } + bool change_password() + { + bool bret = false; + if (using_password_num_ != -1) { + using_password_num_ = (using_password_num_ + 1) % 2; + if (using_password_num_ == 0) { + password_ = password0_; + } else { + password_ = password1_; + } + bret = true; + } + return bret; + } + inline bool can_change_password() const { return using_password_num_ != -1; } const common::ObString &get_request_sql() const { return request_param_.sql_; } ObMysqlRequestParam &get_request_param() { return request_param_; } @@ -183,6 +200,9 @@ private: common::ObString user_name_; common::ObString database_name_; common::ObString password_; + common::ObString password0_; + common::ObString password1_; + int32_t using_password_num_; ObMysqlRequestParam request_param_; char *name_; int64_t name_len_; diff --git a/src/obproxy/proxy/client/ob_client_vc.cpp b/src/obproxy/proxy/client/ob_client_vc.cpp index 98f273d..4eb8fa7 100644 --- a/src/obproxy/proxy/client/ob_client_vc.cpp +++ b/src/obproxy/proxy/client/ob_client_vc.cpp @@ -228,7 +228,8 @@ ObMysqlClient::ObMysqlClient() client_vc_(NULL), pool_(NULL), active_timeout_action_(NULL), common_mutex_(), action_(), active_timeout_ms_(0), next_action_(CLIENT_ACTION_UNDEFINED), request_buf_(NULL), - request_reader_(NULL), mysql_resp_(NULL), info_(), is_session_pool_client_(false) + request_reader_(NULL), mysql_resp_(NULL), info_(), is_session_pool_client_(false), + need_connect_retry_(false), retry_times_(0) { SET_HANDLER(&ObMysqlClient::main_handler); } @@ -238,6 +239,7 @@ int ObMysqlClient::init(ObMysqlClientPool *pool, const ObString &password, const ObString &database, const bool is_meta_mysql_client, + const ObString &password1, ClientPoolOption* client_pool_option) { int ret = OB_SUCCESS; @@ -251,7 +253,7 @@ int ObMysqlClient::init(ObMysqlClientPool *pool, } else if (OB_ISNULL(mutex = new_proxy_mutex(CLIENT_VC_LOCK))) { ret = OB_ALLOCATE_MEMORY_FAILED; LOG_WARN("fail to allocate mutex", K(ret)); - } else if (OB_FAIL(info_.set_names(user_name, password, database))) { + } else if (OB_FAIL(info_.set_names(user_name, password, database, password1))) { LOG_WARN("fail to set names", K(user_name), K(password), K(database), K(ret)); } else { if (client_pool_option != NULL) { @@ -344,6 +346,9 @@ int ObMysqlClient::post_request( LOG_WARN("fail to set request sql", K(request_param), K(ret)); } else { active_timeout_ms_ = timeout_ms; + if (CLIENT_ACTION_CONNECT == next_action_ && info_.can_change_password()) { + retry_times_ = 1; + } if (OB_FAIL(do_post_request())) { LOG_WARN("fail to do post request", K(ret)); } else if (OB_ISNULL(client_vc_)) { @@ -433,15 +438,35 @@ int ObMysqlClient::main_handler(int event, void *data) if (0 == reentrancy_count_) { // here common_mutex_ is free or held by this thread, so we can ensure lock it MUTEX_LOCK(lock, common_mutex_, this_ethread()); - if (is_request_complete_) { - if (OB_FAIL(handle_request_complete())) { - LOG_WARN("fail to handle request complete", K(ret)); + if (OB_SUCCESS == ret && need_connect_retry_ && CLIENT_ACTION_CONNECT == next_action_) { + need_connect_retry_ = false; + retry_times_ = 0; + is_request_complete_ = false; + info_.change_password(); + if (NULL != mysql_resp_) { + op_free(mysql_resp_); + if (OB_ISNULL(mysql_resp_ = op_alloc(ObClientMysqlResp))) { + ret = OB_ALLOCATE_MEMORY_FAILED; + LOG_WARN("fail to allocate ObClientMysqlResp", K(ret)); + } else if (mysql_resp_->init()) { + LOG_WARN("fail to init client mysql resp", K(ret)); + } } - } - if (terminate_) { - kill_this(); - he_ret = EVENT_DONE; + if (OB_SUCC(ret)) { + do_post_request(); + } + } else { + if (is_request_complete_) { + if (OB_FAIL(handle_request_complete())) { + LOG_WARN("fail to handle request complete", K(ret)); + } + } + + if (terminate_) { + kill_this(); + he_ret = EVENT_DONE; + } } } return he_ret; @@ -456,6 +481,12 @@ int ObMysqlClient::transport_mysql_resp() // if fail to auth, free client_vc if (mysql_resp_->is_error_resp()) { // free client_vc + if (retry_times_ == 1 && CLIENT_ACTION_READ_LOGIN_RESP == next_action_) { + //do nothing + if (ER_ACCESS_DENIED_ERROR == mysql_resp_->get_err_code()) { + need_connect_retry_ = true; + } + } client_vc_->handle_event(VC_EVENT_EOS, NULL); client_vc_ = NULL; //Attention!! the request buf will be free by client session @@ -696,6 +727,7 @@ int ObMysqlClient::do_next_action(void *data) LOG_WARN("fail to transfrom mysql resp", K(ret)); } } else { + retry_times_ = 0; if (OB_FAIL(setup_read_autocommit_resp())) { LOG_WARN("fail to setup read autocommit resp", K(ret)); } else if (OB_FAIL(forward_mysql_request())) { @@ -1070,14 +1102,14 @@ void ObMysqlClient::kill_this() int ObMysqlClient::alloc(ObMysqlClientPool *pool, ObMysqlClient *&client, const ObString &user_name, const ObString &password, const ObString &database, const bool is_meta_mysql_client, - ClientPoolOption* client_pool_option) + const ObString &password1, ClientPoolOption* client_pool_option) { int ret = OB_SUCCESS; client = NULL; if (OB_ISNULL(client = op_alloc(ObMysqlClient))) { ret = OB_ALLOCATE_MEMORY_FAILED; LOG_WARN("fail to allocate ObMysqlClient", K(ret)); - } else if (OB_FAIL(client->init(pool, user_name, password, database, is_meta_mysql_client, client_pool_option))) { + } else if (OB_FAIL(client->init(pool, user_name, password, database, is_meta_mysql_client, password1, client_pool_option))) { LOG_WARN("fail to init client", K(ret)); } if (OB_FAIL(ret) && (NULL != client)) { diff --git a/src/obproxy/proxy/client/ob_client_vc.h b/src/obproxy/proxy/client/ob_client_vc.h index 1f5f8a6..766f2e8 100644 --- a/src/obproxy/proxy/client/ob_client_vc.h +++ b/src/obproxy/proxy/client/ob_client_vc.h @@ -140,6 +140,7 @@ public: const common::ObString &password, const common::ObString &database, const bool is_meta_mysql_client, + const common::ObString &password1 = "", ClientPoolOption* client_pool_option = NULL); int init(ObMysqlClientPool *pool, @@ -147,6 +148,7 @@ public: const common::ObString &password, const common::ObString &database, const bool is_meta_mysql_client, + const common::ObString &password1 = "", ClientPoolOption* client_pool_option = NULL); // must be used under the mutex_'s lock @@ -226,6 +228,8 @@ private: bool is_session_pool_client_; ObProxySchemaKey schema_key_; proxy::ObCommonAddr server_addr_; + bool need_connect_retry_; + int64_t retry_times_; DISALLOW_COPY_AND_ASSIGN(ObMysqlClient); }; diff --git a/src/obproxy/proxy/client/ob_mysql_client_pool.cpp b/src/obproxy/proxy/client/ob_mysql_client_pool.cpp index f8d0ad7..3d48858 100644 --- a/src/obproxy/proxy/client/ob_mysql_client_pool.cpp +++ b/src/obproxy/proxy/client/ob_mysql_client_pool.cpp @@ -158,6 +158,7 @@ int ObMysqlClientPool::init( const ObString &user_name, const ObString &password, const ObString &database, + const ObString &password1, ClientPoolOption* client_pool_option) { int ret = OB_SUCCESS; @@ -174,7 +175,7 @@ int ObMysqlClientPool::init( ObMysqlClient *mysql_client = NULL; const int64_t mc_count = get_mysql_client_pool_count(is_meta_mysql_client); for (int64_t i = 0; (i < mc_count && OB_SUCC(ret)); ++i) { - if (OB_FAIL(ObMysqlClient::alloc(this, mysql_client, user_name, password, database, is_meta_mysql_client, client_pool_option))) { + if (OB_FAIL(ObMysqlClient::alloc(this, mysql_client, user_name, password, database, is_meta_mysql_client, password1, client_pool_option))) { LOG_WARN("fail to alloc mysql client", K(user_name), K(password), K(database), "idx", i, K(is_meta_mysql_client), K(ret)); } else if (OB_ISNULL(mysql_client)) { diff --git a/src/obproxy/proxy/client/ob_mysql_client_pool.h b/src/obproxy/proxy/client/ob_mysql_client_pool.h index 9ec688a..19e611d 100644 --- a/src/obproxy/proxy/client/ob_mysql_client_pool.h +++ b/src/obproxy/proxy/client/ob_mysql_client_pool.h @@ -52,6 +52,7 @@ public: const common::ObString &user_name, const common::ObString &password, const common::ObString &database, + const common::ObString &password1 = "", ClientPoolOption* client_pool_option = NULL); void destroy(); // Attention!! must release, after required diff --git a/src/obproxy/proxy/client/ob_mysql_proxy.cpp b/src/obproxy/proxy/client/ob_mysql_proxy.cpp index d8711a1..7d8b46b 100644 --- a/src/obproxy/proxy/client/ob_mysql_proxy.cpp +++ b/src/obproxy/proxy/client/ob_mysql_proxy.cpp @@ -462,7 +462,8 @@ const char *ObMysqlProxyCont::get_mysql_proxy_event_name(const int64_t event) int ObMysqlProxy::init(const int64_t timeout_ms, const ObString &user_name, const ObString &password, - const ObString &database) + const ObString &database, + const ObString &password1) { int ret = OB_SUCCESS; if (OB_UNLIKELY(is_inited_)) { @@ -471,7 +472,7 @@ int ObMysqlProxy::init(const int64_t timeout_ms, } else if (OB_UNLIKELY(timeout_ms <= 0)) { ret = OB_INVALID_ARGUMENT; LOG_WARN("invalid input value", K(timeout_ms), K(ret)); - } else if (OB_FAIL(raw_mysql_client_.init(user_name, password, database))) { + } else if (OB_FAIL(raw_mysql_client_.init(user_name, password, database, password1))) { LOG_WARN("fail to init raw mysql client", K(ret)); } else { timeout_ms_ = timeout_ms; @@ -486,6 +487,7 @@ int ObMysqlProxy::rebuild_client_pool(ObShardConnector *shard_conn, const ObString &user_name, const ObString &password, const ObString &database, + const ObString &password1, ClientPoolOption* client_pool_option) { int ret = OB_SUCCESS; @@ -497,7 +499,7 @@ int ObMysqlProxy::rebuild_client_pool(ObShardConnector *shard_conn, ret = OB_INVALID_ARGUMENT; LOG_WARN("invalid input value", K(user_name)); } else { - if (OB_FAIL(alloc_client_pool(is_meta_mysql_client, user_name, password, database, client_pool_option))) { + if (OB_FAIL(alloc_client_pool(is_meta_mysql_client, user_name, password, database, password1, client_pool_option))) { LOG_WARN("fail to alloc client pool", K(is_meta_mysql_client), K(user_name), K(database), K(ret)); } else { client_pool_->set_shard_conn(shard_conn); @@ -514,6 +516,7 @@ int ObMysqlProxy::rebuild_client_pool(ObClusterResource *cluster_resource, const ObString &user_name, const ObString &password, const ObString &database, + const ObString &password1, ClientPoolOption* client_pool_option) { int ret = OB_SUCCESS; @@ -534,7 +537,7 @@ int ObMysqlProxy::rebuild_client_pool(ObClusterResource *cluster_resource, } else { ObString full_username(full_user_name); if (OB_FAIL(alloc_client_pool(is_meta_mysql_client, full_username, - password, database, client_pool_option))) { + password, database, password1, client_pool_option))) { LOG_WARN("fail to alloc client pool", K(user_name), K(database), K(ret)); } else { client_pool_->set_cluster_resource(cluster_resource); @@ -814,6 +817,7 @@ int ObMysqlProxy::alloc_client_pool(const bool is_meta_mysql_client, const ObString &user_name, const ObString &password, const ObString &database, + const ObString &password1, ClientPoolOption* client_pool_option) { int ret = OB_SUCCESS; @@ -827,7 +831,7 @@ int ObMysqlProxy::alloc_client_pool(const bool is_meta_mysql_client, } else if (FALSE_IT(client_pool->inc_ref())) { // will dec_ref in destroy() } else if (OB_FAIL(client_pool->init(is_meta_mysql_client, user_name, - password, database, client_pool_option))) { + password, database, password1, client_pool_option))) { LOG_WARN("fail to init client pool", K(user_name), K(password), K(database), K(is_meta_mysql_client), K(ret)); } else { diff --git a/src/obproxy/proxy/client/ob_mysql_proxy.h b/src/obproxy/proxy/client/ob_mysql_proxy.h index 7ece633..19edd2d 100644 --- a/src/obproxy/proxy/client/ob_mysql_proxy.h +++ b/src/obproxy/proxy/client/ob_mysql_proxy.h @@ -56,7 +56,8 @@ public: int init(const int64_t timeout_ms, const common::ObString &user_name, const common::ObString &password, - const common::ObString &database); + const common::ObString &database, + const common::ObString &password1 = ""); bool is_inited() const { return is_inited_; } void destroy(); int set_timeout_ms(const int64_t timeout_ms); @@ -69,6 +70,7 @@ public: const common::ObString &user_name, const common::ObString &password, const common::ObString &database, + const common::ObString &password1 = "", ClientPoolOption* client_pool_option = NULL); int rebuild_client_pool(obutils::ObClusterResource *cr, @@ -78,6 +80,7 @@ public: const common::ObString &user_name, const common::ObString &password, const common::ObString &database, + const common::ObString &password1 = "", ClientPoolOption* client_pool_option = NULL); void destroy_client_pool(); @@ -110,6 +113,7 @@ private: const common::ObString &user_name, const common::ObString &password, const common::ObString &database, + const common::ObString &password1 = "", ClientPoolOption* client_pool_option = NULL); public: ObMysqlClientPool *acquire_client_pool(); diff --git a/src/obproxy/proxy/client/ob_raw_mysql_client.cpp b/src/obproxy/proxy/client/ob_raw_mysql_client.cpp index aaf6da8..dfb7000 100644 --- a/src/obproxy/proxy/client/ob_raw_mysql_client.cpp +++ b/src/obproxy/proxy/client/ob_raw_mysql_client.cpp @@ -16,12 +16,14 @@ #include "iocore/eventsystem/ob_io_buffer.h" #include "proxy/mysqllib/ob_mysql_request_builder.h" #include "proxy/client/ob_raw_mysql_client.h" +#include "obutils/ob_proxy_config.h" using namespace oceanbase::common; using namespace oceanbase::obmysql; using namespace oceanbase::obproxy::event; using namespace oceanbase::obproxy::net; using namespace oceanbase::obproxy::packet; +using namespace oceanbase::obproxy::obutils; namespace oceanbase { @@ -99,8 +101,14 @@ int ObRawMysqlClientActor::sync_raw_execute(const char *sql, const int64_t timeo } else if (OB_FAIL(resp_->init())) { LOG_WARN("fail to init client mysql resp", K(ret)); } else { - if (!is_avail() && OB_FAIL(connect(addr_, timeout_ms))) { - LOG_WARN("fail to connect", "addr", addr_, K(ret)); + // Get the password again, it may be changed + if (!is_avail() && + OB_FAIL(connect(addr_, timeout_ms))) { + if (!is_avail() && info_->change_password() && OB_FAIL(connect(addr_, timeout_ms))) { + LOG_WARN("fail to connect using password1", "addr", addr_, K(ret)); + } else { + LOG_WARN("fail to connect using password", "addr", addr_, K(ret)); + } } else if (OB_FAIL(send_request(sql))) { LOG_WARN("fail to post request", K(sql), K(ret)); } else { @@ -210,9 +218,9 @@ int ObRawMysqlClientActor::connect(const ObAddr &addr, const int64_t timeout_ms) } } - // do auth job - if (OB_SUCC(ret)) { - if (OB_FAIL(read_response(OB_MYSQL_COM_HANDSHAKE))) { + // do auth job + if (OB_SUCC(ret)) { + if (OB_FAIL(read_response(OB_MYSQL_COM_HANDSHAKE))) { LOG_WARN("fail to read response", K(ret)); } else if (resp_->is_error_resp()) { ret = -resp_->get_err_code(); @@ -227,6 +235,10 @@ int ObRawMysqlClientActor::connect(const ObAddr &addr, const int64_t timeout_ms) } } } + + if (OB_SUCC(ret)) { + is_avail_ = true; + } return ret; } @@ -382,7 +394,8 @@ int ObRawMysqlClientActor::read_response(const ObMySQLCmd cmd) int ObRawMysqlClient::init(const ObString &user_name, const ObString &password, - const ObString &database) + const ObString &database, + const ObString &password1) { int ret = OB_SUCCESS; if (OB_UNLIKELY(user_name.empty())) { @@ -393,8 +406,8 @@ int ObRawMysqlClient::init(const ObString &user_name, LOG_WARN("init twice", K_(is_inited), K(ret)); } else if (OB_FAIL(mutex_init(&mutex_))) { LOG_WARN("fail to init mutex", K(ret)); - } else if (OB_FAIL(info_.set_names(user_name, password, database))) { - LOG_WARN("fail to set names", K(user_name), K(password), K(database), K(ret)); + } else if (OB_FAIL(info_.set_names(user_name, password, database, password1))) { + LOG_WARN("fail to set names", K(user_name), K(password), K(password1), K(database), K(ret)); int tmp_ret = OB_SUCCESS; if (OB_SUCCESS != (tmp_ret = mutex_destroy(&mutex_))) { LOG_ERROR("fail to destroy mutex", K(tmp_ret)); diff --git a/src/obproxy/proxy/client/ob_raw_mysql_client.h b/src/obproxy/proxy/client/ob_raw_mysql_client.h index d52bb98..37ff9a5 100644 --- a/src/obproxy/proxy/client/ob_raw_mysql_client.h +++ b/src/obproxy/proxy/client/ob_raw_mysql_client.h @@ -81,7 +81,8 @@ public: int init(const common::ObString &user_name, const common::ObString &password, - const common::ObString &database); + const common::ObString &database, + const common::ObString &password1 = ""); int sync_raw_execute(const char *sql, const int64_t timeout_ms, ObClientMysqlResp *&resp); diff --git a/src/obproxy/proxy/mysql/ob_mysql_client_session.cpp b/src/obproxy/proxy/mysql/ob_mysql_client_session.cpp index 186ef3c..0673c55 100644 --- a/src/obproxy/proxy/mysql/ob_mysql_client_session.cpp +++ b/src/obproxy/proxy/mysql/ob_mysql_client_session.cpp @@ -1102,7 +1102,6 @@ int ObMysqlClientSession::init_session_pool_info() int ObMysqlClientSession::acquire_svr_session_in_session_pool(const sockaddr &addr, ObMysqlServerSession *&svr_session) { int ret = OB_SUCCESS; - session_info_.set_need_sync_session_vars(true); PROXY_CS_LOG(DEBUG, "[acquire server session] try to acquire session in session pool", K_(cs_id), K_(schema_key)); ObShardConnector *shard_conn = session_info_.get_shard_connector(); ObCommonAddr common_addr; diff --git a/src/obproxy/proxy/mysql/ob_mysql_sm.cpp b/src/obproxy/proxy/mysql/ob_mysql_sm.cpp index 12a6308..199b617 100644 --- a/src/obproxy/proxy/mysql/ob_mysql_sm.cpp +++ b/src/obproxy/proxy/mysql/ob_mysql_sm.cpp @@ -1534,6 +1534,7 @@ inline int ObMysqlSM::init_request_content(ObRequestAnalyzeCtx &ctx) trans_state_.trans_info_.client_request_.set_user_identity(client_session_->get_user_identity()); ctx.is_sharding_mode_ = client_session_->get_session_info().is_sharding_user(); + ctx.connection_collation_ = static_cast(client_session_->get_session_info().get_collation_connection()); } if (OB_SUCC(ret)) { @@ -1606,6 +1607,23 @@ inline int ObMysqlSM::encode_unsupport_ps_message() return ret; } +inline int ObMysqlSM::encode_unsupport_change_user_message() +{ + int ret = OB_SUCCESS; + + if (OB_FAIL(client_buffer_reader_->consume_all())) { + LOG_WARN("client buffer reader fail to consume all", K(ret)); + } else { + trans_state_.mysql_errcode_ = OB_NOT_SUPPORTED; + if (OB_FAIL(ObMysqlTransact::build_error_packet(trans_state_))) { + LOG_WARN("[ObMysqlSM::encode_unsupport_change_user_message] fail to encode error response", + K_(sm_id), K(ret), "errcode", trans_state_.mysql_errcode_); + } + } + + return ret; +} + inline bool ObMysqlSM::is_partition_table_route_supported() { bool bret = false; @@ -1827,7 +1845,7 @@ void ObMysqlSM::analyze_mysql_request(ObMysqlAnalyzeStatus &status) if (client_session_->is_proxysys_tenant()) { //proxysys user no need check everything } else { - if (!client_session_->is_proxy_mysql_client_ && !client_session_->is_proxysys_tenant()) { + if (!client_session_->is_proxy_mysql_client_) { SESSION_PROMETHEUS_STAT(client_session_->get_session_info(), PROMETHEUS_CURRENT_SESSION, true, 1); client_session_->set_conn_prometheus_decrease(true); } @@ -1850,6 +1868,15 @@ void ObMysqlSM::analyze_mysql_request(ObMysqlAnalyzeStatus &status) }//end if !proxysys } } + } else if (OB_MYSQL_COM_CHANGE_USER == req_cmd) { + if (session_info.is_sharding_user() || session_info.is_session_pool_client_) { + if (OB_FAIL(encode_unsupport_change_user_message())) { + LOG_WARN("fail to encode unsupport change user error message", K(ret)); + } else { + LOG_INFO("not support change user"); + } + status = ANALYZE_ERROR; + } } else if (OB_MYSQL_COM_STMT_PREPARE == req_cmd) { if (client_request.get_parse_result().is_start_trans_stmt() || session_info.is_sharding_user()) { if (OB_FAIL(encode_unsupport_ps_message())) { @@ -1868,6 +1895,8 @@ void ObMysqlSM::analyze_mysql_request(ObMysqlAnalyzeStatus &status) LOG_WARN("fail to analyze ps execute request", K(ret), K(req_cmd)); } } else if (OB_MYSQL_COM_STMT_FETCH == req_cmd || OB_MYSQL_COM_STMT_GET_PIECE_DATA == req_cmd) { + // Every time you execute COM_STMT_GET_PIECE_DATA, you also need to set the cursor id, + // because it is the same, so the analyze_fetch_request function is reused here if (OB_FAIL(analyze_fetch_request())) { LOG_WARN("fail to analyze fetch request", K(ret)); } @@ -3571,6 +3600,14 @@ int ObMysqlSM::tunnel_handler_response_transfered(int event, void *data) int ret = OB_SUCCESS; ObMysqlServerSession *last_bound_session = client_session_->get_last_bound_server_session(); if (NULL != last_bound_session) { + // Since the tunnel_handler_server only releases server_session in a transaction, + // There are two places to release server sssion normally: + // 1. During the transaction, tunnel_handler_server + // 2. End of transaction, setup_cmd_complete + // For the COM_STMT_FETCH in the transaction, if you need to switch to another Server: + // 1. In tunnel_handler_server, it is considered that the transaction is over. Because in_trans = false; + // 2. Since the transaction status is modified here, it is considered to be in transaction in the setup_cmd_complete + // So neither of the above will be released, so here we have to release it once release_server_session(); if (OB_FAIL(ObMysqlTransact::return_last_bound_server_session(client_session_))) { LOG_WARN("fail to return last bound server session", K(ret)); @@ -5170,9 +5207,9 @@ void ObMysqlSM::do_internal_request() handshake.set_server_version(server_version); } - if (trans_state_.mysql_config_params_->enable_proxy_scramble_ - && client_session_->get_scramble_string().empty()) { - if (OB_FAIL(client_session_->create_scramble())) { + if (trans_state_.mysql_config_params_->enable_proxy_scramble_) { + if (client_session_->get_scramble_string().empty() + && OB_FAIL(client_session_->create_scramble())) { LOG_WARN("fail to create_scramble", K_(sm_id), K(ret)); } else { ObString &scramble = client_session_->get_scramble_string(); @@ -5308,7 +5345,6 @@ void ObMysqlSM::do_internal_request() bool is_in_trans = (trans_state_.is_hold_start_trans_ || ObMysqlTransact::is_in_trans(trans_state_)); ObObj value; value.set_int(0); - client_info.set_need_sync_session_vars(true); if (client_info.update_common_sys_variable("autocommit", value, true, false)) { LOG_WARN("fail to update sys variable", K_(sm_id), K(ret)); } else if (OB_FAIL(ObMysqlResponseBuilder::build_ok_resq_with_state_changed( @@ -6705,7 +6741,6 @@ int ObMysqlSM::setup_cmd_complete() // stat reset if (ObMysqlTransact::TRANSACTION_COMPLETE == trans_state_.current_.state_) { update_stats(); - client_session_->get_session_info().set_need_sync_session_vars(true); trans_stats_.reset(); milestones_.trans_reset(); set_client_wait_timeout(); diff --git a/src/obproxy/proxy/mysql/ob_mysql_sm.h b/src/obproxy/proxy/mysql/ob_mysql_sm.h index 9f0f458..49027e4 100644 --- a/src/obproxy/proxy/mysql/ob_mysql_sm.h +++ b/src/obproxy/proxy/mysql/ob_mysql_sm.h @@ -174,6 +174,7 @@ public: bool is_pl_route_supported(); int encode_throttle_message(); int encode_unsupport_ps_message(); + int encode_unsupport_change_user_message(); int handle_saved_session_variables(); void print_mysql_complete_log(ObMysqlTunnelProducer *p); diff --git a/src/obproxy/proxy/mysql/ob_mysql_transact.cpp b/src/obproxy/proxy/mysql/ob_mysql_transact.cpp index 8b30311..5ab6e3d 100644 --- a/src/obproxy/proxy/mysql/ob_mysql_transact.cpp +++ b/src/obproxy/proxy/mysql/ob_mysql_transact.cpp @@ -37,6 +37,7 @@ #include "dbconfig/ob_proxy_db_config_info.h" #include "lib/encrypt/ob_encrypted_helper.h" #include "proxy/shard/obproxy_shard_utils.h" +#include "rpc/obmysql/packet/ompk_change_user.h" using namespace oceanbase::share; using namespace oceanbase::common; @@ -250,6 +251,14 @@ void ObMysqlTransact::modify_request(ObTransState &s) } } +bool ObMysqlTransact::need_use_dup_replica(const ObConsistencyLevel level, ObTransState &s) +{ + return (STRONG == level) + && (s.trans_info_.client_request_.get_parse_result().is_select_stmt()) + && (!ObTransState::is_for_update_sql(s.trans_info_.client_request_.get_sql())) + && (s.pll_info_.route_.has_dup_replica_); +} + bool ObMysqlTransact::need_disable_merge_status_check(ObTransState &s) { bool bret = false; @@ -407,7 +416,7 @@ bool ObMysqlTransact::is_sequence_request(ObTransState &s) { oceanbase::obproxy::opsql::ObProxyDualParser parser; ObSqlParseResult& parse_result = client_request.get_parse_result(); ObProxyDualParseResult& dual_result = parse_result.get_dual_result(); - if (OB_FAIL(parser.parse(sql, dual_result))) { + if (OB_FAIL(parser.parse(sql, dual_result, static_cast(session_info.get_collation_connection())))) { LOG_DEBUG("parse sequence_sql_ fail", K(sql)); // ignore parse fail, maybe a db dual request } else if (OB_UNLIKELY(!parser.is_valid_result())) { LOG_DEBUG("not a senquence sql", K(ret)); @@ -1694,8 +1703,10 @@ void ObMysqlTransact::handle_pl_lookup(ObTransState &s) // non weak read(login request included) do nothing: } + bool use_dup_replica = need_use_dup_replica(consistency_level, s); + s.pll_info_.route_.need_use_dup_replica_ = use_dup_replica; const bool disable_merge_status_check = need_disable_merge_status_check(s); - const ObRoutePolicyEnum route_policy = s.get_route_policy(*s.sm_->client_session_); + const ObRoutePolicyEnum route_policy = s.get_route_policy(*s.sm_->client_session_, use_dup_replica); ModulePageAllocator *allocator = NULL; ObLDCLocation::get_thread_allocator(allocator); @@ -2061,10 +2072,10 @@ inline int ObMysqlTransact::build_oceanbase_user_request( if (OB_SUCC(ret)) { if (OB_FAIL(ObProto20Utils::consume_and_compress_data( - request_buffer_reader, write_buffer, client_request_len, compress_seq, compress_seq, - s.sm_->get_server_session()->get_next_server_request_id(), - s.sm_->get_server_session()->get_server_sessid(), - is_last_packet, need_reroute, &extro_info))) { + request_buffer_reader, write_buffer, client_request_len, compress_seq, compress_seq, + s.sm_->get_server_session()->get_next_server_request_id(), + s.sm_->get_server_session()->get_server_sessid(), + is_last_packet, need_reroute, &extro_info))) { LOG_ERROR("fail to consume_and_compress_data", K(ret)); } } @@ -2072,8 +2083,8 @@ inline int ObMysqlTransact::build_oceanbase_user_request( const bool use_fast_compress = true; const bool is_checksum_on = s.sm_->is_checksum_on(); if (OB_FAIL(ObMysqlAnalyzerUtils::consume_and_compress_data( - request_buffer_reader, write_buffer, client_request_len, use_fast_compress, - compress_seq, is_checksum_on))) { + request_buffer_reader, write_buffer, client_request_len, use_fast_compress, + compress_seq, is_checksum_on))) { LOG_WARN("fail to consume_and_compress_data", K(ret)); } } @@ -2669,11 +2680,84 @@ inline void ObMysqlTransact::handle_user_request_succ(ObTransState &s) } } + if (OB_SUCC(ret) && obmysql::OB_MYSQL_COM_CHANGE_USER == s.trans_info_.sql_cmd_) { + if (OB_FAIL(handle_change_user_request_succ(s))) { + LOG_WARN("fail to handle change user request", K(ret)); + } + } + if (OB_FAIL(ret)) { s.current_.state_ = INTERNAL_ERROR; } } +inline int ObMysqlTransact::handle_change_user_request_succ(ObTransState &s) +{ + int ret = OB_SUCCESS; + ObClientSessionInfo& client_info = get_client_session_info(s); + ObProxyMysqlRequest& client_request = s.trans_info_.client_request_; + ObString change_user = client_request.get_req_pkt(); + OMPKChangeUser result; + if (OB_UNLIKELY(change_user.empty())) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("client request is empty", K(change_user), K(ret)); + } else { + const char *start = change_user.ptr() + MYSQL_NET_META_LENGTH; + int32_t len = static_cast(change_user.length() - MYSQL_NET_META_LENGTH); + if (len <= 0) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("client request packet is error", K(ret)); + } else { + result.set_content(start, len); + const ObMySQLCapabilityFlags &capability = client_info.get_orig_capability_flags(); + result.set_capability_flag(capability); + if (OB_FAIL(result.decode())) { + LOG_WARN("fail to decode change user packet", K(ret)); + } else { + // 1. Save username and auth_response + if (OB_FAIL(ObProxySessionInfoHandler::rewrite_change_user_login_req( + client_info, result.get_username(), result.get_auth_response()))) { + LOG_WARN("rewrite change user login req failed", K(ret)); + } else { + /* + * A database will be filled in the change_user API. So the observer side will switch based on this database + * server will clean up session var + * Change_user is allowed to be executed in the transaction, and the current transaction will be forced to rollback after execution + * The above three version number synchronization has been processed in save_changed_session_info, no need to process it anymore + */ + + // 2. Clean up user variables + if (OB_FAIL(client_info.remove_all_user_variable())) { + LOG_WARN("remove all user variable failed", K(ret)); + } + + // 3. Update auth_str + if (OB_SUCC(ret)) { + const ObString full_username = client_info.get_full_username(); + ObMysqlServerSession* server_session = s.sm_->get_server_session(); + if (NULL != server_session && full_username.length() < OB_PROXY_FULL_USER_NAME_MAX_LEN) { + MEMCPY(server_session->full_name_buf_, full_username.ptr(), full_username.length()); + server_session->auth_user_.assign_ptr(server_session->full_name_buf_, full_username.length()); + LOG_DEBUG("handle normal change user request succ", K(server_session->auth_user_)); + } else { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("username length is error", K(full_username.length()), K(ret)); + } + } + + // 4. Clear all server sessions + if (OB_SUCC(ret)) { + ObMysqlClientSession* client_session = s.sm_->get_client_session(); + client_session->get_session_manager().purge_keepalives(); + } + } + } + } + } + + return ret; +} + inline int ObMysqlTransact::handle_user_set_request_succ(ObTransState &s) { int ret = OB_SUCCESS; @@ -4242,12 +4326,6 @@ void ObMysqlTransact::handle_on_forward_server_response(ObTransState &s) } case SERVER_SEND_ALL_SESSION_VARS: - case SERVER_SEND_USE_DATABASE: - case SERVER_SEND_SESSION_VARS: - case SERVER_SEND_LAST_INSERT_ID: - case SERVER_SEND_PREPARE: - case SERVER_SEND_TEXT_PS_PREPARE: - case SERVER_SEND_START_TRANS: { if (OB_LIKELY(NULL != s.sm_->client_session_) && OB_LIKELY(NULL != s.sm_->get_server_session())) { ObClientSessionInfo &client_info = get_client_session_info(s); ObServerSessionInfo &server_info = get_server_session_info(s); @@ -4255,11 +4333,55 @@ void ObMysqlTransact::handle_on_forward_server_response(ObTransState &s) if (obmysql::OB_MYSQL_COM_STMT_CLOSE == s.trans_info_.client_request_.get_packet_meta().cmd_) { // no need sync var, send to server directly s.current_.send_action_ = SERVER_SEND_REQUEST; + s.next_action_ = SM_ACTION_API_SEND_REQUEST; + break; } else if (client_info.need_reset_database(server_info)) { s.current_.send_action_ = SERVER_SEND_USE_DATABASE; - } else if (client_info.need_reset_session_vars(server_info)) { + s.next_action_ = SM_ACTION_API_SEND_REQUEST; + break; + } else { + // fall through: + } + } else { + s.current_.state_ = INTERNAL_ERROR; + handle_server_connection_break(s); + LOG_WARN("[ObMysqlTransact::handle_on_forward_server_response], " + "client session or server session is NULL", + "next_action", ObMysqlTransact::get_action_name(s.next_action_), + K(s.sm_->client_session_), "server_session", s.sm_->get_server_session()); + break; + } + case SERVER_SEND_USE_DATABASE: + if (OB_LIKELY(NULL != s.sm_->client_session_) && OB_LIKELY(NULL != s.sm_->get_server_session())) { + ObClientSessionInfo &client_info = get_client_session_info(s); + ObServerSessionInfo &server_info = get_server_session_info(s); + //obutils::ObSqlParseResult &sql_result = s.trans_info_.client_request_.get_parse_result(); + if (client_info.need_reset_session_vars(server_info)) { s.current_.send_action_ = SERVER_SEND_SESSION_VARS; - } else if (client_info.need_reset_last_insert_id(server_info)) { + s.next_action_ = SM_ACTION_API_SEND_REQUEST; + break; + } else { + // fall through: + } + } else { + s.current_.state_ = INTERNAL_ERROR; + handle_server_connection_break(s); + LOG_WARN("[ObMysqlTransact::handle_on_forward_server_response], " + "client session or server session is NULL", + "next_action", ObMysqlTransact::get_action_name(s.next_action_), + K(s.sm_->client_session_), "server_session", s.sm_->get_server_session()); + break; + } + case SERVER_SEND_SESSION_VARS: + case SERVER_SEND_LAST_INSERT_ID: + case SERVER_SEND_PREPARE: + case SERVER_SEND_TEXT_PS_PREPARE: + case SERVER_SEND_START_TRANS: { + if (OB_LIKELY(NULL != s.sm_->client_session_) && OB_LIKELY(NULL != s.sm_->get_server_session())) { + ObClientSessionInfo &client_info = get_client_session_info(s); + ObServerSessionInfo &server_info = get_server_session_info(s); + //obutils::ObSqlParseResult &sql_result = s.trans_info_.client_request_.get_parse_result(); + if (client_info.need_reset_last_insert_id(server_info)) { // TODO: current version proxy parse can't judge last_insert_id exactly, // so we do not judge, whether sql_reuslt has_last_insert_id here // if it is large request, we do not parse the sql, we don't know whether the sql contains @@ -4734,7 +4856,18 @@ void ObMysqlTransact::handle_new_config_acquired(ObTransState &s) } } -inline ObRoutePolicyEnum ObMysqlTransact::ObTransState::get_route_policy(ObMysqlClientSession &cs) +inline void ObMysqlTransact::ObTransState::get_route_policy(ObProxyRoutePolicyEnum policy, + ObRoutePolicyEnum& ret_policy) +{ + if (FOLLOWER_FIRST_ENUM == policy) { + ret_policy = FOLLOWER_FIRST; + } else if (UNMERGE_FOLLOWER_FIRST_ENUM == policy) { + ret_policy = UNMERGE_FOLLOWER_FIRST; + } else if (FOLLOWER_ONLY_ENUM == policy) { + ret_policy = FOLLOWER_ONLY; + } +} +inline ObRoutePolicyEnum ObMysqlTransact::ObTransState::get_route_policy(ObMysqlClientSession &cs, const bool need_use_dup_replica) { ObRoutePolicyEnum ret_policy = READONLY_ZONE_FIRST; ObRoutePolicyEnum session_route_policy = READONLY_ZONE_FIRST; @@ -4757,7 +4890,10 @@ inline ObRoutePolicyEnum ObMysqlTransact::ObTransState::get_route_policy(ObMysql "session_route_policy", get_route_policy_enum_string(session_route_policy)); } - if (cs.dummy_ldc_.is_readonly_zone_exist()) { + if (need_use_dup_replica) { + //if dup_replica read, use DUP_REPLICA_FIRST, no need care about zone type + ret_policy = DUP_REPLICA_FIRST; + } else if (cs.dummy_ldc_.is_readonly_zone_exist()) { if (common::WEAK == get_trans_consistency_level(cs.get_session_info())) { //if wead read, use session_route_policy ret_policy = session_route_policy; @@ -4772,19 +4908,22 @@ inline ObRoutePolicyEnum ObMysqlTransact::ObTransState::get_route_policy(ObMysql ret_policy = MERGE_IDC_ORDER; } } else { - //if readonly zone also support, only use readwrite zone + //if readonly zone not support, only use readwrite zone ret_policy = ONLY_READWRITE_ZONE; } } else { //if no readonly zone exist, use orig policy ret_policy = MERGE_IDC_ORDER; - if (common::WEAK == get_trans_consistency_level(cs.get_session_info()) - && is_valid_proxy_route_policy(cs.get_session_info().get_proxy_route_policy())) { - //use proxy_route_policy - if (FOLLOWER_FIRST_ENUM == cs.get_session_info().get_proxy_route_policy()) { - ret_policy = FOLLOWER_FIRST; - } else if (UNMERGE_FOLLOWER_FIRST_ENUM == cs.get_session_info().get_proxy_route_policy()) { - ret_policy = UNMERGE_FOLLOWER_FIRST; + if (common::WEAK == get_trans_consistency_level(cs.get_session_info())) { + if (is_valid_proxy_route_policy(cs.get_session_info().get_proxy_route_policy()) + && cs.get_session_info().is_proxy_route_policy_set()) { + get_route_policy(cs.get_session_info().get_proxy_route_policy(), ret_policy); + } else { + const ObString value = get_global_proxy_config().proxy_route_policy.str(); + ObProxyRoutePolicyEnum policy = get_proxy_route_policy(value); + PROXY_CS_LOG(INFO, "succ to global variable proxy_route_policy", + "policy", get_proxy_route_policy_enum_string(policy)); + get_route_policy(policy, ret_policy); } } } diff --git a/src/obproxy/proxy/mysql/ob_mysql_transact.h b/src/obproxy/proxy/mysql/ob_mysql_transact.h index 3bc7a86..b029538 100644 --- a/src/obproxy/proxy/mysql/ob_mysql_transact.h +++ b/src/obproxy/proxy/mysql/ob_mysql_transact.h @@ -755,7 +755,8 @@ public: static bool is_for_update_sql(common::ObString src_sql); common::ObConsistencyLevel get_trans_consistency_level(ObClientSessionInfo &cs_info); bool is_request_readonly_zone_support(ObClientSessionInfo &cs_info); - ObRoutePolicyEnum get_route_policy(ObMysqlClientSession &cs); + ObRoutePolicyEnum get_route_policy(ObMysqlClientSession &cs, const bool need_use_dup_replica); + void get_route_policy(ObProxyRoutePolicyEnum policy, ObRoutePolicyEnum& ret_policy); event::ObFixedArenaAllocator<1024> arena_; @@ -840,11 +841,11 @@ public: static int build_server_request(ObTransState &s, event::ObIOBufferReader *&reader, int64_t &request_len); - static int rewrite_stmt_id(ObTransState &s, event::ObIOBufferReader *client_buffer_reader); static int build_oceanbase_user_request(ObTransState &s, event::ObIOBufferReader *client_buffer_reader, event::ObIOBufferReader *&reader, int64_t &request_len); static int build_user_request(ObTransState &s, event::ObIOBufferReader *client_buffer_reader, event::ObIOBufferReader *&reader, int64_t &request_len); + static int rewrite_stmt_id(ObTransState &s, event::ObIOBufferReader *client_buffer_reader); static void start_access_control(ObTransState &s); static void bad_request(ObTransState &s); @@ -889,6 +890,7 @@ public: static bool is_large_request(ObTransState &s) { return s.trans_info_.client_request_.is_large_request(); } static bool is_bad_route_request(ObTransState &s); static bool is_session_memory_overflow(ObTransState &s); + static bool need_use_dup_replica(const common::ObConsistencyLevel level, ObTransState &s); static bool need_pl_lookup(ObTransState &s); static bool need_use_last_server_session(ObTransState &s); static bool is_db_reset(ObTransState &s); @@ -935,6 +937,7 @@ public: static int do_handle_execute_succ(ObTransState &s); static void handle_prepare_execute_succ(ObTransState &s); static void handle_text_ps_prepare_succ(ObTransState &s); + static int handle_change_user_request_succ(ObTransState &s); static int build_error_packet(ObTransState &s); diff --git a/src/obproxy/proxy/mysqllib/ob_mysql_common_define.h b/src/obproxy/proxy/mysqllib/ob_mysql_common_define.h index fef365a..742c408 100644 --- a/src/obproxy/proxy/mysqllib/ob_mysql_common_define.h +++ b/src/obproxy/proxy/mysqllib/ob_mysql_common_define.h @@ -165,12 +165,12 @@ bool is_supported_mysql_cmd(const obmysql::ObMySQLCmd mysql_cmd) case obmysql::OB_MYSQL_COM_STMT_RESET: // Stored Procedures case obmysql::OB_MYSQL_COM_STMT_FETCH: + case obmysql::OB_MYSQL_COM_CHANGE_USER: // pieceinfo case obmysql::OB_MYSQL_COM_STMT_SEND_PIECE_DATA: case obmysql::OB_MYSQL_COM_STMT_GET_PIECE_DATA: ret = true; break; - case obmysql::OB_MYSQL_COM_CHANGE_USER: // Replication Protocol case obmysql::OB_MYSQL_COM_BINLOG_DUMP: case obmysql::OB_MYSQL_COM_TABLE_DUMP: diff --git a/src/obproxy/proxy/mysqllib/ob_mysql_request_analyzer.cpp b/src/obproxy/proxy/mysqllib/ob_mysql_request_analyzer.cpp index 9fe7fe8..8cd1de1 100644 --- a/src/obproxy/proxy/mysqllib/ob_mysql_request_analyzer.cpp +++ b/src/obproxy/proxy/mysqllib/ob_mysql_request_analyzer.cpp @@ -425,7 +425,8 @@ void ObMysqlRequestAnalyzer::extract_fileds(const ObExprParseResult& result, Sql } } -int ObMysqlRequestAnalyzer::parse_sql_fileds(ObProxyMysqlRequest &client_request) +int ObMysqlRequestAnalyzer::parse_sql_fileds(ObProxyMysqlRequest &client_request, + ObCollationType connection_collation) { int ret = OB_SUCCESS; bool need_parse_fields = true; @@ -470,7 +471,7 @@ int ObMysqlRequestAnalyzer::parse_sql_fileds(ObProxyMysqlRequest &client_request } } LOG_DEBUG("expr_sql is ", K(expr_sql)); - if (OB_FAIL(expr_parser.parse(expr_sql, expr_result))) { + if (OB_FAIL(expr_parser.parse(expr_sql, expr_result, connection_collation))) { LOG_WARN("parse failed", K(expr_sql)); } else if (INSERT_STMT_PARSE_MODE == parse_mode && FALSE_IT(sql_parse_result.set_batch_insert_values_count(expr_result.multi_param_values_))) { @@ -525,10 +526,12 @@ inline int ObMysqlRequestAnalyzer::do_analyze_request( if (OB_FAIL(sql_parser.parse_sql(sql, ctx.parse_mode_, sql_parse_result, use_lower_case_name, + ctx.connection_collation_, ctx.drop_origin_db_table_name_, client_request.is_sharding_user()))) { LOG_WARN("fail to parse sql", K(sql), K(ret)); - } else if (client_request.is_sharding_user() && OB_FAIL(parse_sql_fileds(client_request))){ + } else if (client_request.is_sharding_user() + && OB_FAIL(parse_sql_fileds(client_request, ctx.connection_collation_))){ LOG_WARN("fail to extract_fileds"); } else if (OB_FAIL(handle_internal_cmd(client_request))) { LOG_WARN("fail to handle internal cmd", K(sql), K(ret)); @@ -576,6 +579,7 @@ inline int ObMysqlRequestAnalyzer::do_analyze_request( } break; } + case OB_MYSQL_COM_CHANGE_USER: case OB_MYSQL_COM_INIT_DB: { if (OB_FAIL(client_request.add_request(ctx.reader_, ctx.request_buffer_length_))) { LOG_WARN("fail to add com request", K(ret)); @@ -595,7 +599,6 @@ inline int ObMysqlRequestAnalyzer::do_analyze_request( case OB_MYSQL_COM_DEBUG: case OB_MYSQL_COM_TIME: case OB_MYSQL_COM_DELAYED_INSERT: - case OB_MYSQL_COM_CHANGE_USER: case OB_MYSQL_COM_DAEMON: { //if it is proxysys tenant, we treat it as error cmd, and response error packet to client if (client_request.is_proxysys_tenant()) { diff --git a/src/obproxy/proxy/mysqllib/ob_mysql_request_analyzer.h b/src/obproxy/proxy/mysqllib/ob_mysql_request_analyzer.h index f5ae68c..91ab64b 100644 --- a/src/obproxy/proxy/mysqllib/ob_mysql_request_analyzer.h +++ b/src/obproxy/proxy/mysqllib/ob_mysql_request_analyzer.h @@ -54,6 +54,7 @@ struct ObRequestAnalyzeCtx bool is_auth_; bool drop_origin_db_table_name_; bool is_sharding_mode_; + common::ObCollationType connection_collation_; ObProxyParseMode parse_mode_; event::ObIOBufferReader *reader_; obutils::ObCachedVariables *cached_variables_; @@ -130,7 +131,8 @@ private: const bool is_oracle_mode = false); static int handle_internal_cmd(ObProxyMysqlRequest &client_request); static void extract_fileds(const ObExprParseResult& result, ObProxyMysqlRequest &client_request); - static int parse_sql_fileds(ObProxyMysqlRequest &client_request); + static int parse_sql_fileds(ObProxyMysqlRequest &client_request, + common::ObCollationType connection_collation); static int rewrite_part_key_comment(event::ObIOBufferReader *reader, ObProxyMysqlRequest &client_request); diff --git a/src/obproxy/proxy/mysqllib/ob_mysql_request_builder.cpp b/src/obproxy/proxy/mysqllib/ob_mysql_request_builder.cpp index 711c66c..c4adf34 100644 --- a/src/obproxy/proxy/mysqllib/ob_mysql_request_builder.cpp +++ b/src/obproxy/proxy/mysqllib/ob_mysql_request_builder.cpp @@ -100,7 +100,6 @@ int ObMysqlRequestBuilder::build_all_session_vars_sync_packet(ObMIOBuffer &mio_b if (OB_SUCC(ret)) { server_session->set_compressed_seq(compressed_seq); - client_info.set_need_sync_session_vars(false); LOG_DEBUG("will sync all session variables", K(reset_sql)); } else { LOG_WARN("fail to write buffer", K(cmd), K(reset_sql), K(ob_proxy_protocol), K(ret)); @@ -135,7 +134,6 @@ int ObMysqlRequestBuilder::build_session_vars_sync_packet(ObMIOBuffer &mio_buf, } if (OB_SUCC(ret)) { - client_info.set_need_sync_session_vars(false); server_session->set_compressed_seq(compressed_seq); LOG_DEBUG("will sync session variables", K(reset_sql)); } else { diff --git a/src/obproxy/proxy/mysqllib/ob_proxy_session_info.cpp b/src/obproxy/proxy/mysqllib/ob_proxy_session_info.cpp index 367b31a..1694a5b 100644 --- a/src/obproxy/proxy/mysqllib/ob_proxy_session_info.cpp +++ b/src/obproxy/proxy/mysqllib/ob_proxy_session_info.cpp @@ -160,7 +160,8 @@ int ObServerSessionInfo::add_text_ps_name(const uint32_t text_ps_name_id) ObClientSessionInfo::ObClientSessionInfo() : is_inited_(false), is_trans_specified_(false), is_global_vars_changed_(false), - is_user_idc_name_set_(false), is_read_consistency_set_(false), is_oracle_mode_(false), + is_user_idc_name_set_(false), is_read_consistency_set_(false), is_oracle_mode_(false), + is_proxy_route_policy_set_(false), enable_shard_authority_(false), enable_reset_db_(true), cap_(0), safe_read_snapshot_(0), syncing_safe_read_snapshot_(0), route_policy_(1), proxy_route_policy_(MAX_PROXY_ROUTE_POLICY), user_identity_(USER_TYPE_NONE), cached_variables_(), @@ -168,7 +169,7 @@ ObClientSessionInfo::ObClientSessionInfo() var_set_processor_(NULL), cluster_id_(OB_INVALID_CLUSTER_ID), real_meta_cluster_name_(), real_meta_cluster_name_str_(NULL), server_type_(DB_OB_MYSQL), shard_conn_(NULL), group_id_(OBPROXY_MAX_DBMESH_ID), is_allow_use_last_session_(true), - consistency_level_prop_(INVALID_CONSISTENCY), need_sync_session_vars_(true), + consistency_level_prop_(INVALID_CONSISTENCY), recv_client_ps_id_(0), ps_id_(0), ps_entry_(NULL), ps_id_entry_map_(), text_ps_name_entry_map_(), is_text_ps_execute_(false), cursor_id_(0), cursor_id_addr_map_(), ps_id_addrs_map_(), @@ -710,6 +711,15 @@ int ObClientSessionInfo::remove_user_variable(const ObString &var_name) return ret; } +int ObClientSessionInfo::remove_all_user_variable() +{ + int ret = OB_SUCCESS; + if (OB_FAIL(field_mgr_.remove_all_user_vars())) { + LOG_WARN("fail to remove all user variable", K(ret)); + } + return ret; +} + int ObClientSessionInfo::get_user_variable(const ObString &var_name, ObSessionUserField *&value) const { int ret = OB_SUCCESS; @@ -1130,6 +1140,7 @@ void ObClientSessionInfo::destroy() is_user_idc_name_set_ = false; is_read_consistency_set_ = false; is_oracle_mode_ = false; + is_proxy_route_policy_set_ = false; enable_shard_authority_ = false; enable_reset_db_ = true; diff --git a/src/obproxy/proxy/mysqllib/ob_proxy_session_info.h b/src/obproxy/proxy/mysqllib/ob_proxy_session_info.h index d1abd90..a7829eb 100644 --- a/src/obproxy/proxy/mysqllib/ob_proxy_session_info.h +++ b/src/obproxy/proxy/mysqllib/ob_proxy_session_info.h @@ -492,6 +492,7 @@ public: // include all bool need_reset_all_session_vars() const { return is_global_vars_changed_; } bool is_user_idc_name_set() const { return is_user_idc_name_set_; } + bool is_proxy_route_policy_set() const { return is_proxy_route_policy_set_; } //sys variables related methords int update_cached_variable(const common::ObString &var_name, ObSessionSysField *field); @@ -519,6 +520,7 @@ public: int replace_user_variable(const common::ObString &name, const common::ObObj &val); int replace_user_variable(const common::ObString &name, const common::ObString &val); int remove_user_variable(const common::ObString &name); + int remove_all_user_variable(); int get_user_variable(const common::ObString &name, ObSessionUserField *&value) const; int get_user_variable_value(const common::ObString &name, common::ObObj &value) const; int user_variable_exists(const common::ObString &name, bool &is_exist); @@ -566,7 +568,10 @@ public: //proxy route policy ObProxyRoutePolicyEnum get_proxy_route_policy() const { return proxy_route_policy_; } - void set_proxy_route_policy(ObProxyRoutePolicyEnum policy) { proxy_route_policy_ = policy; } + void set_proxy_route_policy(ObProxyRoutePolicyEnum policy) { + proxy_route_policy_ = policy; + is_proxy_route_policy_set_ = true; + } // the initial value of this flag is false, // when we specifies next transaction characteristic(set transaction xxx), this flag will be set; @@ -641,6 +646,7 @@ public: int64_t get_net_write_timeout() const{ return cached_variables_.get_net_write_timeout(); } bool need_use_lower_case_names() const { return cached_variables_.need_use_lower_case_names(); } int64_t get_read_consistency() const { return cached_variables_.get_read_consistency(); } + int64_t get_collation_connection() const { return cached_variables_.get_collation_connection(); } ObConsistencyLevel get_consistency_level_prop() const {return consistency_level_prop_;} void set_consistency_level_prop(ObConsistencyLevel level) {consistency_level_prop_ = level;} @@ -673,7 +679,6 @@ public: void set_group_id(const int64_t group_id) { group_id_ = group_id; } int64_t get_group_id() { return group_id_; } - void set_need_sync_session_vars(bool need_sync) { need_sync_session_vars_ = need_sync; } bool is_sys_hot_version_changed() const { return hash_version_.hot_sys_var_version_ != version_.hot_sys_var_version_; } @@ -833,6 +838,8 @@ private: bool is_read_consistency_set_; // is oracle mode bool is_oracle_mode_; + //when user set proxy_route_policy, set it true; + bool is_proxy_route_policy_set_; bool enable_shard_authority_; bool enable_reset_db_; @@ -900,8 +907,6 @@ private: // consistency_level_prop in shard_conn_prop ObConsistencyLevel consistency_level_prop_; - // if has synced will not need sync to avoid loop sync when compare failed - bool need_sync_session_vars_; uint32_t recv_client_ps_id_; uint32_t ps_id_; @@ -1102,7 +1107,18 @@ inline bool ObClientSessionInfo::need_reset_user_session_vars(const ObServerSess { bool bret = false; if (!is_session_pool_client_) { - bret = get_user_var_version() > server_info.get_user_var_version(); + if (get_user_var_version() > server_info.get_user_var_version()) { + int ret = OB_SUCCESS; + common::ObSEArray names; + ObClientSessionInfo* client_info = const_cast(this); + if (OB_FAIL(client_info->get_all_user_var_names(names))) { + PROXY_LOG(WARN, "fail get all var name for source", K(ret)); + } else { + int64_t count = names.count(); + bret = (0 != count); + PROXY_LOG(DEBUG, "need_reset_user_session_vars", K(bret), K(count)); + } + } } else { bool is_changed = is_user_var_version_changed(); if (is_changed) { @@ -1137,14 +1153,13 @@ inline bool ObClientSessionInfo::need_reset_safe_read_snapshot(const ObServerSes inline bool ObClientSessionInfo::need_reset_session_vars(const ObServerSessionInfo &server_info) const { bool bret = true; - bool bret2 = false; if (is_oceanbase_server()) { bret = need_reset_common_hot_session_vars(server_info) || need_reset_common_cold_session_vars(server_info) || need_reset_hot_session_vars(server_info) || need_reset_cold_session_vars(server_info) - || need_reset_user_session_vars(server_info); - bret2 = need_reset_safe_read_snapshot(server_info); + || need_reset_user_session_vars(server_info) + || need_reset_safe_read_snapshot(server_info); } else { bret = need_reset_common_hot_session_vars(server_info) || need_reset_common_cold_session_vars(server_info) @@ -1152,13 +1167,6 @@ inline bool ObClientSessionInfo::need_reset_session_vars(const ObServerSessionIn || need_reset_mysql_cold_session_vars(server_info) || need_reset_user_session_vars(server_info); } - // for defence - if (bret && !need_sync_session_vars_) { - bret = bret2; - PROXY_LOG(WARN, "session not same but no need sync", K(bret2)); - } else if (!bret) { - bret = bret2; - } return bret; } diff --git a/src/obproxy/proxy/mysqllib/ob_proxy_session_info_handler.cpp b/src/obproxy/proxy/mysqllib/ob_proxy_session_info_handler.cpp index 01f799b..53f1e7d 100644 --- a/src/obproxy/proxy/mysqllib/ob_proxy_session_info_handler.cpp +++ b/src/obproxy/proxy/mysqllib/ob_proxy_session_info_handler.cpp @@ -221,7 +221,9 @@ int ObProxySessionInfoHandler::rewrite_login_req_by_sharding(ObClientSessionInfo } else { passwd_string += 1; int64_t actual_len = 0; - const ObString &scramble_string = client_info.get_scramble_string(); + const ObString &scramble_string = (client_info.get_scramble_string().empty() + ? ObString::make_string("aaaaaaaabbbbbbbbbbbb") + : client_info.get_scramble_string()); if (OB_FAIL(ObClientUtils::get_auth_password_from_stage1(passwd_string, scramble_string, pwd_buf, pwd_buf_len, actual_len))) { LOG_WARN("fail to get get_auth_password_from_stage1", K(ret)); @@ -412,6 +414,77 @@ int ObProxySessionInfoHandler::rewrite_ldg_login_req(ObClientSessionInfo &clien return ret; } +int ObProxySessionInfoHandler::rewrite_change_user_login_req(ObClientSessionInfo &client_info, + const ObString& username, + const ObString& auth_response) +{ + int ret = OB_SUCCESS; + const int64_t BUFFER_SIZE = BUFFER_SIZE_FOR_INDEX(BUFFER_SIZE_INDEX_4K); + ObMIOBuffer *target_hsr_buf = NULL; + ObIOBufferReader *target_hsr_reader = NULL; + // 1.alloc tmp buffer + if (OB_ISNULL(target_hsr_buf = new_miobuffer(BUFFER_SIZE))) { + ret = OB_ALLOCATE_MEMORY_FAILED; + PROXY_CS_LOG(WARN, "fail to allocate memory for ObMIOBuffer", "size", BUFFER_SIZE, K(ret)); + } else if (OB_ISNULL(target_hsr_reader = target_hsr_buf->alloc_reader())) { + ret = OB_ALLOCATE_MEMORY_FAILED; + PROXY_CS_LOG(WARN, "fail to alloc reader for ObIOBufferReader", K(ret)); + } else { + OMPKHandshakeResponse target_hsr; + ObRequestAnalyzeCtx target_ctx; + ObMysqlAuthRequest& auth_req = client_info.get_login_req(); + target_hsr = auth_req.get_hsr_result().response_; + + // 1. assign seq num + target_hsr.set_seq(static_cast(auth_req.get_packet_meta().pkt_seq_)); + + // 2. change username + target_hsr.set_username(username); + + // 3. change auth_response + target_hsr.set_auth_response(auth_response); + + ObString default_tenant_name; + ObString default_cluster_name; + if (OB_FAIL(client_info.get_tenant_name(default_tenant_name))) { + LOG_WARN("fail to get tenant name", K(ret)); + } else if (OB_FAIL(client_info.get_cluster_name(default_cluster_name))) { + LOG_WARN("fail to get cluster name", K(ret)); + } else if (OB_FAIL(ObMysqlPacketWriter::write_packet(*target_hsr_buf, target_hsr))) { + PROXY_CS_LOG(WARN, "fail to write hsr pkt", K(target_hsr), K(target_hsr_buf), K(ret)); + } else if (OB_FAIL(ObRequestAnalyzeCtx::init_auth_request_analyze_ctx( + target_ctx, target_hsr_reader, + default_tenant_name, default_cluster_name))) { + PROXY_CS_LOG(WARN, "fail to init request analyze context", K(ret)); + } else { + ObMysqlAnalyzeStatus status = ANALYZE_CONT; + obmysql::ObMySQLCmd tmp_req_cmd = obmysql::OB_MYSQL_COM_MAX_NUM; + ObProxyMysqlRequest tmp_request; + auth_req.reset(); + ObMysqlRequestAnalyzer::analyze_request(target_ctx, auth_req, + tmp_request, tmp_req_cmd, status); + if (OB_UNLIKELY(ANALYZE_DONE != status)) { + ret = OB_ERR_UNEXPECTED; + PROXY_CS_LOG(WARN, "fail to analyze request", K(status), K(ret)); + } else { + ObProxySessionPrivInfo &priv_info = client_info.get_priv_info(); + priv_info.cluster_name_ = auth_req.get_hsr_result().cluster_name_; + priv_info.tenant_name_ = auth_req.get_hsr_result().tenant_name_; + priv_info.user_name_ = auth_req.get_hsr_result().user_name_; + PROXY_CS_LOG(DEBUG, "rewrite change user login req", K(auth_req.get_hsr_result())); + } + } + } + + // 4. free the buffer if need + if (OB_LIKELY(NULL != target_hsr_buf)) { + free_miobuffer(target_hsr_buf); + target_hsr_buf = NULL; + target_hsr_reader = NULL; + } + return ret; +} + int ObProxySessionInfoHandler::rewrite_ssl_req(ObClientSessionInfo &client_info) { int ret = OB_SUCCESS; diff --git a/src/obproxy/proxy/mysqllib/ob_proxy_session_info_handler.h b/src/obproxy/proxy/mysqllib/ob_proxy_session_info_handler.h index 073d26b..0e75c05 100644 --- a/src/obproxy/proxy/mysqllib/ob_proxy_session_info_handler.h +++ b/src/obproxy/proxy/mysqllib/ob_proxy_session_info_handler.h @@ -146,6 +146,10 @@ public: const common::ObString &server_scramble, const common::ObString &proxy_scramble, const common::ObAddr &client_addr); + + static int rewrite_change_user_login_req(ObClientSessionInfo &client_info, + const common::ObString& username, + const common::ObString& auth_response); static void assign_database_version(ObClientSessionInfo &client_info, ObServerSessionInfo &server_info); diff --git a/src/obproxy/proxy/mysqllib/ob_session_field_mgr.cpp b/src/obproxy/proxy/mysqllib/ob_session_field_mgr.cpp index fa538d3..b96e465 100644 --- a/src/obproxy/proxy/mysqllib/ob_session_field_mgr.cpp +++ b/src/obproxy/proxy/mysqllib/ob_session_field_mgr.cpp @@ -1357,11 +1357,17 @@ int ObSessionFieldMgr::format_all_var(ObSqlString &sql) const for (int64_t i = 0; OB_SUCC(ret) && i < block->free_idx_; ++i) { field = const_cast(block->field_slots_ + i); if (OB_FIELD_USED == field->stat_) { - if (OB_FAIL(field->format(sql))) { - LOG_WARN("construct sql failed", K(ret)); + var_name.assign(const_cast(field->name_), field->name_len_); + hash_ret = local_var_set.exist_refactored(var_name); + if (OB_HASH_EXIST == hash_ret) { + // do nothing + } else if (OB_HASH_NOT_EXIST != hash_ret) { + ret = hash_ret; + LOG_WARN("local_var_set set failed", K(ret)); } else { - var_name.assign(const_cast(field->name_), field->name_len_); - if (OB_FAIL(local_var_set.set_refactored(var_name))) { + if (OB_FAIL(field->format(sql))) { + LOG_WARN("construct sql failed", K(ret)); + } else if (OB_FAIL(local_var_set.set_refactored(var_name))) { LOG_WARN("local_var_set set failed", K(ret)); } } @@ -2740,6 +2746,8 @@ int ObDefaultSysVarSet::load_default_system_variable() LOG_WARN("fail to load default sysvar tx_read_only", K(ret)); } else if (OB_FAIL(load_sysvar_int(ObString::make_string(OB_SV_READ_CONSISTENCY), 3, both_scope, print_info_log))) { LOG_WARN("fail to load default sysvar ob_read_consistency", K(ret)); + } else if (OB_FAIL(load_sysvar_int(ObString::make_string(OB_SV_COLLATION_CONNECTION), 45, both_scope, print_info_log))) { + LOG_WARN("fail to load default sysvar collation_connection", K(ret)); } return ret; } diff --git a/src/obproxy/proxy/route/ob_ldc_location.cpp b/src/obproxy/proxy/route/ob_ldc_location.cpp index e5d4db9..67ef3e1 100644 --- a/src/obproxy/proxy/route/ob_ldc_location.cpp +++ b/src/obproxy/proxy/route/ob_ldc_location.cpp @@ -354,7 +354,7 @@ bool ObLDCLocation::is_in_primary_zone(const ObProxyReplicaLocation &replica, int ObLDCLocation::fill_strong_read_location(const ObProxyPartitionLocation *pl, ObLDCLocation &dummy_ldc, ObLDCItem &leader_item, ObLDCLocation &ldc_location, - bool &entry_need_update, const bool is_only_readwrite_zone, + bool &entry_need_update, const bool is_only_readwrite_zone, const bool need_use_dup_replica, const ObIArray &ss_info, const ObIArray ®ion_names, const ObString &proxy_primary_zone_name) @@ -425,6 +425,11 @@ int ObLDCLocation::fill_strong_read_location(const ObProxyPartitionLocation *pl, K(replica)); leader_item.set(replica, default_merging_status, default_idc_type, default_zone_type, true, default_congested_status); + if (need_use_dup_replica) { + if (OB_FAIL(tmp_item_array.push_back(leader_item))) { + LOG_WARN("fail to push_back leader_item", K(leader_item), K(tmp_item_array), K(ret)); + } + } } else if (is_ldc_used) { LOG_WARN("fail to find replica in dummy ldc with ldc, maybe someone old, " "do not use it", K(replica)); @@ -441,6 +446,11 @@ int ObLDCLocation::fill_strong_read_location(const ObProxyPartitionLocation *pl, //found it if (replica.is_leader()) { leader_item = tmp_item; + if (need_use_dup_replica) { + if (OB_FAIL(tmp_item_array.push_back(leader_item))) { + LOG_WARN("fail to push_back leader_item", K(leader_item), K(tmp_item_array), K(ret)); + } + } } else if (OB_FAIL(tmp_item_array.push_back(tmp_item))) { LOG_WARN("fail to push_back target_item", K(tmp_item), K(tmp_item_array), K(ret)); } diff --git a/src/obproxy/proxy/route/ob_ldc_location.h b/src/obproxy/proxy/route/ob_ldc_location.h index 75d3023..501665d 100644 --- a/src/obproxy/proxy/route/ob_ldc_location.h +++ b/src/obproxy/proxy/route/ob_ldc_location.h @@ -203,6 +203,7 @@ public: ObLDCLocation &ldc_location, bool &entry_need_update, const bool is_only_readwrite_zone, + const bool need_use_dup_replica, const common::ObIArray &ss_info, const common::ObIArray ®ion_names, const common::ObString &proxy_primary_zone_name); diff --git a/src/obproxy/proxy/route/ob_ldc_route.cpp b/src/obproxy/proxy/route/ob_ldc_route.cpp index 74f5655..89290f0 100644 --- a/src/obproxy/proxy/route/ob_ldc_route.cpp +++ b/src/obproxy/proxy/route/ob_ldc_route.cpp @@ -449,6 +449,86 @@ static ObRouteType route_order_cursor_of_unmerge_follower_first_optimized[] = { ROUTE_TYPE_MAX }; +//ANPD, BNPD, AMPD, BMPD +//CNPD, CMPD +//ANP, BNP, AMP, BMP; +//CNP, CMP; +//ANT, BNT, AMT, BMT; +//CNT, CMT +static ObRouteType route_order_cursor_of_dup_strong_read_order[] = { + ROUTE_TYPE_DUP_PARTITION_UNMERGE_LOCAL, + ROUTE_TYPE_DUP_PARTITION_UNMERGE_REGION, + ROUTE_TYPE_DUP_PARTITION_MERGE_LOCAL, + ROUTE_TYPE_DUP_PARTITION_MERGE_REGION, + ROUTE_TYPE_DUP_PARTITION_UNMERGE_REMOTE, + ROUTE_TYPE_DUP_PARTITION_MERGE_REMOTE, + + ROUTE_TYPE_PARTITION_UNMERGE_LOCAL, + ROUTE_TYPE_PARTITION_UNMERGE_REGION, + ROUTE_TYPE_PARTITION_MERGE_LOCAL, + ROUTE_TYPE_PARTITION_MERGE_REGION, + + ROUTE_TYPE_PARTITION_UNMERGE_REMOTE, + ROUTE_TYPE_PARTITION_MERGE_REMOTE, + + ROUTE_TYPE_NONPARTITION_UNMERGE_LOCAL, + ROUTE_TYPE_NONPARTITION_UNMERGE_REGION, + ROUTE_TYPE_NONPARTITION_MERGE_LOCAL, + ROUTE_TYPE_NONPARTITION_MERGE_REGION, + + ROUTE_TYPE_NONPARTITION_UNMERGE_REMOTE, + ROUTE_TYPE_NONPARTITION_MERGE_REMOTE, + + ROUTE_TYPE_MAX +}; + +//ANPF, BNPF, AMPF, BMPF; +//ANT, BNT, AMT, BMT; +//CNPF, CMPF; +//CNT, CMT +static ObRouteType route_order_cursor_of_follower_only[] = { + ROUTE_TYPE_FOLLOWER_PARTITION_UNMERGE_LOCAL, + ROUTE_TYPE_FOLLOWER_PARTITION_UNMERGE_REGION, + ROUTE_TYPE_FOLLOWER_PARTITION_MERGE_LOCAL, + ROUTE_TYPE_FOLLOWER_PARTITION_MERGE_REGION, + + ROUTE_TYPE_NONPARTITION_UNMERGE_LOCAL, + ROUTE_TYPE_NONPARTITION_UNMERGE_REGION, + ROUTE_TYPE_NONPARTITION_MERGE_LOCAL, + ROUTE_TYPE_NONPARTITION_MERGE_REGION, + + ROUTE_TYPE_FOLLOWER_PARTITION_UNMERGE_REMOTE, + ROUTE_TYPE_FOLLOWER_PARTITION_MERGE_REMOTE, + + ROUTE_TYPE_NONPARTITION_UNMERGE_REMOTE, + ROUTE_TYPE_NONPARTITION_MERGE_REMOTE, + + ROUTE_TYPE_MAX +}; + +//ANPF, BNPF, AMPF, BMPF; +//CNPF, CMPF; +//ANT, BNT, AMT, BMT; +//CNT, CMT +static ObRouteType route_order_cursor_of_follower_only_optimized[] = { + ROUTE_TYPE_FOLLOWER_PARTITION_UNMERGE_LOCAL, + ROUTE_TYPE_FOLLOWER_PARTITION_UNMERGE_REGION, + ROUTE_TYPE_FOLLOWER_PARTITION_MERGE_LOCAL, + ROUTE_TYPE_FOLLOWER_PARTITION_MERGE_REGION, + + ROUTE_TYPE_FOLLOWER_PARTITION_UNMERGE_REMOTE, + ROUTE_TYPE_FOLLOWER_PARTITION_MERGE_REMOTE, + + ROUTE_TYPE_NONPARTITION_UNMERGE_LOCAL, + ROUTE_TYPE_NONPARTITION_UNMERGE_REGION, + ROUTE_TYPE_NONPARTITION_MERGE_LOCAL, + ROUTE_TYPE_NONPARTITION_MERGE_REGION, + + ROUTE_TYPE_NONPARTITION_UNMERGE_REMOTE, + ROUTE_TYPE_NONPARTITION_MERGE_REMOTE, + + ROUTE_TYPE_MAX +}; const ObRouteType *ObLDCRoute::route_order_cursor_[] = { route_order_cursor_of_merge_idc_order, @@ -465,6 +545,9 @@ const ObRouteType *ObLDCRoute::route_order_cursor_[] = { route_order_cursor_of_unmerge_follower_first, route_order_cursor_of_follower_first_optimized, route_order_cursor_of_unmerge_follower_first_optimized, + route_order_cursor_of_dup_strong_read_order, + route_order_cursor_of_follower_only, + route_order_cursor_of_follower_only_optimized, }; int64_t ObLDCRoute::route_order_size_[] = { @@ -483,6 +566,11 @@ int64_t ObLDCRoute::route_order_size_[] = { sizeof(route_order_cursor_of_unmerge_follower_first) / sizeof(ObRouteType),//19 sizeof(route_order_cursor_of_follower_first_optimized) / sizeof(ObRouteType),//19 sizeof(route_order_cursor_of_unmerge_follower_first_optimized) / sizeof(ObRouteType),//19 + + sizeof(route_order_cursor_of_dup_strong_read_order) / sizeof(ObRouteType),//18 + + sizeof(route_order_cursor_of_follower_only) / sizeof(ObRouteType),//13 + sizeof(route_order_cursor_of_follower_only_optimized) / sizeof(ObRouteType),//13 }; const ObLDCItem *ObLDCRoute::get_next_item() @@ -516,6 +604,7 @@ const ObLDCItem *ObLDCRoute::get_next_item() && is_same_role(route_type, *ret_item) && is_same_partition_type(route_type, *ret_item) && is_same_zone_type(route_type, *ret_item) + && is_same_dup_replica_type(route_type, *ret_item) && (disable_merge_status_check_ || is_same_merge_type(route_type, *ret_item))) { ret_item->is_used_ = true; need_break = true; diff --git a/src/obproxy/proxy/route/ob_ldc_route.h b/src/obproxy/proxy/route/ob_ldc_route.h index 3c7aca5..80d81ba 100644 --- a/src/obproxy/proxy/route/ob_ldc_route.h +++ b/src/obproxy/proxy/route/ob_ldc_route.h @@ -42,6 +42,7 @@ public: static bool is_same_zone_type(const ObRouteType route_type, const ObLDCItem &item); static bool is_same_partition_type(const ObRouteType route_type, const ObLDCItem &item); static bool is_same_role(const ObRouteType route_type, const ObLDCItem &item); + static bool is_same_dup_replica_type(const ObRouteType route_type, const ObLDCItem &item); TO_STRING_KV("policy", get_route_policy_enum_string(policy_), K_(disable_merge_status_check), K_(curr_cursor_index), K_(next_index_in_site), K_(location)); @@ -169,6 +170,26 @@ inline bool ObLDCRoute::is_same_role(const ObRouteType route_type, return ret_bool; } +inline bool ObLDCRoute::is_same_dup_replica_type(const ObRouteType route_type, const ObLDCItem &item) +{ + bool ret_bool = false; + if (OB_NOT_NULL(item.replica_)) { + switch (route_type & MAX_DUP_REPLICA_TYPE_VALUE) { + case IS_DUP_REPLICA: + ret_bool = item.replica_->is_dup_replica_ || common::LEADER == item.replica_->role_; + break; + case NON_DUP_REPLICA: + ret_bool = !item.replica_->is_dup_replica_; + break; + case UNKNOWN_DUP_REPLICA_TYPE: + ret_bool = true; + default: + break; + } + } + return ret_bool; +} + inline int64_t ObLDCRoute::get_cursor_index(const ObRouteType route_type) { int64_t idx = common::OB_INVALID_INDEX; diff --git a/src/obproxy/proxy/route/ob_ldc_struct.h b/src/obproxy/proxy/route/ob_ldc_struct.h index e96ad78..c6d9ef4 100644 --- a/src/obproxy/proxy/route/ob_ldc_struct.h +++ b/src/obproxy/proxy/route/ob_ldc_struct.h @@ -32,14 +32,15 @@ enum ObIDCType const common::ObString get_idc_type_string(const ObIDCType type); /* - * |--- n bits ---|--- 2 bits ---|--- 2 bits ---|--- 2 bits ---|--- 2 bits ---|--- 2 bits ---| LSB - * | new attribute |-- role type --|-- pl status --| zone type | merge status | IDC | LSB + * |--- n bits ---|----- 2bits -----|--- 2 bits ---|--- 2 bits ---|--- 2 bits ---|--- 2 bits ---|--- 2 bits ---| LSB + * | new attribute |-- dup replica --|-- role type --|-- pl status --| zone type | merge status | IDC | LSB */ static const int64_t MERGE_BITS_SHIFT = 2; static const int64_t ZONE_TYPE_BITS_SHIFT = 4; static const int64_t PARTITION_BITS_SHIFT = 6; static const int64_t ROLE_TYPE_BITS_SHIFT = 8; -static const int64_t NEW_ATTRIBUTE_BITS_SHIFT = 10; +static const int64_t DUP_REPLICA_BITS_SHIFT = 10; +static const int64_t NEW_ATTRIBUTE_BITS_SHIFT = 12; static const int64_t IN_SAME_IDC = static_cast(SAME_IDC); //LOCAL static const int64_t IN_SAME_REGION = static_cast(SAME_REGION); //REGION static const int64_t IN_OTHER_REGION = static_cast(OTHER_REGION);//REMOTE @@ -61,73 +62,85 @@ static const int64_t IS_FOLLOWER = 0 << ROLE_TYPE_BITS_SHIFT; //FOL static const int64_t IS_LEADER = 1 << ROLE_TYPE_BITS_SHIFT; //LEADER static const int64_t UNKNOWN_ROLE = 3 << ROLE_TYPE_BITS_SHIFT;//UNKNOWN +static const int64_t NON_DUP_REPLICA = 0 << DUP_REPLICA_BITS_SHIFT; // NON DUP_REPLICA +static const int64_t IS_DUP_REPLICA = 1 << DUP_REPLICA_BITS_SHIFT; // IS DUP_REPLICA +static const int64_t UNKNOWN_DUP_REPLICA_TYPE = 3 << DUP_REPLICA_BITS_SHIFT; // UNKNOWN + static const int64_t MAX_IDC_VALUE = ((1 << MERGE_BITS_SHIFT) -1);//0x0011 static const int64_t MAX_MERGE_VALUE = (((1 << (ZONE_TYPE_BITS_SHIFT - MERGE_BITS_SHIFT)) -1) << MERGE_BITS_SHIFT);//0x01100 static const int64_t MAX_ZONE_TYPE_VALUE = (((1 << (PARTITION_BITS_SHIFT - ZONE_TYPE_BITS_SHIFT)) -1) << ZONE_TYPE_BITS_SHIFT);//0x0011 0000 static const int64_t MAX_PARTITION_TYPE_VALUE = (((1 << (ROLE_TYPE_BITS_SHIFT - PARTITION_BITS_SHIFT)) -1) << PARTITION_BITS_SHIFT);//0x1100 0000 -static const int64_t MAX_ROLE_TYPE_VALUE = (((1 << (NEW_ATTRIBUTE_BITS_SHIFT - ROLE_TYPE_BITS_SHIFT)) -1) << ROLE_TYPE_BITS_SHIFT);//0x0011 0000 0000 +static const int64_t MAX_ROLE_TYPE_VALUE = (((1 << (DUP_REPLICA_BITS_SHIFT - ROLE_TYPE_BITS_SHIFT)) -1) << ROLE_TYPE_BITS_SHIFT);//0x0011 0000 0000 +static const int64_t MAX_DUP_REPLICA_TYPE_VALUE = (((1 << (NEW_ATTRIBUTE_BITS_SHIFT - DUP_REPLICA_BITS_SHIFT)) -1) << DUP_REPLICA_BITS_SHIFT);//0x1100 0000 0000 enum ObRouteType { - ROUTE_TYPE_PARTITION_READWRITE_UNMERGE_LOCAL = (UNKNOWN_ROLE | WITH_PARTITION_TYPE | IS_READWRITE_ZONE | IN_UNMERGING | IN_SAME_IDC), // 768 - ROUTE_TYPE_PARTITION_READWRITE_UNMERGE_REGION = (UNKNOWN_ROLE | WITH_PARTITION_TYPE | IS_READWRITE_ZONE | IN_UNMERGING | IN_SAME_REGION), // 769 - ROUTE_TYPE_PARTITION_READWRITE_UNMERGE_REMOTE = (UNKNOWN_ROLE | WITH_PARTITION_TYPE | IS_READWRITE_ZONE | IN_UNMERGING | IN_OTHER_REGION), // 770 - ROUTE_TYPE_PARTITION_READWRITE_MERGE_LOCAL = (UNKNOWN_ROLE | WITH_PARTITION_TYPE | IS_READWRITE_ZONE | IN_MERGING | IN_SAME_IDC), // 772 - ROUTE_TYPE_PARTITION_READWRITE_MERGE_REGION = (UNKNOWN_ROLE | WITH_PARTITION_TYPE | IS_READWRITE_ZONE | IN_MERGING | IN_SAME_REGION), // 723 - ROUTE_TYPE_PARTITION_READWRITE_MERGE_REMOTE = (UNKNOWN_ROLE | WITH_PARTITION_TYPE | IS_READWRITE_ZONE | IN_MERGING | IN_OTHER_REGION), // 724 - - ROUTE_TYPE_PARTITION_READONLY_UNMERGE_LOCAL = (UNKNOWN_ROLE | WITH_PARTITION_TYPE | IS_READONLY_ZONE | IN_UNMERGING | IN_SAME_IDC), // 784 - ROUTE_TYPE_PARTITION_READONLY_UNMERGE_REGION = (UNKNOWN_ROLE | WITH_PARTITION_TYPE | IS_READONLY_ZONE | IN_UNMERGING | IN_SAME_REGION), // 785 - ROUTE_TYPE_PARTITION_READONLY_UNMERGE_REMOTE = (UNKNOWN_ROLE | WITH_PARTITION_TYPE | IS_READONLY_ZONE | IN_UNMERGING | IN_OTHER_REGION), // 786 - ROUTE_TYPE_PARTITION_READONLY_MERGE_LOCAL = (UNKNOWN_ROLE | WITH_PARTITION_TYPE | IS_READONLY_ZONE | IN_MERGING | IN_SAME_IDC), // 788 - ROUTE_TYPE_PARTITION_READONLY_MERGE_REGION = (UNKNOWN_ROLE | WITH_PARTITION_TYPE | IS_READONLY_ZONE | IN_MERGING | IN_SAME_REGION), // 789 - ROUTE_TYPE_PARTITION_READONLY_MERGE_REMOTE = (UNKNOWN_ROLE | WITH_PARTITION_TYPE | IS_READONLY_ZONE | IN_MERGING | IN_OTHER_REGION), // 790 - - ROUTE_TYPE_NONPARTITION_READWRITE_UNMERGE_LOCAL = (UNKNOWN_ROLE | WITHOUT_PARTITION_TYPE | IS_READWRITE_ZONE | IN_UNMERGING | IN_SAME_IDC), // 832 - ROUTE_TYPE_NONPARTITION_READWRITE_UNMERGE_REGION = (UNKNOWN_ROLE | WITHOUT_PARTITION_TYPE | IS_READWRITE_ZONE | IN_UNMERGING | IN_SAME_REGION), // 833 - ROUTE_TYPE_NONPARTITION_READWRITE_UNMERGE_REMOTE = (UNKNOWN_ROLE | WITHOUT_PARTITION_TYPE | IS_READWRITE_ZONE | IN_UNMERGING | IN_OTHER_REGION), // 834 - ROUTE_TYPE_NONPARTITION_READWRITE_MERGE_LOCAL = (UNKNOWN_ROLE | WITHOUT_PARTITION_TYPE | IS_READWRITE_ZONE | IN_MERGING | IN_SAME_IDC), // 836 - ROUTE_TYPE_NONPARTITION_READWRITE_MERGE_REGION = (UNKNOWN_ROLE | WITHOUT_PARTITION_TYPE | IS_READWRITE_ZONE | IN_MERGING | IN_SAME_REGION), // 837 - ROUTE_TYPE_NONPARTITION_READWRITE_MERGE_REMOTE = (UNKNOWN_ROLE | WITHOUT_PARTITION_TYPE | IS_READWRITE_ZONE | IN_MERGING | IN_OTHER_REGION), // 838 - - ROUTE_TYPE_NONPARTITION_READONLY_UNMERGE_LOCAL = (UNKNOWN_ROLE | WITHOUT_PARTITION_TYPE | IS_READONLY_ZONE | IN_UNMERGING | IN_SAME_IDC), // 848 - ROUTE_TYPE_NONPARTITION_READONLY_UNMERGE_REGION = (UNKNOWN_ROLE | WITHOUT_PARTITION_TYPE | IS_READONLY_ZONE | IN_UNMERGING | IN_SAME_REGION), // 849 - ROUTE_TYPE_NONPARTITION_READONLY_UNMERGE_REMOTE = (UNKNOWN_ROLE | WITHOUT_PARTITION_TYPE | IS_READONLY_ZONE | IN_UNMERGING | IN_OTHER_REGION), // 850 - ROUTE_TYPE_NONPARTITION_READONLY_MERGE_LOCAL = (UNKNOWN_ROLE | WITHOUT_PARTITION_TYPE | IS_READONLY_ZONE | IN_MERGING | IN_SAME_IDC), // 852 - ROUTE_TYPE_NONPARTITION_READONLY_MERGE_REGION = (UNKNOWN_ROLE | WITHOUT_PARTITION_TYPE | IS_READONLY_ZONE | IN_MERGING | IN_SAME_REGION), // 853 - ROUTE_TYPE_NONPARTITION_READONLY_MERGE_REMOTE = (UNKNOWN_ROLE | WITHOUT_PARTITION_TYPE | IS_READONLY_ZONE | IN_MERGING | IN_OTHER_REGION), // 854 - - ROUTE_TYPE_PARTITION_UNMERGE_LOCAL = (UNKNOWN_ROLE | WITH_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_UNMERGING | IN_SAME_IDC), // 816 - ROUTE_TYPE_PARTITION_UNMERGE_REGION = (UNKNOWN_ROLE | WITH_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_UNMERGING | IN_SAME_REGION), // 817 - ROUTE_TYPE_PARTITION_UNMERGE_REMOTE = (UNKNOWN_ROLE | WITH_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_UNMERGING | IN_OTHER_REGION), // 818 - ROUTE_TYPE_PARTITION_MERGE_LOCAL = (UNKNOWN_ROLE | WITH_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_MERGING | IN_SAME_IDC), // 820 - ROUTE_TYPE_PARTITION_MERGE_REGION = (UNKNOWN_ROLE | WITH_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_MERGING | IN_SAME_REGION), // 821 - ROUTE_TYPE_PARTITION_MERGE_REMOTE = (UNKNOWN_ROLE | WITH_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_MERGING | IN_OTHER_REGION), // 822 - - ROUTE_TYPE_NONPARTITION_UNMERGE_LOCAL = (UNKNOWN_ROLE | WITHOUT_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_UNMERGING | IN_SAME_IDC), // 880 - ROUTE_TYPE_NONPARTITION_UNMERGE_REGION = (UNKNOWN_ROLE | WITHOUT_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_UNMERGING | IN_SAME_REGION), // 881 - ROUTE_TYPE_NONPARTITION_UNMERGE_REMOTE = (UNKNOWN_ROLE | WITHOUT_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_UNMERGING | IN_OTHER_REGION), // 882 - ROUTE_TYPE_NONPARTITION_MERGE_LOCAL = (UNKNOWN_ROLE | WITHOUT_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_MERGING | IN_SAME_IDC), // 884 - ROUTE_TYPE_NONPARTITION_MERGE_REGION = (UNKNOWN_ROLE | WITHOUT_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_MERGING | IN_SAME_REGION), // 885 - ROUTE_TYPE_NONPARTITION_MERGE_REMOTE = (UNKNOWN_ROLE | WITHOUT_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_MERGING | IN_OTHER_REGION), // 886 - - ROUTE_TYPE_LEADER = (IS_LEADER | WITH_PARTITION_TYPE | MAX_ZONE_TYPE_VALUE | MAX_MERGE_VALUE | MAX_IDC_VALUE), // 319 - - ROUTE_TYPE_FOLLOWER_PARTITION_UNMERGE_LOCAL = (IS_FOLLOWER | WITH_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_UNMERGING | IN_SAME_IDC), // 48 - ROUTE_TYPE_FOLLOWER_PARTITION_UNMERGE_REGION = (IS_FOLLOWER | WITH_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_UNMERGING | IN_SAME_REGION), // 49 - ROUTE_TYPE_FOLLOWER_PARTITION_UNMERGE_REMOTE = (IS_FOLLOWER | WITH_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_UNMERGING | IN_OTHER_REGION), // 50 - ROUTE_TYPE_FOLLOWER_PARTITION_MERGE_LOCAL = (IS_FOLLOWER | WITH_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_MERGING | IN_SAME_IDC), // 52 - ROUTE_TYPE_FOLLOWER_PARTITION_MERGE_REGION = (IS_FOLLOWER | WITH_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_MERGING | IN_SAME_REGION), // 53 - ROUTE_TYPE_FOLLOWER_PARTITION_MERGE_REMOTE = (IS_FOLLOWER | WITH_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_MERGING | IN_OTHER_REGION), // 54 - - ROUTE_TYPE_LEADER_PARTITION_UNMERGE_LOCAL = (IS_LEADER | WITH_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_UNMERGING | IN_SAME_IDC), // 304 - ROUTE_TYPE_LEADER_PARTITION_UNMERGE_REGION = (IS_LEADER | WITH_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_UNMERGING | IN_SAME_REGION), // 305 - ROUTE_TYPE_LEADER_PARTITION_UNMERGE_REMOTE = (IS_LEADER | WITH_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_UNMERGING | IN_OTHER_REGION), // 306 - ROUTE_TYPE_LEADER_PARTITION_MERGE_LOCAL = (IS_LEADER | WITH_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_MERGING | IN_SAME_IDC), // 308 - ROUTE_TYPE_LEADER_PARTITION_MERGE_REGION = (IS_LEADER | WITH_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_MERGING | IN_SAME_REGION), // 309 - ROUTE_TYPE_LEADER_PARTITION_MERGE_REMOTE = (IS_LEADER | WITH_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_MERGING | IN_OTHER_REGION), // 310 - - ROUTE_TYPE_MAX = (MAX_ROLE_TYPE_VALUE | MAX_PARTITION_TYPE_VALUE | MAX_ZONE_TYPE_VALUE | MAX_MERGE_VALUE | MAX_IDC_VALUE),//1023 + ROUTE_TYPE_PARTITION_READWRITE_UNMERGE_LOCAL = (UNKNOWN_ROLE | WITH_PARTITION_TYPE | IS_READWRITE_ZONE | IN_UNMERGING | IN_SAME_IDC | UNKNOWN_DUP_REPLICA_TYPE), // 768 + ROUTE_TYPE_PARTITION_READWRITE_UNMERGE_REGION = (UNKNOWN_ROLE | WITH_PARTITION_TYPE | IS_READWRITE_ZONE | IN_UNMERGING | IN_SAME_REGION | UNKNOWN_DUP_REPLICA_TYPE), // 769 + ROUTE_TYPE_PARTITION_READWRITE_UNMERGE_REMOTE = (UNKNOWN_ROLE | WITH_PARTITION_TYPE | IS_READWRITE_ZONE | IN_UNMERGING | IN_OTHER_REGION | UNKNOWN_DUP_REPLICA_TYPE), // 770 + ROUTE_TYPE_PARTITION_READWRITE_MERGE_LOCAL = (UNKNOWN_ROLE | WITH_PARTITION_TYPE | IS_READWRITE_ZONE | IN_MERGING | IN_SAME_IDC | UNKNOWN_DUP_REPLICA_TYPE), // 772 + ROUTE_TYPE_PARTITION_READWRITE_MERGE_REGION = (UNKNOWN_ROLE | WITH_PARTITION_TYPE | IS_READWRITE_ZONE | IN_MERGING | IN_SAME_REGION | UNKNOWN_DUP_REPLICA_TYPE), // 723 + ROUTE_TYPE_PARTITION_READWRITE_MERGE_REMOTE = (UNKNOWN_ROLE | WITH_PARTITION_TYPE | IS_READWRITE_ZONE | IN_MERGING | IN_OTHER_REGION | UNKNOWN_DUP_REPLICA_TYPE), // 724 + + ROUTE_TYPE_PARTITION_READONLY_UNMERGE_LOCAL = (UNKNOWN_ROLE | WITH_PARTITION_TYPE | IS_READONLY_ZONE | IN_UNMERGING | IN_SAME_IDC | UNKNOWN_DUP_REPLICA_TYPE), // 784 + ROUTE_TYPE_PARTITION_READONLY_UNMERGE_REGION = (UNKNOWN_ROLE | WITH_PARTITION_TYPE | IS_READONLY_ZONE | IN_UNMERGING | IN_SAME_REGION | UNKNOWN_DUP_REPLICA_TYPE), // 785 + ROUTE_TYPE_PARTITION_READONLY_UNMERGE_REMOTE = (UNKNOWN_ROLE | WITH_PARTITION_TYPE | IS_READONLY_ZONE | IN_UNMERGING | IN_OTHER_REGION | UNKNOWN_DUP_REPLICA_TYPE), // 786 + ROUTE_TYPE_PARTITION_READONLY_MERGE_LOCAL = (UNKNOWN_ROLE | WITH_PARTITION_TYPE | IS_READONLY_ZONE | IN_MERGING | IN_SAME_IDC | UNKNOWN_DUP_REPLICA_TYPE), // 788 + ROUTE_TYPE_PARTITION_READONLY_MERGE_REGION = (UNKNOWN_ROLE | WITH_PARTITION_TYPE | IS_READONLY_ZONE | IN_MERGING | IN_SAME_REGION | UNKNOWN_DUP_REPLICA_TYPE), // 789 + ROUTE_TYPE_PARTITION_READONLY_MERGE_REMOTE = (UNKNOWN_ROLE | WITH_PARTITION_TYPE | IS_READONLY_ZONE | IN_MERGING | IN_OTHER_REGION | UNKNOWN_DUP_REPLICA_TYPE), // 790 + + ROUTE_TYPE_NONPARTITION_READWRITE_UNMERGE_LOCAL = (UNKNOWN_ROLE | WITHOUT_PARTITION_TYPE | IS_READWRITE_ZONE | IN_UNMERGING | IN_SAME_IDC | UNKNOWN_DUP_REPLICA_TYPE), // 832 + ROUTE_TYPE_NONPARTITION_READWRITE_UNMERGE_REGION = (UNKNOWN_ROLE | WITHOUT_PARTITION_TYPE | IS_READWRITE_ZONE | IN_UNMERGING | IN_SAME_REGION | UNKNOWN_DUP_REPLICA_TYPE), // 833 + ROUTE_TYPE_NONPARTITION_READWRITE_UNMERGE_REMOTE = (UNKNOWN_ROLE | WITHOUT_PARTITION_TYPE | IS_READWRITE_ZONE | IN_UNMERGING | IN_OTHER_REGION | UNKNOWN_DUP_REPLICA_TYPE), // 834 + ROUTE_TYPE_NONPARTITION_READWRITE_MERGE_LOCAL = (UNKNOWN_ROLE | WITHOUT_PARTITION_TYPE | IS_READWRITE_ZONE | IN_MERGING | IN_SAME_IDC | UNKNOWN_DUP_REPLICA_TYPE), // 836 + ROUTE_TYPE_NONPARTITION_READWRITE_MERGE_REGION = (UNKNOWN_ROLE | WITHOUT_PARTITION_TYPE | IS_READWRITE_ZONE | IN_MERGING | IN_SAME_REGION | UNKNOWN_DUP_REPLICA_TYPE), // 837 + ROUTE_TYPE_NONPARTITION_READWRITE_MERGE_REMOTE = (UNKNOWN_ROLE | WITHOUT_PARTITION_TYPE | IS_READWRITE_ZONE | IN_MERGING | IN_OTHER_REGION | UNKNOWN_DUP_REPLICA_TYPE), // 838 + + ROUTE_TYPE_NONPARTITION_READONLY_UNMERGE_LOCAL = (UNKNOWN_ROLE | WITHOUT_PARTITION_TYPE | IS_READONLY_ZONE | IN_UNMERGING | IN_SAME_IDC | UNKNOWN_DUP_REPLICA_TYPE), // 848 + ROUTE_TYPE_NONPARTITION_READONLY_UNMERGE_REGION = (UNKNOWN_ROLE | WITHOUT_PARTITION_TYPE | IS_READONLY_ZONE | IN_UNMERGING | IN_SAME_REGION | UNKNOWN_DUP_REPLICA_TYPE), // 849 + ROUTE_TYPE_NONPARTITION_READONLY_UNMERGE_REMOTE = (UNKNOWN_ROLE | WITHOUT_PARTITION_TYPE | IS_READONLY_ZONE | IN_UNMERGING | IN_OTHER_REGION | UNKNOWN_DUP_REPLICA_TYPE), // 850 + ROUTE_TYPE_NONPARTITION_READONLY_MERGE_LOCAL = (UNKNOWN_ROLE | WITHOUT_PARTITION_TYPE | IS_READONLY_ZONE | IN_MERGING | IN_SAME_IDC | UNKNOWN_DUP_REPLICA_TYPE), // 852 + ROUTE_TYPE_NONPARTITION_READONLY_MERGE_REGION = (UNKNOWN_ROLE | WITHOUT_PARTITION_TYPE | IS_READONLY_ZONE | IN_MERGING | IN_SAME_REGION | UNKNOWN_DUP_REPLICA_TYPE), // 853 + ROUTE_TYPE_NONPARTITION_READONLY_MERGE_REMOTE = (UNKNOWN_ROLE | WITHOUT_PARTITION_TYPE | IS_READONLY_ZONE | IN_MERGING | IN_OTHER_REGION | UNKNOWN_DUP_REPLICA_TYPE), // 854 + + ROUTE_TYPE_PARTITION_UNMERGE_LOCAL = (UNKNOWN_ROLE | WITH_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_UNMERGING | IN_SAME_IDC | UNKNOWN_DUP_REPLICA_TYPE), // 816 + ROUTE_TYPE_PARTITION_UNMERGE_REGION = (UNKNOWN_ROLE | WITH_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_UNMERGING | IN_SAME_REGION | UNKNOWN_DUP_REPLICA_TYPE), // 817 + ROUTE_TYPE_PARTITION_UNMERGE_REMOTE = (UNKNOWN_ROLE | WITH_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_UNMERGING | IN_OTHER_REGION | UNKNOWN_DUP_REPLICA_TYPE), // 818 + ROUTE_TYPE_PARTITION_MERGE_LOCAL = (UNKNOWN_ROLE | WITH_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_MERGING | IN_SAME_IDC | UNKNOWN_DUP_REPLICA_TYPE), // 820 + ROUTE_TYPE_PARTITION_MERGE_REGION = (UNKNOWN_ROLE | WITH_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_MERGING | IN_SAME_REGION | UNKNOWN_DUP_REPLICA_TYPE), // 821 + ROUTE_TYPE_PARTITION_MERGE_REMOTE = (UNKNOWN_ROLE | WITH_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_MERGING | IN_OTHER_REGION | UNKNOWN_DUP_REPLICA_TYPE), // 822 + + ROUTE_TYPE_NONPARTITION_UNMERGE_LOCAL = (UNKNOWN_ROLE | WITHOUT_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_UNMERGING | IN_SAME_IDC | UNKNOWN_DUP_REPLICA_TYPE), // 880 + ROUTE_TYPE_NONPARTITION_UNMERGE_REGION = (UNKNOWN_ROLE | WITHOUT_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_UNMERGING | IN_SAME_REGION | UNKNOWN_DUP_REPLICA_TYPE), // 881 + ROUTE_TYPE_NONPARTITION_UNMERGE_REMOTE = (UNKNOWN_ROLE | WITHOUT_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_UNMERGING | IN_OTHER_REGION | UNKNOWN_DUP_REPLICA_TYPE), // 882 + ROUTE_TYPE_NONPARTITION_MERGE_LOCAL = (UNKNOWN_ROLE | WITHOUT_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_MERGING | IN_SAME_IDC | UNKNOWN_DUP_REPLICA_TYPE), // 884 + ROUTE_TYPE_NONPARTITION_MERGE_REGION = (UNKNOWN_ROLE | WITHOUT_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_MERGING | IN_SAME_REGION | UNKNOWN_DUP_REPLICA_TYPE), // 885 + ROUTE_TYPE_NONPARTITION_MERGE_REMOTE = (UNKNOWN_ROLE | WITHOUT_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_MERGING | IN_OTHER_REGION | UNKNOWN_DUP_REPLICA_TYPE), // 886 + + ROUTE_TYPE_LEADER = (IS_LEADER | WITH_PARTITION_TYPE | MAX_ZONE_TYPE_VALUE | MAX_MERGE_VALUE | MAX_IDC_VALUE | MAX_DUP_REPLICA_TYPE_VALUE), // 319 + + ROUTE_TYPE_FOLLOWER_PARTITION_UNMERGE_LOCAL = (IS_FOLLOWER | WITH_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_UNMERGING | IN_SAME_IDC | UNKNOWN_DUP_REPLICA_TYPE), // 48 + ROUTE_TYPE_FOLLOWER_PARTITION_UNMERGE_REGION = (IS_FOLLOWER | WITH_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_UNMERGING | IN_SAME_REGION | UNKNOWN_DUP_REPLICA_TYPE), // 49 + ROUTE_TYPE_FOLLOWER_PARTITION_UNMERGE_REMOTE = (IS_FOLLOWER | WITH_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_UNMERGING | IN_OTHER_REGION | UNKNOWN_DUP_REPLICA_TYPE), // 50 + ROUTE_TYPE_FOLLOWER_PARTITION_MERGE_LOCAL = (IS_FOLLOWER | WITH_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_MERGING | IN_SAME_IDC | UNKNOWN_DUP_REPLICA_TYPE), // 52 + ROUTE_TYPE_FOLLOWER_PARTITION_MERGE_REGION = (IS_FOLLOWER | WITH_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_MERGING | IN_SAME_REGION | UNKNOWN_DUP_REPLICA_TYPE), // 53 + ROUTE_TYPE_FOLLOWER_PARTITION_MERGE_REMOTE = (IS_FOLLOWER | WITH_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_MERGING | IN_OTHER_REGION | UNKNOWN_DUP_REPLICA_TYPE), // 54 + + ROUTE_TYPE_LEADER_PARTITION_UNMERGE_LOCAL = (IS_LEADER | WITH_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_UNMERGING | IN_SAME_IDC | UNKNOWN_DUP_REPLICA_TYPE), // 304 + ROUTE_TYPE_LEADER_PARTITION_UNMERGE_REGION = (IS_LEADER | WITH_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_UNMERGING | IN_SAME_REGION | UNKNOWN_DUP_REPLICA_TYPE), // 305 + ROUTE_TYPE_LEADER_PARTITION_UNMERGE_REMOTE = (IS_LEADER | WITH_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_UNMERGING | IN_OTHER_REGION | UNKNOWN_DUP_REPLICA_TYPE), // 306 + ROUTE_TYPE_LEADER_PARTITION_MERGE_LOCAL = (IS_LEADER | WITH_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_MERGING | IN_SAME_IDC | UNKNOWN_DUP_REPLICA_TYPE), // 308 + ROUTE_TYPE_LEADER_PARTITION_MERGE_REGION = (IS_LEADER | WITH_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_MERGING | IN_SAME_REGION | UNKNOWN_DUP_REPLICA_TYPE), // 309 + ROUTE_TYPE_LEADER_PARTITION_MERGE_REMOTE = (IS_LEADER | WITH_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_MERGING | IN_OTHER_REGION | UNKNOWN_DUP_REPLICA_TYPE), // 310 + + ROUTE_TYPE_DUP_PARTITION_UNMERGE_LOCAL = (IS_DUP_REPLICA | UNKNOWN_ROLE | WITH_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_UNMERGING | IN_SAME_IDC), + ROUTE_TYPE_DUP_PARTITION_UNMERGE_REGION = (IS_DUP_REPLICA | UNKNOWN_ROLE | WITH_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_UNMERGING | IN_SAME_REGION), + ROUTE_TYPE_DUP_PARTITION_MERGE_LOCAL = (IS_DUP_REPLICA | UNKNOWN_ROLE | WITH_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_MERGING | IN_SAME_IDC), + ROUTE_TYPE_DUP_PARTITION_MERGE_REGION = (IS_DUP_REPLICA | UNKNOWN_ROLE | WITH_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_MERGING | IN_SAME_REGION), + ROUTE_TYPE_DUP_PARTITION_UNMERGE_REMOTE = (IS_DUP_REPLICA | UNKNOWN_ROLE | WITH_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_UNMERGING | IN_OTHER_REGION), + ROUTE_TYPE_DUP_PARTITION_MERGE_REMOTE = (IS_DUP_REPLICA | UNKNOWN_ROLE | WITH_PARTITION_TYPE | UNKNOWN_ZONE_TYPE | IN_MERGING | IN_OTHER_REGION), + + ROUTE_TYPE_MAX = (MAX_ROLE_TYPE_VALUE | MAX_PARTITION_TYPE_VALUE | MAX_ZONE_TYPE_VALUE | MAX_MERGE_VALUE | MAX_IDC_VALUE | MAX_DUP_REPLICA_TYPE_VALUE),//1023 }; common::ObString get_route_type_string(const ObRouteType type); @@ -205,6 +218,8 @@ public: * L: leader * F: follower * + * D: dup replica + * * e.g. ANRP=same idc + unmerge + readonly zone + with partiton * BMWT=same region + merging + readwrite zone + without partiton * @@ -287,6 +302,25 @@ enum ObRoutePolicyEnum //CMPF, CMPL; //ANT, BNT, AMT, BMT; //CNT, CMT + + // for strong with dup replica + DUP_REPLICA_FIRST, //ANPD, BNPD, AMPD, BMPD, CNPD, CMPD, + //ANP, BNP, AMP, BMP, + //CNP, CMP + //ANT, BNT, AMT, BMT, + //CNT, CMT + + //for weak read, follower only + FOLLOWER_ONLY, //ANPF, BNPF, AMPF, BMPF; + //ANT, BNT, AMT, BMT; + //CNPF, CMPF; + //CNT, CMT + + FOLLOWER_ONLY_OPTIMIZED, //ANPF, BNPF, AMPF, BMPF; + //CNPF, CMPF; + //ANT, BNT, AMT, BMT; + //CNT, CMT + MAX_ROUTE_POLICY_COUNT, }; common::ObString get_route_policy_enum_string(const ObRoutePolicyEnum policy); @@ -311,6 +345,9 @@ common::ObString get_route_policy_enum_string(const ObRoutePolicyEnum policy) common::ObString::make_string("UNMERGE_FOLLOWER_FIRST"), common::ObString::make_string("FOLLOWER_FIRST_OPTIMIZED"), common::ObString::make_string("UNMERGE_FOLLOWER_FIRST_OPTIMIZED"), + common::ObString::make_string("DUP_REPLICA_FIRST"), + common::ObString::make_string("FOLLOWER_ONLY"), + common::ObString::make_string("FOLLOWER_ONLY_OPTIMIZED"), }; common::ObString string; @@ -479,6 +516,24 @@ common::ObString get_route_type_string(const ObRouteType type) str = "ROUTE_TYPE_LEADER_PARTITION_MERGE_REMOTE"; break; + case ROUTE_TYPE_DUP_PARTITION_UNMERGE_LOCAL: + str = "ROUTE_TYPE_DUP_PARTITION_UNMERGE_LOCAL"; + break; + case ROUTE_TYPE_DUP_PARTITION_UNMERGE_REGION: + str = "ROUTE_TYPE_DUP_PARTITION_UNMERGE_REGION"; + break; + case ROUTE_TYPE_DUP_PARTITION_MERGE_LOCAL: + str = "ROUTE_TYPE_DUP_PARTITION_MERGE_LOCAL"; + break; + case ROUTE_TYPE_DUP_PARTITION_MERGE_REGION: + str = "ROUTE_TYPE_DUP_PARTITION_MERGE_REGION"; + break; + case ROUTE_TYPE_DUP_PARTITION_UNMERGE_REMOTE: + str = "ROUTE_TYPE_DUP_PARTITION_UNMERGE_REMOTE"; + break; + case ROUTE_TYPE_DUP_PARTITION_MERGE_REMOTE: + str = "ROUTE_TYPE_DUP_PARTITION_MERGE_REMOTE"; + break; case ROUTE_TYPE_MAX: str = "ROUTE_TYPE_MAX"; break; @@ -508,6 +563,7 @@ const common::ObString get_idc_type_string(const ObIDCType type) enum ObProxyRoutePolicyEnum { FOLLOWER_FIRST_ENUM = 0, UNMERGE_FOLLOWER_FIRST_ENUM, + FOLLOWER_ONLY_ENUM, MAX_PROXY_ROUTE_POLICY, }; @@ -517,7 +573,7 @@ ObProxyRoutePolicyEnum get_proxy_route_policy(const common::ObString &value); bool is_valid_proxy_route_policy(const ObProxyRoutePolicyEnum policy) { - return MAX_PROXY_ROUTE_POLICY != policy; + return policy >= FOLLOWER_FIRST_ENUM && policy < MAX_PROXY_ROUTE_POLICY; } const common::ObString get_proxy_route_policy_enum_string(const ObProxyRoutePolicyEnum policy) @@ -527,6 +583,7 @@ const common::ObString get_proxy_route_policy_enum_string(const ObProxyRoutePoli { common::ObString::make_string("FOLLOWER_FIRST"), common::ObString::make_string("UNMERGE_FOLLOWER_FIRST"), + common::ObString::make_string("FOLLOWER_ONLY"), }; if (OB_LIKELY(policy >= FOLLOWER_FIRST_ENUM) diff --git a/src/obproxy/proxy/route/ob_mysql_route.cpp b/src/obproxy/proxy/route/ob_mysql_route.cpp index f6cb9e4..11873a2 100644 --- a/src/obproxy/proxy/route/ob_mysql_route.cpp +++ b/src/obproxy/proxy/route/ob_mysql_route.cpp @@ -319,8 +319,10 @@ inline void ObMysqlRoute::setup_route_sql_parse() ObProxyParseResult obproxy_parse_result; int tmp_ret = OB_SUCCESS; const common::ObString &parse_sql = ObProxyMysqlRequest::get_parse_sql(routine_entry_->get_route_sql()); + // Because it is a sys tenant, the default UTF8 character set can be used if (OB_SUCCESS != (tmp_ret = obproxy_parser.parse(parse_sql, - obproxy_parse_result))) { + obproxy_parse_result, + CS_TYPE_UTF8MB4_GENERAL_CI))) { LOG_INFO("fail to parse sql, will go on anyway", K(parse_sql), K(tmp_ret)); } else if (OB_SUCCESS != (tmp_ret = route_sql_result_.load_result(obproxy_parse_result, param_.use_lower_case_name_))) { @@ -769,6 +771,11 @@ inline void ObMysqlRoute::notify_caller() param_.result_.part_entry_ = NULL; } + if (NULL != table_entry_ && NULL != part_entry_) { + param_.result_.has_dup_replica_ = part_entry_->has_dup_replica(); + } else if (NULL != table_entry_) { + param_.result_.has_dup_replica_ = table_entry_->has_dup_replica(); + } param_.result_.table_entry_ = table_entry_; table_entry_ = NULL; param_.result_.is_table_entry_from_remote_ = is_table_entry_from_remote_; diff --git a/src/obproxy/proxy/route/ob_mysql_route.h b/src/obproxy/proxy/route/ob_mysql_route.h index 13924c0..59cfc0d 100644 --- a/src/obproxy/proxy/route/ob_mysql_route.h +++ b/src/obproxy/proxy/route/ob_mysql_route.h @@ -42,7 +42,8 @@ public: ObMysqlRouteResult() : table_entry_(NULL), part_entry_(NULL), is_table_entry_from_remote_(false), - is_partition_entry_from_remote_(false) {} + is_partition_entry_from_remote_(false), + has_dup_replica_(false) {} ~ObMysqlRouteResult() {} void reset(); void ref_reset(); @@ -52,6 +53,7 @@ public: bool is_table_entry_from_remote_; bool is_partition_entry_from_remote_; + bool has_dup_replica_; private: DISALLOW_COPY_AND_ASSIGN(ObMysqlRouteResult); }; @@ -62,6 +64,7 @@ inline void ObMysqlRouteResult::reset() part_entry_ = NULL; is_table_entry_from_remote_ = false; is_partition_entry_from_remote_ = false; + has_dup_replica_ = false; } inline void ObMysqlRouteResult::ref_reset() @@ -76,6 +79,7 @@ inline void ObMysqlRouteResult::ref_reset() } is_table_entry_from_remote_ = false; is_partition_entry_from_remote_ = false; + has_dup_replica_ = false; } class ObRouteParam diff --git a/src/obproxy/proxy/route/ob_partition_entry.cpp b/src/obproxy/proxy/route/ob_partition_entry.cpp index abb1fcd..644170b 100644 --- a/src/obproxy/proxy/route/ob_partition_entry.cpp +++ b/src/obproxy/proxy/route/ob_partition_entry.cpp @@ -113,6 +113,7 @@ int64_t ObPartitionEntry::to_string(char *buf, const int64_t buf_len) const J_COMMA(); J_KV(KP(this), K_(pl), + K_(has_dup_replica), K_(table_id), K_(partition_id)); J_OBJ_END(); diff --git a/src/obproxy/proxy/route/ob_partition_entry.h b/src/obproxy/proxy/route/ob_partition_entry.h index 1b43857..2e90b43 100644 --- a/src/obproxy/proxy/route/ob_partition_entry.h +++ b/src/obproxy/proxy/route/ob_partition_entry.h @@ -99,7 +99,8 @@ class ObPartitionEntry : public ObRouteEntry { public: ObPartitionEntry() - : ObRouteEntry(), table_id_(common::OB_INVALID_ID), + : ObRouteEntry(), has_dup_replica_(false), + table_id_(common::OB_INVALID_ID), partition_id_(common::OB_INVALID_ID), pl_() { } @@ -122,6 +123,8 @@ public: void set_table_id(const uint64_t table_id) { table_id_ = table_id; } void set_partition_id(const uint64_t partition_id) { partition_id_ = partition_id; } int set_pl(const common::ObIArray &replicas) { return pl_.set_replicas(replicas); } + bool has_dup_replica() const { return has_dup_replica_; } + void set_has_dup_replica() { has_dup_replica_ = true; } ObPartitionEntryKey get_key() const; uint64_t get_partition_id() const { return partition_id_; } @@ -139,6 +142,7 @@ public: int64_t to_string(char *buf, const int64_t buf_len) const; private: + bool has_dup_replica_; uint64_t table_id_; uint64_t partition_id_; ObProxyPartitionLocation pl_; diff --git a/src/obproxy/proxy/route/ob_route_struct.cpp b/src/obproxy/proxy/route/ob_route_struct.cpp index 654c626..dcb2068 100644 --- a/src/obproxy/proxy/route/ob_route_struct.cpp +++ b/src/obproxy/proxy/route/ob_route_struct.cpp @@ -85,6 +85,7 @@ int64_t ObProxyReplicaLocation::to_string(char *buf, const int64_t buf_len) cons int64_t pos = 0; J_OBJ_START(); J_KV(K_(server), + K_(is_dup_replica), "role", get_role_type_string(role_), "type", get_replica_type_string(replica_type_)); J_OBJ_END(); diff --git a/src/obproxy/proxy/route/ob_route_struct.h b/src/obproxy/proxy/route/ob_route_struct.h index e5f4034..4d30f20 100644 --- a/src/obproxy/proxy/route/ob_route_struct.h +++ b/src/obproxy/proxy/route/ob_route_struct.h @@ -79,9 +79,9 @@ do { \ struct ObProxyReplicaLocation { public: - ObProxyReplicaLocation() : server_(), role_(common::FOLLOWER), replica_type_(common::REPLICA_TYPE_FULL) {} + ObProxyReplicaLocation() : is_dup_replica_(false), server_(), role_(common::FOLLOWER), replica_type_(common::REPLICA_TYPE_FULL) {} ObProxyReplicaLocation(const common::ObAddr &server, const common::ObRole role, const common::ObReplicaType replica_type) - : server_(server), role_(role), replica_type_(replica_type) {} + : is_dup_replica_(false), server_(server), role_(role), replica_type_(replica_type) {} ~ObProxyReplicaLocation() { reset(); } void reset(); @@ -97,6 +97,8 @@ public: static common::ObString get_role_type_string(const common::ObRole role); static common::ObString get_replica_type_string(const common::ObReplicaType type); bool is_full_replica() const { return common::REPLICA_TYPE_FULL == replica_type_; } + void set_dup_replica_type(const int32_t dup_replica_type); + bool is_dup_replica() const { return is_dup_replica_; } bool is_weak_read_avail() const { return common::REPLICA_TYPE_FULL == replica_type_ @@ -104,6 +106,7 @@ public: } bool is_readonly_replica() const { return common::REPLICA_TYPE_READONLY == replica_type_; } + bool is_dup_replica_; common::ObAddr server_; common::ObRole role_; common::ObReplicaType replica_type_; @@ -247,8 +250,18 @@ inline int ObProxyReplicaLocation::set_replica_type(const int32_t replica_type) return ret; } +inline void ObProxyReplicaLocation::set_dup_replica_type(const int32_t dup_replica_type) +{ + if (dup_replica_type > 0) { + is_dup_replica_ = true; + } else { + is_dup_replica_ = false; + } +} + inline void ObProxyReplicaLocation::reset() { + is_dup_replica_ = false; server_.reset(); role_ = common::FOLLOWER; replica_type_ = common::REPLICA_TYPE_FULL; @@ -265,7 +278,8 @@ inline bool ObProxyReplicaLocation::operator==(const ObProxyReplicaLocation &oth { return (server_ == other.server_) && (role_ == other.role_) - && (replica_type_ == other.replica_type_); + && (replica_type_ == other.replica_type_) + && (is_dup_replica_ == other.is_dup_replica_); } inline bool ObProxyReplicaLocation::operator!=(const ObProxyReplicaLocation &other) const diff --git a/src/obproxy/proxy/route/ob_route_utils.cpp b/src/obproxy/proxy/route/ob_route_utils.cpp index 6d60aaf..7ddc755 100644 --- a/src/obproxy/proxy/route/ob_route_utils.cpp +++ b/src/obproxy/proxy/route/ob_route_utils.cpp @@ -69,7 +69,7 @@ static const char *PROXY_PART_INFO_SQL = "part_key_num, part_key_name, part_key_type, part_key_idx, part_key_level, part_key_extra, " "spare1, spare2, spare4 " "FROM oceanbase.%s " - "WHERE table_id = %lu LIMIT %d;"; + "WHERE table_id = %lu order by part_key_idx LIMIT %d;"; static const char *PROXY_FIRST_PART_SQL = "SELECT /*+READ_CONSISTENCY(WEAK)*/ part_id, part_name, high_bound_val_bin, sub_part_num " @@ -106,6 +106,26 @@ static const char *PROXY_ROUTINE_SCHEMA_SQL_WITH_PACKAGE = "AND partition_id = 0 AND svr_ip = '' AND sql_port = 0 " "ORDER BY table_id ASC LIMIT 1;"; +static void get_tenant_name(const ObString &origin_tenant_name, char *new_tenant_name_buf, ObString &new_tenant_name) { + new_tenant_name = origin_tenant_name; + int32_t pos = 0; + for (int64_t i = 0; i < origin_tenant_name.length(); i++) { + if (origin_tenant_name[i] == '\'') { + new_tenant_name_buf[pos++] = '\''; + new_tenant_name_buf[pos++] = '\''; + } else if (origin_tenant_name[i] == '\\') { + new_tenant_name_buf[pos++] = '\\'; + new_tenant_name_buf[pos++] = '\\'; + } else { + new_tenant_name_buf[pos++] = origin_tenant_name[i]; + } + } + + if (pos != origin_tenant_name.length()) { + new_tenant_name.assign_ptr(new_tenant_name_buf, pos); + } +} + int ObRouteUtils::get_table_entry_sql(char *sql_buf, const int64_t buf_len, ObTableEntryName &name, bool is_need_force_flush /*false*/) @@ -116,10 +136,13 @@ int ObRouteUtils::get_table_entry_sql(char *sql_buf, const int64_t buf_len, LOG_WARN("invalid input value", LITERAL_K(sql_buf), K(buf_len), K(name), K(ret)); } else { int64_t len = 0; + char new_tenant_name_buf[OB_MAX_TENANT_NAME_LENGTH * 2 + 1]; + ObString new_tenant_name; + get_tenant_name(name.tenant_name_, new_tenant_name_buf, new_tenant_name); if (name.is_all_dummy_table()) { len = static_cast(snprintf(sql_buf, buf_len, PROXY_TENANT_SCHEMA_SQL, OB_ALL_VIRTUAL_PROXY_SCHEMA_TNAME, - name.tenant_name_.length(), name.tenant_name_.ptr(), + new_tenant_name.length(), new_tenant_name.ptr(), name.database_name_.length(), name.database_name_.ptr(), name.table_name_.length(), name.table_name_.ptr(), INT64_MAX)); @@ -128,7 +151,7 @@ int ObRouteUtils::get_table_entry_sql(char *sql_buf, const int64_t buf_len, len = static_cast(snprintf(sql_buf, buf_len, PROXY_PLAIN_SCHEMA_SQL, is_need_force_flush ? ", FORCE_REFRESH_LOCATION_CACHE" : "", OB_ALL_VIRTUAL_PROXY_SCHEMA_TNAME, - name.tenant_name_.length(), name.tenant_name_.ptr(), + new_tenant_name.length(), new_tenant_name.ptr(), name.database_name_.length(), name.database_name_.ptr(), name.table_name_.length(), name.table_name_.ptr(), FIRST_PARTITION_ID, INT64_MAX)); @@ -248,6 +271,7 @@ int ObRouteUtils::fetch_table_entry(ObResultSetFetcher &rs_fetcher, int64_t schema_version = 0; int64_t role = -1; int32_t replica_type = -1; + int32_t dup_replica_type = 0; int32_t table_type = -1; ObProxyReplicaLocation prl; ObProxyPartitionLocation *ppl = NULL; @@ -255,6 +279,7 @@ int ObRouteUtils::fetch_table_entry(ObResultSetFetcher &rs_fetcher, ObSEArray server_list; const bool is_dummy_entry = entry.is_dummy_entry(); bool use_fake_addrs = false; + bool has_dup_replica = true; while ((OB_SUCC(ret)) && (OB_SUCC(rs_fetcher.next()))) { ip_str[0] = '\0'; @@ -289,6 +314,15 @@ int ObRouteUtils::fetch_table_entry(ObResultSetFetcher &rs_fetcher, } } + if (OB_SUCC(ret)) { + PROXY_EXTRACT_INT_FIELD_MYSQL(rs_fetcher, "spare2", dup_replica_type, int32_t); + if (OB_ERR_COLUMN_NOT_FOUND == ret) { + LOG_DEBUG("can not find spare2, maybe is old server, ignore", K(dup_replica_type), K(ret)); + ret = OB_SUCCESS; + dup_replica_type = 0; + } + } + if (OB_SUCC(ret)) { PROXY_EXTRACT_INT_FIELD_MYSQL(rs_fetcher, "table_type", table_type, int32_t); if (OB_ERR_COLUMN_NOT_FOUND == ret) { @@ -316,8 +350,14 @@ int ObRouteUtils::fetch_table_entry(ObResultSetFetcher &rs_fetcher, LOG_WARN("invalid replica_type in fetching table entry, just skip it," " do not return err", "replica_type", replica_type); ret = OB_SUCCESS; + } else if (FALSE_IT(prl.set_dup_replica_type(dup_replica_type))) { + // can not happen } else if (OB_FAIL(server_list.push_back(prl))) { LOG_WARN("fail to add server", K(prl), K(ret)); + } else { + if (prl.is_dup_replica() && !has_dup_replica) { + has_dup_replica = true; + } }//end of else }//end of OB_SUCC(ret) } @@ -370,6 +410,9 @@ int ObRouteUtils::fetch_table_entry(ObResultSetFetcher &rs_fetcher, entry.set_schema_version(schema_version); entry.set_table_id(table_id); entry.set_table_type(table_type); + if (has_dup_replica) { + entry.set_has_dup_replica(); + } if (entry.is_non_partition_table() && ppl->is_valid()) { if (OB_FAIL(entry.set_first_partition_location(ppl))) { LOG_WARN("fail to set first partition location", K(ret)); @@ -698,6 +741,7 @@ int ObRouteUtils::fetch_first_part(ObResultSetFetcher &rs_fetcher, ObProxyPartIn part_info.get_first_part_option().part_func_type_, part_info.get_first_part_option().part_num_, part_info.is_template_table(), + part_info.get_part_key_info(), rs_fetcher))) { LOG_WARN("fail to build range part", K(ret)); } @@ -706,6 +750,7 @@ int ObRouteUtils::fetch_first_part(ObResultSetFetcher &rs_fetcher, ObProxyPartIn part_info.get_first_part_option().part_func_type_, part_info.get_first_part_option().part_num_, part_info.is_template_table(), + part_info.get_part_key_info(), rs_fetcher))) { LOG_WARN("fail to build list part", K(ret)); } @@ -747,11 +792,13 @@ int ObRouteUtils::fetch_sub_part(ObResultSetFetcher &rs_fetcher, ObProxyPartInfo part_info.get_sub_part_option().part_func_type_, part_info.get_sub_part_option().part_num_, part_info.is_template_table(), + part_info.get_part_key_info(), rs_fetcher))) { LOG_WARN("fail to build range part", K(ret)); } } else { if (OB_FAIL(part_info.get_part_mgr().build_sub_range_part_with_non_template(part_info.get_sub_part_option().part_func_type_, + part_info.get_part_key_info(), rs_fetcher))) { LOG_WARN("fail to build range part", K(ret)); } @@ -762,11 +809,13 @@ int ObRouteUtils::fetch_sub_part(ObResultSetFetcher &rs_fetcher, ObProxyPartInfo part_info.get_sub_part_option().part_func_type_, part_info.get_sub_part_option().part_num_, part_info.is_template_table(), + part_info.get_part_key_info(), rs_fetcher))) { LOG_WARN("fail to build list part", K(ret)); } } else { if (OB_FAIL(part_info.get_part_mgr().build_sub_list_part_with_non_template(part_info.get_sub_part_option().part_func_type_, + part_info.get_part_key_info(), rs_fetcher))) { LOG_WARN("fail to build range part", K(ret)); } @@ -1017,10 +1066,13 @@ int ObRouteUtils::get_partition_entry_sql(char *sql_buf, const int64_t buf_len, K(name), K(partition_id), K(ret)); } else { int64_t len = 0; + char new_tenant_name_buf[OB_MAX_TENANT_NAME_LENGTH * 2 + 1]; + ObString new_tenant_name; + get_tenant_name(name.tenant_name_, new_tenant_name_buf, new_tenant_name); len = static_cast(snprintf(sql_buf, OB_SHORT_SQL_LENGTH, PROXY_PLAIN_SCHEMA_SQL, is_need_force_flush ? ", FORCE_REFRESH_LOCATION_CACHE" : "", OB_ALL_VIRTUAL_PROXY_SCHEMA_TNAME, - name.tenant_name_.length(), name.tenant_name_.ptr(), + new_tenant_name.length(), new_tenant_name.ptr(), name.database_name_.length(), name.database_name_.ptr(), name.table_name_.length(), name.table_name_.ptr(), partition_id, INT64_MAX)); @@ -1050,10 +1102,12 @@ int ObRouteUtils::fetch_one_partition_entry_info( int64_t schema_version = 0; int64_t role = -1; int32_t replica_type = -1; + int32_t dup_replica_type = 0; // 0 for non dup replica; 1 for dup replica; -1 for invalid dup replica type ObAddr leader_addr; ObPartitionEntry *part_entry = NULL; ObProxyReplicaLocation prl; ObSEArray replicas; + bool has_dup_replica = false; while ((OB_SUCC(ret)) && (OB_SUCC(rs_fetcher.next()))) { ip_str[0] = '\0'; @@ -1084,6 +1138,15 @@ int ObRouteUtils::fetch_one_partition_entry_info( } } + if (OB_SUCC(ret)) { + PROXY_EXTRACT_INT_FIELD_MYSQL(rs_fetcher, "spare2", dup_replica_type, int32_t); + if (OB_ERR_COLUMN_NOT_FOUND == ret) { + LOG_DEBUG("can not find spare2, maybe is old server, ignore", K(dup_replica_type), K(ret)); + ret = OB_SUCCESS; + dup_replica_type = 0; + } + } + if (OB_SUCC(ret)) { prl.reset(); prl.role_ = static_cast(role); @@ -1099,8 +1162,14 @@ int ObRouteUtils::fetch_one_partition_entry_info( LOG_INFO("invalid replica_type in fetching table entry, just skip it," " do not return err", "replica_type", replica_type); ret = OB_SUCCESS; + } else if (FALSE_IT(prl.set_dup_replica_type(dup_replica_type))) { + // can not happen } else if (OB_FAIL(replicas.push_back(prl))) { LOG_WARN("fail to add replica location", K(replicas), K(prl), K(ret)); + } else { + if (prl.is_dup_replica() && !has_dup_replica) { + has_dup_replica = true; + } } } } @@ -1133,6 +1202,9 @@ int ObRouteUtils::fetch_one_partition_entry_info( LOG_WARN("fail to alloc and init partition entry", K(ret)); } else { part_entry->set_schema_version(schema_version); // do not forget + if (has_dup_replica) { + part_entry->set_has_dup_replica(); + } entry = part_entry; // hand over the ref count part_entry = NULL; } @@ -1153,11 +1225,14 @@ int ObRouteUtils::get_routine_entry_sql(char *sql_buf, const int64_t buf_len, K(name), K(ret)); } else { int64_t len = 0; + char new_tenant_name_buf[OB_MAX_TENANT_NAME_LENGTH * 2 + 1]; + ObString new_tenant_name; + get_tenant_name(name.tenant_name_, new_tenant_name_buf, new_tenant_name); // call A.B or call A.B.C if (OB_UNLIKELY(!name.package_name_.empty())) { len = static_cast(snprintf(sql_buf, OB_SHORT_SQL_LENGTH, PROXY_ROUTINE_SCHEMA_SQL_WITH_PACKAGE, OB_ALL_VIRTUAL_PROXY_SCHEMA_TNAME, - name.tenant_name_.length(), name.tenant_name_.ptr(), + new_tenant_name.length(), new_tenant_name.ptr(), name.database_name_.length(), name.database_name_.ptr(), name.package_name_.length(), name.package_name_.ptr(), name.package_name_.length(), name.package_name_.ptr(), @@ -1165,7 +1240,7 @@ int ObRouteUtils::get_routine_entry_sql(char *sql_buf, const int64_t buf_len, } else { len = static_cast(snprintf(sql_buf, OB_SHORT_SQL_LENGTH, PROXY_ROUTINE_SCHEMA_SQL, OB_ALL_VIRTUAL_PROXY_SCHEMA_TNAME, - name.tenant_name_.length(), name.tenant_name_.ptr(), + name.table_name_.length(), name.table_name_.ptr(), name.database_name_.length(), name.database_name_.ptr(), name.table_name_.length(), name.table_name_.ptr())); } diff --git a/src/obproxy/proxy/route/ob_routine_cache.cpp b/src/obproxy/proxy/route/ob_routine_cache.cpp index 2601894..4fc2d82 100644 --- a/src/obproxy/proxy/route/ob_routine_cache.cpp +++ b/src/obproxy/proxy/route/ob_routine_cache.cpp @@ -240,6 +240,41 @@ int ObRoutineCacheCont::add_building_routine_entry(ObRoutineCache &routine_cache } //---------------------------ObRoutineCacheParam-------------------------// +int ObRoutineCacheParam::deep_copy_key(const ObRoutineEntryKey &other) +{ + int ret = OB_SUCCESS; + + if (NULL != name_buf_ && name_buf_len_ > 0) { + op_fixed_mem_free(name_buf_, name_buf_len_); + name_buf_ = NULL; + name_buf_len_ = 0; + } + + const int64_t name_size = other.name_->get_total_str_len(); + const int64_t obj_size = sizeof(ObTableEntryName); + name_buf_len_ = name_size + obj_size; + name_buf_ = static_cast(op_fixed_mem_alloc(name_buf_len_)); + if (OB_ISNULL(name_buf_)) { + ret = OB_ALLOCATE_MEMORY_FAILED; + LOG_WARN("fail to alloc mem", K_(name_buf_len), K(ret)); + } else { + ObTableEntryName *name = new (name_buf_) ObTableEntryName(); + if (OB_FAIL(name->deep_copy(*other.name_, name_buf_ + obj_size, name_size))) { + LOG_WARN("fail to deep copy table entry name", K(ret)); + } else { + key_ = other; + key_.name_ = name; + } + } + + if (OB_FAIL(ret) && (NULL != name_buf_)) { + op_fixed_mem_free(name_buf_, name_buf_len_); + name_buf_ = NULL; + name_buf_len_ = 0; + } + return ret; +} + const char *ObRoutineCacheParam::get_op_name(const Op op) { const char *name = NULL; @@ -432,6 +467,7 @@ int ObRoutineCache::add_routine_entry(ObRoutineEntry &entry, bool direct_add) } else { param->op_ = ObRoutineCacheParam::ADD_ROUTINE_OP; param->hash_ = hash; + // No deep copy is needed, because the key here is obtained from the entry param->key_ = key; entry.inc_ref(); param->entry_ = &entry; @@ -476,7 +512,7 @@ int ObRoutineCache::remove_routine_entry(const ObRoutineEntryKey &key) } else { param->op_ = ObRoutineCacheParam::REMOVE_ROUTINE_OP; param->hash_ = hash; - param->key_ = key; + param->deep_copy_key(key); param->entry_ = NULL; todo_lists_[part_num(hash)].push(param); } diff --git a/src/obproxy/proxy/route/ob_routine_cache.h b/src/obproxy/proxy/route/ob_routine_cache.h index 8896eee..1e15471 100644 --- a/src/obproxy/proxy/route/ob_routine_cache.h +++ b/src/obproxy/proxy/route/ob_routine_cache.h @@ -36,19 +36,38 @@ public: REMOVE_ROUTINE_OP, }; - ObRoutineCacheParam() : hash_(0), key_(), op_(INVALID_ROUTINE_OP), entry_(NULL) {} - ~ObRoutineCacheParam() {} + ObRoutineCacheParam() : hash_(0), key_(), op_(INVALID_ROUTINE_OP), entry_(NULL), + name_buf_len_(0), name_buf_(NULL) {} + ~ObRoutineCacheParam() { reset(); } int64_t to_string(char *buf, const int64_t buf_len) const; static const char *get_op_name(const Op op); + void reset(); + int deep_copy_key(const ObRoutineEntryKey &key); static const int64_t SCHEDULE_ROUTINE_CACHE_CONT_INTERVAL = HRTIME_MSECONDS(1); uint64_t hash_; ObRoutineEntryKey key_; Op op_; ObRoutineEntry *entry_; + int64_t name_buf_len_; + char *name_buf_; SLINK(ObRoutineCacheParam, link_); }; +inline void ObRoutineCacheParam::reset() +{ + hash_ = 0; + key_.reset(); + op_ = INVALID_ROUTINE_OP; + entry_ = NULL; + + if (NULL != name_buf_ && name_buf_len_ > 0) { + op_fixed_mem_free(name_buf_, name_buf_len_); + name_buf_ = NULL; + name_buf_len_ = 0; + } +} + // ObRoutineCache, ObPartitionCache and ObTableCache have the same sub partitions, // that is MT_HASHTABLE_PARTITIONS(64); class ObRoutineCache : public RoutineEntryHashMap diff --git a/src/obproxy/proxy/route/ob_server_route.cpp b/src/obproxy/proxy/route/ob_server_route.cpp index 849fbac..75e215c 100644 --- a/src/obproxy/proxy/route/ob_server_route.cpp +++ b/src/obproxy/proxy/route/ob_server_route.cpp @@ -33,6 +33,7 @@ int64_t ObServerRoute::to_string(char *buf, const int64_t buf_len) const K_(ldc_route), K_(is_table_entry_from_remote), K_(is_part_entry_from_remote), + K_(need_use_dup_replica), KP_(table_entry), KP_(part_entry), KP_(dummy_entry)); diff --git a/src/obproxy/proxy/route/ob_server_route.h b/src/obproxy/proxy/route/ob_server_route.h index 110ddee..32c9638 100644 --- a/src/obproxy/proxy/route/ob_server_route.h +++ b/src/obproxy/proxy/route/ob_server_route.h @@ -33,6 +33,7 @@ public: ObServerRoute() : table_entry_(NULL), dummy_entry_(NULL), part_entry_(NULL), cur_chosen_pl_(NULL), is_table_entry_from_remote_(false), is_part_entry_from_remote_(false), + has_dup_replica_(false), need_use_dup_replica_(false), consistency_level_(common::INVALID_CONSISTENCY), leader_item_(), ldc_route_(), valid_count_(0), cur_chosen_server_(), cur_chosen_route_type_(ROUTE_TYPE_MAX) {} @@ -117,6 +118,8 @@ public: const ObProxyPartitionLocation *cur_chosen_pl_; bool is_table_entry_from_remote_; bool is_part_entry_from_remote_; + bool has_dup_replica_; + bool need_use_dup_replica_; common::ObConsistencyLevel consistency_level_; ObLDCItem leader_item_; @@ -132,6 +135,8 @@ inline void ObServerRoute::reset() { is_table_entry_from_remote_ = false; is_part_entry_from_remote_ = false; + has_dup_replica_ = false; + need_use_dup_replica_ = false; set_dummy_entry(NULL); set_table_entry(NULL); set_part_entry(NULL); @@ -186,11 +191,12 @@ inline int ObServerRoute::fill_strong_read_replica(const ObProxyPartitionLocatio if (OB_FAIL(ObLDCLocation::fill_strong_read_location(pl, dummy_ldc, leader_item_, ldc_route_.location_, entry_need_update, is_only_readwrite_zone, + need_use_dup_replica_, ss_info, region_names, proxy_primary_zone_name))) { PROXY_LOG(WARN, "fail to divide_leader_replica", K(ret)); } else { - valid_count_ = ldc_route_.location_.count() + (leader_item_.is_valid() ? 1 : 0); + valid_count_ = ldc_route_.location_.count() + ((!need_use_dup_replica_ && leader_item_.is_valid()) ? 1 : 0); PROXY_LOG(DEBUG, "succ to fill_strong_read_replica", KPC(this), KPC(pl), K(dummy_ldc)); } if (entry_need_update) { @@ -323,6 +329,12 @@ inline int ObServerRoute::fill_replicas( ldc_route_.next_index_in_site_ = ldc_route_.location_.get_other_region_site_start_index(); break; } + case FOLLOWER_ONLY: { + ldc_route_.policy_ = FOLLOWER_ONLY_OPTIMIZED; + ldc_route_.curr_cursor_index_ = ldc_route_.get_cursor_index(ROUTE_TYPE_FOLLOWER_PARTITION_UNMERGE_REMOTE); + ldc_route_.next_index_in_site_ = ldc_route_.location_.get_other_region_site_start_index(); + break; + } default: //do nothing break; @@ -337,17 +349,24 @@ inline const ObProxyReplicaLocation *ObServerRoute::get_next_avail_replica() { const ObLDCItem *item = NULL; if (is_strong_read()) { - if (NULL != leader_item_.replica_ && !leader_item_.is_used_) { - //1. get leader - item = &leader_item_; - cur_chosen_route_type_ = ROUTE_TYPE_LEADER; - leader_item_.is_used_ = true; - } else { - leader_item_.is_used_ = true; - - //2. get follower + if (need_use_dup_replica_) { + // if need_use_dup_replica, + // leader item has already been added into item_array of ldc_route item = ldc_route_.get_next_item(); cur_chosen_route_type_ = ldc_route_.get_curr_route_type(); + } else { + if (NULL != leader_item_.replica_ && !leader_item_.is_used_) { + //1. get leader + item = &leader_item_; + cur_chosen_route_type_ = ROUTE_TYPE_LEADER; + leader_item_.is_used_ = true; + } else { + leader_item_.is_used_ = true; + + //2. get follower + item = ldc_route_.get_next_item(); + cur_chosen_route_type_ = ldc_route_.get_curr_route_type(); + } } if (NULL != item) { @@ -508,6 +527,7 @@ inline void ObServerRoute::set_route_info(ObMysqlRouteResult &result) is_table_entry_from_remote_ = result.is_table_entry_from_remote_; is_part_entry_from_remote_ = result.is_partition_entry_from_remote_; + has_dup_replica_ = result.has_dup_replica_; } inline void ObServerRoute::set_table_entry(ObTableEntry *entry) diff --git a/src/obproxy/proxy/route/ob_table_cache.h b/src/obproxy/proxy/route/ob_table_cache.h index f2931c4..0482dea 100644 --- a/src/obproxy/proxy/route/ob_table_cache.h +++ b/src/obproxy/proxy/route/ob_table_cache.h @@ -140,6 +140,7 @@ struct ObGetTableEntryKey if (OB_LIKELY(NULL != table_entry)) { key.name_ = &table_entry->get_names(); key.cr_version_ = table_entry->get_cr_version(); + key.cr_id_ = table_entry->get_cr_id(); } return key; } diff --git a/src/obproxy/proxy/route/ob_table_entry.cpp b/src/obproxy/proxy/route/ob_table_entry.cpp index 3032614..42155b3 100644 --- a/src/obproxy/proxy/route/ob_table_entry.cpp +++ b/src/obproxy/proxy/route/ob_table_entry.cpp @@ -248,6 +248,7 @@ int64_t ObTableEntry::to_string(char *buf, const int64_t buf_len) const K_(is_entry_from_rslist), K_(is_empty_entry_allowed), K_(is_need_force_flush), + K_(has_dup_replica), K_(cr_id), K_(name), K_(table_id), diff --git a/src/obproxy/proxy/route/ob_table_entry.h b/src/obproxy/proxy/route/ob_table_entry.h index c51f881..b04cd27 100644 --- a/src/obproxy/proxy/route/ob_table_entry.h +++ b/src/obproxy/proxy/route/ob_table_entry.h @@ -41,7 +41,7 @@ class ObTableEntry : public ObRouteEntry public: ObTableEntry() : ObRouteEntry(), is_inited_(false), is_dummy_entry_(false), is_entry_from_rslist_(false), - is_empty_entry_allowed_(false), is_need_force_flush_(false), table_id_(common::OB_INVALID_ID), + is_empty_entry_allowed_(false), is_need_force_flush_(false), has_dup_replica_(false), table_id_(common::OB_INVALID_ID), table_type_(share::schema::MAX_TABLE_TYPE), part_num_(0), replica_num_(0), name_(), buf_len_(0), buf_start_(NULL), first_pl_(NULL) { @@ -79,6 +79,8 @@ public: void set_allow_empty_entry(const bool is_empty_entry_allowed) { is_empty_entry_allowed_ = is_empty_entry_allowed; } bool is_need_force_flush() const { return is_need_force_flush_; } void set_need_force_flush(const bool is_need_force_flush) { is_need_force_flush_ = is_need_force_flush; } + bool has_dup_replica() const { return has_dup_replica_; } + void set_has_dup_replica() { has_dup_replica_ = true; } bool exist_leader_server() const; const ObProxyReplicaLocation *get_leader_replica() const; @@ -126,6 +128,7 @@ private: bool is_entry_from_rslist_; bool is_empty_entry_allowed_; bool is_need_force_flush_; + bool has_dup_replica_; // schema info, add more later uint64_t table_id_; diff --git a/src/obproxy/proxy/route/obproxy_expr_calculator.cpp b/src/obproxy/proxy/route/obproxy_expr_calculator.cpp index f48d57f..999ed79 100644 --- a/src/obproxy/proxy/route/obproxy_expr_calculator.cpp +++ b/src/obproxy/proxy/route/obproxy_expr_calculator.cpp @@ -20,6 +20,8 @@ #include "proxy/route/obproxy_part_info.h" #include "proxy/mysql/ob_prepare_statement_struct.h" #include "lib/rowid/ob_urowid.h" +#include "obproxy/utils/ob_proxy_utils.h" + using namespace oceanbase::common; using namespace oceanbase::share::schema; @@ -27,6 +29,7 @@ using namespace oceanbase::obmysql; using namespace oceanbase::obproxy::opsql; using namespace oceanbase::obproxy::obutils; using namespace oceanbase::obproxy::proxy; +using namespace oceanbase::obproxy; int ObProxyExprCalculator::calculate_partition_id(common::ObArenaAllocator &allocator, const ObString &req_sql, @@ -68,7 +71,8 @@ int ObProxyExprCalculator::calculate_partition_id(common::ObArenaAllocator &allo } } - if (FAILEDx(do_expr_parse(req_sql, parse_result, part_info, allocator, expr_parse_result))) { + if (FAILEDx(do_expr_parse(req_sql, parse_result, part_info, allocator, expr_parse_result, + static_cast(client_info.get_collation_connection())))) { LOG_INFO("fail to do expr parse", K(print_sql), K(part_info), "expr_parse_result", ObExprParseResultPrintWrapper(expr_parse_result)); } else if (OB_FAIL(do_expr_resolve(expr_parse_result, client_request, &client_info, ps_entry, @@ -81,7 +85,20 @@ int ObProxyExprCalculator::calculate_partition_id(common::ObArenaAllocator &allo LOG_INFO("fail to do expr resolve", K(print_sql), K(resolve_result), K(part_info)); } } else { - // do nothing here + // do nothing here + } + + if (OB_FAIL(ret)) { + int64_t tmp_first_part_id = OB_INVALID_INDEX; + int64_t tmp_sub_part_id = OB_INVALID_INDEX; + if (OB_FAIL(calc_part_id_by_random_choose_from_exist(part_info, + tmp_first_part_id, + tmp_sub_part_id, + partition_id))) { + LOG_WARN("fail to cal part id by random choose", K(tmp_first_part_id), K(tmp_sub_part_id), K(ret)); + } else { + LOG_DEBUG("succ to cal part id by random choose", K(tmp_first_part_id), K(tmp_sub_part_id), K(partition_id)); + } } } @@ -115,7 +132,8 @@ int ObProxyExprCalculator::do_expr_parse(const common::ObString &req_sql, const ObSqlParseResult &parse_result, ObProxyPartInfo &part_info, ObIAllocator &allocator, - ObExprParseResult &expr_result) + ObExprParseResult &expr_result, + ObCollationType connection_collation) { int ret = OB_SUCCESS; @@ -160,7 +178,8 @@ int ObProxyExprCalculator::do_expr_parse(const common::ObString &req_sql, } else { // do nothing } - if (OB_FAIL(expr_parser.parse_reqsql(req_sql, parse_result.get_parsed_length(), expr_result, parse_result.get_stmt_type()))) { + if (OB_FAIL(expr_parser.parse_reqsql(req_sql, parse_result.get_parsed_length(), expr_result, + parse_result.get_stmt_type(), connection_collation))) { LOG_DEBUG("fail to do expr parse_reqsql", K(req_sql), K(ret)); } return ret; @@ -232,7 +251,7 @@ int ObProxyExprCalculator::do_partition_id_calc(ObExprResolverResult &resolve_re int64_t &partition_id) { int ret = OB_SUCCESS; - ObProxyPartMgr part_mgr = part_info.get_part_mgr(); + ObProxyPartMgr &part_mgr = part_info.get_part_mgr(); int64_t first_part_id = OB_INVALID_INDEX; int64_t sub_part_id = OB_INVALID_INDEX; if (part_info.has_first_part()) { @@ -240,7 +259,7 @@ int ObProxyExprCalculator::do_partition_id_calc(ObExprResolverResult &resolve_re if (OB_FAIL(part_mgr.get_first_part(resolve_result.ranges_[PARTITION_LEVEL_ONE - 1], allocator, part_ids))) { - LOG_DEBUG("fail to get part", K(ret)); + LOG_DEBUG("fail to get first part", K(ret)); } else if (part_ids.count() >= 1) { first_part_id = part_ids[0]; } else { @@ -249,22 +268,32 @@ int ObProxyExprCalculator::do_partition_id_calc(ObExprResolverResult &resolve_re ObSEArray sub_part_ids; if (OB_INVALID_INDEX != first_part_id && part_info.has_sub_part()) { - if (OB_FAIL(part_mgr.get_sub_part(part_info.is_template_table(), - first_part_id, - resolve_result.ranges_[PARTITION_LEVEL_TWO - 1], - allocator, - sub_part_ids))) { - LOG_DEBUG("fail to get sub part", K(ret)); + ObPartDesc *sub_part_desc_ptr = NULL; + if (OB_FAIL(part_mgr.get_sub_part_desc_by_first_part_id(part_info.is_template_table(), + first_part_id, + sub_part_desc_ptr))) { + LOG_WARN("fail to get sub part desc by first", K(ret)); + } else if (OB_FAIL(part_mgr.get_sub_part(resolve_result.ranges_[PARTITION_LEVEL_TWO - 1], + allocator, + sub_part_desc_ptr, + sub_part_ids))) { + LOG_WARN("fail to get sub part", K(ret)); } else if (sub_part_ids.count() >= 1) { sub_part_id = sub_part_ids[0]; + } else { + // nothing. } } if (OB_SUCC(ret)) { partition_id = generate_phy_part_id(first_part_id, sub_part_id, part_info.get_part_level()); - LOG_DEBUG("succ to get partition_id", K(first_part_id), K(sub_part_id), K(partition_id)); + LOG_DEBUG("succ to get part id", K(first_part_id), K(sub_part_id), K(partition_id)); } else { - LOG_DEBUG("fail to get partition_id", K(ret)); + if (OB_FAIL(calc_part_id_by_random_choose_from_exist(part_info, first_part_id, sub_part_id, partition_id))) { + LOG_WARN("fail to get part id at last", K(first_part_id), K(sub_part_id), K(ret)); + } else { + LOG_DEBUG("succ to get part id by random", K(first_part_id), K(sub_part_id), K(partition_id)); + } } } else { ret = OB_INVALID_ARGUMENT; @@ -274,6 +303,65 @@ int ObProxyExprCalculator::do_partition_id_calc(ObExprResolverResult &resolve_re return ret; } +int ObProxyExprCalculator::calc_part_id_by_random_choose_from_exist(ObProxyPartInfo &part_info, + int64_t &first_part_id, + int64_t &sub_part_id, + int64_t &phy_part_id) +{ + int ret = OB_SUCCESS; + + ObProxyPartMgr &part_mgr = part_info.get_part_mgr(); + if (part_info.has_first_part() && OB_INVALID_INDEX == first_part_id) { + int64_t first_part_num = 0; + if (OB_FAIL(part_info.get_part_mgr().get_first_part_num(first_part_num))) { + LOG_WARN("fail to get first part num", K(ret)); + } else { + int64_t rand_num = 0; + if (OB_FAIL(ObRandomNumUtils::get_random_num(0, first_part_num - 1, rand_num))) { + LOG_WARN("fail to get random num in first part", K(first_part_num), K(ret)); + } else { + if (OB_FAIL(part_mgr.get_first_part_id_by_idx(rand_num, first_part_id))) { + LOG_WARN("failed to random get first part id by idx", K(rand_num), K(ret)); + } + } + } + } + + if (OB_SUCC(ret) && part_info.has_sub_part() && OB_INVALID_INDEX == sub_part_id) { + int64_t sub_part_num = 0; + if (OB_FAIL(part_mgr.get_sub_part_num_by_first_part_id(part_info, first_part_id, sub_part_num))) { + LOG_WARN("fail to get sub part num in random schedule", K(ret)); + } else { + int64_t sub_rand_num = 0; + if (OB_FAIL(ObRandomNumUtils::get_random_num(0, sub_part_num - 1, sub_rand_num))) { + LOG_WARN("fail to get random num in sub part", K(sub_part_num), K(ret)); + } else { + ObSEArray part_ids; + ObPartDesc *sub_part_desc_ptr = NULL; + if (OB_FAIL(part_mgr.get_sub_part_desc_by_first_part_id(part_info.is_template_table(), + first_part_id, + sub_part_desc_ptr))) { + LOG_WARN("fail to get sub part desc by first part id", K(first_part_id), K(ret)); + } else if (OB_FAIL(part_mgr.get_sub_part_by_random(sub_rand_num, sub_part_desc_ptr, part_ids))) { + LOG_WARN("fail to get sub part id by random", K(ret)); + } else if (part_ids.count() >= 1) { + sub_part_id = part_ids[0]; + } else { + // nothing. + } + } + } + } + + if (OB_SUCC(ret)) { + phy_part_id = generate_phy_part_id(first_part_id, sub_part_id, part_info.get_part_level()); + } else { + LOG_WARN("fail to cal part id by random choose from exist", K(ret)); + } + + return ret; +} + int ObProxyExprCalculator::calc_partition_id_using_rowid(const ObExprParseResult &parse_result, ObProxyPartInfo &part_info, ObExprResolverResult &resolve_result, diff --git a/src/obproxy/proxy/route/obproxy_expr_calculator.h b/src/obproxy/proxy/route/obproxy_expr_calculator.h index 0825901..6dfb1ae 100644 --- a/src/obproxy/proxy/route/obproxy_expr_calculator.h +++ b/src/obproxy/proxy/route/obproxy_expr_calculator.h @@ -13,6 +13,8 @@ #ifndef OBPROXY_EXPR_CALCULATOR_H #define OBPROXY_EXPR_CALCULATOR_H #include "opsql/expr_parser/ob_expr_parse_result.h" +#include "lib/charset/ob_charset.h" + namespace oceanbase { namespace common @@ -57,7 +59,8 @@ private: const obutils::ObSqlParseResult &parse_result, ObProxyPartInfo &part_info, common::ObIAllocator &allocator, - ObExprParseResult &expr_result); + ObExprParseResult &expr_result, + common::ObCollationType connection_collation); int do_expr_resolve(ObExprParseResult &expr_result, const ObProxyMysqlRequest &client_request, ObClientSessionInfo *client_info, @@ -81,6 +84,10 @@ private: ObProxyPartInfo &part_info, opsql::ObExprResolverResult &resolve_result, common::ObIAllocator &allocator); + int calc_part_id_by_random_choose_from_exist(ObProxyPartInfo &part_info, + int64_t &first_part_id, + int64_t &sub_part_id, + int64_t &phy_part_id); }; } // end of namespace proxy } // end of namespace obproxy diff --git a/src/obproxy/proxy/route/obproxy_part_mgr.cpp b/src/obproxy/proxy/route/obproxy_part_mgr.cpp index 9219209..70150dd 100644 --- a/src/obproxy/proxy/route/obproxy_part_mgr.cpp +++ b/src/obproxy/proxy/route/obproxy_part_mgr.cpp @@ -12,6 +12,7 @@ #define USING_LOG_PREFIX PROXY #include "proxy/route/obproxy_part_mgr.h" +#include "proxy/route/obproxy_part_info.h" #include "share/part/ob_part_desc_hash.h" #include "share/part/ob_part_desc_key.h" #include "share/part/ob_part_desc_range.h" @@ -63,13 +64,25 @@ int ObProxyPartMgr::get_part_with_part_name(const ObString &part_name, return ret; } +int ObProxyPartMgr::get_first_part_id_by_idx(const int64_t idx, int64_t &part_id) +{ + int ret = OB_SUCCESS; + if (idx < 0 || idx >= first_part_num_ || OB_ISNULL(part_pair_array_)) { + ret = OB_INVALID_ARGUMENT; + LOG_WARN("fail to get part id by idx", K(ret), K(idx), K(first_part_num_), K(part_pair_array_)); + } else { + part_id = part_pair_array_[idx].get_part_id(); + } + return ret; +} + int ObProxyPartMgr::get_first_part(ObNewRange &range, ObIAllocator &allocator, ObIArray &part_ids) { int ret = OB_SUCCESS; - if (NULL != first_part_desc_) { + if (OB_NOT_NULL(first_part_desc_)) { ret = first_part_desc_->get_part(range, allocator, part_ids); } else { ret = OB_INVALID_ARGUMENT; @@ -81,28 +94,26 @@ int ObProxyPartMgr::get_first_part(ObNewRange &range, return ret; } -int ObProxyPartMgr::get_sub_part(const bool is_template_table, - const int64_t first_part_id, - ObNewRange &range, - ObIAllocator &allocator, - ObIArray &part_ids) +int ObProxyPartMgr::get_sub_part_desc_by_first_part_id(const bool is_template_table, + const int64_t first_part_id, + ObPartDesc *&sub_part_desc_ptr) { int ret = OB_SUCCESS; - if (NULL != sub_part_desc_) { - ObPartDesc *sub_part_desc = NULL; - + if (OB_LIKELY(is_sub_part_valid())) { + ObPartDesc *sub_part_desc_tmp = NULL; + if (is_template_table) { - sub_part_desc = sub_part_desc_; + sub_part_desc_tmp = sub_part_desc_; } else { const ObPartitionFuncType sub_part_func_type = sub_part_desc_->get_part_func_type(); - for (int i = 0; i < first_part_num_; i++) { + for (int64_t i = 0; i < first_part_num_; ++i) { if (is_range_part(sub_part_func_type)) { ObPartDescRange *desc_range = (((ObPartDescRange*)sub_part_desc_) + i); RangePartition *part_array = desc_range->get_part_array(); // use first sub partition of everty first partition to get firt partition id if (first_part_id == part_array[0].first_part_id_) { - sub_part_desc = desc_range; + sub_part_desc_tmp = desc_range; break; } } else if (is_list_part(sub_part_func_type)) { @@ -110,36 +121,75 @@ int ObProxyPartMgr::get_sub_part(const bool is_template_table, ListPartition *part_array = desc_list->get_part_array(); // use first sub partition of everty first partition to get firt partition id if (first_part_id == part_array[0].first_part_id_) { - sub_part_desc = desc_list; + sub_part_desc_tmp = desc_list; break; } } else if (is_hash_part(sub_part_func_type)) { ObPartDescHash *desc_hash = (((ObPartDescHash*)sub_part_desc_) + i); if (first_part_id == desc_hash->get_first_part_id()) { - sub_part_desc = desc_hash; + sub_part_desc_tmp = desc_hash; break; } } else if (is_key_part(sub_part_func_type)) { ObPartDescKey *desc_key = (((ObPartDescKey*)sub_part_desc_) + i); if (first_part_id == desc_key->get_first_part_id()) { - sub_part_desc = desc_key; + sub_part_desc_tmp = desc_key; break; } + } else { + // nothing. } } } - if (NULL != sub_part_desc) { - if (OB_FAIL(sub_part_desc->get_part(range, allocator, part_ids))) { - LOG_WARN("fail to get part", K(sub_part_desc), K(ret)); - } + + if (OB_NOT_NULL(sub_part_desc_tmp)) { + sub_part_desc_ptr = sub_part_desc_tmp; } else { ret = OB_INVALID_ARGUMENT; - LOG_WARN("fail to get part, no sub_part_desc", K(ret)); + LOG_WARN("fail to get sub part desc ptr", K(ret)); } } else { ret = OB_INVALID_ARGUMENT; - LOG_WARN("fail to get part, no sub_part_desc", K(ret)); + LOG_WARN("fail to get sub part desc by first part id", K(ret)); } + + return ret; +} + +int ObProxyPartMgr::get_sub_part(ObNewRange &range, + ObIAllocator &allocator, + ObPartDesc *sub_part_desc_ptr, + ObIArray &part_ids) +{ + int ret = OB_SUCCESS; + + if (OB_ISNULL(sub_part_desc_ptr)) { + ret = OB_INVALID_ARGUMENT; + LOG_WARN("fail to get sub part, null ptr", K(ret)); + } else { + if (OB_FAIL(sub_part_desc_ptr->get_part(range, allocator, part_ids))) { + LOG_WARN("fail to get sub part", K(sub_part_desc_ptr), K(ret)); + } + } + + return ret; +} + +int ObProxyPartMgr::get_sub_part_by_random(const int64_t rand_num, + ObPartDesc *sub_part_desc_ptr, + ObIArray &part_ids) +{ + int ret = OB_SUCCESS; + + if (OB_ISNULL(sub_part_desc_ptr)) { + ret = OB_INVALID_ARGUMENT; + LOG_WARN("fail to get sub part, null ptr", K(ret)); + } else { + if (OB_FAIL(sub_part_desc_ptr->get_part_by_num(rand_num, part_ids))) { + LOG_WARN("fail to get sub part by random", K(sub_part_desc_ptr), K(ret)); + } + } + return ret; } @@ -422,6 +472,7 @@ int ObProxyPartMgr::build_range_part(const ObPartitionLevel part_level, const ObPartitionFuncType part_func_type, const int64_t part_num, const bool is_template_table, + const ObProxyPartKeyInfo &key_info, ObResultSetFetcher &rs_fetcher) { int ret = OB_SUCCESS; @@ -509,6 +560,14 @@ int ObProxyPartMgr::build_range_part(const ObPartitionLevel part_level, if (OB_SUCC(ret)) { desc_range->set_part_level(part_level); desc_range->set_part_func_type(part_func_type); + for (int k = 0; k < key_info.key_num_; ++k) { + if (static_cast(key_info.part_keys_[k].level_) == part_level) { + if (static_cast(key_info.part_keys_[k].cs_type_ != CS_TYPE_INVALID)) { + desc_range->set_collation_type(static_cast(key_info.part_keys_[k].cs_type_)); + break; + } + } + } if (PARTITION_LEVEL_ONE == part_level) { first_part_desc_ = desc_range; } else if (PARTITION_LEVEL_TWO == part_level) { @@ -522,6 +581,7 @@ int ObProxyPartMgr::build_range_part(const ObPartitionLevel part_level, } int ObProxyPartMgr::build_sub_range_part_with_non_template(const ObPartitionFuncType part_func_type, + const ObProxyPartKeyInfo &key_info, ObResultSetFetcher &rs_fetcher) { int ret = OB_SUCCESS; @@ -578,6 +638,14 @@ int ObProxyPartMgr::build_sub_range_part_with_non_template(const ObPartitionFunc if (OB_SUCC(ret)) { desc_range->set_part_level(PARTITION_LEVEL_TWO); desc_range->set_part_func_type(part_func_type); + for (int k = 0; k < key_info.key_num_; ++k) { + if (static_cast(key_info.part_keys_[k].level_) == PARTITION_LEVEL_TWO) { + if (static_cast(key_info.part_keys_[k].cs_type_ != CS_TYPE_INVALID)) { + desc_range->set_collation_type(static_cast(key_info.part_keys_[k].cs_type_)); + break; + } + } + } if (OB_FAIL(desc_range->set_part_array(part_array, sub_part_num_[i]))) { LOG_WARN("failed to set_part_array, unexpected ", K(ret)); } @@ -595,6 +663,7 @@ int ObProxyPartMgr::build_list_part(const ObPartitionLevel part_level, const ObPartitionFuncType part_func_type, const int64_t part_num, const bool is_template_table, + const ObProxyPartKeyInfo &key_info, ObResultSetFetcher &rs_fetcher) { int ret = OB_SUCCESS; @@ -693,6 +762,14 @@ int ObProxyPartMgr::build_list_part(const ObPartitionLevel part_level, if (OB_SUCC(ret)) { desc_list->set_part_level(part_level); desc_list->set_part_func_type(part_func_type); + for (int k = 0; k < key_info.key_num_; ++k) { + if (static_cast(key_info.part_keys_[k].level_) == part_level) { + if (static_cast(key_info.part_keys_[k].cs_type_ != CS_TYPE_INVALID)) { + desc_list->set_collation_type(static_cast(key_info.part_keys_[k].cs_type_)); + break; + } + } + } if (PARTITION_LEVEL_ONE == part_level) { first_part_desc_ = desc_list; } else if (PARTITION_LEVEL_TWO == part_level) { @@ -706,6 +783,7 @@ int ObProxyPartMgr::build_list_part(const ObPartitionLevel part_level, } int ObProxyPartMgr::build_sub_list_part_with_non_template(const ObPartitionFuncType part_func_type, + const ObProxyPartKeyInfo &key_info, ObResultSetFetcher &rs_fetcher) { int ret = OB_SUCCESS; @@ -777,6 +855,14 @@ int ObProxyPartMgr::build_sub_list_part_with_non_template(const ObPartitionFuncT if (OB_SUCC(ret)) { desc_list->set_part_level(PARTITION_LEVEL_TWO); desc_list->set_part_func_type(part_func_type); + for (int k = 0; k < key_info.key_num_; ++k) { + if (static_cast(key_info.part_keys_[k].level_) == PARTITION_LEVEL_TWO) { + if (static_cast(key_info.part_keys_[k].cs_type_ != CS_TYPE_INVALID)) { + desc_list->set_collation_type(static_cast(key_info.part_keys_[k].cs_type_)); + break; + } + } + } if (OB_FAIL(desc_list->set_part_array(part_array, sub_part_num_[i]))) { LOG_WARN("failed to set_part_array, unexpected ", K(ret)); } @@ -790,6 +876,81 @@ int ObProxyPartMgr::build_sub_list_part_with_non_template(const ObPartitionFuncT return ret; } +int ObProxyPartMgr::get_first_part_num(int64_t &num) +{ + int ret = OB_SUCCESS; + if (OB_UNLIKELY(!is_first_part_valid())) { + ret = OB_INVALID_ARGUMENT; + LOG_WARN("fail to get first part num", K(ret)); + } else { + num = first_part_num_; + } + return ret; +} + +int ObProxyPartMgr::get_sub_part_num_by_first_part_id(ObProxyPartInfo &part_info, + const int64_t first_part_id, + int64_t &num) +{ + int ret = OB_SUCCESS; + + if (part_info.is_template_table()) { + num = part_info.get_sub_part_option().part_num_; + } else { + if (OB_UNLIKELY(!is_sub_part_valid())) { + ret = OB_INVALID_ARGUMENT; + LOG_WARN("fail to get sub part num by first due to invalid sub part", K(ret)); + } else { + int sub_ret = OB_INVALID_ARGUMENT; + const ObPartitionFuncType sub_part_func_type = sub_part_desc_->get_part_func_type(); + + for (int64_t i = 0; i < first_part_num_; ++i) { + if (is_range_part(sub_part_func_type)) { + ObPartDescRange *desc_range = (((ObPartDescRange*)sub_part_desc_) + i); + RangePartition *part_array = desc_range->get_part_array(); + if (first_part_id == part_array[0].first_part_id_) { + num = sub_part_num_[i]; + sub_ret = OB_SUCCESS; + break; + } + } else if (is_list_part(sub_part_func_type)) { + ObPartDescList *desc_list = (((ObPartDescList*)sub_part_desc_) + i); + ListPartition *part_array = desc_list->get_part_array(); + if (first_part_id == part_array[0].first_part_id_) { + num = sub_part_num_[i]; + sub_ret = OB_SUCCESS; + break; + } + } else if (is_hash_part(sub_part_func_type)) { + ObPartDescHash *desc_hash = (((ObPartDescHash*)sub_part_desc_) + i); + if (first_part_id == desc_hash->get_first_part_id()) { + num = sub_part_num_[i]; + sub_ret = OB_SUCCESS; + break; + } + } else if (is_key_part(sub_part_func_type)) { + ObPartDescKey *desc_key = (((ObPartDescKey*)sub_part_desc_) + i); + if (first_part_id == desc_key->get_first_part_id()) { + num = sub_part_num_[i]; + sub_ret = OB_SUCCESS; + break; + } + } else { + LOG_WARN("unsupported partition func type", K(sub_part_func_type)); + break; + } + } + + if (OB_FAIL(sub_ret)) { + ret = OB_INVALID_ARGUMENT; + LOG_WARN("fail to get sub part num by first part id", K(ret)); + } + } + } + + return ret; +} + int64_t ObProxyPartMgr::to_string(char *buf, const int64_t buf_len) const { int64_t pos = 0; @@ -802,19 +963,19 @@ int64_t ObProxyPartMgr::to_string(char *buf, const int64_t buf_len) const if (NULL != sub_part_desc_ && NULL != sub_part_num_) { const ObPartitionFuncType sub_part_func_type = sub_part_desc_->get_part_func_type(); ObPartDesc *sub_part_desc = NULL; - for (int64_t i = 0; i < first_part_num_; ++i) { - if (is_range_part(sub_part_func_type)) { - sub_part_desc = (((ObPartDescRange*)sub_part_desc_) + i); - } else if (is_list_part(sub_part_func_type)) { - sub_part_desc = (((ObPartDescList*)sub_part_desc_) + i); - } else if (is_hash_part(sub_part_func_type)) { - sub_part_desc = (((ObPartDescHash*)sub_part_desc_) + i); - } else if (is_key_part(sub_part_func_type)) { - sub_part_desc = (((ObPartDescKey*)sub_part_desc_) + i); - } - J_KV("first_part_id", i, KPC(sub_part_desc)); - J_COMMA(); + int i = 0; + // If it is a non-template partition, only print the first secondary partition to avoid too many logs + if (is_range_part(sub_part_func_type)) { + sub_part_desc = (((ObPartDescRange*)sub_part_desc_) + i); + } else if (is_list_part(sub_part_func_type)) { + sub_part_desc = (((ObPartDescList*)sub_part_desc_) + i); + } else if (is_hash_part(sub_part_func_type)) { + sub_part_desc = (((ObPartDescHash*)sub_part_desc_) + i); + } else if (is_key_part(sub_part_func_type)) { + sub_part_desc = (((ObPartDescKey*)sub_part_desc_) + i); } + J_KV("first_part_id", i, KPC(sub_part_desc)); + J_COMMA(); } else { J_KV(KPC_(sub_part_desc)); } diff --git a/src/obproxy/proxy/route/obproxy_part_mgr.h b/src/obproxy/proxy/route/obproxy_part_mgr.h index c68e314..89e6650 100644 --- a/src/obproxy/proxy/route/obproxy_part_mgr.h +++ b/src/obproxy/proxy/route/obproxy_part_mgr.h @@ -84,15 +84,18 @@ public: int get_part_with_part_name(const common::ObString &part_name, int64_t &part_id_); - + int get_first_part_id_by_idx(const int64_t idx, int64_t &part_id); int get_first_part(common::ObNewRange &range, common::ObIAllocator &allocator, common::ObIArray &part_ids); - int get_sub_part(const bool is_template_table, - const int64_t first_part_id, - common::ObNewRange &range, - common::ObIAllocator &allocator, - common::ObIArray &part_ids); + int get_sub_part(ObNewRange &range, + ObIAllocator &allocator, + ObPartDesc *sub_part_desc_ptr, + ObIArray &part_ids); + + int get_sub_part_by_random(const int64_t rand_num, + ObPartDesc *sub_part_desc_ptr, + ObIArray &part_ids); int build_hash_part(const bool is_oracle_mode, const share::schema::ObPartitionLevel part_level, @@ -122,19 +125,31 @@ public: const share::schema::ObPartitionFuncType part_func_type, const int64_t part_num, const bool is_template_table, + const ObProxyPartKeyInfo &key_info, ObResultSetFetcher &rs_fetcher); int build_sub_range_part_with_non_template(const share::schema::ObPartitionFuncType part_func_type, + const ObProxyPartKeyInfo &key_info, ObResultSetFetcher &rs_fetcher); int build_list_part(const share::schema::ObPartitionLevel part_level, const share::schema::ObPartitionFuncType part_func_type, const int64_t part_num, const bool is_template_table, + const ObProxyPartKeyInfo &key_info, ObResultSetFetcher &rs_fetcher); int build_sub_list_part_with_non_template(const share::schema::ObPartitionFuncType part_func_type, + const ObProxyPartKeyInfo &key_info, ObResultSetFetcher &rs_fetcher); bool is_first_part_valid() const { return NULL != first_part_desc_; } bool is_sub_part_valid() const { return NULL != sub_part_desc_; } + int get_first_part_num(int64_t &num); + int get_sub_part_num_by_first_part_id(ObProxyPartInfo &part_info, + const int64_t first_part_id, + int64_t &num); + int get_sub_part_desc_by_first_part_id(const bool is_template_table, + const int64_t first_part_id, + ObPartDesc *&sub_part_desc_ptr); + common::ObObjType get_first_part_type() const; common::ObObjType get_sub_part_type() const; diff --git a/src/rpc/obmysql/ob_mysql_packet.cpp b/src/rpc/obmysql/ob_mysql_packet.cpp index d4f3cd7..a648f27 100644 --- a/src/rpc/obmysql/ob_mysql_packet.cpp +++ b/src/rpc/obmysql/ob_mysql_packet.cpp @@ -81,6 +81,35 @@ int64_t ObMySQLPacket::get_serialize_size() const return -1; } +int ObMySQLPacket::store_string_kv(char* buf, int64_t len, const ObStringKV& str, int64_t& pos) +{ + int ret = OB_SUCCESS; + if (OB_FAIL(ObMySQLUtil::store_obstr(buf, len, str.key_, pos))) { + LOG_WARN("store stringkv key fail", K(ret)); + } else if (OB_FAIL(ObMySQLUtil::store_obstr(buf, len, str.value_, pos))) { + LOG_WARN("store stringkv value fail", K(ret)); + } + return ret; +} + +uint64_t ObMySQLPacket::get_kv_encode_len(const ObStringKV& string_kv) +{ + uint64_t len = 0; + len += ObMySQLUtil::get_number_store_len(string_kv.key_.length()); + len += string_kv.key_.length(); + len += ObMySQLUtil::get_number_store_len(string_kv.value_.length()); + len += string_kv.value_.length(); + return len; +} + +ObStringKV ObMySQLPacket::get_separator_kv() +{ + static ObStringKV separator_kv; + separator_kv.key_ = common::ObString::make_string("__NULL"); + separator_kv.value_ = common::ObString::make_string("__NULL"); + return separator_kv; +} + int64_t ObMySQLRawPacket::get_serialize_size() const { return static_cast(get_clen()) + 1; // add 1 for cmd_ diff --git a/src/rpc/obmysql/ob_mysql_packet.h b/src/rpc/obmysql/ob_mysql_packet.h index 31c0522..bdb44a9 100644 --- a/src/rpc/obmysql/ob_mysql_packet.h +++ b/src/rpc/obmysql/ob_mysql_packet.h @@ -276,7 +276,10 @@ public: virtual int64_t get_serialize_size() const; int encode(char *buffer, int64_t length, int64_t &pos) const; virtual int decode() { return common::OB_NOT_SUPPORTED; } - + static int store_string_kv(char* buf, int64_t len, const ObStringKV& str, int64_t& pos); + static uint64_t get_kv_encode_len(const ObStringKV& string_kv); + static ObStringKV get_separator_kv(); // separator for system variables and user variables + VIRTUAL_TO_STRING_KV("header", hdr_); protected: diff --git a/src/rpc/obmysql/packet/ompk_change_user.cpp b/src/rpc/obmysql/packet/ompk_change_user.cpp index a20c76a..57e2ba0 100644 --- a/src/rpc/obmysql/packet/ompk_change_user.cpp +++ b/src/rpc/obmysql/packet/ompk_change_user.cpp @@ -19,13 +19,60 @@ using namespace oceanbase::common; using namespace oceanbase::obmysql; -OMPKChangeUser::OMPKChangeUser() : status_(0xfe), - username_(), - auth_plugin_data_(), - auth_plugin_name_(), - database_(), - character_set_(CS_TYPE_UTF8MB4_BIN) +OMPKChangeUser::OMPKChangeUser() + : cmd_(OB_MYSQL_COM_CHANGE_USER), + character_set_(CS_TYPE_UTF8MB4_BIN), + mysql_cap_(), + username_(), + auth_response_(), + auth_plugin_name_(), + database_(), + connect_attrs_(), + sys_vars_(), + user_vars_() +{} + +void OMPKChangeUser::reset() +{ + mysql_cap_.capability_ = 0; + character_set_ = 0; + username_.reset(); + auth_response_.reset(); + database_.reset(); + auth_plugin_name_.reset(); + connect_attrs_.reset(); + sys_vars_.reset(); + user_vars_.reset(); +} + +// see com_change_user packet +// http://imysql.com/mysql-internal-manual/com-change-user.html +// for proxy, add session vars as connect attrs +int64_t OMPKChangeUser::get_serialize_size() const { + int64_t len = 0; + len = 1; // cmd + len += username_.length() + 1; + + if (!!mysql_cap_.cap_flags_.OB_CLIENT_SECURE_CONNECTION) { + len += 1; + len += auth_response_.length(); + } else { + len += auth_response_.length() + 1; + } + + len += database_.length() + 1; + len += 2; // character set + + if (!!mysql_cap_.cap_flags_.OB_CLIENT_PLUGIN_AUTH) { + len += auth_plugin_name_.length() + 1; + } + + if (!!mysql_cap_.cap_flags_.OB_CLIENT_CONNECT_ATTRS) { + len += ObMySQLUtil::get_number_store_len(get_connect_attrs_len()); + len += get_connect_attrs_len(); + } + return len; } int OMPKChangeUser::decode() @@ -42,6 +89,62 @@ int OMPKChangeUser::decode() username_ = ObString::make_string(pos); pos += strlen(pos) + 1; } + + // get auth response + if (OB_LIKELY(pos < end)) { + if (mysql_cap_.cap_flags_.OB_CLIENT_SECURE_CONNECTION) { + uint8_t auth_response_len = 0; + ObMySQLUtil::get_uint1(pos, auth_response_len); + auth_response_.assign_ptr(pos, static_cast(auth_response_len)); + pos += auth_response_len; + } else { + auth_response_.assign_ptr(pos, static_cast(STRLEN(pos))); + pos += auth_response_.length() + 1; + } + } + + if (OB_LIKELY(pos < end)) { + database_.assign_ptr(pos, static_cast(STRLEN(pos))); + pos += database_.length() + 1; + } + + if (OB_LIKELY(pos < end)) { + ObMySQLUtil::get_uint2(pos, character_set_); + } + + if (OB_LIKELY(pos < end)) { + if (mysql_cap_.cap_flags_.OB_CLIENT_PLUGIN_AUTH) { + auth_plugin_name_.assign_ptr(pos, static_cast(STRLEN(pos))); + pos += auth_plugin_name_.length() + 1; + } + } + + if (OB_LIKELY(pos < end)) { + if (mysql_cap_.cap_flags_.OB_CLIENT_CONNECT_ATTRS) { + uint64_t all_attrs_len = 0; + const char* attrs_end = NULL; + if (OB_FAIL(ObMySQLUtil::get_length(pos, all_attrs_len))) { + LOG_WARN("fail to get all_attrs_len", K(ret)); + } else { + attrs_end = pos + all_attrs_len; + } + ObStringKV str_kv; + while (OB_SUCC(ret) && OB_LIKELY(pos < attrs_end)) { + if (OB_FAIL(decode_string_kv(attrs_end, pos, str_kv))) { + OB_LOG(WARN, "fail to decode string kv", K(ret)); + } else { + if (str_kv.key_ == OB_MYSQL_PROXY_SESSION_VARS) { + const char* vars_start = str_kv.value_.ptr(); + if (OB_FAIL(decode_session_vars(vars_start, str_kv.value_.length()))) { + OB_LOG(WARN, "fail to decode session vars", K(ret)); + } + } else { + // do not save it + } + } + } + } // end connect attrs + } // end if } else { ret = OB_INVALID_ARGUMENT; LOG_ERROR("null input", K(cdata_)); @@ -49,34 +152,195 @@ int OMPKChangeUser::decode() return ret; } -int64_t OMPKChangeUser::get_serialize_size() const +int OMPKChangeUser::serialize(char* buffer, const int64_t length, int64_t& pos) const { - int64_t len = 0; - len = 1; // [fe] - len += auth_plugin_name_.length() + 1; - len += auth_plugin_data_.length(); - return len; + int ret = OB_SUCCESS; + if (OB_ISNULL(buffer) || OB_UNLIKELY(length - pos < 0)) { + ret = OB_INVALID_ARGUMENT; + LOG_WARN("invalid argument", K(buffer), K(length), K(pos), K(ret)); + } else if (OB_UNLIKELY(length - pos < static_cast(get_serialize_size()))) { + ret = OB_SIZE_OVERFLOW; + LOG_WARN("size is overflow", K(length), K(pos), "need_size", get_serialize_size(), K(ret)); + } else { + if (OB_FAIL(ObMySQLUtil::store_int1(buffer, length, cmd_, pos))) { + LOG_WARN("store fail", K(ret), K(buffer), K(length), K(pos)); + } else if (OB_FAIL(ObMySQLUtil::store_obstr_zt(buffer, length, username_, pos))) { + LOG_WARN("store fail", K(ret), K(buffer), K(length), K(pos)); + } else { + if (mysql_cap_.cap_flags_.OB_CLIENT_SECURE_CONNECTION) { + if (OB_FAIL(ObMySQLUtil::store_int1(buffer, length, static_cast(auth_response_.length()), pos))) { + LOG_WARN("fail to store auth response length", K(ret)); + } else if (OB_FAIL(ObMySQLUtil::store_str_vnzt( + buffer, length, auth_response_.ptr(), auth_response_.length(), pos))) { + LOG_WARN("fail to store auth response", K_(auth_response), K(ret)); + } + } else { + if (OB_FAIL(ObMySQLUtil::store_obstr_zt(buffer, length, auth_response_, pos))) { + LOG_WARN("fail to store auth response", K_(auth_response), K(ret)); + } + } + } + + if (OB_SUCC(ret) && OB_FAIL(ObMySQLUtil::store_obstr_zt(buffer, length, database_, pos))) { + LOG_WARN("fail to store database", K_(database), K(ret)); + } + + if (OB_SUCC(ret) && OB_FAIL(ObMySQLUtil::store_int2(buffer, length, character_set_, pos))) { + LOG_WARN("fail to store charset", K_(character_set), K(ret)); + } + + if (OB_SUCC(ret)) { + if (mysql_cap_.cap_flags_.OB_CLIENT_PLUGIN_AUTH) { + if (OB_FAIL(ObMySQLUtil::store_obstr_zt(buffer, length, auth_plugin_name_, pos))) { + LOG_WARN("fail to store auth_plugin_name", K_(auth_plugin_name), K(ret)); + } + } + } + + if (OB_SUCC(ret)) { + if (mysql_cap_.cap_flags_.OB_CLIENT_CONNECT_ATTRS) { + uint64_t all_attrs_len = get_connect_attrs_len(); + if (OB_FAIL(ObMySQLUtil::store_length(buffer, length, all_attrs_len, pos))) { + LOG_WARN("fail to store all_attrs_len", K(all_attrs_len), K(ret)); + } else { + for (int64_t i = 0; OB_SUCC(ret) && i < connect_attrs_.count(); ++i) { + ret = ObMySQLPacket::store_string_kv(buffer, length, connect_attrs_.at(i), pos); + } // end store normal connect attrs + + if (OB_SUCC(ret)) { + // store session vars + if (sys_vars_.empty() && user_vars_.empty()) { + // do nothing + } else if (OB_FAIL(ObMySQLUtil::store_obstr( + buffer, length, ObString::make_string(OB_MYSQL_PROXY_SESSION_VARS), pos))) { + LOG_WARN("store fail", K(ret), K(buffer), K(length), K(pos)); + } else if (OB_FAIL(serialize_session_vars(buffer, length, pos))) { + LOG_WARN("fail to store session vars", K(ret), K(buffer), K(length), K(pos)); + } + } // end store session vars + } + } + } + } + return ret; +} + +uint64_t OMPKChangeUser::get_session_vars_len() const +{ + uint64_t session_vars_len = 0; + for (int64_t i = 0; i < sys_vars_.count(); ++i) { + session_vars_len += ObMySQLPacket::get_kv_encode_len(sys_vars_.at(i)); + } + if (!user_vars_.empty()) { + session_vars_len += ObMySQLPacket::get_kv_encode_len(ObMySQLPacket::get_separator_kv()); + for (int64_t i = 0; i < user_vars_.count(); ++i) { + session_vars_len += ObMySQLPacket::get_kv_encode_len(user_vars_.at(i)); + } + } + return session_vars_len; +} + +uint64_t OMPKChangeUser::get_connect_attrs_len() const +{ + uint64_t all_attr_len = 0; + ObStringKV string_kv; + if (!!mysql_cap_.cap_flags_.OB_CLIENT_CONNECT_ATTRS) { + for (int64_t i = 0; i < connect_attrs_.count(); i++) { + all_attr_len += ObMySQLPacket::get_kv_encode_len(connect_attrs_.at(i)); + } + // store session vars as connect attrs + if (!sys_vars_.empty() || !user_vars_.empty()) { + int64_t len = STRLEN(OB_MYSQL_PROXY_SESSION_VARS); + all_attr_len += ObMySQLUtil::get_number_store_len(len); + all_attr_len += len; + all_attr_len += ObMySQLUtil::get_number_store_len(get_session_vars_len()); + all_attr_len += get_session_vars_len(); + } + } + return all_attr_len; } -int OMPKChangeUser::serialize(char *buffer, const int64_t length, int64_t &pos) const +int OMPKChangeUser::serialize_session_vars(char* buffer, const int64_t length, int64_t& pos) const { int ret = OB_SUCCESS; + if (OB_FAIL(ObMySQLUtil::store_length(buffer, length, get_session_vars_len(), pos))) { + LOG_WARN("fail to store session vars len", K(ret)); + } else { + for (int64_t i = 0; OB_SUCC(ret) && i < sys_vars_.count(); ++i) { + ret = ObMySQLPacket::store_string_kv(buffer, length, sys_vars_.at(i), pos); + } + if (OB_SUCC(ret)) { + if (!user_vars_.empty()) { + ret = ObMySQLPacket::store_string_kv(buffer, length, ObMySQLPacket::get_separator_kv(), pos); + } + for (int64_t i = 0; OB_SUCC(ret) && i < user_vars_.count(); ++i) { + ret = ObMySQLPacket::store_string_kv(buffer, length, user_vars_.at(i), pos); + } + } + } + return ret; +} - if (OB_ISNULL(buffer) || OB_UNLIKELY(length - pos < static_cast(get_serialize_size()))) { - LOG_WARN("invalid argument", K(buffer), K(length), K(pos), "need_size", get_serialize_size()); +int OMPKChangeUser::decode_string_kv(const char* attrs_end, const char*& pos, ObStringKV& kv) +{ + int ret = OB_SUCCESS; + uint64_t key_len = 0; + uint64_t value_len = 0; + if (OB_ISNULL(pos)) { ret = OB_INVALID_ARGUMENT; + LOG_WARN("invalie input value", K(pos), K(ret)); } else { - if (OB_FAIL(ObMySQLUtil::store_int1(buffer, length, status_, pos))) { - LOG_WARN("store fail", K(ret), K(buffer), K(length), K(pos)); - } else if (OB_FAIL(ObMySQLUtil::store_obstr_zt(buffer, length, auth_plugin_name_, pos))) { - LOG_WARN("store fail", K(ret), K(buffer), K(length), K(pos)); + if (OB_FAIL(ObMySQLUtil::get_length(pos, key_len))) { + OB_LOG(WARN, "fail t get key len", K(pos), K(ret)); } else { - if (!auth_plugin_data_.empty()) { - MEMCPY(buffer + pos, auth_plugin_data_.ptr(), auth_plugin_data_.length()); - pos += auth_plugin_data_.length(); + kv.key_.assign_ptr(pos, static_cast(key_len)); + pos += key_len; + if (pos >= attrs_end) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("unexpected key len", K(ret), K(key_len)); + } else if (OB_FAIL(ObMySQLUtil::get_length(pos, value_len))) { + OB_LOG(WARN, "fail t get value len", K(pos), K(ret)); + } else { + kv.value_.assign_ptr(pos, static_cast(value_len)); + pos += value_len; } } } return ret; } +int OMPKChangeUser::decode_session_vars(const char*& pos, const int64_t session_vars_len) +{ + int ret = OB_SUCCESS; + if (OB_ISNULL(pos) || OB_UNLIKELY(session_vars_len < 0)) { + ret = OB_INVALID_ARGUMENT; + OB_LOG(WARN, "invalie input value", K(pos), K(session_vars_len), K(ret)); + } else { + const char* end = pos + session_vars_len; + bool found_separator = false; + ObStringKV tmp_kv; + while (OB_SUCC(ret) && OB_LIKELY(pos < end)) { + if (OB_FAIL(decode_string_kv(end, pos, tmp_kv))) { + OB_LOG(WARN, "fail to decode string kv", K(ret)); + } else { + if (tmp_kv.key_ == ObMySQLPacket::get_separator_kv().key_ && + tmp_kv.value_ == ObMySQLPacket::get_separator_kv().value_) { + found_separator = true; + // continue + } else { + if (found_separator) { + if (OB_FAIL(user_vars_.push_back(tmp_kv))) { + OB_LOG(WARN, "fail to push back user_vars", K(tmp_kv), K(ret)); + } + } else { + if (OB_FAIL(sys_vars_.push_back(tmp_kv))) { + OB_LOG(WARN, "fail to push back sys_vars", K(tmp_kv), K(ret)); + } + } + } + } + } // end while + } + + return ret; +} diff --git a/src/rpc/obmysql/packet/ompk_change_user.h b/src/rpc/obmysql/packet/ompk_change_user.h index a2aadf0..40c3678 100644 --- a/src/rpc/obmysql/packet/ompk_change_user.h +++ b/src/rpc/obmysql/packet/ompk_change_user.h @@ -14,21 +14,19 @@ #define OCEANBASE_OBMYSQL_OMPK_CHANGE_USER_H_ #include "lib/string/ob_string.h" +#include "lib/container/ob_se_array.h" #include "rpc/obmysql/ob_mysql_packet.h" -namespace oceanbase -{ +namespace oceanbase { using common::ObString; -namespace obmysql -{ +namespace obmysql { -class OMPKChangeUser - : public ObMySQLPacket -{ +class OMPKChangeUser : public ObMySQLRawPacket { public: OMPKChangeUser(); - ~OMPKChangeUser() {} + virtual ~OMPKChangeUser() + {} /** * Serialize all data not include packet header to buffer @@ -36,26 +34,91 @@ public: * @param len buffer length * @param pos buffer pos */ - int serialize(char *buffer, int64_t len, int64_t &pos) const; + virtual int serialize(char* buffer, int64_t len, int64_t& pos) const; + // decode ok packet int decode(); - inline const ObString& get_username() { return username_; } - inline const ObString& get_auth_plugin_name() { return auth_plugin_name_; } - inline const ObString& get_auth_response() { return auth_plugin_data_; } - inline void set_auth_plugin_name(const ObString &plugin_name) { auth_plugin_name_ = plugin_name; } - inline void set_auth_response(const ObString &auth_response) { auth_plugin_data_ = auth_response; } + void reset(); + inline void set_mysql_capability(const ObMySQLCapabilityFlags& mysql_cap) + { + mysql_cap_ = mysql_cap; + } + inline void set_username(const ObString& username) + { + username_ = username; + } + inline void set_auth_response(const ObString& auth_response) + { + auth_response_ = auth_response; + } + inline void set_database(const ObString& database) + { + database_ = database; + } + inline void set_character_set(const uint8_t charset) + { + character_set_ = charset; + } + inline void set_auth_plugin_name(const ObString& auth_plugin_name) + { + auth_plugin_name_ = auth_plugin_name; + } + inline const ObString& get_username() + { + return username_; + } + inline const ObString& get_auth_response() + { + return auth_response_; + } + inline const common::ObIArray& get_system_vars() const + { + return sys_vars_; + } + inline const common::ObIArray& get_user_vars() const + { + return user_vars_; + } + inline common::ObIArray& get_system_vars() + { + return sys_vars_; + } + inline common::ObIArray& get_user_vars() + { + return user_vars_; + } + inline const common::ObIArray& get_connect_attrs() const + { + return connect_attrs_; + } + inline void set_capability_flag(const ObMySQLCapabilityFlags mysql_cap) + { + mysql_cap_ = mysql_cap; + } virtual int64_t get_serialize_size() const; + void reset_connect_attr() { connect_attrs_.reset(); } private: - //DISALLOW_COPY_AND_ASSIGN(OMPKChangeUser); - uint8_t status_; + uint64_t get_session_vars_len() const; + uint64_t get_connect_attrs_len() const; + int serialize_session_vars(char* buffer, const int64_t length, int64_t& pos) const; + static int decode_string_kv(const char* attrs_end, const char*& pos, obmysql::ObStringKV& kv); + int decode_session_vars(const char*& pos, const int64_t session_vars_len); + +private: + uint8_t cmd_; + uint16_t character_set_; + ObMySQLCapabilityFlags mysql_cap_; ObString username_; - ObString auth_plugin_data_; + ObString auth_response_; ObString auth_plugin_name_; ObString database_; - uint8_t character_set_; -}; // end of class + common::ObSEArray connect_attrs_; + common::ObSEArray sys_vars_; + common::ObSEArray user_vars_; + //DISALLOW_COPY_AND_ASSIGN(OMPKChangeUser); +}; // end of class -} // end of namespace obmysql -} // end of namespace oceanbase +} // end of namespace obmysql +} // end of namespace oceanbase #endif /* OCEANBASE_OBMYSQL_OMPK_CHANGE_USER_H_ */ diff --git a/src/share/part/ob_part_desc.cpp b/src/share/part/ob_part_desc.cpp index c2283d8..6d2f33a 100644 --- a/src/share/part/ob_part_desc.cpp +++ b/src/share/part/ob_part_desc.cpp @@ -26,5 +26,13 @@ int ObPartDesc::get_part(common::ObNewRange &range, return OB_NOT_IMPLEMENT; } +int ObPartDesc::get_part_by_num(const int64_t num, common::ObIArray &part_ids) +{ + UNUSED(num); + UNUSED(part_ids); + return OB_NOT_IMPLEMENT; +} + + } // end of common } // end of oceanbase diff --git a/src/share/part/ob_part_desc.h b/src/share/part/ob_part_desc.h index f637e1a..629822b 100644 --- a/src/share/part/ob_part_desc.h +++ b/src/share/part/ob_part_desc.h @@ -35,6 +35,7 @@ public: virtual int get_part(common::ObNewRange &range, common::ObIAllocator &allocator, common::ObIArray &part_ids); + virtual int get_part_by_num(const int64_t num, common::ObIArray &part_ids); void set_part_level(share::schema::ObPartitionLevel part_level) { part_level_ = part_level; } share::schema::ObPartitionLevel get_part_level() { return part_level_; } void set_part_func_type(share::schema::ObPartitionFuncType part_func_type) { part_func_type_ = part_func_type; } diff --git a/src/share/part/ob_part_desc_hash.cpp b/src/share/part/ob_part_desc_hash.cpp index eb66bef..1480eb9 100644 --- a/src/share/part/ob_part_desc_hash.cpp +++ b/src/share/part/ob_part_desc_hash.cpp @@ -62,6 +62,19 @@ int ObPartDescHash::get_part(ObNewRange &range, return ret; } +int ObPartDescHash::get_part_by_num(const int64_t num, common::ObIArray &part_ids) +{ + int ret = OB_SUCCESS; + int64_t part_id = -1; + int64_t part_idx = num % part_num_; + if (OB_FAIL(get_part_hash_idx(part_idx, part_id))) { + COMMON_LOG(WARN, "fail to get part hash id", K(num), K(ret)); + } else if (OB_FAIL(part_ids.push_back(part_id))) { + COMMON_LOG(WARN, "fail to push part_id", K(ret)); + } + return ret; +} + bool ObPartDescHash::is_oracle_supported_type(const ObObjType type) { bool supported = false; @@ -143,13 +156,14 @@ int ObPartDescHash::calc_value_for_oracle(ObObj &src_obj, ObIAllocator &allocato uint64_t hash_val = 0; - src_obj.set_collation_type(cs_type_); ObCastCtx cast_ctx(&allocator, NULL, CM_NULL_ON_WARN, cs_type_); // use src_obj as buf_obj - if (OB_FAIL(ObObjCasterV2::to_type(obj_type_, cast_ctx, src_obj, src_obj))) { + COMMON_LOG(DEBUG, "begin to cast value for hash oracle", K(src_obj), K(cs_type_)); + if (OB_FAIL(ObObjCasterV2::to_type(obj_type_, cs_type_, cast_ctx, src_obj, src_obj))) { COMMON_LOG(WARN, "failed to cast obj", K(src_obj), K(obj_type_), K(cs_type_), K(ret)); } else { //1. calc hash value + COMMON_LOG(DEBUG, "end to cast values for hash oracle", K(src_obj), K(cs_type_)); const ObObjType type = src_obj.get_type(); if (ObNullType == type) { //do nothing, hash_code not changed @@ -193,7 +207,7 @@ int ObPartDescHash::calc_value_for_mysql(ObObj &src_obj, ObIAllocator &allocator ObCastCtx cast_ctx(&allocator, NULL, CM_NULL_ON_WARN, CS_TYPE_INVALID); ObObjType target_type = ObIntType; - if (OB_FAIL(ObObjCasterV2::to_type(target_type, cast_ctx, src_obj, src_obj))) { + if (OB_FAIL(ObObjCasterV2::to_type(target_type, cs_type_, cast_ctx, src_obj, src_obj))) { COMMON_LOG(INFO, "failed to cast to target type", K(target_type), K(src_obj), K(ret)); } else { int64_t val = 0; diff --git a/src/share/part/ob_part_desc_hash.h b/src/share/part/ob_part_desc_hash.h index ada11a4..dc87242 100644 --- a/src/share/part/ob_part_desc_hash.h +++ b/src/share/part/ob_part_desc_hash.h @@ -31,6 +31,7 @@ public: virtual int get_part(common::ObNewRange &range, common::ObIAllocator &allocator, ObIArray &part_ids); + virtual int get_part_by_num(const int64_t num, common::ObIArray &part_ids); void set_part_num(int64_t part_num) { part_num_ = part_num; } void set_part_space(int64_t part_space) { part_space_ = part_space; } void set_first_part_id(int64_t first_part_id) { first_part_id_ = first_part_id; } diff --git a/src/share/part/ob_part_desc_key.cpp b/src/share/part/ob_part_desc_key.cpp index 7c1c8f0..d24a324 100644 --- a/src/share/part/ob_part_desc_key.cpp +++ b/src/share/part/ob_part_desc_key.cpp @@ -43,10 +43,9 @@ int ObPartDescKey::get_part(ObNewRange &range, "obj_cnt", range.get_start_key().get_obj_cnt(), K(ret)); } else { ObObj &src_obj = const_cast(range.get_start_key().get_obj_ptr()[0]); - src_obj.set_collation_type(cs_type_); ObCastCtx cast_ctx(&allocator, NULL, CM_NULL_ON_WARN, cs_type_); // use src_obj as buf_obj - if (OB_FAIL(ObObjCasterV2::to_type(obj_type_, cast_ctx, src_obj, src_obj))) { + if (OB_FAIL(ObObjCasterV2::to_type(obj_type_, cs_type_, cast_ctx, src_obj, src_obj))) { COMMON_LOG(INFO, "failed to cast obj", K(src_obj), K(obj_type_), K(cs_type_), K(ret)); } else { int64_t result_num = 0; @@ -71,5 +70,22 @@ int ObPartDescKey::get_part(ObNewRange &range, return ret; } + +int ObPartDescKey::get_part_by_num(const int64_t num, common::ObIArray &part_ids) +{ + int ret = OB_SUCCESS; + int64_t part_idx = num % part_num_; + int64_t part_id = part_idx; + if (share::schema::PARTITION_LEVEL_ONE == part_level_ && part_array_ != NULL) { + part_id = part_array_[part_idx]; + } + part_id = part_space_ << OB_PART_IDS_BITNUM | part_id; + if (OB_FAIL(part_ids.push_back(part_id))) { + COMMON_LOG(WARN, "fail to push part_id", K(ret)); + } + return ret; +} + + } // end of common } // end of oceanbase diff --git a/src/share/part/ob_part_desc_key.h b/src/share/part/ob_part_desc_key.h index 0733aa7..1815e78 100644 --- a/src/share/part/ob_part_desc_key.h +++ b/src/share/part/ob_part_desc_key.h @@ -29,6 +29,7 @@ public: virtual int get_part(ObNewRange &range, ObIAllocator &allocator, ObIArray &part_ids); + virtual int get_part_by_num(const int64_t num, common::ObIArray &part_ids); void set_part_num(int64_t part_num) { part_num_ = part_num; } void set_part_space(int64_t part_space) { part_space_ = part_space; } void set_first_part_id(int64_t first_part_id) { first_part_id_ = first_part_id; } diff --git a/src/share/part/ob_part_desc_list.cpp b/src/share/part/ob_part_desc_list.cpp index 5cc848d..a197822 100644 --- a/src/share/part/ob_part_desc_list.cpp +++ b/src/share/part/ob_part_desc_list.cpp @@ -21,6 +21,7 @@ namespace common ObPartDescList::ObPartDescList() : part_array_ (NULL) , part_array_size_(0) , default_part_array_idx_(OB_INVALID_INDEX) + , collation_type_(CS_TYPE_UTF8MB4_BIN) { } @@ -34,13 +35,8 @@ int64_t ObPartDescList::to_string(char *buf, const int64_t buf_len) const int64_t pos = 0; J_OBJ_START(); - J_KV("part_type", "list"); - J_COMMA(); - for (int64_t i = 0; i < part_array_size_; ++i) { - J_KV("part_id", i, "part_array", part_array_[i]); - J_COMMA(); - } - + J_KV("part_type", "list", + K_(part_array_size)); J_OBJ_END(); return pos; } @@ -54,7 +50,6 @@ int ObPartDescList::get_part(ObNewRange &range, ObIArray &part_ids) { int ret = OB_SUCCESS; - part_ids.reset(); if (OB_ISNULL(part_array_) || OB_UNLIKELY(part_array_size_ <= 0)) { @@ -101,17 +96,28 @@ int ObPartDescList::get_part(ObNewRange &range, return ret; } +int ObPartDescList::get_part_by_num(const int64_t num, common::ObIArray &part_ids) +{ + int ret = OB_SUCCESS; + int64_t part_idx = num % part_array_size_; + if (OB_FAIL(part_ids.push_back(part_array_[part_idx].part_id_))) { + COMMON_LOG(WARN, "fail to push part_id", K(ret)); + } + return ret; +} + inline int ObPartDescList::cast_obj(ObObj &src_obj, - const ObObj &target_obj, + ObObj &target_obj, ObIAllocator &allocator) { int ret = OB_SUCCESS; - src_obj.set_collation_type(target_obj.get_collation_type()); + COMMON_LOG(DEBUG, "begin to cast obj for list", K(src_obj), K(target_obj), K_(collation_type)); ObCastCtx cast_ctx(&allocator, NULL, CM_NULL_ON_WARN, target_obj.get_collation_type()); // use src_obj as buf_obj - if (OB_FAIL(ObObjCasterV2::to_type(target_obj.get_type(), cast_ctx, src_obj, src_obj))) { - COMMON_LOG(INFO, "failed to cast obj", K(src_obj), K(target_obj), K(ret)); + if (OB_FAIL(ObObjCasterV2::to_type(target_obj.get_type(), collation_type_, cast_ctx, src_obj, src_obj))) { + COMMON_LOG(WARN, "failed to cast obj", K(src_obj), K(target_obj), K_(collation_type), K(ret)); } + COMMON_LOG(DEBUG, "end to cast obj for list", K(src_obj), K(target_obj), K_(collation_type)); return ret; } diff --git a/src/share/part/ob_part_desc_list.h b/src/share/part/ob_part_desc_list.h index 00b0507..07ed114 100644 --- a/src/share/part/ob_part_desc_list.h +++ b/src/share/part/ob_part_desc_list.h @@ -41,6 +41,7 @@ public: virtual int get_part(ObNewRange &range, ObIAllocator &allocator, ObIArray &part_ids); + virtual int get_part_by_num(const int64_t num, common::ObIArray &part_ids); void set_default_part_array_idx(int64_t idx) { default_part_array_idx_ = idx; } int64_t get_default_part_array_idx() const { return default_part_array_idx_; } ListPartition *get_part_array() { return part_array_; } @@ -50,15 +51,21 @@ public: return OB_SUCCESS; } + void set_collation_type(const ObCollationType collation_type) + { + collation_type_ = collation_type; + } + DECLARE_VIRTUAL_TO_STRING; private: int cast_obj(ObObj &src_obj, - const ObObj &target_obj, + ObObj &target_obj, ObIAllocator &allocator); private: ListPartition *part_array_; int64_t part_array_size_; int64_t default_part_array_idx_; + ObCollationType collation_type_; }; } // end common diff --git a/src/share/part/ob_part_desc_range.cpp b/src/share/part/ob_part_desc_range.cpp index 670e1f8..306e63c 100644 --- a/src/share/part/ob_part_desc_range.cpp +++ b/src/share/part/ob_part_desc_range.cpp @@ -32,6 +32,7 @@ bool RangePartition::less_than(const RangePartition &a, const RangePartition &b) ObPartDescRange::ObPartDescRange() : part_array_ (NULL) , part_array_size_(0) + , collation_type_(CS_TYPE_UTF8MB4_BIN) { } @@ -45,12 +46,8 @@ int64_t ObPartDescRange::to_string(char *buf, const int64_t buf_len) const int64_t pos = 0; J_OBJ_START(); - J_KV("part_type", "range"); - J_COMMA(); - for (int64_t i = 0; i < part_array_size_; ++i) { - J_KV("part_id", i, "part_array", part_array_[i]); - J_COMMA(); - } + J_KV("part_type", "range", + K_(part_array_size)); J_OBJ_END(); return pos; @@ -158,15 +155,25 @@ int ObPartDescRange::get_part(ObNewRange &range, return ret; } +int ObPartDescRange::get_part_by_num(const int64_t num, common::ObIArray &part_ids) +{ + int ret = OB_SUCCESS; + int64_t part_idx = num % part_array_size_; + if (OB_FAIL(part_ids.push_back(part_array_[part_idx].part_id_))) { + COMMON_LOG(WARN, "fail to push part id", K(ret)); + } + return ret; +} + int ObPartDescRange::cast_key(ObRowkey &src_key, - const ObRowkey &target_key, + ObRowkey &target_key, ObIAllocator &allocator) { int ret = OB_SUCCESS; int64_t min_col_cnt = std::min(src_key.get_obj_cnt(), target_key.get_obj_cnt()); for (int64_t i = 0; i < min_col_cnt && OB_SUCC(ret); ++i) { if (OB_FAIL(cast_obj(const_cast(src_key.get_obj_ptr()[i]), - target_key.get_obj_ptr()[i], + const_cast(target_key.get_obj_ptr()[i]), allocator))) { COMMON_LOG(INFO, "fail to cast obj", K(i), K(ret)); } else { @@ -177,16 +184,17 @@ int ObPartDescRange::cast_key(ObRowkey &src_key, } inline int ObPartDescRange::cast_obj(ObObj &src_obj, - const ObObj &target_obj, + ObObj &target_obj, ObIAllocator &allocator) { int ret = OB_SUCCESS; - src_obj.set_collation_type(target_obj.get_collation_type()); + COMMON_LOG(DEBUG, "begin to cast obj for range", K(src_obj), K(target_obj), K_(collation_type)); ObCastCtx cast_ctx(&allocator, NULL, CM_NULL_ON_WARN, target_obj.get_collation_type()); // use src_obj as buf_obj - if (OB_FAIL(ObObjCasterV2::to_type(target_obj.get_type(), cast_ctx, src_obj, src_obj))) { - COMMON_LOG(INFO, "failed to cast obj", K(src_obj), K(target_obj), K(ret)); + if (OB_FAIL(ObObjCasterV2::to_type(target_obj.get_type(), collation_type_, cast_ctx, src_obj, src_obj))) { + COMMON_LOG(WARN, "failed to cast obj", K(src_obj), K(target_obj), K_(collation_type), K(ret)); } + COMMON_LOG(DEBUG, "end to cast obj for range", K(src_obj), K(target_obj), K_(collation_type)); return ret; } diff --git a/src/share/part/ob_part_desc_range.h b/src/share/part/ob_part_desc_range.h index 926dba8..17892d1 100644 --- a/src/share/part/ob_part_desc_range.h +++ b/src/share/part/ob_part_desc_range.h @@ -14,6 +14,7 @@ #define _OB_PART_DESC_RANGE_H 1 #include "share/part/ob_part_desc.h" +#include "lib/container/ob_se_array.h" namespace oceanbase { @@ -43,6 +44,7 @@ public: virtual int get_part(common::ObNewRange &range, common::ObIAllocator &allocator, ObIArray &part_ids); + virtual int get_part_by_num(const int64_t num, common::ObIArray &part_ids); RangePartition* get_part_array() { return part_array_; } int set_part_array(RangePartition *part_array, int64_t size) { part_array_ = part_array; @@ -50,6 +52,11 @@ public: return common::OB_SUCCESS; } + void set_collation_type(const ObCollationType collation_type) + { + collation_type_ = collation_type; + } + DECLARE_VIRTUAL_TO_STRING; private: int64_t get_start(const RangePartition *part_array, @@ -61,15 +68,16 @@ private: const ObNewRange &range); int cast_key(ObRowkey &src_key, - const ObRowkey &target_key, + ObRowkey &target_key, ObIAllocator &allocator); int cast_obj(ObObj &src_obj, - const ObObj &target_obj, + ObObj &target_obj, ObIAllocator &allocator); private: RangePartition *part_array_; int64_t part_array_size_; + ObCollationType collation_type_; }; } } diff --git a/unittest/obproxy/ob_expr_parser_checker.cpp b/unittest/obproxy/ob_expr_parser_checker.cpp index 5f00754..64c1a2d 100644 --- a/unittest/obproxy/ob_expr_parser_checker.cpp +++ b/unittest/obproxy/ob_expr_parser_checker.cpp @@ -47,13 +47,13 @@ ObExprParserChecker::ObExprParserChecker() : is_verbose_(true), { } -int ObExprParserChecker::do_obproxy_parser(const ObString &query_str, ObExprParseResult &result) +int ObExprParserChecker::do_obproxy_parser(const ObString &query_str, ObExprParseResult &result, ObCollationType connection_collation) { int ret = OB_SUCCESS; int64_t t0 = ObTimeUtility::current_time(); ObExprParser parser(allocator_, parse_mode_); - if (OB_FAIL(parser.parse(query_str, result))) { + if (OB_FAIL(parser.parse(query_str, result, connection_collation))) { // do nothing } @@ -151,7 +151,7 @@ void ObExprParserChecker::build_schema(std::string &extra_str, ObExprParseResult } } -bool ObExprParserChecker::run_parse_string(const ObString query_str, std::string &extra_str) +bool ObExprParserChecker::run_parse_string(const ObString query_str, std::string &extra_str, ObCollationType connection_collation) { bool bret = false; @@ -166,7 +166,7 @@ bool ObExprParserChecker::run_parse_string(const ObString query_str, std::string build_schema(extra_str, result); DUMP_RESULT("SQL : %.*s\n", query_str.length(), query_str.ptr()); - if (OB_SUCCESS == do_obproxy_parser(query_str, result)) { + if (OB_SUCCESS == do_obproxy_parser(query_str, result, connection_collation)) { ObExprParseResultPrintWrapper wrapper(result); DUMP_RESULT("RESULT:\n%.*s\n", static_cast(wrapper.to_string(buf, MAX_STR_LEN)), buf); @@ -193,7 +193,7 @@ bool ObExprParserChecker::run_parse_string(const ObString query_str, std::string return bret; } -bool ObExprParserChecker::run_parse_std_string(std::string query_str, std::string extra_str) +bool ObExprParserChecker::run_parse_std_string(std::string query_str, std::string extra_str, ObCollationType connection_collation) { query_str += " "; ObString input_query(query_str.size(), query_str.c_str()); @@ -228,7 +228,56 @@ bool ObExprParserChecker::run_parse_std_string(std::string query_str, std::strin input_query += (len_before_where - 1); } } - return run_parse_string(input_query, extra_str); + return run_parse_string(input_query, extra_str, connection_collation); +} + +bool ObExprParserChecker::run_parse_file(const char *filepath, std::string extra_str, ObCollationType connection_collation) +{ + bool bret = false; + std::ifstream input_file(filepath); + std::string line_str; + std::string query_str; + + if (!input_file.is_open()) { + fprintf(stderr, "file is not open, filepath:%s\n", filepath); + bret = false; + } else { + // open result file + if (NULL == result_file_ && strlen(result_file_name_) > 0) { + result_file_ = fopen(result_file_name_, "w+"); + } + + // walk through and do parser string + while (std::getline(input_file, line_str)) { + if (query_str == "") { + query_str = line_str; + } else { + query_str += "\n" + line_str; + } + std::size_t begin = query_str.find_first_not_of("\r\f\n\t "); + begin = (begin == std::string::npos) ? 0 : begin; + if (query_str.size() <= 0 || query_str.at(begin) == '#' || query_str.at(begin) == '-' ) { + query_str = ""; + continue; + } else { + std::size_t end = -1; + if (std::string::npos != (end = query_str.find_last_of(';'))) { + query_str = query_str.substr(begin, end - begin + 1); + run_parse_std_string(query_str, extra_str, connection_collation); + query_str = ""; + } else { + // not contains ';' + } + } + } + input_file.close(); + + // close if need + if (NULL != result_file_) { + fclose(result_file_); + } + } + return bret; } void ObExprParserChecker::print_stat() @@ -244,18 +293,23 @@ void ObExprParserChecker::print_stat() } // end of namespace obproxy } // end of namespace oceanbase -extern int obexprdebug; +extern int ob_expr_parser_utf8_yydebug; using namespace oceanbase::obproxy::test; int main(int argc, char **argv) { int ret = 0; ObExprParserChecker checker; int c = -1; + const char *filepath = ""; const char *input_str = ""; const char *extra_str = ""; int loop_count = 1; - while(-1 != (c = getopt(argc, argv, "e:s:n:r:t:SDRI"))) { + ObCollationType connection_collation = CS_TYPE_INVALID;; + while(-1 != (c = getopt(argc, argv, "f:e:s:n:r:t:c:SDRI"))) { switch(c) { + case 'f': + filepath = optarg; + break; case 's': input_str = optarg; break; @@ -263,7 +317,7 @@ int main(int argc, char **argv) checker.is_verbose_ = false; break; case 'D': - obexprdebug = 1; + ob_expr_parser_utf8_yydebug = 1; oceanbase::common::ObLogger::get_logger().set_log_level("DEBUG"); OB_LOGGER.set_log_level("DEBUG"); break; @@ -282,6 +336,11 @@ int main(int argc, char **argv) case 'I': checker.parse_mode_ = INSERT_STMT_PARSE_MODE; break; + case 'c': + if (strcmp(optarg, "utb8") == 0) { + connection_collation = CS_TYPE_UTF8MB4_GENERAL_CI; + } + break; case 't': ObString stmt_type(strlen(optarg), optarg); checker.stmt_type_ = get_stmt_type_by_name(stmt_type); @@ -289,12 +348,14 @@ int main(int argc, char **argv) } } - if (strlen(input_str) > 0 && strlen(extra_str)) { - while (loop_count-- > 0) { - checker.run_parse_std_string(input_str, extra_str); + while (loop_count-- > 0) { + if (strlen(filepath) > 0 && strlen(extra_str)) { + checker.run_parse_file(filepath, extra_str, connection_collation); + } else if (strlen(input_str) > 0 && strlen(extra_str)) { + checker.run_parse_std_string(input_str, extra_str, connection_collation); + } else { + printf("must spec input_str(-i)/file_name(-f) and extra_str(-e)"); } - } else { - printf("must spec input_str(-i) and extra_str(-e)"); } checker.print_stat(); diff --git a/unittest/obproxy/ob_expr_parser_checker.h b/unittest/obproxy/ob_expr_parser_checker.h index a5427e1..127f1e9 100644 --- a/unittest/obproxy/ob_expr_parser_checker.h +++ b/unittest/obproxy/ob_expr_parser_checker.h @@ -30,9 +30,10 @@ public: ~ObExprParserChecker() {} // parse sql - bool run_parse_string(const common::ObString query_str, std::string &extra_str); - bool run_parse_std_string(std::string query_str, std::string extra_str); - int do_obproxy_parser(const common::ObString &query_str, ObExprParseResult &result); + bool run_parse_string(const common::ObString query_str, std::string &extra_str, common::ObCollationType connection_collation); + bool run_parse_std_string(std::string query_str, std::string extra_str, common::ObCollationType connection_collation); + bool run_parse_file(const char *filepath, std::string extra_str, common::ObCollationType connection_collation); + int do_obproxy_parser(const common::ObString &query_str, ObExprParseResult &result, common::ObCollationType connection_collation); int do_expr_resolver(opsql::ObExprResolverContext &ctx, opsql::ObExprResolverResult &result); void print_stat(); diff --git a/unittest/obproxy/obproxy_parser_checker.cpp b/unittest/obproxy/obproxy_parser_checker.cpp index 505389d..10108df 100644 --- a/unittest/obproxy/obproxy_parser_checker.cpp +++ b/unittest/obproxy/obproxy_parser_checker.cpp @@ -49,14 +49,14 @@ ObProxyParserChecker::ObProxyParserChecker() : is_verbose_(true), { } -int ObProxyParserChecker::do_obproxy_parser(const ObString &query_str, ObProxyParseResultWapper &result) +int ObProxyParserChecker::do_obproxy_parser(const ObString &query_str, ObProxyParseResultWapper &result, ObCollationType connection_collation) { int ret = OB_SUCCESS; int64_t t0 = ObTimeUtility::current_time(); ObProxyParser parser(allocator_, NORMAL_PARSE_MODE); ObProxyParseResult obproxy_parse_result; - if (OB_FAIL(parser.parse(query_str, obproxy_parse_result))) { + if (OB_FAIL(parser.parse(query_str, obproxy_parse_result, connection_collation))) { // do nothing } else if (OB_FAIL(result.load_result(&obproxy_parse_result))) { // do nothing @@ -70,7 +70,7 @@ int ObProxyParserChecker::do_obproxy_parser(const ObString &query_str, ObProxyPa } -bool ObProxyParserChecker::run_parse_string(const ObString query_str) +bool ObProxyParserChecker::run_parse_string(const ObString query_str, ObCollationType connection_collation) { bool bret = false; @@ -79,7 +79,7 @@ bool ObProxyParserChecker::run_parse_string(const ObString query_str) ObProxyParseResultWapper result; DUMP_RESULT("SQL : %.*s\n", query_str.length(), query_str.ptr()); - if (OB_SUCCESS == do_obproxy_parser(query_str, result)) { + if (OB_SUCCESS == do_obproxy_parser(query_str, result, connection_collation)) { DUMP_RESULT("RESULT: %s\n", (result.to_string(parse_string, MAX_STR_LEN), parse_string)); } else { @@ -92,16 +92,16 @@ bool ObProxyParserChecker::run_parse_string(const ObString query_str) return bret; } -bool ObProxyParserChecker::run_parse_std_string(std::string query_str) +bool ObProxyParserChecker::run_parse_std_string(std::string query_str, ObCollationType connection_collation) { query_str += " "; ObString input_query(query_str.size(), query_str.c_str()); input_query.ptr()[input_query.length() - 2] = 0; input_query.ptr()[input_query.length() - 1] = 0; - return run_parse_string(input_query); + return run_parse_string(input_query, connection_collation); } -bool ObProxyParserChecker::run_parse_file(const char *filepath) +bool ObProxyParserChecker::run_parse_file(const char *filepath, ObCollationType connection_collation) { bool bret = false; std::ifstream input_file(filepath); @@ -133,7 +133,7 @@ bool ObProxyParserChecker::run_parse_file(const char *filepath) std::size_t end = -1; if (std::string::npos != (end = query_str.find_last_of(';'))) { query_str = query_str.substr(begin, end - begin + 1); - run_parse_std_string(query_str); + run_parse_std_string(query_str, connection_collation); query_str = ""; } else { // not contains ';' @@ -162,7 +162,7 @@ void ObProxyParserChecker::print_stat() #define YYDEBUG 1 #if YYDEBUG -extern int obproxydebug; +extern int ob_proxy_parser_utf8_yydebug; #endif using namespace oceanbase::obproxy::test; int main(int argc, char **argv) @@ -172,8 +172,9 @@ int main(int argc, char **argv) int c = -1; const char *filepath = ""; const char *input_str = ""; + ObCollationType connection_collation = CS_TYPE_INVALID; int loop_count = 1; - while(-1 != (c = getopt(argc, argv, "f:s:n:r:SD"))) { + while(-1 != (c = getopt(argc, argv, "f:s:n:r:c:SD"))) { switch(c) { case 'f': filepath = optarg; @@ -186,12 +187,17 @@ int main(int argc, char **argv) break; case 'D': #if YYDEBUG - obproxydebug = 1; + ob_proxy_parser_utf8_yydebug = 1; #endif break; case 'n': loop_count = atoi(optarg); break; + case 'c': + if (strcmp(optarg, "utb8") == 0) { + connection_collation = CS_TYPE_UTF8MB4_GENERAL_CI; + } + break; case 'r': checker.result_file_name_ = optarg; } @@ -199,11 +205,11 @@ int main(int argc, char **argv) while (loop_count-- > 0) { if (strlen(filepath) > 0) { - checker.run_parse_file(filepath); + checker.run_parse_file(filepath, connection_collation); } else if (strlen(input_str) > 0) { - checker.run_parse_std_string(input_str); + checker.run_parse_std_string(input_str, connection_collation); } else { - checker.run_parse_file("parser/mysqltest.sql"); + checker.run_parse_file("parser/mysqltest.sql", connection_collation); } } diff --git a/unittest/obproxy/obproxy_parser_checker.h b/unittest/obproxy/obproxy_parser_checker.h index 1fe0b7b..690a457 100644 --- a/unittest/obproxy/obproxy_parser_checker.h +++ b/unittest/obproxy/obproxy_parser_checker.h @@ -60,11 +60,15 @@ public: ~ObProxyParserChecker() {} // parse sql - bool run_parse_string(const common::ObString query_str); - bool run_parse_std_string(std::string query_str); - bool run_parse_file(const char *filename); + bool run_parse_string(const common::ObString query_str, + common::ObCollationType connection_collation); + bool run_parse_std_string(std::string query_str, + common::ObCollationType connection_collation); + bool run_parse_file(const char *filename, + common::ObCollationType connection_collation); int do_obproxy_parser(const common::ObString &query_str, - ObProxyParseResultWapper &result); + ObProxyParseResultWapper &result, + common::ObCollationType connection_collation); void print_stat(); diff --git a/unittest/obproxy/obproxy_parser_test.cpp b/unittest/obproxy/obproxy_parser_test.cpp index 8df9127..ec74427 100755 --- a/unittest/obproxy/obproxy_parser_test.cpp +++ b/unittest/obproxy/obproxy_parser_test.cpp @@ -86,7 +86,7 @@ void do_parser_test(ObProxyMysqlRequest& client_request, std::string query_str) ObProxySqlParser sql_parser; ObSqlParseResult& sql_result = client_request.get_parse_result(); - if (OB_FAIL(sql_parser.parse_sql(input_query, NORMAL_PARSE_MODE, sql_result, true, false, false))) { + if (OB_FAIL(sql_parser.parse_sql(input_query, NORMAL_PARSE_MODE, sql_result, true, CS_TYPE_UTF8MB4_GENERAL_CI, false, false))) { fprintf(stderr, "parse sql failed"); } else if (sql_result.get_proxy_stmt() != NULL) { ObSqlString sql_string; @@ -315,7 +315,7 @@ int parse_sql_fileds(ObProxyMysqlRequest &client_request, ObString expr_sql) { expr_sql += (len_before_where - 1); } } - if(OB_FAIL(expr_parser.parse(expr_sql, expr_result))) { + if(OB_FAIL(expr_parser.parse(expr_sql, expr_result, CS_TYPE_UTF8MB4_GENERAL_CI))) { fprintf(stderr, "parse failed %s\n", expr_sql.ptr()); } else { int64_t t1 = ObTimeUtility::current_time(); diff --git a/unittest/obproxy/test_dual_parser.cpp b/unittest/obproxy/test_dual_parser.cpp index 39de1cd..156911e 100644 --- a/unittest/obproxy/test_dual_parser.cpp +++ b/unittest/obproxy/test_dual_parser.cpp @@ -100,7 +100,7 @@ TEST(ObProxyDualParserTest, SIMPLE_DUAL_MULTI_COL_TEST) ObProxyDualParser parser; ObProxyDualParseResult result; ObString sql = ObString::make_string("select test_seq.next_val, test_seq.min_value, test_seq.uid from dual;"); - parser.parse(sql, result); + parser.parse(sql, result, CS_TYPE_UTF8MB4_GENERAL_CI); show_parser_result(result); ASSERT_FALSE(parser.is_valid_result()); } @@ -109,7 +109,7 @@ TEST(ObProxyDualParserTest, INVALID_COL_TEST) ObProxyDualParser parser; ObProxyDualParseResult result; ObString sql = ObString::make_string("select test_seq1.next_val, test_seq2.min_value, test_seq.uid from dual;"); - parser.parse(sql, result); + parser.parse(sql, result, CS_TYPE_UTF8MB4_GENERAL_CI); show_parser_result(result); ASSERT_FALSE(parser.is_valid_result()); } @@ -118,7 +118,7 @@ TEST(ObProxyDualParserTest, SIMPLE_DUAL_ONE_COL_TEST) ObProxyDualParser parser; ObProxyDualParseResult result; ObString sql = ObString::make_string("select test_sql.nextval from dual"); - parser.parse(sql, result); + parser.parse(sql, result, CS_TYPE_UTF8MB4_GENERAL_CI); show_parser_result(result); ASSERT_TRUE(parser.is_valid_result()); } @@ -127,7 +127,7 @@ TEST(ObProxyDualParserTest, ONE_WHERE_COL_TEST) ObProxyDualParser parser; ObProxyDualParseResult result; ObString sql = ObString::make_string("select test.nextval from dual where sharding_col = '00'"); - parser.parse(sql, result); + parser.parse(sql, result, CS_TYPE_UTF8MB4_GENERAL_CI); show_parser_result(result); ASSERT_TRUE(parser.is_valid_result()); } @@ -136,7 +136,7 @@ TEST(ObProxyDualParserTest, MULTI_WHERE_COLS_TEST) ObProxyDualParser parser; ObProxyDualParseResult result; ObString sql = ObString::make_string("select test_sql.nextval from dual where sharding_col = '123' and name = 'test'"); - parser.parse(sql, result); + parser.parse(sql, result, CS_TYPE_UTF8MB4_GENERAL_CI); show_parser_result(result); ASSERT_TRUE(parser.is_valid_result()); } @@ -145,7 +145,7 @@ TEST(ObProxyDualParserTest, ALIAS_NAME_TEST) ObProxyDualParser parser; ObProxyDualParseResult result; ObString sql = ObString::make_string("select test_seq.nextval next_val, test_seq.min_value min_value, test_seq.uid as uid from dual;"); - parser.parse(sql, result); + parser.parse(sql, result, CS_TYPE_UTF8MB4_GENERAL_CI); show_parser_result(result); ASSERT_FALSE(parser.is_valid_result()); } @@ -162,7 +162,7 @@ int main(int argc, char **argv) ObProxyDualParser parser; ObProxyDualParseResult result; ObString sql = ObString::make_string(argv[1]); - if (OB_FAIL(parser.parse(sql, result))) { + if (OB_FAIL(parser.parse(sql, result, CS_TYPE_UTF8MB4_GENERAL_CI))) { fprintf(stderr, "parse sql failed"); } else { oceanbase::obproxy::show_parser_result(result); diff --git a/unittest/obproxy/test_eventsystem_api.cpp b/unittest/obproxy/test_eventsystem_api.cpp index 1706573..d9498ba 100644 --- a/unittest/obproxy/test_eventsystem_api.cpp +++ b/unittest/obproxy/test_eventsystem_api.cpp @@ -202,7 +202,6 @@ void *thread_g_net_processor_start(void *data) UNUSED(data); int ret = OB_SUCCESS; net::ObNetOptions net_options; - net_options.poll_timeout_ = 10; net_options.max_connections_ = 8192; net_options.default_inactivity_timeout_ = 180000; net_options.max_client_connections_ = 0; diff --git a/unittest/obproxy/test_ldc_location.cpp b/unittest/obproxy/test_ldc_location.cpp index 4e88b8f..1157056 100644 --- a/unittest/obproxy/test_ldc_location.cpp +++ b/unittest/obproxy/test_ldc_location.cpp @@ -830,11 +830,12 @@ TEST_F(TesLDCLocation, fill_strong_read_location) ObLDCItem leader_item; bool entry_need_update = true; bool is_only_readwrite_zone = false; + bool need_use_dup_replica = false; ObSEArray region_names; ObSEArray servers_info; ObString proxy_primary_zone_name; ASSERT_EQ(OB_ERR_UNEXPECTED, ObLDCLocation::fill_strong_read_location(&pl, dummy_ldc, leader_item, target_ldc, entry_need_update, is_only_readwrite_zone, - servers_info, region_names, proxy_primary_zone_name)); + need_use_dup_replica, servers_info, region_names, proxy_primary_zone_name)); ASSERT_EQ(OB_SUCCESS, dummy_ldc.assign(&ts, ss_info_, idc_name, true, cluster_name, OB_DEFAULT_CLUSTER_ID)); ASSERT_TRUE(dummy_ldc.is_ldc_used()); @@ -874,7 +875,7 @@ TEST_F(TesLDCLocation, fill_strong_read_location) ASSERT_TRUE(!dummy_ldc.is_empty()); ASSERT_EQ(OB_SUCCESS, ObLDCLocation::fill_strong_read_location(&pl, dummy_ldc, leader_item, - target_ldc, entry_need_update, is_only_readwrite_zone, servers_info, region_names, proxy_primary_zone_name)); + target_ldc, entry_need_update, is_only_readwrite_zone, need_use_dup_replica, servers_info, region_names, proxy_primary_zone_name)); ASSERT_TRUE(target_ldc.is_ldc_used()); ASSERT_TRUE(!entry_need_update); ASSERT_TRUE(!leader_item.is_valid()); @@ -894,7 +895,7 @@ TEST_F(TesLDCLocation, fill_strong_read_location) is_only_readwrite_zone = true; ASSERT_EQ(OB_SUCCESS, ObLDCLocation::fill_strong_read_location(&pl, dummy_ldc, leader_item, - target_ldc, entry_need_update, is_only_readwrite_zone, servers_info, region_names, proxy_primary_zone_name)); + target_ldc, entry_need_update, is_only_readwrite_zone, need_use_dup_replica, servers_info, region_names, proxy_primary_zone_name)); ASSERT_TRUE(target_ldc.is_ldc_used()); ASSERT_TRUE(entry_need_update); ASSERT_TRUE(leader_item.is_valid()); @@ -910,7 +911,7 @@ TEST_F(TesLDCLocation, fill_strong_read_location) is_only_readwrite_zone = false; ASSERT_EQ(OB_SUCCESS, ObLDCLocation::fill_strong_read_location(&pl, dummy_ldc, leader_item, - target_ldc, entry_need_update, is_only_readwrite_zone, servers_info, region_names, proxy_primary_zone_name)); + target_ldc, entry_need_update, is_only_readwrite_zone, need_use_dup_replica, servers_info, region_names, proxy_primary_zone_name)); ASSERT_TRUE(target_ldc.is_ldc_used()); ASSERT_TRUE(entry_need_update); ASSERT_TRUE(leader_item.is_valid()); -- GitLab