Package net.sf.minuteProject.configuration.bean.model.data

Examples of net.sf.minuteProject.configuration.bean.model.data.Function


    return new ArrayList<Function>();
  }
 
  public static List<Function> getFunctions(Connection connection, String schema, Database database) {
    functions = new HashMap<String, Function>();
    Function function = null;
    try {
//      List<Function> functions = new ArrayList<Function>();
//       
      DatabaseMetaData dbMetaData = connection.getMetaData();
      String catalog = connection.getCatalog();
      ResultSet rs;
      if ("MYSQL".equals(database.getType()))
        rs = dbMetaData.getProcedureColumns(catalog, schema, "%", "%");
      else
        rs = dbMetaData.getProcedureColumns(catalog, schema, null, null);
 
        String previousProcedureCatalog = "";
        String previousProcedureName    = "";
        while(rs.next()) {
          // get stored procedure metadata
          String procedureCatalog     = rs.getString(1);
          String procedureSchema      = rs.getString(2);
          String procedureName        = rs.getString(3);
          String columnName           = rs.getString(4);
          short  columnReturn         = rs.getShort(5);
          int    columnDataType       = rs.getInt(6);
          String columnReturnTypeName = rs.getString(7);
          int    columnPrecision      = rs.getInt(8);
          int    columnByteLength     = rs.getInt(9);
          short  columnScale          = rs.getShort(10);
          short  columnRadix          = rs.getShort(11);
          short  columnNullable       = rs.getShort(12);
          String columnRemarks        = rs.getString(13);
  
          function = getFunction (procedureCatalog, catalog, procedureName);
//          if (procedureCatalog==null  || !procedureCatalog.equals(previousProcedureCatalog) || !procedureName.equals(previousProcedureName)) {
//           if (function!=null)
//             functions.add(function);
//           function = new FunctionDDLUtils();
//           if (procedureCatalog!=null)
//             function.setCatalog(procedureCatalog);
//           else
//             function.setCatalog(catalog);
//             function.setName(procedureName);
//          }
          previousProcedureCatalog = (procedureCatalog!=null)?procedureCatalog:"";
          previousProcedureName    = (procedureName!=null)?procedureName:"";
         
          FunctionColumn functionColumn = new FunctionColumnDDLUtils();
          functionColumn.setName(columnName);
          functionColumn.setDirection(getDirection(columnReturn));
          functionColumn.setTypeCode(columnDataType);
          functionColumn.setType(columnReturnTypeName);//getType(columnDataType));
          functionColumn.setPrecisionRadix(columnRadix);
          functionColumn.setSizeAndScale(columnByteLength, columnScale);
          functionColumn.setSize(columnByteLength+"");
          functionColumn.setPrecision(columnPrecision);
          functionColumn.setRequired((columnNullable==0)?true:false);
          functionColumn.setDescription(columnRemarks);
          function.addColumn(functionColumn);
         
          function.setDatabase(database);
          functions.put(getKey(procedureCatalog, catalog, procedureName), function);
        }
       
        connection.close();
        return new ArrayList<Function>(functions.values());
View Full Code Here


    return new ArrayList<Function>();
  }
 
  private static Function getFunction(String procedureCatalog, String catalog,
      String procedureName) {
    Function function = functions.get(getKey(procedureCatalog, catalog, procedureName));
    if (function!=null) return function;
    function = new FunctionDDLUtils();
        if (procedureCatalog!=null)
       function.setCatalog(procedureCatalog);
     else
       function.setCatalog(catalog);
       function.setName(procedureName);
    return function;
  }
View Full Code Here

TOP

Related Classes of net.sf.minuteProject.configuration.bean.model.data.Function

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.