diff --git a/code/datastudio/src/org.opengauss.mppdbide.debuger/src/org/opengauss/mppdbide/debuger/debug/DebugConstants.java b/code/datastudio/src/org.opengauss.mppdbide.debuger/src/org/opengauss/mppdbide/debuger/debug/DebugConstants.java index 632036efdfc11fd47bed27a25357792201dcbfdd..b335bc7271e7e9569848e42e76671d951006ce01 100644 --- a/code/datastudio/src/org.opengauss.mppdbide.debuger/src/org/opengauss/mppdbide/debuger/debug/DebugConstants.java +++ b/code/datastudio/src/org.opengauss.mppdbide.debuger/src/org/opengauss/mppdbide/debuger/debug/DebugConstants.java @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) 2022 Huawei Technologies Co.,Ltd. * * openGauss is licensed under Mulan PSL v2. @@ -6,7 +6,7 @@ * You may obtain a copy of Mulan PSL v2 at: * * http://license.coscl.org.cn/MulanPSL2 - * + * * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. @@ -152,7 +152,7 @@ public class DebugConstants { DBE_STEP_OUT("pldbg_step_out", 1), DBE_CONTINUE_EXEC("DBE_PLDEBUGGER.continue", 0), DBE_ABORT_TARGET("DBE_PLDEBUGGER.abort", 0), - DBE_GET_VARIABLES("DBE_PLDEBUGGER.print_var", 1), + DBE_GET_VARIABLES("DBE_PLDEBUGGER.info_locals", 0), DBE_GET_STACKS("DBE_PLDEBUGGER.backtrace", 0), DBE_GET_BREAKPOINTS("DBE_PLDEBUGGER.info_breakpoints", 0), DBE_DROP_BREAKPOINT("DBE_PLDEBUGGER.delete_breakpoint", 1), diff --git a/code/datastudio/src/org.opengauss.mppdbide.debuger/src/org/opengauss/mppdbide/debuger/service/DbeDebugService.java b/code/datastudio/src/org.opengauss.mppdbide.debuger/src/org/opengauss/mppdbide/debuger/service/DbeDebugService.java index 11f65317b2dc64ee51f394decb3cacf2e0067c9d..774f9be55eaec1ff726b2130aa4457bca53cf93f 100644 --- a/code/datastudio/src/org.opengauss.mppdbide.debuger/src/org/opengauss/mppdbide/debuger/service/DbeDebugService.java +++ b/code/datastudio/src/org.opengauss.mppdbide.debuger/src/org/opengauss/mppdbide/debuger/service/DbeDebugService.java @@ -406,22 +406,38 @@ public class DbeDebugService extends DebugService { private List getAllVariable(DebugConstants.DebugOpt debugOpt, Class clazz) throws SQLException { List vos = new ArrayList(); - map.get(getFunctionVo().oid).forEach(item -> { - try { - List inputParams = Arrays.asList(item); - try (PreparedStatement ps = getClientConn().getDebugOptPrepareStatement(debugOpt, inputParams)) { - try (ResultSet rs = ps.executeQuery()) { - if (rs.next()) { - vos.addAll(QueryResVoConvertHelper.parseList(rs, clazz, getClientConn())); - } - } catch (SQLException e) { - MPPDBIDELoggerUtility.error(e.getMessage()); + if(debugOpt.equals(DebugConstants.DebugOpt.DBE_GET_VARIABLES)) { + try (PreparedStatement ps = getClientConn().getDebugOptPrepareStatement(debugOpt, new ArrayList())) { + try (ResultSet rs = ps.executeQuery()) { + while (rs.next()) { + vos.addAll(QueryResVoConvertHelper.parseList(rs, clazz, getClientConn())); } + + } catch (SQLException e) { + MPPDBIDELoggerUtility.error(e.getMessage()); } - } catch (SQLException e) { - MPPDBIDELoggerUtility.error(e.getMessage()); } - }); + }else { + map.get(getFunctionVo().oid).forEach(item -> { + try { + List inputParams = Arrays.asList(item); + if(debugOpt.paramNum==0) { + inputParams=new ArrayList(); + } + try (PreparedStatement ps = getClientConn().getDebugOptPrepareStatement(debugOpt, inputParams)) { + try (ResultSet rs = ps.executeQuery()) { + if (rs.next()) { + vos.addAll(QueryResVoConvertHelper.parseList(rs, clazz, getClientConn())); + } + } catch (SQLException e) { + MPPDBIDELoggerUtility.error(e.getMessage()); + } + } + } catch (SQLException e) { + MPPDBIDELoggerUtility.error(e.getMessage()); + } + }); + } return vos; }