Fix printer bugs

This commit is contained in:
xianyu-w
2023-06-22 03:42:42 +00:00
committed by ob-robot
parent 7851991b8b
commit 1858194fc4
5 changed files with 201 additions and 136 deletions

View File

@ -113,6 +113,36 @@ private:
int ret_;
};
class ObISqlPrinter
{
protected:
virtual int inner_print(char *buf, int64_t buf_len, int64_t &pos) = 0;
public:
virtual int do_print(ObIAllocator &allocator, ObString &result);
virtual ~ObISqlPrinter() = default;
};
class ObSqlPrinter : public ObISqlPrinter
{
public:
ObSqlPrinter(const ObStmt *stmt,
ObSchemaGetterGuard *schema_guard,
ObObjPrintParams print_params,
const ParamStore *param_store) :
stmt_(stmt),
schema_guard_(schema_guard),
print_params_(print_params),
param_store_(param_store)
{}
virtual int inner_print(char *buf, int64_t buf_len, int64_t &res_len) override;
protected:
const ObStmt *stmt_;
ObSchemaGetterGuard *schema_guard_;
ObObjPrintParams print_params_;
const ParamStore *param_store_;
};
class ObSQLUtils
{
public:
@ -368,11 +398,10 @@ public:
ObSchemaGetterGuard *schema_guard,
ObObjPrintParams print_params = ObObjPrintParams(),
const ParamStore *param_store = NULL);
static int print_sql(ObIAllocator &allocator,
char *buf,
static int print_sql(char *buf,
int64_t buf_len,
int64_t &pos,
const ObStmt *stmt,
ObString &sql,
ObSchemaGetterGuard *schema_guard,
ObObjPrintParams print_params,
const ParamStore *param_store = NULL);