本文整理了Java中com.psddev.dari.db.Query.setDatabase
方法的一些代码示例,展示了Query.setDatabase
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.setDatabase
方法的具体详情如下:
包路径:com.psddev.dari.db.Query
类名称:Query
方法名:setDatabase
[英]Sets the database to be used with the read methods.
[中]设置要与读取方法一起使用的数据库。
代码示例来源:origin: perfectsense/dari
public Query<E> using(Database database) {
setDatabase(database);
return this;
}
代码示例来源:origin: perfectsense/dari
public Query<E> usingFirst(Class<? extends Database> databaseClass) {
setDatabase(Database.Static.getFirst(databaseClass));
return this;
}
代码示例来源:origin: perfectsense/brightspot-cms
/** @deprecated Use {@link Query#from} instead. */
@Deprecated
public <T> Query<T> queryFrom(Class<T> objectClass) {
Query<T> query = Query.from(objectClass);
query.setDatabase(getDatabase());
return query;
}
代码示例来源:origin: perfectsense/dari
/** @see Query#from */
public <T> Query<T> queryFrom(Class<T> objectClass) {
Query<T> query = Query.from(objectClass);
query.setDatabase(getState().getDatabase());
return query;
}
代码示例来源:origin: perfectsense/dari
/**
* Builds an SQL statement that can be used to list all rows
* matching the given {@code query}.
*/
public String buildSelectStatement(Query<?> query) {
try {
Query<?> strippedQuery = query.clone();
// Remove any possibility that multiple CachingDatabases will be cached in the sqlQueryCache.
strippedQuery.setDatabase(this);
strippedQuery.getOptions().remove(State.REFERENCE_RESOLVING_QUERY_OPTION);
return addComment(sqlQueryCache.getUnchecked(strippedQuery), query);
} catch (UncheckedExecutionException e) {
Throwable cause = e.getCause();
if (cause instanceof RuntimeException) {
throw (RuntimeException) cause;
} else {
throw new DatabaseException(this, cause);
}
}
}
代码示例来源:origin: perfectsense/dari
@Override
public Query<E> clone() {
Query<E> clone = new Query<E>(group, objectClass);
clone.setPredicate(predicate);
clone.setSorters(sorters != null ? new ArrayList<Sorter>(sorters) : null);
clone.setFields(fields != null ? new ArrayList<String>(fields) : null);
clone.setDatabase(database);
clone.setResolveToReferenceOnly(isResolveToReferenceOnly);
clone.setCache(!noCache);
clone.setMaster(master);
clone.setResolveInvisible(resolveInvisible);
clone.setTimeout(timeout);
clone.setOptions(options != null ? new HashMap<String, Object>(options) : null);
return clone;
}
代码示例来源:origin: perfectsense/dari
query.setDatabase(null);
database = query.getDatabase();
内容来源于网络,如有侵权,请联系作者删除!