use of io.leopard.bdb.Bdb in project leopard by tanhaichao.
the class IdTransverterBdbImpl method transform.
@Override
public String transform(String tableName, String id) {
try {
Bdb database = bdb.getDatabase(tableName);
// System.err.println("getString tableName:" + tableName + " id:" + id + " count:" + bdb.count());
String newId = database.getString(id);
return newId;
} catch (DatabaseException e) {
throw new RuntimeException(e.getMessage(), e);
}
}
use of io.leopard.bdb.Bdb in project leopard by tanhaichao.
the class IdTransverterBdbImpl method add.
@Override
public boolean add(String tableName, String id, String newId) {
try {
Bdb database = bdb.getDatabase(tableName);
System.err.println("add tableName:" + tableName + " id:" + id);
return database.putNoDupData(id, newId);
} catch (DuplicateEntryException e) {
logger.warn(e.getMessage());
return false;
} catch (DatabaseException e) {
throw new RuntimeException(e.getMessage(), e);
}
}
Aggregations