package mircoders.storage;
-import java.sql.Connection;\r
-import java.sql.SQLException;\r
-import java.sql.Statement;\r
-\r
-import mir.log.LoggerWrapper;\r
-import mir.storage.Database;\r
-import mir.storage.StorageObject;\r
-import mir.storage.StorageObjectFailure;
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.sql.Statement;
-/**
- * <b>This class implements the access to the comment-table for the
- * media table.
- *
- *
- */
+import mir.log.LoggerWrapper;
+import mir.storage.Database;
+import mir.storage.DatabaseFailure;
-public class DatabaseComment extends Database implements StorageObject{
+public class DatabaseComment extends Database {
private static DatabaseComment instance;
private DatabaseComment() {
super();
- hasTimestamp = false;
- theTable = "comment";
+ mainTable = "comment";
logger = new LoggerWrapper("Database.Comment");
- this.theEntityClass = mircoders.entity.EntityComment.class;
+ entityClass = mircoders.entity.EntityComment.class;
}
- public boolean deleteByContentId(String id) throws StorageObjectFailure {
+ public boolean deleteByContentId(String id) throws DatabaseFailure {
Statement stmt = null;
Connection con = null;
String sql;
- int res = 0;
- /** @todo comments and topics should be deleted */
- sql = "delete from " + theTable + " where to_media=" + id;
+ /** todo comments and topics should be deleted */
+ sql = "delete from " + mainTable + " where to_media=" + id;
logger.info("DELETE "+ sql);
try {
- con = getPooledCon();
+ con = obtainConnection();
stmt = con.createStatement();
- res = stmt.executeUpdate(sql);
+ stmt.executeUpdate(sql);
}
catch (SQLException sqe) {
- new StorageObjectFailure(sqe);
+ new DatabaseFailure(sqe);
return false;
}
finally {