Ignore:
Timestamp:
2005-05-16T11:02:50+12:00 (19 years ago)
Author:
kjdon
Message:

merged from branch ant-install-branch: merge 1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/doctypes/DocumentSQLWriter.java

    r8742 r9874  
    1919    update.addDate("IndexedDate", new java.sql.Timestamp(touchTime));
    2020    update.addDate("ModifiedDate", new java.sql.Timestamp(modTime));
    21     connection.execute(update.toString());
     21    try {
     22    Statement statement = connection.createStatement();
     23    statement.execute(update.toString());
     24    statement.close();
     25    } catch (SQLException e) {
     26    System.err.println("DocumentSQLWriter.touchDocument() Error: "+ e);
     27    return false;
     28    }
    2229    System.out.println(update.toString());
    2330    return true;
     
    3946    select.addField("*");
    4047    select.setWhere(new GS3SQLWhere(new GS3SQLWhereItem("DocID", "=", document.getID().toString())));
    41     connection.execute(select.toString());
    4248   
    43     ResultSet results = connection.getResultSet();
    44 
    45     if (results == null ||
    46         !results.first())
    47     { GS3SQLInsert insert = new GS3SQLInsert("document");
     49    Statement statement = connection.createStatement();
     50    ResultSet results = statement.executeQuery(select.toString());
     51    if (!results.first()) { // empty result
     52      GS3SQLInsert insert = new GS3SQLInsert("document");
    4853      insert.addValue("DocID", document.getID().toString());
    4954      insert.addValue("DocType", document.getDocumentType());
     
    5358      insert.addDate("ModifiedDate", new java.sql.Timestamp(document.getModifiedDatestamp()));
    5459
    55       connection.execute(insert.toString());
     60      statement.execute(insert.toString());
    5661    }
    5762    else {
     
    6166      //      connection.execute(update.toString());
    6267    }
     68    statement.close();
    6369      }
    64     } catch (Exception ex) {
    65     System.out.println(ex);
     70    } catch (SQLException ex) {
     71    System.out.println("DocumentSQLWriter.writeDocument() Error:"+ex);
    6672    }
    6773    //    output.println(tag);
Note: See TracChangeset for help on using the changeset viewer.