提交 1dadecec 编写于 作者: S Serge Rider

#94 Attribute binding updater

上级 05c53754
......@@ -18,6 +18,7 @@
package org.jkiss.dbeaver.ext.mysql.data;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.model.DBPDataKind;
import org.jkiss.dbeaver.model.DBPDataSource;
import org.jkiss.dbeaver.model.DBPImage;
import org.jkiss.dbeaver.model.DBUtils;
......@@ -26,8 +27,6 @@ import org.jkiss.dbeaver.model.data.DBDValueHandler;
import org.jkiss.dbeaver.model.data.DBDValueHandlerProvider;
import org.jkiss.dbeaver.model.struct.DBSTypedObject;
import java.sql.Types;
/**
* MySQL data types provider
*/
......@@ -43,8 +42,7 @@ public class MySQLValueHandlerProvider implements DBDValueHandlerProvider {
@Override
public DBDValueHandler getHandler(DBPDataSource dataSource, DBDPreferences preferences, DBSTypedObject typedObject)
{
int typeID = typedObject.getTypeID();
if (typeID == Types.DATE || typeID == Types.TIME || typeID == Types.TIMESTAMP) {
if (typedObject.getDataKind() == DBPDataKind.DATETIME) {
return new MySQLDateTimeValueHandler(preferences.getDataFormatterProfile());
} else {
return null;
......
......@@ -36,10 +36,12 @@ public class EpochTimeAttributeTransformer implements DBDAttributeTransformer {
@Override
public void transformAttribute(@NotNull DBCSession session, @NotNull DBDAttributeBinding attribute, @NotNull List<Object[]> rows) throws DBException {
// TODO: Change attribute type (to DATETIME)
attribute.setValueHandler(new EpochValueHandler(attribute.getValueHandler()));
}
private class EpochValueHandler extends ProxyValueHandler {
public EpochValueHandler(DBDValueHandler target) {
super(target);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册