app/src/main/java/com/example/android/pets/data/PetDbHelper.java
/** This is called when the database is created for the first time.
     * This is the SQL CREATE TABLE Statement written in a format for Android */
This is called when the database is created for the first time.
This is the SQL CREATE TABLE Statement written in a format for Android
This is called when the database is created for the first time . This is the SQL CREATE TABLE Statement written in a format for Android
@Override
    public void onCreate(SQLiteDatabase db) {
        String SQL_CREATE_PETS_TABLE = "CREATE TABLE " + PetContract.PetEntry.TABLE_NAME + " ("
                + PetContract.PetEntry._ID + " INTEGER PRIMARY KEY AUTOINCREMENT, "
                + PetContract.PetEntry.COLUMN_PET_NAME + " TEXT NOT NULL, "
                + PetContract.PetEntry.COLUMN_PET_BREED + " TEXT, "
                + PetContract.PetEntry.COLUMN_PET_GENDER + " INTEGER NOT NULL, "
                + PetContract.PetEntry.COLUMN_PET_WEIGHT + " INTEGER NOT NULL DEFAULT 0);";
        db.execSQL(SQL_CREATE_PETS_TABLE);
    }
@ Override public void onCreate ( SQLiteDatabase db ) { String SQL_CREATE_PETS_TABLE = "CREATE TABLE " + PetContract . PetEntry . TABLE_NAME + " (" + PetContract . PetEntry . _ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + PetContract . PetEntry . COLUMN_PET_NAME + " TEXT NOT NULL, " + PetContract . PetEntry . COLUMN_PET_BREED + " TEXT, " + PetContract . PetEntry . COLUMN_PET_GENDER + " INTEGER NOT NULL, " + PetContract . PetEntry . COLUMN_PET_WEIGHT + " INTEGER NOT NULL DEFAULT 0);" ; db . execSQL ( SQL_CREATE_PETS_TABLE ) ; }
This is called when the database is created for the first time.
This is called when the database is created for the first time .
// Create a String that contains the SQL statement that will create the pets table // Execute the SQL statement