Thanks Wyclif, I will remember this for future stories :)


On Sat, Dec 21, 2013 at 12:52 AM, wluyima <notifications@github.com> wrote:

> In
> api/src/main/java/org/openmrs/util/databasechange/MigrateDrugOrderUnitsToCodedDoseUnitsChangeset.java:
>
> > +            throw new CustomChangeException(e);
> > +        }
> > +    }
> > +
> > +    private void migrateUnitsToCodedValue(JdbcConnection connection, List<String> uniqueUnits) throws CustomChangeException, SQLException, DatabaseException {
> > +        PreparedStatement updateDrugOrderStatement = null;
> > +        Boolean autoCommit = null;
> > +        try {
> > +            autoCommit = connection.getAutoCommit();
> > +            connection.setAutoCommit(false);
> > +            updateDrugOrderStatement = connection.prepareStatement("update drug_order set dose_units = ? where units = ?");
> > +            for (String unit : uniqueUnits) {
> > +                Integer conceptIdForUnit = DatabaseUtil.getConceptIdForUnits(connection.getUnderlyingConnection(), unit);
> > +                updateDrugOrderStatement.setInt(1, conceptIdForUnit);
> > +                updateDrugOrderStatement.setString(2, unit);
> > +                updateDrugOrderStatement.executeUpdate();
>
> Anyways it was just a suggestion, you can leave it the way it is as long
> as it was working
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/openmrs/openmrs-core/pull/488/files#r8508060>
> .
>