diff src/main/java/de/mpiwg/gazetteer/utils/DBService.java @ 22:2c6f44ef34ab

new: add comment textarea
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Tue, 23 Jun 2015 16:18:52 +0200
parents 5b1856cd6b4f
children ce2e3f2814c0
line wrap: on
line diff
--- a/src/main/java/de/mpiwg/gazetteer/utils/DBService.java	Tue Jun 23 14:20:36 2015 +0200
+++ b/src/main/java/de/mpiwg/gazetteer/utils/DBService.java	Tue Jun 23 16:18:52 2015 +0200
@@ -705,5 +705,27 @@
 	
 		
 	}
+
+	public void updateComment(String bookId, String comment) throws SQLException {
+		Connection conn = null;
+		Statement stmt = null;
+		
+		try {
+			String query = "UPDATE books SET comments='"+ comment + "' WHERE id='" + bookId + "'";
+			conn = getNewConnection();
+			stmt   = conn.createStatement();
+			int rs = stmt.executeUpdate(query);
+			
+		} catch (Exception e) {
+			e.printStackTrace();
+		}finally{
+			conn.close();
+		}
+		
+		DBBook book = this.bookMap.get(bookId);
+		book.setComments(comment);
+		
+		
+	}
 	
 }