fix: mysql trigger save failed by time formate error
This commit is contained in:
parent
7e49353fdd
commit
56e21a26f2
|
@ -12,10 +12,15 @@ import java.sql.SQLException;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@Slf4j
|
||||
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
|
||||
public List<TriggerMeta> selectTriggers(Connection connection, TableCondition condition) {
|
||||
String sql = "SELECT TRIGGER_CATALOG,\n"
|
||||
|
@ -50,6 +55,12 @@ public class MysqlTableTriggerMetaProvider implements TriggerMetaProvider {
|
|||
String timing = results.getString("ACTION_TIMING");
|
||||
String manipulation = results.getString("EVENT_MANIPULATION");
|
||||
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()
|
||||
.name(name)
|
||||
.manipulation(manipulation)
|
||||
|
|
Loading…
Reference in New Issue