Back to project page android-textlater.
The source code is released under:
Apache License
If you think the Android project android-textlater listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
/* * Copyright (C) 2013 The Android Open Source Project *//from w ww . j a v a 2 s . c o m * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.michael.feng.textlater; import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.util.Log; public class SQLiteHelper extends SQLiteOpenHelper { private static final int DB_VERSION = 3; private static final String DB_NAME = "textlater.db"; public static final String TB_NAME = "messages"; public static final String COL_ID = "_id"; public static final String COL_CONTACT = "textContact"; public static final String COL_NUMBER = "textNumber"; public static final String COL_WHEN = "textWhen"; public static final String COL_CONTENT = "textContent"; public static final String COL_HASSENT = "hasSent"; // DB creation SQL private static final String DB_CREATE_SQL = "CREATE TABLE messages" + "(_id INTEGER PRIMARY KEY AUTOINCREMENT, " + "textContact VARCHAR NOT NULL," + "textNumber VARCHAR NOT NULL," + "textWhen VARCHAR NOT NULL," + "textContent VARCHAR NOT NULL," + "hasSent CHAR(1) DEFAULT 0 NOT NULL)"; public SQLiteHelper(Context context) { super(context, DB_NAME, null, DB_VERSION); } @Override public void onCreate(SQLiteDatabase database) { database.execSQL(DB_CREATE_SQL); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { Log.w(SQLiteHelper.class.getName(), "Upgrading database from version " + oldVersion + " to " + newVersion + ", which will destroy all old data"); db.execSQL("DROP TABLE IF EXISTS " + DB_NAME); onCreate(db); } }