Changeset 9874 for trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/doctypes/DocumentSQLWriter.java
- Timestamp:
- 2005-05-16T11:02:50+12:00 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/doctypes/DocumentSQLWriter.java
r8742 r9874 19 19 update.addDate("IndexedDate", new java.sql.Timestamp(touchTime)); 20 20 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 } 22 29 System.out.println(update.toString()); 23 30 return true; … … 39 46 select.addField("*"); 40 47 select.setWhere(new GS3SQLWhere(new GS3SQLWhereItem("DocID", "=", document.getID().toString()))); 41 connection.execute(select.toString());42 48 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"); 48 53 insert.addValue("DocID", document.getID().toString()); 49 54 insert.addValue("DocType", document.getDocumentType()); … … 53 58 insert.addDate("ModifiedDate", new java.sql.Timestamp(document.getModifiedDatestamp())); 54 59 55 connection.execute(insert.toString());60 statement.execute(insert.toString()); 56 61 } 57 62 else { … … 61 66 // connection.execute(update.toString()); 62 67 } 68 statement.close(); 63 69 } 64 } catch ( Exception ex) {65 System.out.println( ex);70 } catch (SQLException ex) { 71 System.out.println("DocumentSQLWriter.writeDocument() Error:"+ex); 66 72 } 67 73 // output.println(tag);
Note:
See TracChangeset
for help on using the changeset viewer.