本文整理了Java中com.psddev.dari.db.Query.getDatabase
方法的一些代码示例,展示了Query.getDatabase
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.getDatabase
方法的具体详情如下:
包路径:com.psddev.dari.db.Query
类名称:Query
方法名:getDatabase
[英]Returns the database to be used with the read methods.
[中]返回要与读取方法一起使用的数据库。
代码示例来源:origin: perfectsense/dari
/** @deprecated Use {@link #groupBy} instead. */
@Deprecated
public Map<Object, Long> countBy(String key) {
return getDatabase().readGroupedCount(this, key);
}
代码示例来源:origin: perfectsense/dari
/**
* Returns a partial list of all objects matching this query
* within the range of the given {@code offset} and {@code limit}
* in a {@linkplain #getDatabase database}.
*/
public PaginatedResult<E> select(long offset, int limit) {
return getDatabase().readPartial(this, offset, limit);
}
代码示例来源:origin: perfectsense/dari
/**
* Returns all objects matching the given {@code query} grouped by
* the values of the given {@code fields} in a {@linkplain
* #getDatabase database}.
*/
public PaginatedResult<Grouping<E>> groupByPartial(long offset, int limit, String... fields) {
return getDatabase().readPartialGrouped(this, offset, limit, fields);
}
代码示例来源:origin: perfectsense/dari
/**
* Returns the date when the objects matching this query were
* last updated in a {@linkplain #getDatabase database}.
*/
public Date lastUpdate() {
return getDatabase().readLastUpdate(this);
}
代码示例来源:origin: perfectsense/dari
/**
* Returns a list of all objects matching this query in a
* {@linkplain #getDatabase database}.
*/
public List<E> selectAll() {
return getDatabase().readAll(this);
}
代码示例来源:origin: perfectsense/dari
/**
* Returns a count of all objects matching this query in a
* {@linkplain #getDatabase database}.
*/
public long count() {
return getDatabase().readCount(this);
}
代码示例来源:origin: perfectsense/dari
/**
* Returns the first object matching this query in a {@linkplain
* #getDatabase database}.
*/
public E first() {
return getDatabase().readFirst(this);
}
代码示例来源:origin: perfectsense/dari
/**
* Returns all objects matching the given {@code query} grouped by
* the values of the given {@code fields} in a {@linkplain
* #getDatabase database}.
*/
public List<Grouping<E>> groupBy(String... fields) {
return getDatabase().readAllGrouped(this, fields);
}
代码示例来源:origin: perfectsense/dari
/**
* Returns an iterable of all objects matching this query in a
* {@linkplain #getDatabase database}.
*/
public Iterable<E> iterable(int fetchSize) {
return getDatabase().readIterable(this, fetchSize);
}
代码示例来源:origin: perfectsense/dari
/** Deletes all objects matching this query. */
public void deleteAll() {
getDatabase().deleteByQuery(this);
}
代码示例来源:origin: perfectsense/brightspot-cms
private void addLegacyDatabaseSupport(Query query) {
boolean usesLegacyDatabase = false;
Database database = query.getDatabase();
while (database instanceof ForwardingDatabase) {
database = ((ForwardingDatabase) database).getDelegate();
}
if (database instanceof SqlDatabase) {
usesLegacyDatabase = true;
} else if (database instanceof AggregateDatabase) {
usesLegacyDatabase = ((AggregateDatabase) database).getDelegatesByClass(SqlDatabase.class).size() > 0;
}
if (usesLegacyDatabase) {
query.getOptions().put(SqlDatabase.USE_JDBC_FETCH_SIZE_QUERY_OPTION, false);
query.setSorters(null); // SqlDatabase#ByIdIterator does not support sorters
}
}
代码示例来源:origin: perfectsense/dari
/**
* Returns {@code true} if there are more items that match this query than
* the given {@code count}.
*/
public boolean hasMoreThan(long count) {
return !getDatabase().readPartial(this.clone().referenceOnly(), count, 1).getItems().isEmpty();
}
代码示例来源:origin: perfectsense/dari
Map<?, ?> convertedKeys = (Map<?, ?>) StateSerializer.toJavaValue(query.getDatabase(), null, field, "map/" + itemType, rawKeys);
代码示例来源:origin: perfectsense/dari
public void deleteAllImmediately() {
Database database = getDatabase();
database.beginIsolatedWrites();
try {
database.deleteByQuery(this);
database.commitWrites();
} finally {
database.endWrites();
}
}
代码示例来源:origin: perfectsense/dari
keys.add(StateValueUtils.toJavaValue(query.getDatabase(), null, objectFields.get(j), objectFields.get(j).getInternalItemType(), result.getObject(j + 3))); // 3 because _count and amount
代码示例来源:origin: perfectsense/dari
ObjectField field = mapFullyDenormalizedKey(query, fields[0]).getField();
if (field != null) {
key = StateValueUtils.toJavaValue(query.getDatabase(), null, field, field.getInternalItemType(), key);
代码示例来源:origin: perfectsense/dari
@Override
public boolean equals(Object other) {
if (this == other) {
return true;
} else if (other instanceof Query) {
Query<?> otherQuery = (Query<?>) other;
return ObjectUtils.equals(group, otherQuery.group)
&& ObjectUtils.equals(objectClass, otherQuery.objectClass)
&& ObjectUtils.equals(predicate, otherQuery.predicate)
&& ObjectUtils.equals(getSorters(), otherQuery.getSorters())
&& ObjectUtils.equals(getDatabase(), otherQuery.getDatabase())
&& ObjectUtils.equals(getFields(), otherQuery.getFields())
&& ObjectUtils.equals(getOptions(), otherQuery.getOptions())
&& isResolveToReferenceOnly == otherQuery.isResolveToReferenceOnly
&& ObjectUtils.equals(timeout, otherQuery.timeout);
} else {
return false;
}
}
代码示例来源:origin: perfectsense/dari
@Override
public int hashCode() {
return ObjectUtils.hashCode(
getGroup(),
getObjectClass(),
getPredicate(),
getSorters(),
getDatabase(),
getFields(),
getOptions(),
isResolveToReferenceOnly(),
getTimeout());
}
代码示例来源:origin: perfectsense/dari
database = query.getDatabase();
代码示例来源:origin: perfectsense/dari
objectState.setDatabase(query.getDatabase());
objectState.setResolveToReferenceOnly(query.isResolveToReferenceOnly());
objectState.setResolveUsingCache(query.isCache());
内容来源于网络,如有侵权,请联系作者删除!