package cobolprogramclasses.dao;

/************************************************************************

 **This file automatically generated from a part of Cobol program.

 **Generated at time 16:01:14.45 on Wednesday, 12/16/09

 ************************************************************************/

import com.res.java.lib.*;

import java.math.BigDecimal;

import java.sql.*;

 

public class CblexDao extends AbstractDao {

 

      public boolean execSqlStatement1(BigDecimal val1,BigDecimal val2) {

            try {

                  if(openConnection()) {

                        if(prepareStatement(" "+

                        " UPDATE CORPDATA/EMPLOYEE"+

                        " SET SALARY = SALARY * ?"+

                        " WHERE COMM >= ? ")) {

                              getStatement().setBigDecimal(1,val1);

                              getStatement().setBigDecimal(2,val2);

                              getStatement().executeUpdate();

                              return true;

                        }

                  }

            } catch(Exception e) {

                  e.printStackTrace();

            }

            return false;

      }

      public boolean execSqlStatement2() {

            try {

                  if(openConnection())

                        getConnection().commit();

                  return true;

            } catch(Exception e) {

            }

            return false;

      }

      public boolean execSqlStatement3(BigDecimal val1) {

            try {

                  if(openConnection()) {

                        if(prepareStatement(" "+

                        " SELECT DISTINCT projno, empprojact.empno,"+

                        " lastname||\", \"||firstnme ,salary "+

                        " from corpdata/empprojact, corpdata/employee "+

                        " where empprojact.empno =employee.empno and"+

                        " comm >= ? ")) {

                              getStatement().setBigDecimal(1,val1);

                              saveStatement("C1",getStatement());

                              return true;

                        }

                  }

            } catch(Exception e) {

                  e.printStackTrace();

            }

            return false;

      }

      public boolean execSqlStatement4() {

            try {

                  loadStatement("C1");

                  saveResult("C1",getStatement().executeQuery());

                  return true;

            } catch(Exception e) {

                  e.printStackTrace();

            }

            return false;

      }

      public boolean execSqlStatement5(int val1,String val2) {

            try {

                  if(openConnection()) {

                        if(prepareStatement(" "+

                        " SELECT EMPPROJACT.PROJNO, PROJNAME, COUNT(*),"+

                        " SUM ( (DAYS(EMENDATE)-DAYS(EMSTDATE)) *"+

                        " EMPTIME * DECIMAL((SALARY / ?),8,2)) "+

                        " FROM CORPDATA/EMPPROJACT, CORPDATA/PROJECT,"+

                        " CORPDATA/EMPLOYEE "+

                        " WHERE EMPPROJACT.PROJNO=PROJECT.PROJNO AND"+

                        " EMPPROJACT.EMPNO =EMPLOYEE.EMPNO AND"+

                        " PRENDATE > ? "+

                        " GROUP BY EMPPROJACT.PROJNO, PROJNAME ")) {

                              getStatement().setInt(1,val1);

                              getStatement().setString(2,val2);

                              saveStatement("C2",getStatement());

                              return true;

                        }

                  }

            } catch(Exception e) {

                  e.printStackTrace();

            }

            return false;

      }

      public boolean execSqlStatement6() {

            try {

                  loadStatement("C2");

                  saveResult("C2",getStatement().executeQuery());

                  return true;

            } catch(Exception e) {

                  e.printStackTrace();

            }

            return false;

      }

      public boolean execSqlStatement7() {

            try {

                  loadResult("C1");

                  return true;

            } catch(Exception e) {

                  e.printStackTrace();

            }

            return false;

      }

      public boolean execSqlStatement8() {

            try {

                  loadResult("C2");

                  return true;

            } catch(Exception e) {

                  e.printStackTrace();

            }

            return false;

      }

}