use of org.apache.derby.iapi.types.UserType in project derby by apache.
the class CacheLock method saveProperty.
void saveProperty(TransactionController tc, String key, Serializable value) throws StandardException {
if (saveServiceProperty(key, value))
return;
// Do a scan to see if the property already exists in the Conglomerate.
ScanController scan = this.openScan(tc, key, TransactionController.OPENMODE_FORUPDATE);
DataValueDescriptor[] row = makeNewTemplate();
if (scan.fetchNext(row)) {
if (value == null) {
// A null input value means that we should delete the row
scan.delete();
} else {
// a value already exists, just replace the second columm
row[1] = new UserType(value);
scan.replace(row, (FormatableBitSet) null);
}
scan.close();
} else {
// The value does not exist in the Conglomerate.
scan.close();
scan = null;
if (value != null) {
// not a delete request, so insert the new property.
row = makeNewTemplate(key, value);
ConglomerateController cc = tc.openConglomerate(propertiesConglomId, false, TransactionController.OPENMODE_FORUPDATE, TransactionController.MODE_TABLE, TransactionController.ISOLATION_SERIALIZABLE);
cc.insert(row);
cc.close();
}
}
}
Aggregations