一般的数据库SQLite操作
package com.map.database;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
public class DatabaseHelper extends SQLiteOpenHelper {
private static final String TAG = "DatabaseHelper";
public static final String DB_NAME = "DB_MAP";
public static final int DB_VERSION = 1;
/**
* 数据库表的名字
*/
public static final String DB_TABLE = "RECORD";
public final static String DB_START_LAT = "start_lat";
public final static String DB_START_LNG = "start_lng";
public final static String DB_START_PLACE = "location_place_start";
public final static String DB_END_LAT = "end_lat";
public final static String DB_END_LNG = "end_lng";
public final static String DB_END_PLACE = "location_place_end";
public DatabaseHelper(Context context, String name, SQLiteDatabase.CursorFactory factory,
int version) {
super(context, name, factory, version);
// TODO Auto-generated constructor stub
}
/**
* 调用此方法,首次会创建数据库和数据库版本
* @param context
*/
public DatabaseHelper(Context context){
super(context, DB_NAME, null, DB_VERSION);
// TODO Auto-generated constructor stub
Log.d("LOG_TAG----->", "DatabaseHelper");
}
@Override
public void onCreate(SQLiteDatabase db) {
// TODO Auto-generated method stub
//创建数据表
StringBuffer sBuffer = new StringBuffer();
sBuffer.append("CREATE TABLE IF