- 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/SimpleNamespace.java
r8742 r9874 9 9 10 10 import java.sql.SQLException; 11 import java.sql.Statement; 11 12 import java.sql.ResultSet; 12 13 … … 281 282 } 282 283 284 Statement statement = null; 285 ResultSet results = null; 283 286 try { 287 statement = connection.createStatement(); 284 288 if (this.id == null) { 285 289 GS3SQLSelect select = new GS3SQLSelect("namespaces"); 286 290 select.setWhere(new GS3SQLWhere(new GS3SQLWhereItem("MetadataRef", "=", Integer.toString(parentId), GS3SQLField.INTEGER_TYPE))); 287 291 select.addField("NamespaceRef"); 288 connection.execute(select.toString()); 289 290 ResultSet results = connection.getResultSet(); 291 results.first(); 292 sqlId = Integer.toString(results.getInt("NamespaceRef")); 292 results = statement.executeQuery(select.toString()); 293 if (results.first()) { 294 sqlId = Integer.toString(results.getInt("NamespaceRef")); 295 } else { 296 statement.close(); 297 return false; 298 } 293 299 } 294 300 else { … … 300 306 GS3SQLWhere where = new GS3SQLWhere(new GS3SQLWhereItem("NamespaceRef", "=", sqlId, GS3SQLField.INTEGER_TYPE)); 301 307 delete.setWhere(where); 302 connection.execute(delete.toString());308 statement.execute(delete.toString()); 303 309 304 310 // write out the metadata for this namespace … … 316 322 insert.addValue("Label", thisKey); 317 323 insert.addValue("Value", value); 318 connection.execute(insert.toString()); 319 } 320 } 324 statement.execute(insert.toString()); 325 } 326 } 327 statement.close(); 321 328 } 322 329 catch (SQLException sql) { 323 System.out.println( sql);330 System.out.println("SimpleNamespace.writeSQL(): "+sql); 324 331 } 325 332 return true;
Note:
See TracChangeset
for help on using the changeset viewer.