support view trigger producer function

This commit is contained in:
jipengfei-jpf
2023-08-13 19:40:57 +08:00
parent b4006c8a28
commit e2d76e7b56
3 changed files with 53 additions and 1 deletions

View File

@ -1,4 +1,4 @@
# 2.0.12
# 2.0.13
## ⭐ New Features
@ -12,6 +12,12 @@
- Fixed an issue where locally stored theme colors and background colors are incompatible with the new version, causing page crashes
- Logs desensitize sensitive data
- Fix the issue of 'CLOB' not displaying specific content [Issue #440](https://github.com/chat2db/Chat2DB/issues/440)
- Fix the problem that non-Select does not display query results
- Fix the problem that Oracle cannot query without schema
- Fix the problem of special type of SQL execution error reporting
## ⭐ 新特性
@ -25,6 +31,9 @@
- 修复本地存储的主题色、背景色与新版本不兼容时会导致页面崩溃问题
- 日志对敏感数据进行脱敏
- 修复 `CLOB` 不展示具体内容的问题 [Issue #440](https://github.com/chat2db/Chat2DB/issues/440)
- 修复非Select不展示查询结果的问题
- 修复Oracle不带schema无法查询的问题
- 修复特殊类型的SQL执行报错的问题
# 2.0.11

View File

@ -0,0 +1,7 @@
package ai.chat2db.server.domain.core.util;
public class H2Functions {
public static String keyGeneratorFunction(String tableName) {
return null;
}
}

View File

@ -0,0 +1,36 @@
package ai.chat2db.server.domain.core.util;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Arrays;
import org.h2.api.Trigger;
public class H2Triggers implements Trigger {
@Override
public void init(Connection conn, String schemaName, String triggerName,
String tableName, boolean before, int type) throws SQLException {
// Initialization logic, if needed.
}
@Override
public void fire(Connection conn, Object[] oldRow, Object[] newRow)
throws SQLException {
// This method is called when the trigger is executed.
// In this example, let's simply print the new values when a row is inserted.
if (newRow != null) {
System.out.println("New Row Inserted: " + Arrays.toString(newRow));
}
}
@Override
public void close() throws SQLException {
// Cleanup logic, if needed.
}
@Override
public void remove() throws SQLException {
// Logic to execute when the trigger is dropped/removed.
}
}