fix dblink print binary double lose precision & flush case result file
This commit is contained in:
@ -160,7 +160,6 @@ int ObLinkOp::init_dblink(uint64_t dblink_id, ObDbLinkProxy *dblink_proxy, bool
|
|||||||
OB_FAIL(my_session->get_dblink_context().set_dblink_conn(dblink_conn_))) {
|
OB_FAIL(my_session->get_dblink_context().set_dblink_conn(dblink_conn_))) {
|
||||||
LOG_WARN("failed to set dblink connection to session", K(in_xa_trascaction_), K(my_session), K(sessid_), K(ret));
|
LOG_WARN("failed to set dblink connection to session", K(in_xa_trascaction_), K(my_session), K(sessid_), K(ret));
|
||||||
} else {
|
} else {
|
||||||
in_xa_trascaction_ = true; //to tell link scan op don't release dblink_conn_
|
|
||||||
LOG_TRACE("link op get connection from dblink pool", K(in_xa_trascaction_), KP(dblink_conn_), K(lbt()));
|
LOG_TRACE("link op get connection from dblink pool", K(in_xa_trascaction_), KP(dblink_conn_), K(lbt()));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -253,10 +252,15 @@ int ObLinkOp::combine_link_stmt(const ObString &link_stmt_fmt,
|
|||||||
obj_print_params.need_cast_expr_ = true;
|
obj_print_params.need_cast_expr_ = true;
|
||||||
obj_print_params.print_const_expr_type_ = true;
|
obj_print_params.print_const_expr_type_ = true;
|
||||||
while (OB_SUCC(ret) && link_stmt_pos == saved_stmt_pos) {
|
while (OB_SUCC(ret) && link_stmt_pos == saved_stmt_pos) {
|
||||||
|
if (128 > (stmt_buf_len_ - link_stmt_pos) && // ensure all params has sufficient mem to print as literal sql, avoiding lose precision
|
||||||
|
OB_FAIL(extend_stmt_buf())) {
|
||||||
|
LOG_WARN("failed to extend stmt buf", K(ret));
|
||||||
|
}
|
||||||
//Previously, the format parameter of the print sql literal function was NULL.
|
//Previously, the format parameter of the print sql literal function was NULL.
|
||||||
//In the procedure scenario, when dblink reverse spell trunc(date type), it will treat the date type as a string,
|
//In the procedure scenario, when dblink reverse spell trunc(date type), it will treat the date type as a string,
|
||||||
//so correct formatting parameter obj_print_params need to be given.
|
//so correct formatting parameter obj_print_params need to be given.
|
||||||
if (OB_FAIL(param.print_sql_literal(stmt_buf_, stmt_buf_len_, link_stmt_pos, obj_print_params))) {
|
if (OB_FAIL(ret)) {
|
||||||
|
} else if (OB_FAIL(param.print_sql_literal(stmt_buf_, stmt_buf_len_, link_stmt_pos, obj_print_params))) {
|
||||||
if (ret == OB_SIZE_OVERFLOW) {
|
if (ret == OB_SIZE_OVERFLOW) {
|
||||||
ret = OB_SUCCESS;
|
ret = OB_SUCCESS;
|
||||||
if (OB_FAIL(extend_stmt_buf())) {
|
if (OB_FAIL(extend_stmt_buf())) {
|
||||||
@ -286,10 +290,16 @@ int ObLinkOp::combine_link_stmt(const ObString &link_stmt_fmt,
|
|||||||
// do nothing
|
// do nothing
|
||||||
} else if (link_stmt_pos >= stmt_buf_len_ && OB_FAIL(extend_stmt_buf(link_stmt_pos + 1))) {
|
} else if (link_stmt_pos >= stmt_buf_len_ && OB_FAIL(extend_stmt_buf(link_stmt_pos + 1))) {
|
||||||
LOG_WARN("failed to extend stmt buf", K(ret), K(link_stmt_pos), K(stmt_buf_len_));
|
LOG_WARN("failed to extend stmt buf", K(ret), K(link_stmt_pos), K(stmt_buf_len_));
|
||||||
|
} else {
|
||||||
|
if (link_stmt_pos + 1 >= stmt_buf_len_ && OB_FAIL(extend_stmt_buf())) {
|
||||||
|
LOG_WARN("failed to extend stmt buf", K(ret));
|
||||||
} else {
|
} else {
|
||||||
stmt_buf_[link_stmt_pos++] = 0;
|
stmt_buf_[link_stmt_pos++] = 0;
|
||||||
LOG_DEBUG("succ to combine link sql", K(stmt_buf_), K(link_stmt_pos));
|
LOG_DEBUG("succ to combine link sql", K(stmt_buf_), K(link_stmt_pos));
|
||||||
if (DBLINK_DRV_OB == link_type_) {
|
}
|
||||||
|
if (OB_FAIL(ret)) {
|
||||||
|
// do nothing
|
||||||
|
} else if (DBLINK_DRV_OB == link_type_) {
|
||||||
snprintf(stmt_buf_, head_comment_length_, head_comment_fmt_, next_sql_req_level_);
|
snprintf(stmt_buf_, head_comment_length_, head_comment_fmt_, next_sql_req_level_);
|
||||||
// after snprint only head_comment_length_ - 1 byte was printed by head comment
|
// after snprint only head_comment_length_ - 1 byte was printed by head comment
|
||||||
// pos of head_comment_length_ - 1 is '\0', need filled as ' '
|
// pos of head_comment_length_ - 1 is '\0', need filled as ' '
|
||||||
|
|||||||
Reference in New Issue
Block a user