Package org.apache.empire.db

Examples of org.apache.empire.db.DBRecord.update()


        // Now load a record from that table and set the value for foo
        System.out.println("Changing the value for the FOO field of a particular employee:");
        DBRecord rec = new DBRecord();
        rec.read(db.T_EMPLOYEES, idTestPerson, conn);
        rec.setValue(C_FOO, "Hello World");
        rec.update(conn);
       
        // Now extend the size of the field from 20 to 40 characters
        System.out.println("Extending size of column FOO to 40 characters:");
        C_FOO.setSize(40);
        script.clear();
View Full Code Here


        script.run(db.getDriver(), conn, false);

        // Now set a longer value for the record
        System.out.println("Changing the value for the FOO field for the above employee to a longer string:");
        rec.setValue(C_FOO, "This is a very long field value!");
        rec.update(conn);

        // Finally, drop the column again
        System.out.println("Dropping the FOO column from the employee table:");
        script.clear();
        db.getDriver().getDDLScript(DBCmdType.DROP, C_FOO, script);
View Full Code Here

        DBRecord rec = new DBRecord();
        rec.read(Q_EMP_DEP, employeeId, conn);
        // Modify and Update fields from both Employee and Department
        rec.setValue(T_EMP.C_PHONE_NUMBER, "0815-4711");
        rec.setValue(T_DEP.C_BUSINESS_UNIT, "AUTO");
        rec.update(conn);
        // Successfully updated
        System.out.println("The employee has been sucessfully updated");
    }   
   
    /**
 
View Full Code Here

    DBRecord rec = new DBRecord();
    rec.create(sampleDB.T_DEPARTMENTS);
    rec.setValue(sampleDB.T_DEPARTMENTS.NAME, department_name);
    rec.setValue(sampleDB.T_DEPARTMENTS.BUSINESS_UNIT, businessUnit);
    try {
      rec.update(conn);
    } catch (Exception e) {
      log.error(e.getLocalizedMessage());
      return 0;
    }
    // Return Department ID
View Full Code Here

    rec.setValue(sampleDB.T_EMPLOYEES.FIRST_NAME, firstName);
    rec.setValue(sampleDB.T_EMPLOYEES.LAST_NAME, lastName);
    rec.setValue(sampleDB.T_EMPLOYEES.GENDER, gender);
    rec.setValue(sampleDB.T_EMPLOYEES.DEPARTMENT_ID, depID);
    try {
      rec.update(conn);
    } catch (Exception e) {
      log.error(e.getLocalizedMessage());
      return 0;
    }
    // Return Employee ID
View Full Code Here

      // Insert a Department
      DBRecord rec = new DBRecord();
      rec.create(db.T_DEPARTMENTS);
      rec.setValue(db.T_DEPARTMENTS.C_NAME, department_name);
      rec.setValue(db.T_DEPARTMENTS.C_BUSINESS_UNIT, businessUnit);
      rec.update(conn);
      // Return Department ID
      return rec.getInt(db.T_DEPARTMENTS.C_DEPARTMENT_ID);
    }

  /*
 
View Full Code Here

    rec.setValue(db.T_EMPLOYEES.C_SALUTATION, salutation);
    rec.setValue(db.T_EMPLOYEES.C_FIRSTNAME, firstName);
    rec.setValue(db.T_EMPLOYEES.C_LASTNAME, lastName);
    rec.setValue(db.T_EMPLOYEES.C_GENDER, gender);
    rec.setValue(db.T_EMPLOYEES.C_DEPARTMENT_ID, depID);
    rec.update(conn);
    // Return Employee ID
    return rec.getInt(db.T_EMPLOYEES.C_EMPLOYEE_ID);
  }

}
View Full Code Here

        // Insert a Department
        DBRecord rec = new DBRecord();
        rec.create(db.DEPARTMENTS);
        rec.setValue(db.DEPARTMENTS.NAME, department_name);
        rec.setValue(db.DEPARTMENTS.BUSINESS_UNIT, businessUnit);
        rec.update(conn);
        // Return Department ID
        return rec.getInt(db.DEPARTMENTS.DEPARTMENT_ID);
    }

    /*
 
View Full Code Here

        rec.setValue(db.EMPLOYEES.SALUTATION, salutation);
        rec.setValue(db.EMPLOYEES.FIRSTNAME, firstName);
        rec.setValue(db.EMPLOYEES.LASTNAME, lastName);
        rec.setValue(db.EMPLOYEES.GENDER, gender);
        rec.setValue(db.EMPLOYEES.DEPARTMENT_ID, depID);
        rec.update(conn);
        // Return Employee ID
        return rec.getInt(db.EMPLOYEES.EMPLOYEE_ID);
    }
}
View Full Code Here

            r.create(T_EMP, conn);
        else
            r.read(T_EMP, emp.getEmployeeId(), conn);

        r.setBeanValues(emp);
        r.update(conn);


        r.getBeanProperties(emp);
        emp.setNew(false);
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.