コード例 #1
0
  // ===============================================================
  public ArrayList<String[]> getHostProperty(String devname, String propname) throws DevFailed {
    String table = "property_device";
    String[] fields = {"device", "value"};

    String cmd = "";
    for (int i = 0; i < fields.length; i++) {
      cmd += fields[i];
      if (i < fields.length - 1) cmd += ",";
    }
    cmd += " FROM " + table;
    cmd += " WHERE device LIKE \"" + devname + "\"";
    cmd += " And name = \"" + propname + "\"";

    MySqlData result = executeMySqlSelect(cmd);
    ArrayList<String[]> v = new ArrayList<String[]>();
    for (MySqlRow row : result) if (!row.hasNull()) v.add(new String[] {row.get(0), row.get(1)});
    return v;
  }
コード例 #2
0
  // ===============================================================
  @SuppressWarnings({"UnusedDeclaration"})
  public DbEventImportInfo[] getMultipleEventImportInfo(String devname) throws DevFailed {
    String table = "event";
    String[] fields = {"name", "host", "exported", "ior"};

    String cmd = "";
    for (int i = 0; i < fields.length; i++) {
      cmd += fields[i];
      if (i < fields.length - 1) cmd += ",";
    }
    cmd += " FROM " + table;
    cmd += " WHERE name LIKE \"" + devname + "\"";

    MySqlData result = executeMySqlSelect(cmd);
    DbEventImportInfo[] info = new DbEventImportInfo[result.size()];
    int idx = 0;
    for (MySqlRow row : result)
      if (!row.hasNull())
        info[idx++] =
            new DbEventImportInfo(
                row.get(0).toLowerCase(), row.get(1), row.get(2).equals("1"), row.get(3));
    /*
    System.out.println("getMultipleEventImportInfo()");
        for (MySqlRow row : result)
            if (row.hasNull()==false)
                System.out.println("	"+
                            row.get(0).toLowerCase() +"\n"+
                            row.get(1) +"\n"+
                            row.get(2) +"\n"+
                            row.get(3) );

    */
    return info;
  }
コード例 #3
0
  // ===============================================================
  public DbDevImportInfo[] getHostDevImportInfo(String devname) throws DevFailed {
    String table = "device";
    String[] fields = {"name", "exported", "version", "ior", "server", "host", "class"};

    String cmd = "";
    for (int i = 0; i < fields.length; i++) {
      cmd += fields[i];
      if (i < fields.length - 1) cmd += ",";
    }
    cmd += " FROM " + table;
    cmd += " WHERE name LIKE \"" + devname + "\" ORDER BY name";

    MySqlData result = executeMySqlSelect(cmd);

    DbDevImportInfo[] info = new DbDevImportInfo[result.size()];
    int idx = 0;
    for (MySqlRow row : result)
      if (!row.hasNull())
        info[idx++] =
            new DbDevImportInfo(
                row.get(0).toLowerCase(),
                row.get(1).equals("1"),
                row.get(2),
                row.get(3),
                row.get(4),
                row.get(5),
                row.get(6));
    return info;
  }