mirror of
https://github.com/vran-dev/databasir.git
synced 2025-10-16 03:43:01 +08:00
fix: mysql trigger save failed by time formate error
This commit is contained in:
@@ -12,10 +12,15 @@ import java.sql.SQLException;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class MysqlTableTriggerMetaProvider implements TriggerMetaProvider {
|
public class MysqlTableTriggerMetaProvider implements TriggerMetaProvider {
|
||||||
|
|
||||||
|
private static final Pattern DATE_TIME_PATTERN =
|
||||||
|
Pattern.compile("(\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2})(.*)");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<TriggerMeta> selectTriggers(Connection connection, TableCondition condition) {
|
public List<TriggerMeta> selectTriggers(Connection connection, TableCondition condition) {
|
||||||
String sql = "SELECT TRIGGER_CATALOG,\n"
|
String sql = "SELECT TRIGGER_CATALOG,\n"
|
||||||
@@ -50,6 +55,12 @@ public class MysqlTableTriggerMetaProvider implements TriggerMetaProvider {
|
|||||||
String timing = results.getString("ACTION_TIMING");
|
String timing = results.getString("ACTION_TIMING");
|
||||||
String manipulation = results.getString("EVENT_MANIPULATION");
|
String manipulation = results.getString("EVENT_MANIPULATION");
|
||||||
String created = results.getString("CREATED");
|
String created = results.getString("CREATED");
|
||||||
|
if (created != null) {
|
||||||
|
Matcher matcher = DATE_TIME_PATTERN.matcher(created);
|
||||||
|
if (matcher.matches()) {
|
||||||
|
created = matcher.group(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
TriggerMeta meta = TriggerMeta.builder()
|
TriggerMeta meta = TriggerMeta.builder()
|
||||||
.name(name)
|
.name(name)
|
||||||
.manipulation(manipulation)
|
.manipulation(manipulation)
|
||||||
|
Reference in New Issue
Block a user