Package realcix20.utils

Examples of realcix20.utils.DAO


                    sb.append(pkColumn.getColumnName() + "=? AND ");
                }               
            }
            sb.delete(sb.lastIndexOf("AND"), sb.lastIndexOf("AND") + 3);
            String sql = sb.toString();
            DAO dao = DAO.getInstance();       
            dao.update(sql);
            for (int i = 0; i < whereColumns.size(); i++) {
                Column column = (Column)columns.get(i);
                Cell cell = ObjectUtil.findNewCell(row, column.getTableName(), column.getColumnName());
                dao.setObject(i+1, cell.getColumnValue());
            }             
            dao.executeUpdate()
        }             
        //Delete mainTables
        StringBuffer sb = new StringBuffer("DELETE FROM ");
        sb.append(mainTableName + " WHERE ");
        Vector whereColumns = new Vector();
        Iterator pkColumnIter = pkColumns.iterator();
        while (pkColumnIter.hasNext()) {
            Column pkColumn = (Column)pkColumnIter.next();
            if (pkColumn.getTableName().equals(mainTableName)) {
                whereColumns.add(pkColumn);
                sb.append(pkColumn.getColumnName() + "=? AND ");
            }               
        }
        sb.delete(sb.lastIndexOf("AND"), sb.lastIndexOf("AND") + 3);
        String sql = sb.toString();  
        dao.update(sql);
        for (int i = 0; i < whereColumns.size(); i++) {
            Column column = (Column)columns.get(i);
            Cell cell = ObjectUtil.findNewCell(row, column.getTableName(), column.getColumnName());
            dao.setObject(i+1, cell.getColumnValue());
        }        
        dao.executeUpdate()
        dao.commit();
        dao.setAutoCommit(true);       
        return true;       
    }
View Full Code Here


                }
            }
            sb.delete(sb.lastIndexOf("AND"), sb.lastIndexOf("AND") + 3);
            String sql = sb.toString();
            //Delete Child Row
            DAO dao = DAO.getInstance();
            dao.update(sql);
            for (int i = 0; i < whereColumns.size(); i++) {
                Column column = (Column)whereColumns.get(i);
                Cell cell = ObjectUtil.findNewCell(row, column.getTableName(), column.getColumnName());
                dao.setObject(i+1, cell.getColumnValue());               
            }
            dao.executeUpdate();
            dao.commit();
            dao.setAutoCommit(true);
        }      
        return true;       
    }
View Full Code Here

            }
            sb.delete(sb.lastIndexOf("AND"),sb.lastIndexOf("AND") + 3);
            String sql = sb.toString();     
           
            //Update rows
            DAO dao = DAO.getInstance();
            dao.update(sql);
            dao.setAutoCommit(false);
           
            int currentParameter = 1;
            columnIterator = needModifyColumns.iterator();
            while (columnIterator.hasNext()) {
                Column column = (Column)columnIterator.next();
                Object value = getNewCellValue(column, row);
                dao.setObject(currentParameter, value);
                currentParameter++;
            }
            columnIterator = whereColumns.iterator();
            while (columnIterator.hasNext()) {
                Column column = (Column)columnIterator.next();
                Object value = getOldCellValue(column, row);
                dao.setObject(currentParameter, value);
                currentParameter++;
            }
           
            result = dao.executeUpdate();
           
            if (test) {
                dao.rollback();
            } else {
                if (!result) {
                    dao.rollback();
                }
                else {
                   
                    dao.commit();
                   
                    Iterator rowIter = row.getRowSet().getRows().iterator();
                    while (rowIter.hasNext()) {
                       
                        Row childRow = (Row)rowIter.next();
                        if (childRow.isDelete())
                            classDelete_Child(childRow);
                        else if (childRow.isAdd())
                            classInsert_Child(childRow, false);
                        else if (childRow.isModify())
                            classUpdate_Child(childRow, false);
                       
                    }
                                       
                }
            }
                   
            dao.setAutoCommit(true);
           
            return result;
           
    }
View Full Code Here

            }
            sb.delete(sb.lastIndexOf("AND"),sb.lastIndexOf("AND") + 3);
            String sql = sb.toString();
           
            //Update rows
            DAO dao = DAO.getInstance();
            dao.update(sql);
            dao.setAutoCommit(false);
           
            int currentParameter = 1;
            columnIterator = needModifyColumns.iterator();
            while (columnIterator.hasNext()) {
                Column column = (Column)columnIterator.next();
                Object value = getNewCellValue(column, row);
                dao.setObject(currentParameter, value);
                currentParameter++;
            }
            columnIterator = whereColumns.iterator();
            while (columnIterator.hasNext()) {
                Column column = (Column)columnIterator.next();
                Object value = getOldCellValue(column, row);
                dao.setObject(currentParameter, value);
                currentParameter++;
            }
           
            result = dao.executeUpdate();
           
            if (test)
                dao.rollback();
            else {
                if (!result)
                    dao.rollback();
                else
                    dao.commit();
            }
           
            dao.setAutoCommit(true);
                           
        return result;
       
    }
View Full Code Here

            public LDTableModel() {                                   
                    Vector names = new Vector();
                    Vector dataValues = new Vector();
                    names.add(ObjectUtil.findColumnTxt(200, "LD", "LD"));
                    names.add(ObjectUtil.findColumnTxt(200, "LD", "RUSER"));
                    DAO dao = DAO.getInstance();
                    dao.query(Resources.SELECT_ALL_LD_FROM_LD_SQL);
                    ResultSet rs = dao.executeQuery();
                    try {
                        while (rs.next()) {
                            Vector rowDatas = new Vector();
                            rowDatas.add(rs.getString("LD"));
                            rowDatas.add(rs.getString("RUSER"));
View Full Code Here

        }
       
       
        private static void deleteRelativeThings(int r){
            //first,delete rpn
            DAO dao = DAO.getInstance();
            dao.update(Resources.DELETE_RPN_BY_R_SQL);
            dao.setInt(1, r);
            dao.executeUpdate();
            //next,delete budgets(BI)
            dao.update(Resources.DELETE_BI_BY_R_SQL);
            dao.setInt(1, r);
            dao.executeUpdate();         
        }
View Full Code Here

            dao.executeUpdate();         
        }
       
        public static void delete(int r){
          deleteRelativeThings(r);         
          DAO dao = DAO.getInstance();
//          Delete childTables
          dao.update(Resources.DELETE_RI_SQL);
      dao.setInt(1, r);
      dao.executeUpdate();
//      Delete mainTables     
          dao.update(Resources.DELETE_R_SQL);
      dao.setInt(1, r);
      dao.executeUpdate();
        }
View Full Code Here

      dao.executeUpdate();
        }
       
        public static void deleteRelativeThings(int r, int ri) {
            //first,delete rpn
            DAO dao = DAO.getInstance();
            dao.update(Resources.DELETE_RPN_BY_R_RI_SQL);
            dao.setInt(1, r);
            dao.setInt(2, ri);
            dao.executeUpdate();
            //next,delete budgets(BI)
            dao.update(Resources.DELETE_BI_BY_R_RI_SQL);
            dao.setInt(1, r);
            dao.setInt(2, ri);
            dao.executeUpdate();
        }
View Full Code Here

            ObjectUtil.findNewCell(newRegRow, "R", "CREATED").setColumnValue(now);
            ObjectUtil.findNewCell(newRegRow, "R", "CREATEDBY").setColumnValue(GlobalValueManager.getValue("SESSION.LOGINUSER"));
            ObjectUtil.findNewCell(newRegRow, "R", "LASTCHANGED").setColumnValue(now);
            ObjectUtil.findNewCell(newRegRow, "R", "LASTCHANGEDBY").setColumnValue(GlobalValueManager.getValue("SESSION.LOGINUSER"));
            ObjectUtil.findNewCell(newRegRow, "R", "TXT256").setColumnValue(TxtManager.getTxt("VIEW.CURRENCYEVALUATION.TITLE"));
            DAO dao = DAO.getInstance();
            dao.query(Resources.SELECT_RI_XR_INFO_SQL);
            ResultSet rs = dao.executeQuery();
            try {
                int i = 1;
                double sum = 0.0;
                while (rs.next()) {
                    if (rs.getDouble("LAMT") != 0.0) {       
View Full Code Here

            String ip = ObjectUtil.findNewCell(ipRow, "IP", "IP").getColumnValue().toString();
            RegClass reg = (RegClass)ClassManager.createClass(510);
            StringBuffer sb = new StringBuffer(reg.getBasicSQL());
            sb.append(" WHERE RI.IM=? AND RI.IP=?");
            String sql = sb.toString();
            DAO dao = DAO.getInstance();
            dao.setObject(1, im);
            dao.setObject(2, ip);
            ResultSet rs = dao.executeQuery();
            try {
                if ( (rs.next()) && (im.equals(rs.getObject("IM"))) && (ip.equals(rs.getObject("IP"))) ) {
                    result = true;
                }
                rs.close();
View Full Code Here

TOP

Related Classes of realcix20.utils.DAO

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.