FileDocCategorySizeDatePackage
SaveComment.javaAPI DocExample1832Mon Mar 31 23:08:52 BST 2003org.dasein.gb.persist

SaveComment

public class SaveComment extends org.dasein.persist.Execution

Fields Summary
private static final String
SAVE
private static final int
APPROVED
private static final int
EMAIL
private static final int
NAME
private static final int
COMMENT
private static final int
COMMENT_ID
Constructors Summary
Methods Summary
public java.lang.StringgetDataSource()

        return "jdbc/kyra";
    
public static org.dasein.gb.persist.SaveCommentgetInstance()

        return (SaveComment)Execution.getInstance(SaveComment.class);
    
public java.lang.StringgetStatement()

        return SAVE;
    
public java.util.HashMaprun()

    
          
        long cid = ((Long)data.get(Comment.COMMENT_ID)).longValue();
        String tmp;
        boolean b;

        b = ((Boolean)data.get(Comment.APPROVED)).booleanValue();
        statement.setString(APPROVED, (b ? "Y" : "N"));
        tmp = (String)data.get(Comment.EMAIL);
        if( tmp == null ) {
            statement.setNull(EMAIL, Types.VARCHAR);
        }
        else {
            statement.setString(EMAIL, tmp);
        }
        statement.setString(NAME, (String)data.get(Comment.NAME));
        statement.setString(COMMENT, (String)data.get(Comment.COMMENT));
        statement.setLong(COMMENT_ID, cid);
        if( statement.executeUpdate() != 1 ) {
            throw new PersistenceException("Bizarre number of rows updated.");
        }
        return null;