- Timestamp:
- 2010-01-01T23:35:24+13:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/common-src/src/jdbmedit/JdbmAPI.java
r21401 r21402 45 45 HTree hashtable_; 46 46 47 public JdbmAPI(String db_filename )47 public JdbmAPI(String db_filename,boolean must_exist) 48 48 throws IOException 49 49 { … … 56 56 57 57 if (recid != 0) { 58 System. out.println("Loading existing database table '" + TNAME +"' ...");58 System.err.println("# Loading existing database table '" + TNAME +"' ..."); 59 59 hashtable_ = HTree.load(recman_, recid); 60 60 } 61 61 else { 62 System.out.println("No database table '" + TNAME +"' to set. Creating new one"); 63 hashtable_ = HTree.createInstance(recman_); 64 recman_.setNamedObject(TNAME, hashtable_.getRecid()); 65 } 62 63 if (must_exist) { 64 recman_.close(); 65 System.err.println("Database table '" + TNAME +"' does not exist."); 66 throw new IOException(); 67 } 68 else { 69 System.err.println("# No database table '" + TNAME +"' to set. Creating new one"); 70 hashtable_ = HTree.createInstance(recman_); 71 recman_.setNamedObject(TNAME, hashtable_.getRecid()); 72 } 73 } 74 } 75 76 public JdbmAPI(String db_filename) 77 throws IOException 78 { 79 // default is that database does not have to exist 80 this(db_filename,false); 66 81 } 67 82 68 83 public void append(String key, String val) 69 84 throws IOException 70 { 71 85 { 72 86 String orig_val = (String)hashtable_.get(key); 73 87 String new_val = orig_val + val; … … 127 141 { 128 142 recman_.close(); 143 System.err.println("# Done"); 129 144 } 130 145
Note:
See TracChangeset
for help on using the changeset viewer.