use of com.raizlabs.android.dbflow.sql.QueryBuilder in project DBFlow by Raizlabs.
the class Update method getQuery.
@Override
public String getQuery() {
QueryBuilder queryBuilder = new QueryBuilder("UPDATE ");
if (conflictAction != null && !conflictAction.equals(ConflictAction.NONE)) {
queryBuilder.append("OR").appendSpaceSeparated(conflictAction.name());
}
queryBuilder.append(FlowManager.getTableName(table)).appendSpace();
return queryBuilder.getQuery();
}
use of com.raizlabs.android.dbflow.sql.QueryBuilder in project DBFlow by Raizlabs.
the class AlterTableMigration method addForeignKeyColumn.
/**
* Add a column to the DB. This does not necessarily need to be reflected in the {@link TModel},
* but it is recommended.
*
* @param sqLiteType The type of column that pertains to an {@link SQLiteType}
* @param columnName The name of the column to add. Use the "$Table" class for the specified table.
* @param referenceClause The clause of the references that this foreign key points to.
* @return This instance
*/
public AlterTableMigration<TModel> addForeignKeyColumn(SQLiteType sqLiteType, String columnName, String referenceClause) {
if (columnDefinitions == null) {
columnDefinitions = new ArrayList<>();
columnNames = new ArrayList<>();
}
QueryBuilder queryBuilder = new QueryBuilder().append(QueryBuilder.quoteIfNeeded(columnName)).appendSpace().appendSQLiteType(sqLiteType).appendSpace().append("REFERENCES ").append(referenceClause);
columnDefinitions.add(queryBuilder);
columnNames.add(columnName);
return this;
}
use of com.raizlabs.android.dbflow.sql.QueryBuilder in project DBFlow by Raizlabs.
the class AlterTableMigration method renameFrom.
/**
* Call this to rename a table to a new name, such as changing either the {@link com.raizlabs.android.dbflow.structure.Model} class name
* or by changing the name through a {@link com.raizlabs.android.dbflow.annotation.Table}
*
* @param oldName The new name to call the table.
* @return This instance
*/
public AlterTableMigration<TModel> renameFrom(@NonNull String oldName) {
oldTableName = oldName;
renameQuery = new QueryBuilder().append(" RENAME").appendSpaceSeparated("TO");
return this;
}
use of com.raizlabs.android.dbflow.sql.QueryBuilder in project DBFlow by Raizlabs.
the class CompletedTrigger method getQuery.
@Override
public String getQuery() {
QueryBuilder queryBuilder = new QueryBuilder(triggerMethod.getQuery());
queryBuilder.append("\nBEGIN").append("\n").append(triggerLogicQuery.getQuery()).append(";").append("\nEND");
return queryBuilder.getQuery();
}
Aggregations