Example #1
0
  /** 对于函数的调用使能使用顺序位置标识来绑定变量 */
  public @Test void testTest_fWithNameIndexForXMLStringRowHandler() {
    CallableDBUtil callableDBUtil = new CallableDBUtil();
    try {
      callableDBUtil.prepareCallable("{? = call Test_f(?,?,?)}");
      // 不允许的操作: Ordinal binding and Named binding cannot be combined!
      callableDBUtil.registerOutParameter(1, java.sql.Types.INTEGER);
      callableDBUtil.setInt(2, 10);
      callableDBUtil.registerOutParameter(3, java.sql.Types.VARCHAR);
      callableDBUtil.registerOutParameter(4, java.sql.Types.VARCHAR);
      String xmlString =
          callableDBUtil.executeCallableForXML(
              new com.frameworkset.common.poolman.handle.RowHandler() {
                /**
                 * 对已经处理好的行记录进行处理的逻辑
                 *
                 * @param rowValue
                 */
                public void handleRow(Object rowValue, Record record) {
                  StringBuffer objects = (StringBuffer) rowValue;
                  objects.append(record);
                  System.out.println("objects:" + objects);
                }
              });
      //			System.out.println("name1:" + callableDBUtil.getString("name"));
      //			System.out.println("name2:" + callableDBUtil.getString("name1"));
      System.out.println("xmlString:" + xmlString);

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Example #2
0
  public @Test void testTest_fWithNameIndexForXMLString() {
    CallableDBUtil callableDBUtil = new CallableDBUtil();
    try {
      callableDBUtil.prepareCallable("{? = call Test_f(?,?,?)}");
      callableDBUtil.registerOutParameter(1, java.sql.Types.INTEGER);
      // 不允许的操作: Ordinal binding and Named binding cannot be combined!
      callableDBUtil.setInt(2, 10);
      callableDBUtil.registerOutParameter(3, java.sql.Types.VARCHAR);
      callableDBUtil.registerOutParameter(4, java.sql.Types.VARCHAR);
      String xmlString = callableDBUtil.executeCallableForXML();
      //			System.out.println("name1:" + callableDBUtil.getString("name"));
      //			System.out.println("name2:" + callableDBUtil.getString("name1"));
      System.out.println("xmlString:" + xmlString);

    } catch (Exception e) {
      e.printStackTrace();
    }
  }