Package com.exedosoft.plat.bo

Examples of com.exedosoft.plat.bo.DODataSource


        "update DO_Code_MaxSequence SET max_sequence=max_sequence+1")
        .append(" WHERE upper(code_ItemUid)=?");
    Connection con = null;
    PreparedStatement stmt = null;
    DOBO bo = DOBO.getDOBOByName("do_authorization");
    DODataSource dss = bo.getDataBase();

    try {
      // query
      con = dss.getContextConnection();
      stmt = con.prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE,
          ResultSet.CONCUR_READ_ONLY);
      int retId = 1;

      stmt.setString(1, codeItemID);
      ResultSet rs = stmt.executeQuery();

      System.out.println("The SQL" + sql);

      if (rs.next()) {
        retId = rs.getInt("max_sequence") + 1;
        // update
        // //update
        stmt = con.prepareStatement(sqlUpdate.toString());
        stmt.setString(1, codeItemID);
        stmt.execute();
      } else {
        // //////////////insert
        stmt = con.prepareStatement(insertSql.toString());
        stmt.setString(1, UUIDHex.getInstance().generate());
        stmt.setString(2, null);
        stmt.setString(3, codeItemID);
        stmt.setString(4, null);
        stmt.setInt(5, 0);
        stmt.setLong(6, retId);
        stmt.execute();
      }
      // stmt.close();
      //

      return retId;

    } catch (SQLException ex) {
      try {
        con.rollback();
      } catch (SQLException e) {

      }
      ex.printStackTrace();
      return 0;
    } finally {// Close Connection
      try {
        if (stmt != null) {
          stmt.close();
        }
        dss.ifCloseConnection(con);
      } catch (Exception ex1) {
        ex1.printStackTrace();
      }
    }
  }
View Full Code Here


  }

  public void geneConfig() {

   
    DODataSource dss = DODataSource.parseGlobals();
    Transaction t = dss.getTransaction();
   
 

    // ///////////////////second generator grid and panes
    try {
View Full Code Here

  public static Connection getConnection() {
    Connection conn = null;
    try {
//      Class.forName(driverName);
//      conn = DriverManager.getConnection(url, user, password);
       DODataSource dss = DODataSource.getDataSourceByL10n("报销数据库I");
       conn = dss.getConnection();

    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
View Full Code Here

    StringBuffer insertSql = new StringBuffer(
        "insert into DO_Code_Sequence_Trash values(")
        .append("?,?,?,?,?,?)");
    DOBO bo = DOBO.getDOBOByName("do_authorization");
    DODataSource dss =  bo.getDataBase();
    Connection con = null;
    PreparedStatement stmt = null;

    try {

      con = dss.getContextConnection();
      // //////////////insert
      Date curDate = new Date(System.currentTimeMillis());
      stmt = con.prepareStatement(insertSql.toString());
      stmt.setString(1, UUIDHex.getInstance().generate());
      stmt.setString(2, codeItemID);
      stmt.setString(3, aDeptCode);
      stmt.setInt(4, aYear);
      stmt.setInt(5, aTrashID);
      stmt.setDate(6, curDate);
      stmt.execute();

    } catch (SQLException ex) {
      try {
        con.rollback();
      } catch (SQLException e) {

      }
      ex.printStackTrace();

    } finally {// Close Connection
      try {
        if (stmt != null) {
          stmt.close();
        }
        dss.ifCloseConnection(con);
      } catch (Exception ex1) {
        ex1.printStackTrace();
      }
    }
View Full Code Here

    Connection con = null;
    PreparedStatement stmt = null;
    int retId = -1;// //////////返回的值
    DOBO bo = DOBO.getDOBOByName("DO_CODE_MAXSEQUENCE");
    DODataSource dss =  bo.getDataBase();
    try {
      con = dss.getContextConnection();
      // query
      stmt = con.prepareStatement(selectSql);
      stmt.setString(1, codeItemID);
      stmt.setString(2, aDeptCode);
      stmt.setInt(3, aYear);
      ResultSet rs = stmt.executeQuery();

      if (rs.next()) {
        retId = rs.getInt("TRASH_CODE");
        // update
        stmt = con.prepareStatement(deleteSql.toString());
        stmt.setString(1, codeItemID);
        stmt.setString(2, aDeptCode);
        stmt.setInt(3, aYear);
        stmt.execute();
      }

      return retId;

    } catch (SQLException ex) {
      try {
        con.rollback();
      } catch (SQLException e) {

      }
      ex.printStackTrace();
      return -1;

    } finally {// Close Connection
      try {
        if (stmt != null) {
          stmt.close();
        }
        dss.ifCloseConnection(con);
      } catch (Exception ex1) {
        ex1.printStackTrace();
      }
    }
  }
View Full Code Here

      DatabaseMetaData meta = con.getMetaData();
      String[] tblTypes = new String[] { "TABLE" };
     
      /*对oracle的schema过滤 by whutmen@gmail.com begin */
      DOBO bo = DOBO.getDOBOByName("do_datasource");
      DODataSource dss = DODataSource.getDataSourceByL10n(bo
          .getCorrInstance().getValue("l10n"));
      String schema = null;
      if (dss.isOracle()) {
        schema = dss.getUserName().trim().toUpperCase();
      }
     
      ResultSet rsDB = meta.getTables(null, schema, null, tblTypes);
            /*by whutmen@gmail.com end */
     
 
View Full Code Here

      DatabaseMetaData meta = con.getMetaData();
      String[] tblTypes = new String[] { "TABLE" };
     
      /*对oracle的schema过滤 by whutmen@gmail.com begin */
      DOBO bo = DOBO.getDOBOByName("do_datasource");
      DODataSource dss = DODataSource.getDataSourceByL10n(bo
          .getCorrInstance().getValue("l10n"));
      String schema = null;
      if (dss.isOracle()) {
        schema = dss.getUserName().trim().toUpperCase();
      }
     
      ResultSet rsDB = meta.getTables(null, schema, null, tblTypes);
            /*by whutmen@gmail.com end */
     
 
View Full Code Here

      DatabaseMetaData meta = con.getMetaData();
      String[] tblTypes = new String[] { "TABLE" };
     
      /*对oracle的schema过滤 by whutmen@gmail.com begin */
      DOBO bo = DOBO.getDOBOByName("do_datasource");
      DODataSource dss = DODataSource.getDataSourceByL10n(bo
          .getCorrInstance().getValue("l10n"));
      String schema = null;
      if (dss.isOracle()) {
        schema = dss.getUserName().trim().toUpperCase();
      }
     
      ResultSet rsDB = meta.getTables(null, schema, null, tblTypes);
            /*by whutmen@gmail.com end */
     
 
View Full Code Here

    DOBO aBO = new DOBO();
    aBO.setType(DOBO.TYPE_BUSINESS);
    aBO.setName(project.getName() + "_global_bo");
    aBO.setL10n(project.getL10n() + "_Global");

    DODataSource dds = DODataSource.parseGlobals();

    Transaction t = dds.getTransaction();

    t.begin();

    DOService aService = DOService.getService("DO_UI_PaneLinks_copy");
    try {
View Full Code Here

    Connection con = null;
    PreparedStatement stmt = null;
    int retId = 1;// //////////返回的值
    DOBO bo = DOBO.getDOBOByName("do_authorization");
    DODataSource dss =  bo.getDataBase();
    try {


      con = dss.getContextConnection();
      // query
      stmt = con.prepareStatement(selectSql);
      stmt.setString(1, codeItemID);
      stmt.setInt(2, aYear);
      ResultSet rs = stmt.executeQuery();

      if (rs.next()) {
        retId = rs.getInt("max_sequence") + 1;
        // update
        stmt = con.prepareStatement(updateSql.toString());
        stmt.setString(1, codeItemID);
        stmt.setInt(2, aYear);
        stmt.execute();
      } else {
        // //////////////insert
        stmt = con.prepareStatement(insertSql.toString());
        stmt.setString(1, UUIDHex.getInstance().generate());
        stmt.setString(2, aDeptCode);
        stmt.setString(3, codeItemID);
        stmt.setString(4, aDeptCode);
        stmt.setInt(5, aYear);
        stmt.setLong(6, retId);
        stmt.execute();
      }

      return retId;

    } catch (SQLException ex) {
      try {
        con.rollback();
      } catch (SQLException e) {

      }
      ex.printStackTrace();
      return -1;

    } finally {// Close Connection
      try {
        if (stmt != null) {
          stmt.close();
        }
        dss.ifCloseConnection(con);
      } catch (Exception ex1) {
        ex1.printStackTrace();
      }
    }
  }
View Full Code Here

TOP

Related Classes of com.exedosoft.plat.bo.DODataSource

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.