Created
February 4, 2019 15:16
-
-
Save parzibyte/49ac1bcf7afef0739eec1d9b338d6a11 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package me.parzibyte.crudsqlite; | |
import android.content.Context; | |
import android.database.sqlite.SQLiteDatabase; | |
import android.database.sqlite.SQLiteOpenHelper; | |
public class AyudanteBaseDeDatos extends SQLiteOpenHelper { | |
private static final String NOMBRE_BASE_DE_DATOS = "mascotas", | |
NOMBRE_TABLA_MASCOTAS = "mascotas"; | |
private static final int VERSION_BASE_DE_DATOS = 1; | |
public AyudanteBaseDeDatos(Context context) { | |
super(context, NOMBRE_BASE_DE_DATOS, null, VERSION_BASE_DE_DATOS); | |
} | |
@Override | |
public void onCreate(SQLiteDatabase db) { | |
db.execSQL(String.format("CREATE TABLE IF NOT EXISTS %s(id integer primary key autoincrement, nombre text, edad int)", NOMBRE_TABLA_MASCOTAS)); | |
} | |
@Override | |
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment