Android Open Source - SNET S Q Lite Base






From Project

Back to project page SNET.

License

The source code is released under:

GNU Lesser General Public License

If you think the Android project SNET listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.snet.notepad;
// w w w  .j av a2 s .  co  m
import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteDatabase.CursorFactory;

public class SQLiteBase extends SQLiteOpenHelper
{

    private static final String TABLE_NOTES = "table_notes";
    private static final String COL_ID = "ID";
    private static final int NUM_COL_ID = 0;
    private static final String COL_NOTE = "Note";
    private static final int NUM_COL_ISBN = 1;
    private static final String COL_TITRE = "Titre";
    private static final int NUM_COL_TITRE = 2;
    private static final String COL_DATECREATION = "Date_creation";
    private static final int NUM_COL_DATECREATION = 3;
    private static final String COL_DATEMODIFICATION = "Date_modification";
    private static final int NUM_COL_DATEMODIFICATION = 4;
    
    private static final String CREATE_BDD = "CREATE TABLE " + TABLE_NOTES + " ("
            + COL_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + COL_NOTE + " TEXT NOT NULL, "
            + COL_TITRE + " TEXT NOT NULL, " + COL_DATECREATION + " TEXT NOT NULL, " + COL_DATEMODIFICATION +  " TEXT NOT NULL);";

    public SQLiteBase(Context context, String name, CursorFactory factory, int version)
    {
        super(context, name, factory, version);
    }

    @Override
    public void onCreate(SQLiteDatabase db)
    {
        //on cr la table  partir de la requte crite dans la variable CREATE_BDD
        db.execSQL(CREATE_BDD);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion)
    {
        //On peut fait ce qu'on veut ici moi j'ai dcid de supprimer la table et de la recrer
        //comme a lorsque je change la version les id repartent de 0
        db.execSQL("DROP TABLE " + TABLE_NOTES + ";");
        onCreate(db);
    }


}




Java Source Code List

com.snet.MainActivity.java
com.snet.notepad.NoteEdition.java
com.snet.notepad.NoteMain.java
com.snet.notepad.Note.java
com.snet.notepad.NotesBDD.java
com.snet.notepad.Preference.java
com.snet.notepad.SQLiteBase.java
com.snet.textedit.TextEdition.java