提交 509bc740 编写于 作者: S Serge Rider

#3761 MySQL event object model fix


Former-commit-id: e82d537a
上级 c4baed83
...@@ -20,11 +20,13 @@ import org.jkiss.code.NotNull; ...@@ -20,11 +20,13 @@ import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable; import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.DBException; import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.model.DBConstants; import org.jkiss.dbeaver.model.DBConstants;
import org.jkiss.dbeaver.model.DBPSaveableObject;
import org.jkiss.dbeaver.model.DBUtils; import org.jkiss.dbeaver.model.DBUtils;
import org.jkiss.dbeaver.model.impl.jdbc.JDBCUtils; import org.jkiss.dbeaver.model.impl.jdbc.JDBCUtils;
import org.jkiss.dbeaver.model.meta.Property; import org.jkiss.dbeaver.model.meta.Property;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor; import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.model.sql.SQLUtils; import org.jkiss.dbeaver.model.sql.SQLUtils;
import org.jkiss.dbeaver.model.struct.DBSObject;
import org.jkiss.utils.CommonUtils; import org.jkiss.utils.CommonUtils;
import java.sql.ResultSet; import java.sql.ResultSet;
...@@ -37,11 +39,13 @@ import java.util.Map; ...@@ -37,11 +39,13 @@ import java.util.Map;
/** /**
* MySQLEvent * MySQLEvent
*/ */
public class MySQLEvent extends MySQLInformation implements MySQLSourceObject { public class MySQLEvent implements MySQLSourceObject, DBPSaveableObject {
private static final String CAT_DETAILS = "Details"; private static final String CAT_DETAILS = "Details";
private static final String CAT_STATS = "Statistics"; private static final String CAT_STATS = "Statistics";
private MySQLCatalog catalog;
private boolean persisted;
private String name; private String name;
private String definer; private String definer;
private String timeZone; private String timeZone;
...@@ -68,10 +72,19 @@ public class MySQLEvent extends MySQLInformation implements MySQLSourceObject { ...@@ -68,10 +72,19 @@ public class MySQLEvent extends MySQLInformation implements MySQLSourceObject {
public MySQLEvent(MySQLCatalog catalog, ResultSet dbResult) public MySQLEvent(MySQLCatalog catalog, ResultSet dbResult)
throws SQLException throws SQLException
{ {
super(catalog.getDataSource()); this.catalog = catalog;
this.persisted = true;
this.loadInfo(dbResult); this.loadInfo(dbResult);
} }
public MySQLEvent(MySQLCatalog catalog, boolean persisted, String name) {
this.catalog = catalog;
this.name = name;
this.persisted = false;
}
private void loadInfo(ResultSet dbResult) private void loadInfo(ResultSet dbResult)
throws SQLException throws SQLException
{ {
...@@ -115,6 +128,26 @@ public class MySQLEvent extends MySQLInformation implements MySQLSourceObject { ...@@ -115,6 +128,26 @@ public class MySQLEvent extends MySQLInformation implements MySQLSourceObject {
return eventComment; return eventComment;
} }
@Override
public DBSObject getParentObject() {
return catalog;
}
@Override
public MySQLDataSource getDataSource() {
return catalog.getDataSource();
}
@Override
public boolean isPersisted() {
return persisted;
}
@Override
public void setPersisted(boolean persisted) {
this.persisted = persisted;
}
@Property(viewable = true, order = 10) @Property(viewable = true, order = 10)
public String getEventType() { public String getEventType() {
return eventType; return eventType;
...@@ -242,4 +275,5 @@ public class MySQLEvent extends MySQLInformation implements MySQLSourceObject { ...@@ -242,4 +275,5 @@ public class MySQLEvent extends MySQLInformation implements MySQLSourceObject {
public void setObjectDefinitionText(String sourceText) throws DBException { public void setObjectDefinitionText(String sourceText) throws DBException {
eventDefinition = sourceText; eventDefinition = sourceText;
} }
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册