Package com.mysql.jdbc

Examples of com.mysql.jdbc.Statement


     *
     * @throws java.sql.SQLException
     */
    @Override
    protected void createIndexes() throws SQLException {
        Statement statement = (com.mysql.jdbc.Statement)connection.getJDBCConnection().createStatement();
        statement.execute("ALTER TABLE nodes ENABLE KEYS");
        statement.execute("ALTER TABLE triples ENABLE KEYS");
        statement.execute("SET UNIQUE_CHECKS=1; ");
    }
View Full Code Here


     */
    @Override
    protected void flushBacklogInternal() throws SQLException {
        try {
            // load node backlog
            Statement statement = (com.mysql.jdbc.Statement)connection.getJDBCConnection().createStatement();
            statement.setLocalInfileInputStream(MySQLLoadUtil.flushNodes(nodeBacklog));
            statement.execute(
                    "LOAD DATA LOCAL INFILE 'nodes.csv' " +
                            "INTO TABLE nodes " +
                            "COLUMNS TERMINATED BY ',' " +
                            "OPTIONALLY ENCLOSED BY '\"' " +
                            "ESCAPED BY '\"' " +
                            "LINES TERMINATED BY '\\r\\n' " +
                            "(id,ntype,svalue,dvalue,ivalue,tvalue,bvalue,ltype,lang,createdAt)");


            statement.setLocalInfileInputStream(MySQLLoadUtil.flushTriples(tripleBacklog));
            statement.execute(
                    "LOAD DATA LOCAL INFILE 'triples.csv' " +
                            "INTO TABLE triples " +
                            "COLUMNS TERMINATED BY ',' " +
                            "OPTIONALLY ENCLOSED BY '\"' " +
                            "ESCAPED BY '\"' " +
                            "LINES TERMINATED BY '\\r\\n' " +
                            "(id,subject,predicate,object,context,creator,inferred,deleted,createdAt,deletedAt)");

            statement.close();

        } catch (IOException ex) {
            throw new SQLException("error while flushing out data",ex);
        }
    }
View Full Code Here

     *
     * @throws java.sql.SQLException
     */
    @Override
    protected void dropIndexes() throws SQLException {
        Statement statement = (com.mysql.jdbc.Statement)connection.getJDBCConnection().createStatement();
        statement.execute("SET UNIQUE_CHECKS=0; ");
        statement.execute("ALTER TABLE nodes DISABLE KEYS");
        statement.execute("ALTER TABLE triples DISABLE KEYS");
    }
View Full Code Here

    }

    public List getPipeLineListByObjectInspectionId(Integer id, Properties props) throws SQLException {

        Connection dbConn = getConnection(props);
        Statement st = (Statement) dbConn.createStatement();
        ResultSet rs = (ResultSet) st.executeQuery("select * from pipeLineElement where objectId=" + id);
        List plList = setValues(rs);
        rs.close();
        return plList;


View Full Code Here

    public List getPipeLineListByObjectInspectionAndDetailType(Integer typeId, Integer objectId, Properties props) throws SQLException {


        Connection dbConn = getConnection(props);
        Statement st = (Statement) dbConn.createStatement();
        ResultSet rs = (ResultSet) st.executeQuery("select * from pipeLineElement where objectId=" + objectId + " and detailTypeId=" + typeId);
        List plList = setValues(rs);
        rs.close();

        return plList;
    }
View Full Code Here

  public boolean excSql(String sql) {
    if (con == null)
      getConnection(); // 连接到数据库

    try {
      Statement st = (Statement) con.createStatement(); // 创建用于执行静态sql语句的Statement对象
      int counts = st.executeUpdate(sql); // 执行操作的sql语句
      if (0 == counts) {
        log.info("执行成功,,共0条数据受到影响,没有完成操作!:SQL语句-->【" + sql + "】");
        return false;
      }
      log.info("执行成功,共" + counts + "条数据受到影响:" + "SQL语句-->【" + sql + "】");
View Full Code Here

    ResultSet rs = null;
    if (con == null)
      getConnection(); // 连接到数据库
    try {
      Statement st = null; // 创建用于执行静态sql语句的Statement对象,st属局部变量
      st = (Statement) con
          .createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
              ResultSet.CONCUR_READ_ONLY);
      rs = st.executeQuery(sql); // 执行sql查询语句,返回查询数据的结果集
      log.info("执行成功:SQL查询语句-->【" + sql + "】");
    } catch (SQLException e) {
      log.error("执行失败:SQL查询语句-->【" + sql + "】");
      log.error(e.getMessage());
      rs = null;
View Full Code Here

    public List getConstructionDefectZonesByConstrType(String typeId,  String buildingObjectId,Properties props) throws SQLException {


        Connection dbConn = getConnection(props);
        Statement st = (Statement) dbConn.createStatement();
        ResultSet rs = (ResultSet) st.executeQuery("select constructionDefectsZone.constructionDefectId from constructionExamples, constructionDefectsZone where constructionExamples.buildObjectId="+buildingObjectId+" and constructionExamples.exampleId=constructionDefectsZone.exampleId and constructionDefectsZone.constructionTypeId="+typeId+" group by uniqueForExamples");
        List plList = setValues(rs);
        rs.close();

        return plList;
    }
View Full Code Here

        return plList;
    }

    public List getExamplesByDefect(String unique,Properties properties) throws SQLException {
        Connection dbConn = getConnection(properties);
        Statement st = (Statement) dbConn.createStatement();
        ResultSet rs = (ResultSet) st.executeQuery("select exampleId from constructionDefectsZone where uniqueForExamples="+unique);
        List list=new ArrayList();
        while (rs.next()) {
              list.add(rs.getString(1));
        }
        rs.close();
View Full Code Here

        }

        public List getExamplesWithNoDefects(Integer buildingObjectId, Properties props) throws SQLException {

            Connection dbConn = getConnection(props);
            Statement st = (Statement) dbConn.createStatement();
            System.out.println("select exampleId from constructionExamples where constructionExamples.noDeffects=false and objectConstructionId in (select typeId from objectConstructions where objectId="+buildingObjectId+")");
            ResultSet rs = (ResultSet) st.executeQuery("select exampleId from constructionExamples where constructionExamples.noDeffects=false and objectConstructionId in (select typeId from objectConstructions where objectId="+buildingObjectId+")");
            List list=new ArrayList();
            while (rs.next()) {
                list.add(new Integer(rs.getInt(1)));
            }

            rs.close();
            st.close();
            dbConn.close();
            return list;

        }
View Full Code Here

TOP

Related Classes of com.mysql.jdbc.Statement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.