Make sure to save the auctions.xml file if we're changing databases.
- M jbidwatcher/trunk/src/com/jbidwatcher/app/MacFriendlyFrame.java view
- M jbidwatcher/trunk/src/com/jbidwatcher/util/db/Database.java view
| 951 | 952 | |
|---|---|---|
| 172 | 172 | SearchManager.getInstance().saveSearches(); |
| 173 | 173 | AuctionStats as = AuctionServerManager.getInstance().getStats(); |
| 174 | 174 | JConfig.setConfiguration("last.auctioncount", Integer.toString(as.getCount())); |
| 175 | Database.saveDBConfig(); | |
| 175 | if(Database.saveDBConfig()) { | |
| 176 | // If we're changing databases, we'll need the auction information saved so we can load it into the new database. | |
| 177 | AuctionsManager.getInstance().saveAuctions(); | |
| 178 | } | |
| 176 | 179 | JConfig.saveConfiguration(cfgFilename); |
| 177 | 180 | ActiveRecord.shutdown(); // TODO -- Can this be put before the saveDBConfig? |
| 178 | 181 | JConfig.log().logMessage("Shutting down JBidwatcher."); |
| 951 | 952 | |
|---|---|---|
| 185 | 185 | return mConn; |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | public static void saveDBConfig() { | |
| 188 | public static boolean saveDBConfig() { | |
| 189 | 189 | if(JConfig.queryConfiguration("temp.db.protocol") != null) { |
| 190 | 190 | String[] keys = { "db.framework", "db.protocol", "db.driver", "db.user", "db.pass" }; |
| 191 | 191 | for(String key : keys) { |
| 192 | 192 | JConfig.setConfiguration(key, JConfig.queryConfiguration("temp." + key)); |
| 193 | 193 | } |
| 194 | 194 | JConfig.kill("jbidwatcher.created_db"); |
| 195 | return true; | |
| 195 | 196 | } |
| 197 | return false; | |
| 196 | 198 | } |
| 197 | 199 | } |
