Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Dec 24th, 2010  |  syntax: Java  |  size: 1.23 KB  |  views: 98  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. package com.v3.messaging;
  2.  
  3. import android.content.Context;
  4. import android.database.sqlite.SQLiteDatabase;
  5. import android.database.sqlite.SQLiteOpenHelper;
  6. import android.database.sqlite.SQLiteDatabase.CursorFactory;
  7.  
  8. public class DatabaseHelper extends SQLiteOpenHelper{
  9.         private static final String DB_NAME = "messaging";
  10.         private static final String TITLE = "title";
  11.         private static final String VALUE = "value";
  12.        
  13.         public DatabaseHelper(Context context) {
  14.                 super(context, DB_NAME, null, 1);
  15.         }
  16.  
  17.         @Override
  18.         public void onCreate(SQLiteDatabase db) {
  19.                 db.execSQL("CREATE TABLE users (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, username TEXT, password TEXT);");
  20.                 db.execSQL("CREATE TABLE mails (id INTEGER PRIMARY KEY AUTOINCREMENT, pid INTEGER DEFAULT '0', from_id INTEGER, to_id INTEGER, subject TEXT, body TEXT, datetime TEXT, read INTEGER);");
  21.                 db.execSQL("CREATE TABLE drafts (id INTEGER PRIMARY KEY AUTOINCREMENT, from_id INTEGER, to_id INTEGER, subject TEXT, body TEXT, datetime TEXT);");
  22.                 db.execSQL("CREATE TABLE sent (id INTEGER PRIMARY KEY AUTOINCREMENT, from_id INTEGER, to_id INTEGER, subject TEXT, body TEXT, datetime TEXT);");
  23.                
  24.         }
  25.  
  26.         @Override
  27.         public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
  28.                
  29.         }
  30.  
  31. }