package BWP.MobileSale.Config;

import BWP.MobileSale.R;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteDatabase.CursorFactory;

public class SaleDataBase extends SQLiteOpenHelper {
	
	public static SQLiteDatabase getWritableDatabase(Context context){
		return new SaleDataBase(context, "main", null, CurDbVersion).getWritableDatabase();
	}
	
	public static SQLiteDatabase getReadableDatabase(Context context){
		return new SaleDataBase(context, "main", null, CurDbVersion).getReadableDatabase();
	}
	
	public static int CurDbVersion = 1;
	Context mContext;


	public SaleDataBase(Context context, String name, CursorFactory factory,
			int version) {
		super(context, name, factory, version);
		mContext = context;
	}

	@Override
	public void onCreate(SQLiteDatabase arg0) {
		arg0.execSQL(mContext.getString(R.string.createTable_ClientGoods));
		
		arg0.execSQL(mContext.getString(R.string.createTable_ClientBuyer));
	}

	@Override
	public void onUpgrade(SQLiteDatabase arg0, int arg1, int arg2) {
		// TODO Auto-generated method stub

	}

}
