Package org.jtester.module.dbfit.db.model

Examples of org.jtester.module.dbfit.db.model.DbParameterAccessor


      while (rs.next()) {
        String paramName = rs.getString(1);
        if (paramName == null)
          paramName = "";
        String dataType = rs.getString(2);
        DbParameterAccessor dbp = new DbParameterAccessor(paramName, DbParameterAccessor.INPUT,
            getSqlType(dataType), getJavaClass(dataType), position++);
        allParams.put(NameNormaliser.normaliseName(paramName), dbp);
      }

      return allParams;
View Full Code Here


          token = s.nextToken();
        }
        String paramName = token;
        String dataType = s.nextToken();

        DbParameterAccessor dbp = new DbParameterAccessor(paramName, direction, getSqlType(dataType),
            getJavaClass(dataType), position++);
        allParams.put(NameNormaliser.normaliseName(paramName), dbp);
      }
      if ("FUNCTION".equals(type)) {
        StringTokenizer s = new StringTokenizer(returns.trim().toLowerCase(), " ()");
        String dataType = s.nextToken();
        allParams.put("", new DbParameterAccessor("", DbParameterAccessor.RETURN_VALUE, getSqlType(dataType),
            getJavaClass(dataType), -1));
      }
      return allParams;
    } finally {
      DBHelper.closeResultSet(rs);
View Full Code Here

        int paramDirection;
        if (paramName.trim().length() == 0)
          paramDirection = DbParameterAccessor.RETURN_VALUE;
        else
          paramDirection = getParameterDirection(direction);
        DbParameterAccessor dbp = new DbParameterAccessor(paramName, paramDirection, getSqlType(dataType),
            getJavaClass(dataType), position++);
        allParams.put(NameNormaliser.normaliseName(paramName), dbp);
      }
      return allParams;
    } finally {
View Full Code Here

          paramName = "";
        String dataType = rs.getString(2);
        // int length=rs.getInt(3);
        String direction = rs.getString(4);
        int paramDirection = getParameterDirection(direction);
        DbParameterAccessor dbp = new DbParameterAccessor(paramName, paramDirection, getSqlType(dataType),
            getJavaClass(dataType), paramDirection == DbParameterAccessor.RETURN_VALUE ? -1 : position++);
        allParams.put(NameNormaliser.normaliseName(paramName), dbp);
      }
      return allParams;
    } finally {
View Full Code Here

          paramDirection = DbParameterAccessor.RETURN_VALUE;
        } else {
          paramDirection = getParameterDirection(direction);
        }

        DbParameterAccessor dbp = new DbParameterAccessor(paramName, paramDirection, getSqlType(dataType),
            getJavaClass(dataType), paramDirection == DbParameterAccessor.RETURN_VALUE ? -1 : position++);
        allParams.put(NameNormaliser.normaliseName(paramName), dbp);
      }
      return allParams;
    } finally {
View Full Code Here

      Map<String, DbParameterAccessor> allParams = new HashMap<String, DbParameterAccessor>();
      int position = 0;
      while (rs.next()) {
        String columnName = rs.getString(1);
        String dataType = rs.getString(2);
        DbParameterAccessor dbp = new DbParameterAccessor(columnName, DbParameterAccessor.INPUT,
            typeMapper.getJDBCSQLTypeForDBType(dataType), getJavaClass(dataType), position++);
        allParams.put(NameNormaliser.normaliseName(columnName), dbp);
      }
      return allParams;
    } finally {
View Full Code Here

      if (accessors[i] == null)
        throw new SQLException("Cannot find parameter for column " + i + " name=\"" + paramName + "\"");
      boolean isOutput = headerCells.text().endsWith("?");
      if (accessors[i].getDirection() == DbParameterAccessor.INPUT_OUTPUT) {
        // clone, separate into input and output
        accessors[i] = new DbParameterAccessor(accessors[i]);
        accessors[i].setDirection(isOutput ? DbParameterAccessor.OUTPUT : DbParameterAccessor.INPUT);
      }
      if (isOutput) {
        columnBindings[i] = new SymbolAccessQueryBinding();
      } else {
        // sql server quirk. if output parameter is used in an input
        // column, then
        // the param should be cloned and remapped to IN/OUT
        if (accessors[i].getDirection() == DbParameterAccessor.OUTPUT) {
          accessors[i] = new DbParameterAccessor(accessors[i]);
          accessors[i].setDirection(DbParameterAccessor.INPUT);
        }
        columnBindings[i] = new SymbolAccessSetBinding();
      }
      columnBindings[i].adapter = accessors[i];
View Full Code Here

    for (int i = 0; headerCells != null; i++, headerCells = headerCells.more) {
      String name = headerCells.text();
      String paramName = NameNormaliser.normaliseName(name);
      // need to clone db param accessors here because same column may be
      // in the update and select part
      DbParameterAccessor orig = allParams.get(paramName);
      if (orig == null) {
        wrong(headerCells);
        throw new SQLException("Cannot find column " + paramName);
      }
      // clone parameter because there may be multiple usages of the same
      // column
      DbParameterAccessor acc = new DbParameterAccessor(orig);
      acc.setDirection(DbParameterAccessor.INPUT);
      if (headerCells.text().endsWith("="))
        updateAcc.add(acc);
      else
        selectAcc.add(acc);
      columnBindings[i] = new SymbolAccessSetBinding();
View Full Code Here

TOP

Related Classes of org.jtester.module.dbfit.db.model.DbParameterAccessor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.