X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=source%2Fmircoders%2Fstorage%2FDatabaseComment.java;h=8561eb451b8a091595a9fb7893a3dae809e5eb8f;hb=95c2e3a74f492f6f61d4dbe8bb47996f43af0627;hp=ba67579110748267c5ccc84e11c3d9bea242910a;hpb=855ecf8acedb12afbab7a621b2e2c0cf45b2f98f;p=mir.git diff --git a/source/mircoders/storage/DatabaseComment.java b/source/mircoders/storage/DatabaseComment.java index ba675791..8561eb45 100755 --- a/source/mircoders/storage/DatabaseComment.java +++ b/source/mircoders/storage/DatabaseComment.java @@ -36,17 +36,9 @@ import java.sql.Statement; import mir.log.LoggerWrapper; import mir.storage.Database; -import mir.storage.StorageObject; -import mir.storage.StorageObjectFailure; +import mir.storage.DatabaseFailure; -/** - * This class implements the access to the comment-table for the - * media table. - * - * - */ - -public class DatabaseComment extends Database implements StorageObject{ +public class DatabaseComment extends Database { private static DatabaseComment instance; @@ -59,30 +51,28 @@ public class DatabaseComment extends Database implements StorageObject{ 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 {