package cn.net.caoyao.cpzshandset.db;

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

public class SeedsDBHelper extends SQLiteOpenHelper {
	private static final int VERSION = 1;// 
	public final static String db_name = "seedsHandset.db";
	/**
	 * 产品信息表 <br>
	 */
	public static final String tb_product_info = "productInfo";
	
	/**
	 * 激活信息表
	 */
	public static final String tb_activate_info = "activateInfo";
	/**
	 * 基地列表  
	 * 
	 */
	public static final String tb_land_info = "landinfo";

	/**
	 * 证书列表
	 * 
	 */
	public static final String tb_zhengshu_info = "zhengshuinfo";
	
	public SeedsDBHelper(Context context) {
		super(context, db_name, null, VERSION);
		
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		productInfo(db);
		landInfo(db);
		zhengshuInfo(db);
	}

	@Override
	public void onUpgrade(SQLiteDatabase arg0, int arg1, int arg2) {

	}
	private void productInfo(SQLiteDatabase db) {

		String productSql = "CREATE TABLE "
				+ tb_product_info
				+ " (_id integer primary key autoincrement,product_id varchar(32) , name varchar(64) , nid varchar(32) ,product_option varchar(64))";

		db.execSQL(productSql);

	}
	
	/**
	 * 基地 
	 */
	private void landInfo(SQLiteDatabase db) {

		String landSql = "CREATE TABLE "
				+ tb_land_info
				+ " (_id integer primary key autoincrement, land_id interger,land_name varchar(30) ,area varchar(30),addr varchar(100),charger varchar(50) , phonenum varchar(30) ,des varchar(30) ,create_date varchar(30),update_date varchar(30) )";

		db.execSQL(landSql);
	}

	/**
	 * 证书
	 */
	private void zhengshuInfo(SQLiteDatabase db) {

		String zhengshuSql = "CREATE TABLE "
				+ tb_zhengshu_info
				+ " (_id integer primary key autoincrement, zhengshu_id interger,zhengshu_name varchar(30) ,update_date varchar(30),create_date varchar(30))";

		db.execSQL(zhengshuSql);
	}
}
