Exemplo n.º 1
0
  public TextFile openDBforFile(String dbName, String fileName, String tablePrefix) {
    perFile = new perFileStruc();

    cliDB = new sqlSolver();
    initialScript(dbName, tablePrefix);

    if (checkMisprog(cliDB == null, "cliDB")) return null;
    if (checkMisprog(cached == null, "cached")) return null;

    cliDB.openScript();
    out(
        "INSERT INTO "
            + cached.tabPrefix
            + "_files VALUES ("
            + cached.fileID
            + ", '"
            + cliDB.escapeString(DateFormat.getTodayStr())
            + "', '"
            + fileName
            + "');");

    log.dbg(2, "processOneFile", "start parsing [" + fileName + "]");
    TextFile tf = new TextFile();
    if (!tf.fopen(fileName, "rb")) // mode "rb" to be able to get the InputStream!
    {
      log.err("processOneFile", "file to parse [" + fileName + "] cannot be openned!");
      return null;
    }
    return tf;
  }