- 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/metadata/METSFile.java
r8742 r9874 11 11 import java.sql.ResultSet; 12 12 import java.sql.SQLException; 13 import java.sql.Statement; 13 14 14 15 import org.w3c.dom.Document; … … 201 202 where.add(whereItem); 202 203 select.setWhere(where); 203 connection.execute(select.toString()); 204 205 Statement statement = null; 204 206 205 207 // if not, then make an insert action 206 208 try { 207 ResultSet results = connection.getResultSet();208 if (results == null ||209 209 statement = connection.createStatement(); 210 ResultSet results = statement.executeQuery(select.toString()); 211 if (!results.first()){ 210 212 GS3SQLInsert insert = new GS3SQLInsert("files"); 211 213 … … 223 225 } 224 226 catch (SQLException ex){ 225 System.err.println( ex);227 System.err.println("METSFile.writeSQL(): "+ex); 226 228 return false; 227 229 } … … 230 232 action.addValue("MIMEType", this.MIMEType); 231 233 232 return connection.execute(action.toString()); 234 try { 235 statement.execute(action.toString()); 236 statement.close(); 237 238 } catch (SQLException e) { 239 System.err.println("METSFile.writeSQL():"+e); 240 return false; 241 } 242 return true; 233 243 } 234 244 … … 248 258 } 249 259 catch (SQLException ex){ 250 System.out.println( ex);260 System.out.println("METSFile.readSQL(): "+ex); 251 261 } 252 262 catch (java.net.MalformedURLException urlEx){ 253 System.out.println( urlEx);263 System.out.println("METSFile.readSQL(): "+urlEx); 254 264 } 255 265 return null; … … 309 319 } catch (java.net.MalformedURLException ex) { 310 320 // TODO: raise error 311 System.err.println( ex);321 System.err.println("METSFile.parse_flocateXML(): "+ex); 312 322 } 313 323 return thisFilePos;
Note:
See TracChangeset
for help on using the changeset viewer.