use of com.raizlabs.android.dbflow.sql.QueryBuilder in project DBFlow by Raizlabs.
the class Condition method concatenate.
@SuppressWarnings("unchecked")
@Override
public Condition concatenate(Object value) {
operation = new QueryBuilder(Operation.EQUALS).append(columnName()).toString();
TypeConverter typeConverter = this.typeConverter;
if (typeConverter == null && value != null) {
typeConverter = FlowManager.getTypeConverterForClass(value.getClass());
}
if (typeConverter != null && convertToDB) {
value = typeConverter.getDBValue(value);
}
if (value instanceof String || value instanceof ITypeConditional) {
operation = String.format("%1s %1s ", operation, Operation.CONCATENATE);
} else if (value instanceof Number) {
operation = String.format("%1s %1s ", operation, Operation.PLUS);
} else {
throw new IllegalArgumentException(String.format("Cannot concatenate the %1s", value != null ? value.getClass() : "null"));
}
this.value = value;
isValueSet = true;
return this;
}
use of com.raizlabs.android.dbflow.sql.QueryBuilder in project DBFlow by Raizlabs.
the class Condition method getQuery.
@Override
public String getQuery() {
QueryBuilder queryBuilder = new QueryBuilder();
appendConditionToQuery(queryBuilder);
return queryBuilder.getQuery();
}
use of com.raizlabs.android.dbflow.sql.QueryBuilder in project DBFlow by Raizlabs.
the class ConditionGroup method getQuerySafe.
private QueryBuilder getQuerySafe() {
QueryBuilder query = new QueryBuilder();
int count = 0;
int size = conditionsList.size();
for (int i = 0; i < size; i++) {
SQLCondition condition = conditionsList.get(i);
if (condition != null) {
condition.appendConditionToQuery(query);
if (count < size - 1) {
if (!allCommaSeparated) {
query.appendSpace().append(condition.hasSeparator() ? condition.separator() : separator);
} else {
query.append(",");
}
query.appendSpace();
}
}
count++;
}
return query;
}
use of com.raizlabs.android.dbflow.sql.QueryBuilder in project DBFlow by Raizlabs.
the class From method getQuery.
@Override
public String getQuery() {
QueryBuilder queryBuilder = new QueryBuilder().append(queryBase.getQuery());
if (!(queryBase instanceof Update)) {
queryBuilder.append("FROM ");
}
queryBuilder.append(tableAlias);
if (queryBase instanceof Select) {
for (Join join : joins) {
queryBuilder.appendSpace();
queryBuilder.append(join.getQuery());
}
} else {
queryBuilder.appendSpace();
}
return queryBuilder.getQuery();
}
use of com.raizlabs.android.dbflow.sql.QueryBuilder in project DBFlow by Raizlabs.
the class Select method getQuery.
@Override
public String getQuery() {
QueryBuilder queryBuilder = new QueryBuilder("SELECT ");
if (mSelectQualifier != NONE) {
if (mSelectQualifier == DISTINCT) {
queryBuilder.append("DISTINCT");
} else if (mSelectQualifier == ALL) {
queryBuilder.append("ALL");
}
queryBuilder.appendSpace();
}
queryBuilder.append(QueryBuilder.join(",", propertyList));
queryBuilder.appendSpace();
return queryBuilder.getQuery();
}
Aggregations