本文整理匯總了Java中com.sleepycat.je.OperationStatus.SUCCESS屬性的典型用法代碼示例。如果您正苦於以下問題:Java OperationStatus.SUCCESS屬性的具體用法?Java OperationStatus.SUCCESS怎麽用?Java OperationStatus.SUCCESS使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類com.sleepycat.je.OperationStatus
的用法示例。
在下文中一共展示了OperationStatus.SUCCESS屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: syncGetFirst
public byte [] syncGetFirst()
{
try
{
m_cursor = m_bdb.openCursor(null, null);
OperationStatus status = m_cursor.getFirst(m_key, m_data, LockMode.DEFAULT);
if(status == OperationStatus.SUCCESS)
{
m_nNbRecordExported = 1;
byte tDataWithHeader[] = getDataRead();
return tDataWithHeader;
}
}
catch (DatabaseException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
示例2: syncGetNext
public byte [] syncGetNext()
{
try
{
if(m_cursor != null)
{
OperationStatus status = m_cursor.getNext(m_key, m_data, LockMode.DEFAULT);
if(status == OperationStatus.SUCCESS)
{
m_nNbRecordExported++;
byte tDataWithHeader[] = getDataRead();
return tDataWithHeader;
}
}
}
catch (DatabaseException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
示例3: getTotalCount
/**
* 獲取總數
* @param dbName
* @return
* @throws Exception
*/
public int getTotalCount(String dbName) throws Exception {
int count = 0;
Cursor cursor = null;
try {
Database db = this.getDb(dbName);
cursor = db.openCursor(null, null);
DatabaseEntry foundKey = new DatabaseEntry();
DatabaseEntry foundData = new DatabaseEntry();
if (cursor.getLast(foundKey, foundData, LockMode.DEFAULT) == OperationStatus.SUCCESS) {
count = cursor.count();
}
} finally {
if (cursor != null) {
cursor.close();
}
}
return count;
}
示例4: put
/**
* 向數據庫中添加一條記錄。
*
* 如果數據庫不支持一個key對應多個data或當前database中已經存在該key了,
* 則使用此方法將使用新的值覆蓋舊的值。
*
* @param i_Key
* @param i_Value
* @return
*/
public boolean put(DatabaseEntry i_Key ,DatabaseEntry i_Value)
{
OperationStatus v_OperationStatus = this.database.put(null ,i_Key ,i_Value);
if ( v_OperationStatus == OperationStatus.SUCCESS )
{
if ( this.autoCommit )
{
this.commit();
}
return true;
}
else
{
return false;
}
}
示例5: putNoOverwrite
/**
* 向數據庫中添加一條記錄。
*
* 如果原先已經有了該key,則不覆蓋。
* 不管database是否允許支持多重記錄(一個key對應多個value),
* 隻要存在該key就不允許添加,並且返回OperationStatus.KEYEXIST信息。
*
* @param i_Key
* @param i_Value
* @return
*/
public boolean putNoOverwrite(DatabaseEntry i_Key ,DatabaseEntry i_Value)
{
OperationStatus v_OperationStatus = this.database.putNoOverwrite(null ,i_Key ,i_Value);
if ( v_OperationStatus == OperationStatus.SUCCESS )
{
if ( this.autoCommit )
{
this.commit();
}
return true;
}
else if ( v_OperationStatus == OperationStatus.KEYEXIST )
{
return true;
}
else
{
return false;
}
}
示例6: putNoDupData
/**
* 向數據庫中添加一條記錄。
*
* 如果原先已經有了該key,則不覆蓋。
* 不管database是否允許支持多重記錄(一個key對應多個value),
* 隻要存在該key就不允許添加,並且返回OperationStatus.KEYEXIST信息。
*
* @param i_Key
* @param i_Value
* @return
*/
public boolean putNoDupData(DatabaseEntry i_Key ,DatabaseEntry i_Value)
{
OperationStatus v_OperationStatus = this.database.putNoDupData(null ,i_Key ,i_Value);
if ( v_OperationStatus == OperationStatus.SUCCESS )
{
if ( this.autoCommit )
{
this.commit();
}
return true;
}
else
{
return false;
}
}
示例7: getDBEntry
/**
* 獲取記錄的方法,通過key的方式來匹配,如果沒有改記錄則返回OperationStatus.NOTFOUND
*
* @param i_Key
* @return
*/
public DatabaseEntry getDBEntry(String i_Key)
{
DatabaseEntry v_Value = new DatabaseEntry();
OperationStatus v_OperationStatus = null;
try
{
v_OperationStatus = this.database.get(null ,this.toDBEntry(i_Key) ,v_Value ,LockMode.DEFAULT);
if ( v_OperationStatus != null && v_OperationStatus == OperationStatus.SUCCESS )
{
return v_Value;
}
}
catch (Exception exce)
{
exce.printStackTrace();
}
return null;
}
示例8: get
public TempTarget get(final long uid) {
final DatabaseEntry key = new DatabaseEntry();
LongBinding.longToEntry(uid, key);
final DatabaseEntry value = new DatabaseEntry();
if (_id2Target.get(null, key, value, LockMode.READ_UNCOMMITTED) == OperationStatus.SUCCESS) {
final TempTarget target = fromByteArray(value.getData());
LongBinding.longToEntry(System.nanoTime(), value);
_id2LastAccessed.put(null, key, value);
if (s_logger.isDebugEnabled()) {
s_logger.debug("Found record {} for {} in {}", new Object[] {target, uid, _id2Target.getDatabaseName() });
}
return target;
} else {
if (s_logger.isDebugEnabled()) {
s_logger.debug("No record found for {} in {}", uid, _id2Target.getDatabaseName());
}
return null;
}
}
示例9: get
@Override
public CloneableRecord get(ExecutionContext context, CloneableRecord key, IndexMeta indexMeta, String dbName) {
DatabaseEntry keyEntry = new DatabaseEntry();
DatabaseEntry valueEntry = new DatabaseEntry();
keyEntry.setData(indexCodecMap.get(indexMeta.getName()).getKey_codec().encode(key));
OperationStatus status = getDatabase(dbName).get(context.getTransaction() == null ? null : ((JE_Transaction) context.getTransaction()).txn,
keyEntry,
valueEntry,
LockMode.DEFAULT);
if (OperationStatus.SUCCESS != status) {
return null;
}
if (valueEntry.getSize() != 0) {
return indexCodecMap.get(indexMeta.getName()).getValue_codec().decode(valueEntry.getData());
} else {
return null;
}
}
示例10: getGroundhogStatistics
public GroundhogStatistics getGroundhogStatistics() {
GroundhogStatistics wholeGroundhogStatistics = new GroundhogStatistics();
try {
Cursor myCursor = conceptToConceptVectorIndexStore.openCursor(null, null);
DatabaseEntry foundKey = new DatabaseEntry();
DatabaseEntry foundData = new DatabaseEntry();
while (myCursor.getNext(foundKey, foundData, LockMode.DEFAULT) == OperationStatus.SUCCESS) {
ConceptToConceptVectorRecordIndexEntry entry = (ConceptToConceptVectorRecordIndexEntry) myDataBinding.entryToObject(foundData);
Integer key = (Integer) myIntegerBinding.entryToObject(foundKey);
ConceptStatistic conceptStatistic = new ConceptStatistic();
conceptStatistic.docFrequency = entry.conceptVectorRecordIDs.size();
conceptStatistic.termFrequency = entry.sumOfValuesInRecords.intValue();
wholeGroundhogStatistics.conceptStatistics.put(key, conceptStatistic);
wholeGroundhogStatistics.allConceptOccurrences += entry.sumOfValuesInRecords;
}
myCursor.close();
} catch (DatabaseException e) {
e.printStackTrace();
}
return wholeGroundhogStatistics;
}
示例11: getLink
public HGPersistentHandle[] getLink(HGPersistentHandle handle)
{
try
{
DatabaseEntry key = new DatabaseEntry(handle.toByteArray());
DatabaseEntry value = new DatabaseEntry();
if (data_db.get(txn().getBJETransaction(), key, value, LockMode.DEFAULT) == OperationStatus.SUCCESS)
return (HGPersistentHandle[]) linkBinding.entryToObject(value);
else
return null;
}
catch (Exception ex)
{
throw new HGException("Failed to retrieve link with handle " + handle, ex);
}
}
示例12: readData
public void readData(int limit)
{
Cursor cursor = scaffoldDatabase.openCursor(null, null);
DatabaseEntry key = new DatabaseEntry();
DatabaseEntry data = new DatabaseEntry();
int i = 0;
while(cursor.getNext(key, data, LockMode.DEFAULT) == OperationStatus.SUCCESS)
{
if(i >= limit)
break;
String keyString = new String(key.getData());
System.out.println("hash: " + keyString);
i++;
}
cursor.close();
}
示例13: skipTo
@Override
public boolean skipTo(KVPair kv) throws TddlException {
/*
* for (ColumnMeta c : meta.getKeyColumns()) { Object v =
* kv.getKey().get(c.getName()); if (v == null) { if(kv.getValue() !=
* null) v = kv.getValue().get(c.getName()); }
* key_record.put(c.getName(), v); } return skipTo(key_record);
*/
key.setData(key_codec.encode(kv.getKey()));
if (value != null) {
value.setData(value_codec.encode(kv.getValue()));
}
if (OperationStatus.SUCCESS == je_cursor.getSearchBothRange(key, value, lockMode)) {
setKV();
// //System.out.println("skip true:"+skip_key+",,,current="+current);
return true;
}
// //System.out.println("skip false:"+skip_key);
return false;
}
示例14: store
public HGPersistentHandle store(HGPersistentHandle handle, HGPersistentHandle[] link)
{
DatabaseEntry key = new DatabaseEntry(handle.toByteArray());
DatabaseEntry value = new DatabaseEntry();
linkBinding.objectToEntry(link, value);
try
{
OperationStatus result = data_db.put(txn().getBJETransaction(), key, value);
if (result != OperationStatus.SUCCESS)
throw new Exception("OperationStatus: " + result);
}
catch (Exception ex)
{
throw new HGException("Failed to store hypergraph link: " + ex.toString(), ex);
}
return handle;
}
示例15: countKeys
public long countKeys(ValueType value) {
DatabaseEntry keyEntry = new DatabaseEntry(valueConverter.toByteArray(value));
DatabaseEntry valueEntry = new DatabaseEntry();
SecondaryCursor cursor = null;
try {
cursor = secondaryDb.openCursor(txn().getBJETransaction(), cursorConfig);
OperationStatus status = cursor.getSearchKey(keyEntry, valueEntry, dummy, LockMode.DEFAULT);
if (status == OperationStatus.SUCCESS)
return cursor.count();
else
return 0;
}
catch (DatabaseException ex) {
throw new HGException(ex);
}
finally {
if (cursor != null) {
try {
cursor.close();
}
catch (Throwable t) {
}
}
}
}