Skip to content

Schema and Provider Definition

hamsterksu edited this page Oct 23, 2014 · 1 revision

Root interface

Define all tables in the root interface.

@Schema(className="FSchema", dbName="football.db", dbVersion=1)
@Provider(authority="com.gdubina.football.providers.rss", schemaClass="FSchema", name="FProvider", openHelperClass="CustomOpenHelper")
public interface FStore {

Shema - define schema class name, db file name and version. FSchema.java will contain all necessary sql code. FSchema2.java will be generated too. It will contains constants to access view/query's columns.

Provider - can use autogenerated open helper class or your own. Auto generated class doesn't have ability to upgrate db. It will drop old db an create new. So openHelperClass attribute is optional.

Define schema elements

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