v1.8.78
- fix sql or py_sql macro
upper_case_sql_keyword
feature enable's bug - add plugin
BlockAttackDeleteInterceptor
andBlockAttackUpdateInterceptor
When operating on the database, especially the management authority (usually SA account) to operate on the data, there may be no attention to conditions in the operation process, resulting in the full table operation, such as:
1, delete,
delete from tablename
2, update,
update tablename set columnname = value
- add plugin for
RbatisLogFormatSqlIntercept
for example:
/// Formatting precompiled SQL
///
/// [] Exec ==> insert into biz_activity (id,name,pc_link,h5_link,pc_banner_img,h5_banner_img,sort,status,remark,create_time,version,delete_flag)
/// values (?,?,?,?,?,?,?,?,?,?,?,?)
///
/// into
///
/// [rbatis] [] [format_sql]insert into biz_activity (id,name,pc_link,h5_link,pc_banner_img,h5_banner_img,sort,status,remark,create_time,version,delete_flag)
/// values ("12312","12312",null,null,null,null,"1",1,null,"2021-03-10T20:34:47.432751100",1,1)
#[async_std::test]
pub async fn test_show_format_sql() {
fast_log::init_log("requests.log", 1000, log::Level::Info, None, true);
let mut rb = Rbatis::new();
rb.add_sql_intercept(RbatisLogFormatSqlIntercept{});
rb.link("mysql://root:123456@localhost:3306/test")
.await
.unwrap();
let activity = BizActivity {
id: Some("12312".to_string()),
name: Some("12312".to_string()),
pc_link: None,
h5_link: None,
pc_banner_img: None,
h5_banner_img: None,
sort: Some("1".to_string()),
status: Some(1),
remark: None,
create_time: Some(NaiveDateTime::now()),
version: Some(1),
delete_flag: Some(1),
};
let r = rb.save("", &activity).await;
}
- fix no return problem when interceptors return errors