Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[新功能方案讨论] 实现会话级变量设置 #166

Closed
hanchuanchuan opened this issue Mar 7, 2020 · 4 comments
Closed

[新功能方案讨论] 实现会话级变量设置 #166

hanchuanchuan opened this issue Mar 7, 2020 · 4 comments
Labels
wontfix This will not be worked on

Comments

@hanchuanchuan
Copy link
Owner

描述您想要的功能:

添加会话级变量设置,实现更灵活的审核规则配置。

用法:

/*--user=xxx;--password=xxx;--host=127.0.0.1;--port=3306;--check=1;*/
inception_magic_start;
use test;

-- 支持用法
inception set ghost_on = 0,osc_on = 1; /* 支持 */
inception set session ghost_on = 0,osc_on = 1; /* 支持, 和上面完全一致 */

-- 错误示例
inception set global ghost_on = 0,osc_on = 1; /* ERROR: 全局变量仅支持单独设置 */
inception set ghost_on = '123'; /* ERROR: Variable 'ghost_on' can't be set to the value of '123' */
inception set level er_table_must_have_comment = 2; /* ERROR: 暂不支持会话级的自定义审核级别 */

create table t1(id int primary key,c1 bigint(10));
 
inception_magic_commit;

重要说明:
inception会话变量正确设置时,该行SQL不再返回!以免后续误发送到mysql端。
(会记录相应日志,以便追溯查看)

示例一:

/*--user=xxx;--password=xxx;--host=127.0.0.1;--port=3306;--check=1;*/
inception_magic_start;
use test;

drop table if exists t1,t2;

inception set check_table_comment = 1;

create table t1(id int primary key);

inception set check_table_comment = 0;

create table t2(id int primary key);
 
inception_magic_commit;

审核结果(隐藏了部分列):
注意,inception set 的行并不返回!除非set失败报错。

order_id stage error_level stage_status error_message sql
1 CHECKED 0 Audit Completed None use test_inc
2 CHECKED 0 Audit Completed None drop table if exists t1,t2
3 CHECKED 1 Audit Completed 表 't1' 需要设置注释. create table t1(id int primary key)values(1,1,1)
4 CHECKED 0 Audit Completed None create table t2(id int primary key)
@hanchuanchuan
Copy link
Owner Author

相关issue #157

hanchuanchuan added a commit that referenced this issue Mar 8, 2020
@hhyo
Copy link
Contributor

hhyo commented Mar 8, 2020

除了在inception_magic域范围内设置,在范外可以设置么

@hanchuanchuan
Copy link
Owner Author

范围外只能设置全局参数,执行审核时不能设置,只能在单独执行SQL时使用。会话级参数和全局参数不能混用。
全局参数一直是支持的(并且即使不加global也只会全局更改)。

@stale
Copy link

stale bot commented Mar 22, 2020

由于此问题没有最近的活动,因此已被自动标记为陈旧。如果没有进一步的活动,会作为不活跃issue关闭。感谢你对本项目的贡献。 This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Mar 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants