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

@ -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.
}
}