Package org.yaorma.database

Examples of org.yaorma.database.Data


      str += this.tagAttributes;
      str += ">";
      out.write(str);

      // get the options from the database and write them
      Data data = Database.query(this.sqlString, conn);

      // string to hold the string constructed for each option
      String valString = "";

      // add a blank option if that option is indicated
      if ("false".equalsIgnoreCase(this.addBlank) == false) {
        valString += "<option value='";
        valString += "{\"name\":\"\",\"value\":\"\",\"display\":\"\",\"displayFieldName\":\""
            + this.displayFieldName
            + "\",\"keyFieldName\":\""
            + this.keyFieldName 
            + "\",\"parameterName\":\""
            + this.name +
            "\"}";
        valString += "'></option>";
      }
      out.write(valString);

      // create an option for each database value found
      for (int i = 0; i < data.size(); i++) {
        Row row = data.get(i);
        String value = row.getString(this.keyFieldName);
        String display = row.getString(this.displayFieldName);
        valString = "";
        valString += "{";
        valString += "\"displayFieldName\":\"" + this.displayFieldName
View Full Code Here


  public void testLoadPersonList() throws Exception {
    Connection conn = null;
    try {
      conn = ConnectionFactoryForUnitTests.getDedicatedConnection();
      String sqlString = "select * from person limit 10";
      Data data = Database.query(sqlString, conn);
      ArrayList<PersonDvo> personList = Dao.load(PersonDvo.class, data);
      System.out.println("got " + personList.size() + " people.");
      assertTrue(personList.size() > 0);
      for(int i=0;i<personList.size();i++) {
        PersonDvo person = personList.get(i);
View Full Code Here

    sqlString += "from all_tables \n";
    sqlString += "where owner = ? \n";
    sqlString += "union select view_name table_name from all_views \n";
    sqlString += "where owner = ? \n";
    String[] params = {schemaName, schemaName};
    Data data = Database.query(sqlString, params, conn);
   
    for (int i = 0; i < data.size(); i++) {
      String tableName = data.get(i).getString("tableName");
      AbstractClassFactory core = new OracleClassFactoryCore(tableName,
          schemaName, conn);
      DvoClassFactory dvoFactory = new DvoClassFactory(core);
      dvoFactory.createDvo(destDir, packageName);
    }
View Full Code Here

  private void initCols(Connection conn) throws Exception {
    String sqlString = "select column_name from information_schema.columns where table_name = ? ";
    sqlString += "and table_schema = ?";
    String[] params = { this.tableName, this.schemaName };
    Data data = Database.query(sqlString, params, conn);
    for (int i = 0; i < data.size(); i++) {
      this.columnNames.add(data.get(i).getString("columnName"));
    }
  }
View Full Code Here

  private void initCols(Connection conn) throws Exception {
    String sqlString = "select column_name from all_tab_columns where table_name = ? ";
    sqlString += "and owner = ?";
    String[] params = { this.tableName, this.schemaName };
    Data data = Database.query(sqlString, params, conn);
    for (int i = 0; i < data.size(); i++) {
      this.columnNames.add(data.get(i).getString("columnName"));
    }
  }
View Full Code Here

    sqlString += "from information_schema.columns \n";
    sqlString += "where column_key = 'PRI' \n";
    sqlString += "and table_name = ? \n";
    sqlString += "and table_schema = ? \n";
    String[] params = { this.tableName, this.schemaName };
    Data data = Database.query(sqlString, params, conn);
    for (int i = 0; i < data.size(); i++) {
      this.primaryKeyColumnNames.add(data.get(i).getString("columnName"));
    }
  }
View Full Code Here

    sqlString += "select * from all_cons_columns col, all_constraints con \n";
    sqlString += "where col.constraint_name = con.constraint_name \n";
    sqlString += "and col.table_name = ? and col.owner = ? \n";
    sqlString += "and constraint_type = 'P' \n";
    String[] params = { this.tableName, this.schemaName };
    Data data = Database.query(sqlString, params, conn);
    for (int i = 0; i < data.size(); i++) {
      this.primaryKeyColumnNames.add(data.get(i).getString("columnName"));
    }
  }
View Full Code Here

    String sqlString = "";
    sqlString += "select column_name, referenced_table_name \n";
    sqlString += "from information_schema.key_column_usage \n";
    sqlString += "where table_name = ? and table_schema = ? and referenced_table_name is not null";
    String[] params = { this.tableName, this.schemaName };
    Data data = Database.query(sqlString, params, conn);
    for (int i = 0; i < data.size(); i++) {
      HashMap<String, String> row = new HashMap<String, String>();
      row
          .put("tableName", (data.get(i)
              .getString("referencedTableName")));
      row.put("columnName", (data.get(i).getString("columnName")));
      this.lookUpColumns.add(row);
    }
  }
View Full Code Here

  private void initChildTables(Connection conn) throws Exception {
    String sqlString = "";
    sqlString += "select table_name, column_name from information_schema.key_column_usage \n";
    sqlString += "where referenced_table_name = ? and referenced_table_schema = ?";
    String[] params = { this.tableName, this.schemaName };
    Data data = Database.query(sqlString, params, conn);
    for (int i = 0; i < data.size(); i++) {
      HashMap<String, String> row = new HashMap<String, String>();
      row.put("tableName", data.get(i).getString("tableName"));
      row.put("columnName", data.get(i).getString("columnName"));
      this.childTables.add(row);
    }
  }
View Full Code Here

    // generate all dvo classes for schema
    String sqlString = "";
    sqlString += "select table_name \n";
    sqlString += "from information_schema.tables \n";
    sqlString += "where table_schema = ?";
    Data data = Database.query(sqlString, schemaName, conn);
    for (int i = 0; i < data.size(); i++) {
      String tableName = data.get(i).getString("tableName");
      AbstractClassFactory core = new MySqlClassFactoryCore(tableName,
          schemaName, conn);
      DvoClassFactory dvoFactory = new DvoClassFactory(core);
      dvoFactory.createDvo(destDir, packageName);
    }
View Full Code Here

TOP

Related Classes of org.yaorma.database.Data

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.