⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 msgpolloptiondb.java

📁 云网论坛CWBBS 源码,内容丰富,学习,参考,教学的好资料,具体见内说明,
💻 JAVA
字号:
package com.redmoon.forum;

import com.cloudwebsoft.framework.base.*;
import java.util.Vector;
import com.cloudwebsoft.framework.db.JdbcTemplate;
import cn.js.fan.cache.jcs.RMCache;
import com.cloudwebsoft.framework.util.LogUtil;
import java.sql.SQLException;
import cn.js.fan.db.PrimaryKey;

/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2006</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
public class MsgPollOptionDb extends QObjectDb {
    public static final String OPTS = "opts_";

    public MsgPollOptionDb() {
    }

    public MsgPollOptionDb getMsgPollOptionDb(long msgId, int order) {
        PrimaryKey pk = (PrimaryKey)primaryKey.clone();
        pk.setKeyValue("msg_id", new Long(msgId));
        pk.setKeyValue("orders", new Integer(order));
        MsgPollOptionDb mpod = (MsgPollOptionDb)getQObjectDb(pk.getKeys());
        return mpod;
    }

    public boolean save(JdbcTemplate jt, Object[] params) throws SQLException {
        // System.out.println(getClass() + " save2 msgId=" + getLong("msg_id") + " orders=" + getInt("orders") + " primaryKey=" + primaryKey);

        boolean re = super.save(jt, params);
        long msgId = getLong("msg_id");
        // System.out.println(getClass() + " save3 msgId=" + getLong("msg_id") + " orders=" + getInt("orders") + " primaryKey=" + primaryKey);
        try {
            RMCache.getInstance().remove(OPTS + msgId, cacheGroup);
        }
        catch (Exception e) {
            LogUtil.getLog(getClass()).error("getOptionsOfMsg1:" + e.getMessage());
        }
        return re;
    }

    public Vector getOptions(long msgId) {
        String sql = "select msg_id,orders from " + table.getName() + " where msg_id=? order by orders asc";
        Vector v = null;
        try {
            v = (Vector)RMCache.getInstance().getFromGroup(OPTS + msgId, cacheGroup);
        }
        catch (Exception e) {
            LogUtil.getLog(getClass()).error("getOptionsOfMsg1:" + e.getMessage());
        }
        if (v==null) {
            v = list(new JdbcTemplate(), sql, new Object[] {new Long(msgId)});
            try {
                RMCache.getInstance().putInGroup(OPTS + msgId, cacheGroup, v);
            }
            catch (Exception e) {
                LogUtil.getLog(getClass()).error("getOptionsOfMsg2:" + e.getMessage());
            }
        }
        return v;
    }


}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -