Skip to content
hamsterksu edited this page Oct 23, 2014 · 1 revision

Define view

View is useful mechanism to aggregate data. You can use @Join, @RawJoin to join tables. The library support all join types: INNER, LEFT, RIGHT, CROSS

You can define selected columns from each tables if you want. Use @Columns or @IgnoreColumns to limit selected columns.

@SimpleView(ResultView.VIEW_NAME)
public static interface ResultView {

	@URI(type = URI.Type.DIR, onlyQuery = true)
	String URI_CONTENT = "result_view";

	String VIEW_NAME = "result_view";

	@From(ResultsTable.TABLE_NAME)
	String TABLE_RESULT = "result_t";

	@Join(joinTable = TeamTable.TABLE_NAME, joinColumn = TeamTable.ID, onTableAlias = TABLE_RESULT, onColumn = ResultsTable.TEAM_ID)
	String TABLE_TEAM = "team_t";
	
}

Schema and Provider

Define SQL Schema

  1. Declare schema - @Schema
  2. Define sql table - @Table
  3. Define sql view - @SimpleView
  4. Define raw sql query - @RawQuery

Define Content Provider

  1. Declare provider - @Provider
  2. Define provider uri - @URI
  3. Extra provider features - features
Clone this wiki locally