当前位置: 首页>>代码示例>>Java>>正文


Java OperationStatus.SUCCESS属性代码示例

本文整理汇总了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;
}
 
开发者ID:costea7,项目名称:ChronoBike,代码行数:20,代码来源:BtreeFile.java

示例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;
}
 
开发者ID:costea7,项目名称:ChronoBike,代码行数:22,代码来源:BtreeFile.java

示例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;
}
 
开发者ID:tiglabs,项目名称:jsf-core,代码行数:24,代码来源:BerkeleyDb.java

示例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;
    }
}
 
开发者ID:HY-ZhengWei,项目名称:hy.common.berkeley,代码行数:28,代码来源:Berkeley.java

示例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;
    }
}
 
开发者ID:HY-ZhengWei,项目名称:hy.common.berkeley,代码行数:33,代码来源:Berkeley.java

示例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;
    }
}
 
开发者ID:HY-ZhengWei,项目名称:hy.common.berkeley,代码行数:29,代码来源:Berkeley.java

示例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;
}
 
开发者ID:HY-ZhengWei,项目名称:hy.common.berkeley,代码行数:27,代码来源:Berkeley.java

示例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;
  }
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:19,代码来源:BerkeleyDBTempTargetRepository.java

示例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;
    }
}
 
开发者ID:beebeandwer,项目名称:TDDL,代码行数:19,代码来源:JE_Table.java

示例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;
}
 
开发者ID:BiosemanticsDotOrg,项目名称:GeneDiseasePaper,代码行数:24,代码来源:ConceptToRecordIndex.java

示例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);
	}
}
 
开发者ID:hypergraphdb,项目名称:hypergraphdb,代码行数:16,代码来源:BJEStorageImplementation.java

示例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();
}
 
开发者ID:ashish-gehani,项目名称:SPADE,代码行数:16,代码来源:Scaffold.java

示例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;
}
 
开发者ID:beebeandwer,项目名称:TDDL,代码行数:20,代码来源:JE_Cursor.java

示例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;
}
 
开发者ID:hypergraphdb,项目名称:hypergraphdb,代码行数:18,代码来源:BJEStorageImplementation.java

示例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) {
			}
		}
	}
}
 
开发者ID:hypergraphdb,项目名称:hypergraphdb,代码行数:26,代码来源:DefaultBiIndexImpl.java


注:本文中的com.sleepycat.je.OperationStatus.SUCCESS属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。