1.1 restoration
[mir.git] / source / mircoders / entity / EntityUploadedMedia.java
index 436cdb0..110f694 100755 (executable)
@@ -42,7 +42,7 @@ import mircoders.storage.DatabaseUploadedMedia;
 /**
  *
  * @author mh, mir-coders group
- * @version $Id: EntityUploadedMedia.java,v 1.26.2.6 2004/01/18 17:30:58 zapata Exp $
+ * @version $Id: EntityUploadedMedia.java,v 1.26.2.8 2004/11/21 22:07:13 zapata Exp $
  */
 
 public class EntityUploadedMedia extends AbstractEntity {
@@ -62,20 +62,35 @@ public class EntityUploadedMedia extends AbstractEntity {
     super.update();
 
     try {
-      storageObject.executeUpdate( "update content set is_produced='0' where exists(select * from content_x_media where content_id=content.id and media_id=" + getId()+")");
-      storageObject.executeUpdate( "update content set is_produced='0' where exists(select * from comment_x_media, comment where comment_x_media.comment_id=comment.id and comment.to_media=content.id and comment_x_media.media_id=" + getId()+")");
+      storageObject.executeUpdate(
+          "update content " +
+          "set is_produced='0' " +
+          "from content_x_media cxm " +
+          "where" +
+          "   cxm.content_id=content.id and cxm.media_id=" + getId()
+      );
+
+      storageObject.executeUpdate(
+          "update content " +
+          "set is_produced='0' " +
+          "from comment_x_media cxm, comment c "+
+          "where " +
+          "   cxm.comment_id = c.id and " +
+          "   c.to_media=content.id and " +
+          "   cxm.media_id=" + getId()
+      );
     }
     catch (SQLException e) {
       throw new StorageObjectFailure(e);
     }
   }
 
-  public void setValues(Map theStringValues) {
+  public void setFieldValues(Map theStringValues) {
     if (theStringValues != null) {
       if (!theStringValues.containsKey("is_published"))
         theStringValues.put("is_published", "0");
     }
-    super.setValues(theStringValues);
+    super.setFieldValues(theStringValues);
   }