package com.bingka.weathercool;

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

public class WeatherCoolOpenHelper extends SQLiteOpenHelper {
	
	public static final String PROVINCE_TABLE = "Province";
	public static final String CITY_TABLE = "City";
	public static final String COUNTY_TABLE = "County";
	
	/**
	* Province±í½¨±íÓï¾ä(Ê¡)
	*/
	public static final String CREATE_PROVINCE = "create table Province(" +
			"id integer primary key autoincrement, " +
			"province_name text, " +
			"province_code text)";
	
	/**
	* City±í½¨±íÓï¾ä(ÊÐ)
	*/
	public static final String CREATE_CITY = "create table City(" +
			"id integer primary key autoincrement, " +
			"city_name text, " +
			"city_code text, " +
			"province_id integer)";
	
	/**
	* County±í½¨±íÓï¾ä(ÏØ)
	*/
	public static final String CREATE_COUNTY = "create table County(" +
			"id integer primary key autoincrement, " +
			"county_name text, " +
			"county_code text, " +
			"city_id integer)";
	
	
	public WeatherCoolOpenHelper(Context context, String name,
			CursorFactory factory, int version,
			DatabaseErrorHandler errorHandler) {
		
		super(context, name, factory, version, errorHandler);

	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		db.execSQL(CREATE_PROVINCE);  // ´´½¨Province±í
		db.execSQL(CREATE_CITY);      // ´´½¨City±í
		db.execSQL(CREATE_COUNTY);    // ´´½¨County±í

	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		

	}

}
