Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created February 4, 2019 15:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/49ac1bcf7afef0739eec1d9b338d6a11 to your computer and use it in GitHub Desktop.
Save parzibyte/49ac1bcf7afef0739eec1d9b338d6a11 to your computer and use it in GitHub Desktop.
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