mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix code
This commit is contained in:
@@ -2,6 +2,7 @@ package org.dromara.hutool.db;
|
||||
|
||||
import org.dromara.hutool.core.lang.Console;
|
||||
import org.dromara.hutool.db.config.DbConfig;
|
||||
import org.dromara.hutool.db.config.SettingConfigParser;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@@ -28,4 +29,22 @@ public class IssueI8UTGPTest {
|
||||
|
||||
Assertions.assertTrue(isFilterValid.get());
|
||||
}
|
||||
|
||||
@Test
|
||||
void customSqlLogTest2() {
|
||||
final AtomicBoolean isFilterValid = new AtomicBoolean(false);
|
||||
|
||||
final DbConfig dbConfig = SettingConfigParser.of().parse("test");
|
||||
dbConfig.addSqlFilter((conn, boundSql, returnGeneratedKey) -> {
|
||||
isFilterValid.set(true);
|
||||
Console.log("Custom log: {}", boundSql.getSql());
|
||||
});
|
||||
|
||||
final Db db = Db.of(dbConfig);
|
||||
|
||||
final List<Entity> find = db.query("select * from user where age = ?", 18);
|
||||
Assertions.assertEquals("王五", find.get(0).get("name"));
|
||||
|
||||
Assertions.assertTrue(isFilterValid.get());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user