Add history feature; group some functionality into subpackages
[zxing.git] / android / src / com / google / zxing / client / android / history / DBHelper.java
1 /*
2  * Copyright (C) 2009 ZXing authors
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package com.google.zxing.client.android.history;
18
19 import android.database.sqlite.SQLiteOpenHelper;
20 import android.database.sqlite.SQLiteDatabase;
21 import android.content.Context;
22
23 /**
24  * @author Sean Owen
25  */
26 final class DBHelper extends SQLiteOpenHelper {
27
28   private static final int DB_VERSION = 1;
29   private static final String DB_NAME = "barcode_scanner_history.db";
30   static final String TABLE_NAME = "history";
31   private static final String ID_COL = "id";
32   static final String TEXT_COL = "text";
33   static final String TIMESTAMP_COL = "timestamp";
34
35   DBHelper(Context context) {
36     super(context, DB_NAME, null, DB_VERSION);
37   }
38
39   @Override
40   public void onCreate(SQLiteDatabase sqLiteDatabase) {
41     sqLiteDatabase.execSQL(
42             "CREATE TABLE " + TABLE_NAME + " (" +
43             ID_COL + " INTEGER PRIMARY KEY, " +
44             TEXT_COL + " TEXT, " +
45             TIMESTAMP_COL + " INTEGER" +
46             ");");
47   }
48
49   @Override
50   public void onUpgrade(SQLiteDatabase sqLiteDatabase, int oldVersion, int newVersion) {
51   }
52
53 }