Search in sources :

Example 1 with Bdb

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);
    }
}
Also used : Bdb(io.leopard.bdb.Bdb) DatabaseException(com.sleepycat.je.DatabaseException)

Example 2 with Bdb

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);
    }
}
Also used : Bdb(io.leopard.bdb.Bdb) DuplicateEntryException(com.sleepycat.je.tree.DuplicateEntryException) DatabaseException(com.sleepycat.je.DatabaseException)

Aggregations

DatabaseException (com.sleepycat.je.DatabaseException)2 Bdb (io.leopard.bdb.Bdb)2 DuplicateEntryException (com.sleepycat.je.tree.DuplicateEntryException)1