fix oci pull meta bug

This commit is contained in:
obdev
2023-04-27 13:11:52 +00:00
committed by ob-robot
parent 6873db3200
commit ea5c70b38c
7 changed files with 12 additions and 9 deletions

View File

@ -84,8 +84,6 @@ void ObMySQLResult::format_precision_scale_length(int16_t &precision, int16_t &s
// format precision from others to oceanbase
if (ob_is_nstring(ob_type)) {
precision = LS_CHAR; // precision is LS_CHAR means national character set (unicode)
} else if (ob_is_varchar_or_char(ob_type, cs_type)) {
precision = LS_BYTE; // precision is LS_BYTE means ascii character set (non-unicode)
} else if (ObNumberFloatType == ob_type) {
precision = tmp_precision; //bit precision, not decimal precision
} else if (tmp_precision < OB_MIN_NUMBER_PRECISION || tmp_precision > OB_MAX_NUMBER_PRECISION) {

View File

@ -1371,7 +1371,7 @@ public:
virtual int get_type(const int64_t col_idx, ObObjMeta &type) const = 0;
virtual int get_col_meta(const int64_t col_idx, bool old_max_length,
oceanbase::common::ObString &name, ObObjMeta &meta,
int16_t &precision, int16_t &scale, int32_t &length) const = 0;
ObAccuracy &acc) const = 0;
void format_precision_scale_length(int16_t &precision, int16_t &scale, int32_t &length,
oceanbase::common::ObObjType ob_type, oceanbase::common::ObCollationType cs_type,
DblinkDriverProto link_type, bool old_max_length) const;

View File

@ -751,7 +751,7 @@ int ObMySQLResultImpl::get_type(const int64_t col_idx, ObObjMeta &type) const
}
int ObMySQLResultImpl::get_col_meta(const int64_t col_idx, bool old_max_length,
oceanbase::common::ObString &name, ObObjMeta &meta,
int16_t &precision, int16_t &scale, int32_t &length) const
ObAccuracy &acc) const
{
int ret = OB_SUCCESS;
return ret;

View File

@ -78,7 +78,7 @@ public:
int get_type(const int64_t col_idx, ObObjMeta &type) const override;
int get_col_meta(const int64_t col_idx, bool old_max_length,
oceanbase::common::ObString &name, ObObjMeta &meta,
int16_t &precision, int16_t &scale, int32_t &length) const override;
ObAccuracy &acc) const override;
int get_ob_type(ObObjType &ob_type, obmysql::EMySQLFieldType mysql_type) const;
int get_obj(const int64_t col_idx, ObObj &obj,
const common::ObTimeZoneInfo *tz_info = NULL,

View File

@ -544,9 +544,9 @@ int ObInnerSQLResult::get_type(const int64_t col_idx, ObObjMeta &type) const
int ObInnerSQLResult::get_col_meta(const int64_t col_idx, bool old_max_length,
oceanbase::common::ObString &name, ObObjMeta &meta,
int16_t &precision, int16_t &scale, int32_t &length) const
ObAccuracy &acc) const
{
UNUSEDx(col_idx, old_max_length, name, meta);
UNUSEDx(col_idx, old_max_length, name, meta, acc);
int ret = OB_ERR_UNEXPECTED;
return ret;
}

View File

@ -79,7 +79,7 @@ public:
virtual int get_type(const int64_t col_idx, ObObjMeta &type) const override;
virtual int get_col_meta(const int64_t col_idx, bool old_max_length,
oceanbase::common::ObString &name, ObObjMeta &meta,
int16_t &precision, int16_t &scale, int32_t &length) const override;
ObAccuracy &acc) const override;
virtual int64_t get_column_count() const override;
virtual int get_obj(const int64_t col_idx, ObObj &obj,
const common::ObTimeZoneInfo *tz_info = NULL,

View File

@ -8454,11 +8454,15 @@ int ObSchemaServiceSQLImpl::fetch_link_table_info(uint64_t tenant_id,
int32_t length = 0;
ObString column_name;
bool old_max_length = false;
if (OB_FAIL(result->get_col_meta(i, old_max_length, column_name, type, precision, scale, length))) {
ObAccuracy acc;
if (OB_FAIL(result->get_col_meta(i, old_max_length, column_name, type, acc))) {
LOG_WARN("failed to get column meta", K(i), K(old_max_length), K(ret));
} else if (OB_FAIL(column_schema.set_column_name(column_name))) {
LOG_WARN("failed to set column name", K(i), K(column_name), K(ret));
} else {
precision = acc.get_precision();
scale = acc.get_scale();
length = acc.get_length();
column_schema.set_table_id(tmp_table_schema.get_table_id());
column_schema.set_tenant_id(tenant_id);
column_schema.set_column_id(i + OB_END_RESERVED_COLUMN_ID_NUM);
@ -8466,6 +8470,7 @@ int ObSchemaServiceSQLImpl::fetch_link_table_info(uint64_t tenant_id,
column_schema.set_charset_type(ObCharset::charset_type_by_coll(column_schema.get_collation_type()));
column_schema.set_data_precision(precision);
column_schema.set_data_scale(scale);
LOG_DEBUG("schema service sql impl get DBLINK schema", K(column_schema), K(length));
if (need_desc && OB_ISNULL(desc_result) &&
(ObNCharType == column_schema.get_data_type() || ObNVarchar2Type == column_schema.get_data_type())) {
if (OB_FAIL(desc_sql.append_fmt(desc_sql_str_fmt, database_name.length(), database_name.ptr(),