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


Java SecondaryConfig.setMultiKeyCreator方法代码示例

本文整理汇总了Java中com.sleepycat.je.SecondaryConfig.setMultiKeyCreator方法的典型用法代码示例。如果您正苦于以下问题:Java SecondaryConfig.setMultiKeyCreator方法的具体用法?Java SecondaryConfig.setMultiKeyCreator怎么用?Java SecondaryConfig.setMultiKeyCreator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sleepycat.je.SecondaryConfig的用法示例。


在下文中一共展示了SecondaryConfig.setMultiKeyCreator方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: openSecondary

import com.sleepycat.je.SecondaryConfig; //导入方法依赖的package包/类
private SecondaryDatabase openSecondary(Database priDb, String dbName,
                                        boolean dups, int keyId)
    throws DatabaseException {

    SecondaryConfig dbConfig = new SecondaryConfig();
    dbConfig.setTransactional(isTransactional);
    dbConfig.setAllowCreate(true);
    dbConfig.setSortedDuplicates(dups);
    if (useMultiKey) {
        dbConfig.setMultiKeyCreator
            (new SimpleMultiKeyCreator(new MyKeyCreator(keyId)));
    } else {
        dbConfig.setKeyCreator(new MyKeyCreator(keyId));
    }

    Transaction txn = txnBegin();
    try {
        return env.openSecondaryDatabase(txn, dbName, priDb, dbConfig);
    } finally {
        txnCommit(txn);
    }
}
 
开发者ID:nologic,项目名称:nabs,代码行数:23,代码来源:JoinTest.java

示例2: openSecondary

import com.sleepycat.je.SecondaryConfig; //导入方法依赖的package包/类
private SecondaryDatabase openSecondary(Database priDb,
                                        String dbName,
                                        boolean dups)
    throws DatabaseException {

    SecondaryConfig dbConfig = new SecondaryConfig();
    dbConfig.setTransactional(isTransactional);
    dbConfig.setAllowCreate(true);
    dbConfig.setSortedDuplicates(dups);
    dbConfig.setMultiKeyCreator(new MyKeyCreator());

    Transaction txn = txnBegin();
    try {
        return env.openSecondaryDatabase(txn, dbName, priDb, dbConfig);
    } finally {
        txnCommit(txn);
    }
}
 
开发者ID:nologic,项目名称:nabs,代码行数:19,代码来源:ToManyTest.java

示例3: openSecondary

import com.sleepycat.je.SecondaryConfig; //导入方法依赖的package包/类
/**
 * Opens the secondary database.
 */
private SecondaryDatabase openSecondary(Database priDb, String dbName,
                                        boolean allowDuplicates)
    throws DatabaseException {

    SecondaryConfig dbConfig = new SecondaryConfig();
    dbConfig.setTransactional(isTransactional);
    dbConfig.setAllowCreate(true);
    dbConfig.setSortedDuplicates(allowDuplicates);
    if (useMultiKey) {
        dbConfig.setMultiKeyCreator
            (new SimpleMultiKeyCreator(new MyKeyCreator()));
    } else {
        dbConfig.setKeyCreator(new MyKeyCreator());
    }
    Transaction txn = txnBegin();
    SecondaryDatabase secDb;
    try {
        secDb = env.openSecondaryDatabase(txn, dbName, priDb, dbConfig);
    } finally {
        txnCommit(txn);
    }
    return secDb;
}
 
开发者ID:nologic,项目名称:nabs,代码行数:27,代码来源:SecondaryDirtyReadTest.java

示例4: openSecondary

import com.sleepycat.je.SecondaryConfig; //导入方法依赖的package包/类
private SecondaryDatabase openSecondary(Database priDb, String dbName,
                                        Database foreignDb,
                                        ForeignKeyDeleteAction onDelete)
    throws DatabaseException {

    SecondaryConfig dbConfig = new SecondaryConfig();
    dbConfig.setTransactional(isTransactional);
    dbConfig.setAllowCreate(true);
    dbConfig.setSortedDuplicates(true);

    MyKeyCreator keyCreator = new MyKeyCreator();
    if (useMultiKey) {
        dbConfig.setMultiKeyCreator(new SimpleMultiKeyCreator(keyCreator));
    } else {
        dbConfig.setKeyCreator(keyCreator);
    }

    if (foreignDb != null) {

        if (useMultiKey) {
            dbConfig.setForeignMultiKeyNullifier(keyCreator);
        } else {
            dbConfig.setForeignKeyNullifier(keyCreator);
        }
        dbConfig.setForeignKeyDatabase(foreignDb);
        dbConfig.setForeignKeyDeleteAction(onDelete);
    }

    Transaction txn = txnBegin();
    try {
        return env.openSecondaryDatabase(txn, dbName, priDb, dbConfig);
    } finally {
        txnCommit(txn);
    }
}
 
开发者ID:nologic,项目名称:nabs,代码行数:36,代码来源:ForeignKeyTest.java

示例5: init

import com.sleepycat.je.SecondaryConfig; //导入方法依赖的package包/类
@Override
public void init() throws DatabaseException {
	
	SecondaryConfig config = new SecondaryConfig();
	config.setAllowCreate(true);
	config.setAllowPopulate(true);
	config.setTransactional(true);
	config.setImmutableSecondaryKey(immutableSecondaryKey);
	config.setSortedDuplicates(sortedDuplicates);
	
	config.setMultiKeyCreator(keyCreator);
	
	db = primary.envWrap.env.openSecondaryDatabase(null, name, primary.db, config);
}
 
开发者ID:mosscode,项目名称:bdbwrap,代码行数:15,代码来源:MultiKeySecondaryDbWrap.java

示例6: openSecondary

import com.sleepycat.je.SecondaryConfig; //导入方法依赖的package包/类
private SecondaryDatabase openSecondary(Database priDb,
                                        boolean allowDuplicates,
                                        String dbName,
                                        boolean allowPopulate,
                                        boolean readOnly)
    throws DatabaseException {

    List secListBefore = priDb.getSecondaryDatabases();
    SecondaryConfig dbConfig = new SecondaryConfig();
    dbConfig.setTransactional(isTransactional);
    dbConfig.setAllowCreate(true);
    dbConfig.setSortedDuplicates(allowDuplicates);
    dbConfig.setReadOnly(readOnly);
    dbConfig.setAllowPopulate(allowPopulate);
    if (!readOnly) {
        if (useMultiKey) {
            dbConfig.setMultiKeyCreator
                (new SimpleMultiKeyCreator(new MyKeyCreator()));
        } else {
            dbConfig.setKeyCreator(new MyKeyCreator());
        }
    }
    Transaction txn = txnBegin();
    SecondaryDatabase secDb;
    try {
        secDb = env.openSecondaryDatabase(txn, dbName, priDb, dbConfig);
    } finally {
        txnCommit(txn);
    }
    assertNotNull(secDb);

    /* Check configuration. */
    assertSame(priDb, secDb.getPrimaryDatabase());
    SecondaryConfig config2 = secDb.getSecondaryConfig();
    assertEquals(allowPopulate, config2.getAllowPopulate());
    assertEquals(dbConfig.getKeyCreator(), config2.getKeyCreator());

    /* Make sure the new secondary is added to the primary's list. */
    List secListAfter = priDb.getSecondaryDatabases();
    assertTrue(secListAfter.remove(secDb));
    assertEquals(secListBefore, secListAfter);

    return secDb;
}
 
开发者ID:nologic,项目名称:nabs,代码行数:45,代码来源:SecondaryTest.java

示例7: openSecondary

import com.sleepycat.je.SecondaryConfig; //导入方法依赖的package包/类
private SecondaryDatabase openSecondary(Database priDb, 
                                        boolean allowDuplicates,
                                        String dbName,
                                        boolean allowPopulate,
                                        boolean readOnly)
    throws DatabaseException {

    List secListBefore = priDb.getSecondaryDatabases();
    SecondaryConfig dbConfig = new SecondaryConfig();
    dbConfig.setTransactional(isTransactional);
    dbConfig.setAllowCreate(true);
    dbConfig.setSortedDuplicates(allowDuplicates);
    dbConfig.setReadOnly(readOnly);
    dbConfig.setAllowPopulate(allowPopulate);
    if (!readOnly) {
        if (useMultiKey) {
            dbConfig.setMultiKeyCreator
                (new SimpleMultiKeyCreator(new MyKeyCreator()));
        } else {
            dbConfig.setKeyCreator(new MyKeyCreator());
        }
    }
    Transaction txn = txnBegin();
    SecondaryDatabase secDb;
    try {
        secDb = env.openSecondaryDatabase(txn, dbName, priDb, dbConfig);
    } finally {
        txnCommit(txn);
    }
    assertNotNull(secDb);

    /* Check configuration. */
    assertSame(priDb, secDb.getPrimaryDatabase());
    SecondaryConfig config2 = secDb.getSecondaryConfig();
    assertEquals(allowPopulate, config2.getAllowPopulate());
    assertEquals(dbConfig.getKeyCreator(), config2.getKeyCreator());

    /* Make sure the new secondary is added to the primary's list. */
    List secListAfter = priDb.getSecondaryDatabases();
    assertTrue(secListAfter.remove(secDb));
    assertEquals(secListBefore, secListAfter);

    return secDb;
}
 
开发者ID:nologic,项目名称:nabs,代码行数:45,代码来源:SecondaryTest.java


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