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


Java Sequoiadb类代码示例

本文整理汇总了Java中com.sequoiadb.base.Sequoiadb的典型用法代码示例。如果您正苦于以下问题:Java Sequoiadb类的具体用法?Java Sequoiadb怎么用?Java Sequoiadb使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: queryAll

import com.sequoiadb.base.Sequoiadb; //导入依赖的package包/类
/**
 * 
 * @param dbcollection
 * @return
 */
public List<BSONObject> queryAll() {
	List<BSONObject> list = new ArrayList<BSONObject>();
	DBCursor cursor = null;
	Sequoiadb sdb = DbConnectionPool.getConnection();
	try {
		cursor = getDbCollection(sdb).query();
		while (cursor.hasNext()) {
			BSONObject record = cursor.getNext();
			list.add(record);
		}
	} catch (BaseException e) {

		e.printStackTrace();
	} finally {
		DbConnectionPool.free(sdb);
	}
	return list;
}
 
开发者ID:slowlizard,项目名称:SequoiaDB-ORM,代码行数:24,代码来源:SequoiaDataAccess.java

示例2: query

import com.sequoiadb.base.Sequoiadb; //导入依赖的package包/类
/**
 * 
 * 查询多少条数据
 * 
 * @param matcher
 * @param selector
 * @param order
 * @param skipRows
 * @param returnRows
 * @return
 */
public List<BSONObject> query(BSONObject matcher, BSONObject selector, BSONObject order, long skipRows,
		long returnRows) {
	Sequoiadb sdb = DbConnectionPool.getConnection();
	List<BSONObject> list = new ArrayList<BSONObject>();
	DBCursor cursor = null;
	try {
		cursor = getDbCollection(sdb).query(matcher, selector, order, null, skipRows, returnRows);
		while (cursor.hasNext()) {
			BSONObject record = cursor.getNext();
			list.add(record);
		}
	} catch (BaseException e) {

		e.printStackTrace();
	} finally {
		DbConnectionPool.free(sdb);
	}
	return list;
}
 
开发者ID:slowlizard,项目名称:SequoiaDB-ORM,代码行数:31,代码来源:SequoiaDataAccess.java

示例3: SequoiaConnection

import com.sequoiadb.base.Sequoiadb; //导入依赖的package包/类
public SequoiaConnection(String url, String db) throws UnknownHostException {
//	this.url = url;
	this._schema = db;		
	try {
	mc = new Sequoiadb(url, "", "");
	} catch (BaseException e) {
		throw new IllegalArgumentException("Failed to connect to database: " + url
				+ ", error description" + e.getErrorType());
	}		
}
 
开发者ID:huang-up,项目名称:mycat-src-1.6.1-RELEASE,代码行数:11,代码来源:SequoiaConnection.java

示例4: queryOne

import com.sequoiadb.base.Sequoiadb; //导入依赖的package包/类
/**
 * 查询一条数据
 * 
 * @param matcher
 * @param selector
 * @param order
 * @return
 */
public BSONObject queryOne(BSONObject matcher, BSONObject selector, BSONObject order) {
	Sequoiadb sdb = DbConnectionPool.getConnection();
	try {
		return getDbCollection(sdb).queryOne(matcher, selector, order, null, 0);
	} catch (Exception e) {

		e.printStackTrace();
	} finally {

		DbConnectionPool.free(sdb);

	}
	return null;
}
 
开发者ID:slowlizard,项目名称:SequoiaDB-ORM,代码行数:23,代码来源:SequoiaDataAccess.java

示例5: updateUsingSetOpreator

import com.sequoiadb.base.Sequoiadb; //导入依赖的package包/类
/**
 * 
 * @param matcher
 * @param obj
 */
public void updateUsingSetOpreator(BSONObject matcher, Object obj) {
	BSONObject modifier = new BasicBSONObject();
	Sequoiadb sdb = DbConnectionPool.getConnection();
	try {
		modifier.put("$set", BasicBSONObject.typeToBson(obj));
		getDbCollection(sdb).update(matcher, modifier, null);
	} catch (Exception e) {

		e.printStackTrace();
	} finally {
		DbConnectionPool.free(sdb);
	}
}
 
开发者ID:slowlizard,项目名称:SequoiaDB-ORM,代码行数:19,代码来源:SequoiaDataAccess.java

示例6: updateWithUserDefine

import com.sequoiadb.base.Sequoiadb; //导入依赖的package包/类
/**
 * 
 * @param dbcollection
 * @param matcher
 * @param record
 */
public void updateWithUserDefine(BSONObject matcher, Object record) {
	Sequoiadb sdb = DbConnectionPool.getConnection();
	try {
		BSONObject modifier = BasicBSONObject.typeToBson(record);
		getDbCollection(sdb).update(matcher, modifier, null);
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		DbConnectionPool.free(sdb);
	}
}
 
开发者ID:slowlizard,项目名称:SequoiaDB-ORM,代码行数:18,代码来源:SequoiaDataAccess.java

示例7: updateCounter

import com.sequoiadb.base.Sequoiadb; //导入依赖的package包/类
/**
 * 
 * @param matcher
 * @param fieldName
 * @param increment
 */
public void updateCounter(BSONObject matcher, String fieldName, int increment) {
	Sequoiadb sdb = DbConnectionPool.getConnection();
	try {
		BSONObject obj = new BasicBSONObject();
		BSONObject rule = new BasicBSONObject();
		rule.put(fieldName, increment);
		obj.put(MatchConst._INC, rule);
		getDbCollection(sdb).update(matcher, obj, null);
	} catch (BaseException e) {
		e.printStackTrace();
	} finally {
		DbConnectionPool.free(sdb);
	}
}
 
开发者ID:slowlizard,项目名称:SequoiaDB-ORM,代码行数:21,代码来源:SequoiaDataAccess.java

示例8: delete

import com.sequoiadb.base.Sequoiadb; //导入依赖的package包/类
public void delete(BSONObject matcher) {
	Sequoiadb sdb = DbConnectionPool.getConnection();
	try {
		getDbCollection(sdb).delete(matcher);
	} catch (BaseException e) {

		e.printStackTrace();
	} finally {
		DbConnectionPool.free(sdb);
	}
}
 
开发者ID:slowlizard,项目名称:SequoiaDB-ORM,代码行数:12,代码来源:SequoiaDataAccess.java

示例9: insert

import com.sequoiadb.base.Sequoiadb; //导入依赖的package包/类
public void insert(Object obj) {
	Sequoiadb sdb = DbConnectionPool.getConnection();
	if (obj != null) {
		try {
			BSONObject bson = BasicBSONObject.typeToBson(obj);
			getDbCollection(sdb).insert(bson);
		} catch (Exception e) {

			e.printStackTrace();
		} finally {
			DbConnectionPool.free(sdb);
		}
	}
}
 
开发者ID:slowlizard,项目名称:SequoiaDB-ORM,代码行数:15,代码来源:SequoiaDataAccess.java

示例10: batchInsert

import com.sequoiadb.base.Sequoiadb; //导入依赖的package包/类
/**
 * 
 * @param items
 */
public void batchInsert(List<BSONObject> items) {
	Sequoiadb sdb = DbConnectionPool.getConnection();
	try {
		getDbCollection(sdb).bulkInsert(items, 0);
	} catch (Exception e) {

		e.printStackTrace();
	} finally {
		DbConnectionPool.free(sdb);
	}
}
 
开发者ID:slowlizard,项目名称:SequoiaDB-ORM,代码行数:16,代码来源:SequoiaDataAccess.java

示例11: getDbCollection

import com.sequoiadb.base.Sequoiadb; //导入依赖的package包/类
/**
 * @param sdb
 * @return
 */
private DBCollection getDbCollection(Sequoiadb sdb) {
	CollectionSpace db = null;
	DBCollection dbCollection = null;
	if (sdb.isCollectionSpaceExist(dataSpaceName))
		db = sdb.getCollectionSpace(dataSpaceName);
	else
		db = sdb.createCollectionSpace(dataSpaceName);
	if (db.isCollectionExist(dataCollectionName))
		dbCollection = db.getCollection(dataCollectionName);
	else
		dbCollection = db.createCollection(dataCollectionName);
	return dbCollection;
}
 
开发者ID:slowlizard,项目名称:SequoiaDB-ORM,代码行数:18,代码来源:SequoiaDataAccess.java

示例12: getCount

import com.sequoiadb.base.Sequoiadb; //导入依赖的package包/类
public long getCount(BSONObject matcher) {
	Sequoiadb sdb = DbConnectionPool.getConnection();
	try {
		return getDbCollection(sdb).getCount(matcher);
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		DbConnectionPool.free(sdb);
	}
	return 0;
}
 
开发者ID:slowlizard,项目名称:SequoiaDB-ORM,代码行数:12,代码来源:SequoiaDataAccess.java

示例13: free

import com.sequoiadb.base.Sequoiadb; //导入依赖的package包/类
public static void free(Sequoiadb sdb) {
    if (sdb != null && sdb.isValid())
        datasource.close(sdb);
}
 
开发者ID:slowlizard,项目名称:SequoiaDB-ORM,代码行数:5,代码来源:DbConnectionPool.java


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