exam-master/src/org/mmxbb/exam/dao/QuestionDAO.java

(开头部分) 14KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

package org.mmxbb.exam.dao;



import java.sql.*;
import java.util.*;

import org.mmxbb.exam.bean.Question;
import org.mmxbb.exam.business.question.QuestionActionForm;
import org.mmxbb.exam.util.DBConn;

public class QuestionDAO {
  DBConn dbconn = null;
  private Connection conn = null;
  private int rowCount;
  private int pageCount;
  private int length;
  private String pagestr;
  private String conditionStr = "";
  private final static String ADD_QUESTIOIN =
      "INSERT INTO EX_QUESTION VALUES('',?,?,?,?,?,?,?,?,?)";
  private final static String UPDATE_QUESTION =
      "UPDATE ex_question set Q_CLASS=?,Q_KNOWLEDGE=?,Q_VALUE=?,Q_TYPE=?,Q_DIFFICULTY=?,Q_CONTENT=?,Q_ANSWER=?,Q_STANDARD=?,Q_PICTURE=? WHERE Q_ID=?";
  private final static String SELECT_QUESTIOIN_NoInt =
      "select ex_question.q_id as q_id,b1.b_value as q_class,b2.b_value as q_knowledge,ex_question.q_value as q_value,b3.b_value as q_type,b4.b_value as q_difficulty,ex_question.q_content as q_content,ex_question.q_answer as q_answer,ex_question.q_standard,ex_question.q_picture as q_picture from ex_question,ex_baseinfo b1, ex_baseinfo b2,ex_baseinfo b3,ex_baseinfo b4  where ex_question.q_class=b1.b_id  and ex_question.q_knowledge=b2.b_id and ex_question.q_type=b3.b_id and ex_question.q_difficulty=b4.b_id and ex_question.q_class like ? and ex_question.q_knowledge like ? and ex_question.q_type like ? and ex_question.q_difficulty like ? ORDER BY Q_ID DESC";
  private final static String SELECT_QUESTIOIN_WithInt =
      "select ex_question.q_id as q_id,b1.b_value as q_class,b2.b_value as q_knowledge,ex_question.q_value as q_value,b3.b_value as q_type,b4.b_value as q_difficulty,ex_question.q_content as q_content,ex_question.q_answer as q_answer,ex_question.q_standard,ex_question.q_picture as q_picture from ex_question,ex_baseinfo b1, ex_baseinfo b2,ex_baseinfo b3,ex_baseinfo b4  where ex_question.q_class=b1.b_id  and ex_question.q_knowledge=b2.b_id and ex_question.q_type=b3.b_id and ex_question.q_difficulty=b4.b_id and ex_question.q_class like ? and ex_question.q_knowledge like ? and ex_question.q_type like ? and ex_question.q_difficulty like ? and ex_question.q_value=? ORDER BY Q_ID DESC";

  /**
   * get a connection from a DB pool
   * @return Connection
   */
  public QuestionDAO() {
    try {
      dbconn = new DBConn();
      conn = dbconn.getConnection();
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }

  /**
   * get an object for the row find by PK
   * @param question_id String
   * @throws SQLException
   * @return Examinee
   */

  public Question findByKey(long question_id) throws SQLException {
    Statement stmt = null;
    ResultSet rs = null;
    Question question = null;
    question = new Question();
    try {
      stmt = conn.createStatement();

      rs = stmt.executeQuery("SELECT * FROM ex_question WHERE q_id=" +
                             question_id);
      while (rs.next()) {
        question.setQ_id(rs.getLong("q_id"));
后面还有 433 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。