Skip to content

Commit 7813ad8

Browse files
committed
remove table_name field from the desc result (#107)
1. Setting precompiled without timeout 2. suplement error message 3. remove table_name field from the desc result 4. fix parseCallOutput
1 parent 2c01fea commit 7813ad8

File tree

5 files changed

+25
-11
lines changed

5 files changed

+25
-11
lines changed

src/demo/java/org/fisco/bcos/sdk/demo/perf/parallel/DagPrecompiledDemo.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ public void run() {
8787
callback.setUser(dtu);
8888
try {
8989
callback.recordStartTime();
90+
callback.setTimeout(0);
9091
dagTransfer.userAdd(user, amount, callback);
9192
int current = sended.incrementAndGet();
9293
if (current >= area && ((current % area) == 0)) {

src/main/java/org/fisco/bcos/sdk/contract/precompiled/crud/TableCRUDService.java

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -177,17 +177,26 @@ public static List<Map<String, String>> parseSelectResult(String selectResult)
177177

178178
private List<Map<String, String>> getTableDescLessThan230Version(
179179
EnumNodeVersion.Version enumNodeVersion, String tableName) throws ContractException {
180+
List<Map<String, String>> tableDesc = new ArrayList<>();
180181
if (enumNodeVersion.getMajor() == 2 && enumNodeVersion.getMinor() < 2) {
181-
return select(
182-
PrecompiledConstant.SYS_TABLE,
183-
PrecompiledConstant.USER_TABLE_PREFIX + tableName,
184-
new Condition());
182+
tableDesc =
183+
select(
184+
PrecompiledConstant.SYS_TABLE,
185+
PrecompiledConstant.USER_TABLE_PREFIX + tableName,
186+
new Condition());
185187
} else {
186-
return select(
187-
PrecompiledConstant.SYS_TABLE,
188-
PrecompiledConstant.USER_TABLE_PREFIX_2_2_0_VERSION + tableName,
189-
new Condition());
188+
tableDesc =
189+
select(
190+
PrecompiledConstant.SYS_TABLE,
191+
PrecompiledConstant.USER_TABLE_PREFIX_2_2_0_VERSION + tableName,
192+
new Condition());
190193
}
194+
for (Map<String, String> item : tableDesc) {
195+
if (item.containsKey(PrecompiledConstant.TABLE_NAME_FIELD)) {
196+
item.remove(PrecompiledConstant.TABLE_NAME_FIELD);
197+
}
198+
}
199+
return tableDesc;
191200
}
192201

193202
private List<Map<String, String>> getTableDesc(String tableName) throws ContractException {

src/main/java/org/fisco/bcos/sdk/contract/precompiled/model/PrecompiledConstant.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,5 @@ public class PrecompiledConstant {
3636

3737
public static final String KEY_FIELD_NAME = "key_field";
3838
public static final String VALUE_FIELD_NAME = "value_field";
39+
public static final String TABLE_NAME_FIELD = "table_name";
3940
}

src/main/java/org/fisco/bcos/sdk/contract/precompiled/model/PrecompiledRetCode.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ public class PrecompiledRetCode {
102102
"The committee permission control by ChainGovernancePrecompiled are recommended");
103103
public static final RetCode CODE_CONTRACT_NOT_EXIST =
104104
new RetCode(-51003, "The contract is not exist");
105-
public static final RetCode CODE_TABLE_NAME_OVERFLOW = new RetCode(-51002, "");
105+
public static final RetCode CODE_TABLE_NAME_OVERFLOW =
106+
new RetCode(-51002, "The table name string length exceeds the maximum limit");
106107
public static final RetCode CODE_TABLE_AND_ADDRESS_NOT_EXIST =
107108
new RetCode(-51001, "The table name and address not exist");
108109
public static final RetCode CODE_TABLE_AND_ADDRESS_EXIST =

src/main/java/org/fisco/bcos/sdk/transaction/codec/decode/ReceiptParser.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import org.fisco.bcos.sdk.model.RevertMessageParser;
2424
import org.fisco.bcos.sdk.model.TransactionReceipt;
2525
import org.fisco.bcos.sdk.model.TransactionReceiptStatus;
26+
import org.fisco.bcos.sdk.utils.Numeric;
2627
import org.slf4j.Logger;
2728
import org.slf4j.LoggerFactory;
2829

@@ -96,8 +97,9 @@ public static RetCode parseCallOutput(Call.CallOutput callResult, String message
9697
RevertMessageParser.tryResolveRevertMessage(
9798
callResult.getStatus(), callResult.getOutput());
9899
if (errorOutput.getValue1()) {
99-
return TransactionReceiptStatus.getStatusMessage(
100-
callResult.getStatus(), errorOutput.getValue2());
100+
return new RetCode(
101+
Numeric.decodeQuantity(callResult.getStatus()).intValue(),
102+
errorOutput.getValue2());
101103
}
102104
return TransactionReceiptStatus.getStatusMessage(callResult.getStatus(), message);
103105
}

0 commit comments

Comments
 (0)