Package org.fto.jthink.jdbc

Examples of org.fto.jthink.jdbc.SQLBuilder


    //JDBCTransaction transaction = (JDBCTransaction)resManager.getResource(JDBCTransaction.class.getName());
    JDBCTransaction transaction = (JDBCTransaction)((TransactionFactory)resManager.getResource("SampleTransaction")).create();
    /* 返回SQLExecutor工厂,并创建SQLExecutor对象 */
    SQLExecutor sqlExecutor = transaction.getSQLExecutorFactory(connId).create();
    /* 返回SQLBuilder工厂,并创建SQLBuilder对象 */
    SQLBuilder sqlBuilder = transaction.getSQLBuilderFactory(connId).create("");

    try{
      /* 开始事务 */
      transaction.begin();
      //transaction.setAutoCommit(connId, true);
View Full Code Here


//    PreparedStatement ps = sqlExecutor.getConnection().prepareStatement("select 1");
//    logger.debug("timeout:"+ps.getQueryTimeout());
//    ps.close();
//    logger.debug("timeout:"+sqlExecutor.getTimeout());
    /* 返回SQLBuilder工厂,并创建SQLBuilder对象 */
    SQLBuilder sqlBuilder = transaction.getSQLBuilderFactory("SampleDataSource").create("");
   
    try{
      /* 开始事务 */
      transaction.begin();
     
      //logger.debug("getTransactionLevel():"+transaction.getTransactionLevel("SampleDataSource"));
     
      messagesHM.put("ID", generateID(sqlExecutor));
      messagesHM.put("SendTime", DateTimeHelper.formatDateTimetoString(DateTimeHelper.getSystemDate()));
     
      SQL sql = sqlBuilder.constructSQLForInsert("Messages", messagesHM);
      if(logger.isDebugEnabled()){
        logger.debug("通过SQLBuilder构建的SQL: " + sql.getSQLString()+"     "+messagesHM);
      }
      /* 执行SQ语句 */
      sqlExecutor.execute(sql);
View Full Code Here

    //JDBCTransaction transaction = (JDBCTransaction)resManager.getResource(JDBCTransaction.class.getName());
    JDBCTransaction transaction = (JDBCTransaction)((TransactionFactory)resManager.getResource("SampleTransaction")).create();
    /* 返回SQLExecutor工厂,并创建SQLExecutor对象 */
    SQLExecutor sqlExecutor = transaction.getSQLExecutorFactory("SampleDataSource").create();
    /* 返回SQLBuilder工厂,并创建SQLBuilder对象 */
    SQLBuilder sqlBuilder = transaction.getSQLBuilderFactory("SampleDataSource").create("");
   
    try{
      /* 开始事务 */
      transaction.begin();

      Condition condi = new Condition();
      condi.add(new ConditionItem("ID","=",id));
     
      SQL sql = sqlBuilder.constructSQLForUpdate("Messages", messagesHM, condi);
      if(logger.isDebugEnabled()){
        logger.debug("通过SQLBuilder构建的SQL: " + sql.getSQLString()+"     "+messagesHM);
      }
      /* 执行SQ语句 */
      Object rs = sqlExecutor.execute(sql);
View Full Code Here

    //JDBCTransaction transaction = (JDBCTransaction)resManager.getResource(JDBCTransaction.class.getName());
    JDBCTransaction transaction = (JDBCTransaction)((TransactionFactory)resManager.getResource("SampleTransaction")).create();
    /* 返回SQLExecutor工厂,并创建SQLExecutor对象 */
    SQLExecutor sqlExecutor = transaction.getSQLExecutorFactory("SampleDataSource").create();
    /* 返回SQLBuilder工厂,并创建SQLBuilder对象 */
    SQLBuilder sqlBuilder = transaction.getSQLBuilderFactory("SampleDataSource").create("");
   
    try{
      /* 开始事务 */
      transaction.begin();

      Condition condi = new Condition();
      condi.add(new ConditionItem("ID","=",id));
     
      SQL sql = sqlBuilder.constructSQLForDelete("Messages", condi);
      if(logger.isDebugEnabled()){
        logger.debug("通过SQLBuilder构建的SQL: " + sql.getSQLString()+"     ");
      }
      /* 执行SQ语句 */
      Object rs = sqlExecutor.execute(sql);
View Full Code Here

    JDBCTransaction transaction = (JDBCTransaction)((TransactionFactory)resManager.getResource("SampleTransaction")).create();
    /* 返回SQLExecutor工厂,并创建SQLExecutor对象 */
    SQLExecutor sqlExecutor = transaction.getSQLExecutorFactory("SampleDataSource").create();
    //sqlExecutor.setPoolable(true);
    //sqlExecutor.setResultMaker(new MapResultMaker());
    SQLBuilder sqlBuilder = transaction.getSQLBuilderFactory("SampleDataSource").create("");
    try{
      /* 开始事务 */
      transaction.begin();
      /* 直接执行SQL查询语句 */
      return (List)sqlExecutor.execute(sqlBuilder.constructSQLForCount("messages", "*", "MsgCount", null));
     
    }finally{
      /* 关闭事务 */
      transaction.close();
    }
View Full Code Here

    JDBCTransaction transaction = (JDBCTransaction)((TransactionFactory)resManager.getResource("SampleTransaction")).create();
    /* 返回SQLExecutor工厂,并创建SQLExecutor对象 */
    SQLExecutor sqlExecutor = transaction.getSQLExecutorFactory("SampleDataSource").create();
   
    /* 返回SQLBuilder工厂,并创建SQLBuilder对象 */
    SQLBuilder sqlBuilder = transaction.getSQLBuilderFactory("SampleDataSource").create("");
   
    //sqlExecutor.setResultMaker(new MapResultMaker());
   
    try{
      /* 开始事务 */
      transaction.begin();
     
//      /* 构建查询条件 */
//      Condition condition = new Condition();
//      condition.add(new ConditionItem("Id","=",id));
     
      /* 通过SQLBuilder来构建SQL语句 */
      SQL sql = sqlBuilder.constructSQLForSelect("Messages",false,new Column[]{new Column("SUBJECT"),new Column("SENDER")},condition,null,null,3,2);
      //SQL sql = sqlBuilder.constructSQLForSelect("Messages",true,null,condition,null,null);
     
      logger.debug("通过SQLBuilder构建的SQL: " + sql.getSQLString());
     
      return (List)sqlExecutor.execute(sql);
View Full Code Here

TOP

Related Classes of org.fto.jthink.jdbc.SQLBuilder

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.