diff --git a/build.xml b/build.xml
index 80bc907..244edb0 100644
--- a/build.xml
+++ b/build.xml
@@ -88,8 +88,8 @@
-
-
+
+
diff --git a/plugin.xml b/plugin.xml
index fde589c..b1a2a00 100755
--- a/plugin.xml
+++ b/plugin.xml
@@ -3,12 +3,13 @@
com.fr.solution.plugin.db.redis.v10
yes
- 6.0
+ 6.1
10.0
2018-11-29
richie
[2019-03-21]现在可以通过跳板服务连接redis。
[2019-03-18]修复连接没有释放的问题。
[2019-03-18]增加程序数据集,可以使用javascript进行取数,需要2019-03-01之后的版本。
diff --git a/src/main/java/com/fr/plugin/db/redis/core/RedisScriptTableDataModel.java b/src/main/java/com/fr/plugin/db/redis/core/RedisScriptTableDataModel.java
index f163ac8..29267b0 100644
--- a/src/main/java/com/fr/plugin/db/redis/core/RedisScriptTableDataModel.java
+++ b/src/main/java/com/fr/plugin/db/redis/core/RedisScriptTableDataModel.java
@@ -1,18 +1,11 @@
package com.fr.plugin.db.redis.core;
-import com.eclipsesource.v8.V8;
-import com.eclipsesource.v8.V8Array;
-import com.eclipsesource.v8.V8Object;
-import com.fr.base.TableData;
import com.fr.data.AbstractDataModel;
import com.fr.plugin.db.redis.core.emb.Redis;
-import com.fr.plugin.db.redis.help.Console;
-import com.fr.plugin.db.redis.help.Files;
import com.fr.plugin.db.redis.help.RedisClient;
-import com.fr.plugin.db.redis.util.RedisUtils;
-import com.fr.third.redis.clients.jedis.Jedis;
+import com.fr.plugin.db.redis.help.RedisClientSelector;
+import com.fr.plugin.db.redis.help.client.SimpleDataModel;
-import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
@@ -43,69 +36,15 @@ public class RedisScriptTableDataModel extends AbstractDataModel {
}
Redis redis = mc.createRedisClient();
redis.getClient().select(dbIndex);
- V8 v8 = V8.createV8Runtime();
- RedisClient client = new RedisClient(v8, redis.getClient());
- V8Object v8Console = initConsole(v8);
- V8Object v8Require = initRequire(v8);
- V8Object v8Client = initRedis(v8, client);
-
- v8.executeVoidScript(
- "function unique(array) {return Array.from(new Set(array));};" +
- "function merge(table, column) {return {content:table, column:column}};");
-
- V8Object returnObj = v8.executeObjectScript(String.format("(function(){%s})();", script));
-
- V8Array v8Column = returnObj.getArray("column");
- V8Array v8Table = returnObj.getArray("content");
- int columnCount = v8Column.length();
- columnNames = new String[columnCount];
- for (int i = 0; i < columnCount; i++) {
- columnNames[i] = String.valueOf(v8Column.get(i));
+ RedisClient redisClient = RedisClientSelector.select(redis);
+ SimpleDataModel simple = redisClient.build(redis, script, rowCount);
+ if (simple != null) {
+ this.columnNames = simple.getColumnNames();
+ this.data = simple.getData();
+ this.rowCount = simple.getRowCount();
}
- int returnRowCount = v8Table.length();
- int realCount = rowCount == TableData.RESULT_ALL ? returnRowCount : Math.min(returnRowCount, this.rowCount);
- for (int i = 0; i < realCount; i++) {
- V8Array v8Row = v8Table.getArray(i);
- List