From 54189a85a60165e849f4c2d541a5b0763cd21788 Mon Sep 17 00:00:00 2001 From: richie Date: Fri, 30 Nov 2018 13:55:00 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9D=9EJDBC=E4=B8=8D=E5=BD=B1=E5=93=8DJDBC?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin.xml | 5 +++-- .../db/redis/core/RedisDatabaseConnection.java | 15 ++++++++++++++- .../fr/plugin/db/redis/core/RedisTableData.java | 2 +- .../db/redis/ui/RedisDBConnectionChosePane.java | 10 +++------- 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/plugin.xml b/plugin.xml index 3611e87..3db1012 100755 --- a/plugin.xml +++ b/plugin.xml @@ -3,12 +3,13 @@ com.fr.solution.plugin.db.redis.v10 yes - 4.0 + 4.1 10.0 - 2018-08-20 + 2018-11-30 richie [2018-11-26]解决10.0版本中服务器数据集无法保存的问题。
[2018-09-12]适配10.0版本。
[2018-05-12]增加了keys、hget、hmget、hkeys查询。
diff --git a/src/main/java/com/fr/plugin/db/redis/core/RedisDatabaseConnection.java b/src/main/java/com/fr/plugin/db/redis/core/RedisDatabaseConnection.java index bbf4ce4..32e4059 100755 --- a/src/main/java/com/fr/plugin/db/redis/core/RedisDatabaseConnection.java +++ b/src/main/java/com/fr/plugin/db/redis/core/RedisDatabaseConnection.java @@ -6,6 +6,7 @@ import com.fr.data.impl.AbstractDatabaseConnection; import com.fr.data.impl.Connection; import com.fr.general.Inter; import com.fr.security.SecurityToolbox; +import com.fr.stable.ArrayUtils; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.stable.xml.XMLPrintWriter; @@ -13,6 +14,7 @@ import com.fr.stable.xml.XMLableReader; import redis.clients.jedis.Jedis; import java.util.List; +import java.util.Set; public class RedisDatabaseConnection extends AbstractDatabaseConnection { @@ -51,6 +53,7 @@ public class RedisDatabaseConnection extends AbstractDatabaseConnection { } + @Override public void testConnection() throws Exception { Jedis client = createRedisClient(); @@ -75,7 +78,17 @@ public class RedisDatabaseConnection extends AbstractDatabaseConnection { @Override public java.sql.Connection createConnection() throws Exception { - return null; + return Connection.IGNORE; + } + + @Override + public String[] summary(String... args) { + if (ArrayUtils.isEmpty(args)) { + return ArrayUtils.EMPTY_STRING_ARRAY; + } else { + Set keys = createRedisClient().keys(args[0]); + return keys.toArray(new String[0]); + } } @Override diff --git a/src/main/java/com/fr/plugin/db/redis/core/RedisTableData.java b/src/main/java/com/fr/plugin/db/redis/core/RedisTableData.java index 9ad03d8..06a8b09 100755 --- a/src/main/java/com/fr/plugin/db/redis/core/RedisTableData.java +++ b/src/main/java/com/fr/plugin/db/redis/core/RedisTableData.java @@ -33,7 +33,7 @@ import java.util.Map; public class RedisTableData extends AbstractParameterTableData { private Conf database = Holders.obj(null, Connection.class); - private Conf dbIndex = XmlHolders.obj(new NumberOrderValue(0), OrderValue.class); + private Conf dbIndex = XmlHolders.obj(new NumberOrderValue(0), OrderValue.class, OrderValue.XML_TAG); private Conf query = Holders.simple(StringUtils.EMPTY); public void setDatabase(Connection c) { diff --git a/src/main/java/com/fr/plugin/db/redis/ui/RedisDBConnectionChosePane.java b/src/main/java/com/fr/plugin/db/redis/ui/RedisDBConnectionChosePane.java index 6f9c08b..fa83d2f 100755 --- a/src/main/java/com/fr/plugin/db/redis/ui/RedisDBConnectionChosePane.java +++ b/src/main/java/com/fr/plugin/db/redis/ui/RedisDBConnectionChosePane.java @@ -1,7 +1,7 @@ package com.fr.plugin.db.redis.ui; -import com.fr.base.FRContext; import com.fr.data.impl.Connection; +import com.fr.data.operator.DataOperator; import com.fr.design.data.datapane.connect.ConnectionComboBoxPanel; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ibutton.UIButton; @@ -9,10 +9,9 @@ import com.fr.design.gui.itextfield.PlaceholderTextField; import com.fr.design.i18n.Toolkit; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.file.DatasourceManager; -import com.fr.general.Inter; import com.fr.log.FineLoggerFactory; -import com.fr.plugin.db.redis.ui.event.DataLoadedListener; import com.fr.plugin.db.redis.core.RedisDatabaseConnection; +import com.fr.plugin.db.redis.ui.event.DataLoadedListener; import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; @@ -22,8 +21,6 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.List; -import java.util.Set; -import java.util.concurrent.ExecutionException; public class RedisDBConnectionChosePane extends BasicPane { @@ -100,8 +97,7 @@ public class RedisDBConnectionChosePane extends BasicPane { if (StringUtils.isEmpty(keysPattern)) { return ArrayUtils.EMPTY_STRING_ARRAY; } else { - Set keys = connection.createRedisClient().keys(keysPattern); - return keys.toArray(new String[keys.size()]); + return DataOperator.getInstance().getTableSummary(connection, keysPattern); } }