Planning a Database

To explore this topic, we'll create a database that contains a collection of books. The book database contains only one table called books, and its columns are name, isbn, and author. You'll define this sort of relevant metadata in a Java class. This metadata-bearing Java class BookProviderMetaData is shown in Listing 3-24. Some key elements of this metadata class are highlighted.

Listing 3-24. Defining Metadata for Your Database: The BookProviderMetaData Class public class BookProviderMetaData {

public static final String AUTHORITY = "com.androidbook.provider.BookProvider";

public static final String DATABASE_NAME = "book.db"; public static final int DATABASE_VERSION = 1; public static final String BOOKS_TABLE_NAME = "books";

private BookProviderMetaData() {}

//inner class describing BookTable

0 0

Post a comment