Advertisement
Guest User

Untitled

a guest
Dec 12th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.17 KB | None | 0 0
  1. package com.example.signoriello;
  2.  
  3. import android.content.Context;
  4. import android.database.sqlite.SQLiteDatabase;
  5. import android.database.sqlite.SQLiteOpenHelper;
  6.  
  7. /**
  8.  * Created by Francesco on 12/12/2018.
  9.  */
  10.  
  11. public class StudenteDBHelper extends SQLiteOpenHelper {
  12.  
  13.  
  14.     public static final int DATABASE_VERSION = 1;
  15.  
  16.     public static final String DATABASE_NAME = "esami_signoriello.db";
  17.  
  18.     public static final String PIANO_STUDI_TABLE_NAME = "PianodDiStudi";
  19.  
  20.     public static final String ESAMI_SUPERATI_TABLE_NAME = "EsamiSuperati";
  21.  
  22.  
  23.  
  24.     //colonne della tabella piano di studi
  25.     public static final String COLONNA_NOME_ESAME = "nome";
  26.     public static final String COLONNA_ANNO = "anno";
  27.     public static final String COLONNA_SEMESTRE = "semestre";
  28.     public static final String COLONNA_CFU = "cfu";
  29.  
  30.     //questa stringa contiene il comando per la creazione della tabella piano di studi
  31.     private static final String PIANO_STUDI_TABLE_CREATE = "CREATE TABLE " + PIANO_STUDI_TABLE_NAME + "("+
  32.             COLONNA_NOME_ESAME + " TEXT," +
  33.             COLONNA_ANNO + " TEXT," +
  34.             COLONNA_SEMESTRE + " TEXT," +
  35.             COLONNA_CFU + " INTEGER);";
  36.  
  37.  
  38.  
  39.     //colonne della tabella esami superati
  40.     public static final String COLONNA_NOME_ESAME_SUPERATO = "nome";
  41.     public static final String COLONNA_DATA_SUPERAMENTO = "data_superamento";
  42.     public static final String COLONNA_VOTO = "voto";
  43.  
  44.  
  45.     //questa stringa contiene il comando per la creazione della tabella esami superati
  46.     private static final String ESAMI_SUPERATI_TABLE_CREATE = "CREATE TABLE " + ESAMI_SUPERATI_TABLE_NAME + "("+
  47.             COLONNA_NOME_ESAME_SUPERATO + " TEXT," +
  48.             COLONNA_DATA_SUPERAMENTO + " TEXT," +
  49.             COLONNA_VOTO + " INTEGER);";
  50.  
  51.     public StudenteDBHelper(Context context) {
  52.         super(context, DATABASE_NAME,null, DATABASE_VERSION);
  53.     }
  54.  
  55.     @Override
  56.     public void onCreate(SQLiteDatabase db) {
  57.         db.execSQL(PIANO_STUDI_TABLE_CREATE);
  58.         db.execSQL(ESAMI_SUPERATI_TABLE_CREATE);
  59.     }
  60.  
  61.     @Override
  62.     public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
  63.  
  64.     }
  65.  
  66.  
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement