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

Define table

Use tipical annotations to define table. You can use @PrimaryKey, @Autoincrement, @NotNull, @Unique annotation to define column. Also you can add @Index or @PrimaryKey by few columns for table.

To allow access to the table over content provider use @URI to mark content path

@Table(TeamTable.TABLE_NAME)
public static interface TeamTable{
	
    String TABLE_NAME = "team_table";
	
	@URI
	String CONTENT_URI = "team_table";

	@PrimaryKey
	@Column(type = Type.INTEGER)
	String ID = "_id";
	
	@Column(type = Type.TEXT)
	String TITLE = "title";
	
	@Column(type = Type.INTEGER)
	String CHEMP_ID = "chemp_id";
}

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