SQLiteDatabase getVersion - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for SQLiteDatabase getVersion method.

This code example shows how to use the following methods: close, beginTransaction, endTransaction, getVersion, setTransactionSuccessful
                    db = SQLiteDatabase.openOrCreateDatabase(new File(mPath, mName), mFactory);
                else 
                    db = mContext.openOrCreateDatabase(mName, 0, mFactory);
            } 
 
            int version = db.getVersion();
            if (version != mNewVersion) {
                db.beginTransaction();
                try { 
                    if (version == 0) {
                        onCreate(db);
                    } else { 
                        onUpgrade(db, version, mNewVersion);
                    } 
                    db.setVersion(mNewVersion);
                    db.setTransactionSuccessful();
                } finally { 
                    db.endTransaction();
                } 
            } 

8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: execSQL, getVersion, rawQuery
    private boolean isReleased = false;
 
    @Override 
    public void onCreate(SQLiteDatabase database, ConnectionSource connectionSource) {
        Log.v(TAG, "Now we are creating a new database!");
        Log.i(TAG, "Newly created db version: " + database.getVersion());
 
        try { 
            TableUtils.createTable(connectionSource, Card.class);
            TableUtils.createTable(connectionSource, Deck.class);
            TableUtils.createTable(connectionSource, Setting.class);
            TableUtils.createTable(connectionSource, Filter.class);
            TableUtils.createTable(connectionSource, Category.class);
            TableUtils.createTable(connectionSource, LearningData.class);
 
            getSettingDao().create(new Setting()); 
            getCategoryDao().create(new Category()); 
 
            if (database.getVersion() == 0) {
                convertOldDatabase(database);

7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: execSQL, getVersion
				+ KEY_MODIFICATION_DATE + " DATETIME,"
				+ KEY_DUE_DATE + " DATETIME,"
				+ KEY_G_ID + " TEXT,"
				+ KEY_NOTES + " TEXT)";
		 
		db.execSQL(create_tasks_table);
	} 
	 
	private void createCategoriesTable(SQLiteDatabase db) {
		String create_categories_table = "CREATE TABLE " + TABLE_CATEGORIES + "(" 
				+ KEY_ID + " INTEGER PRIMARY KEY,"
				+ KEY_NAME + " TEXT,"
				+ KEY_COLOR + " INTEGER,"
				+ KEY_UPDATED + " DATETIME,"
				+ KEY_G_ID + " TEXT)";
		 
		db.execSQL(create_categories_table);
		 
		// Create first entry of categories table 
		ContentValues values = new ContentValues();

6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: close, getVersion, isOpen, isReadOnly
  
		if (dbExist) {
			if (LOGV) Log.v(TAG, "Found existing DB at " + dbFile);
 
			mDB = SQLiteDatabase.openDatabase(dbFile, null, SQLiteDatabase.OPEN_READONLY);
			int thisDBVersion = mDB.getVersion();
			mDB.close();
			 
			if (LOGV) Log.v(TAG, "Current DB Version: v" + thisDBVersion + " - Shipped DB Version is v" + DATABASE_VERSION);
			if (thisDBVersion != DATABASE_VERSION) {							
				try { 
					copyDB(dbFile);
				} catch (IOException e) {
					throw new Error("Error copying database");
				} 
			}	 
		} 
		else { 
			if (LOGV) Log.v(TAG, "Creating a new DB at " + dbFile);
			// By calling this method and empty database will be created into the default system path 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getVersion
            // Not much we can do to recover at this point 
            Log.e(LOGTAG, "Unable to open or create " + databaseFile);
            return; 
        } 
 
        if (mDatabase.getVersion() != DATABASE_VERSION) {
            mDatabase.beginTransactionNonExclusive();
            try { 
                createTable(); 
                mDatabase.setTransactionSuccessful();
            } finally { 
                mDatabase.endTransaction();
            } 
        } 
    } 
 
    private void createTable() { 
        mDatabase.execSQL("CREATE TABLE " + HTTPAUTH_TABLE_NAME
                + " (" + ID_COL + " INTEGER PRIMARY KEY, "
                + HTTPAUTH_HOST_COL + " TEXT, " + HTTPAUTH_REALM_COL
Full Snippet Info
5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related SQLiteDatabase getVersion Questions & Answers:

getVersion Method Overview
Gets the database version.
See Code Examples for other Android SQLiteDatabase Methods: