SQLiteDatabase getPath - 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 getPath method.

This code example shows how to use the following methods:getPath, rawQuery
             } 
        } 
 
        @Override 
        public void onOpen(SQLiteDatabase db) {
            debug("Opening tabs.db: " + db.getPath());
 
            Cursor cursor = null;
            try { 
                cursor = db.rawQuery("PRAGMA synchronous=OFF", null);
            } finally { 
                if (cursor != null)
                    cursor.close();
            } 
 
            // From Honeycomb on, it's possible to run several db 
            // commands in parallel using multiple connections. 
            if (Build.VERSION.SDK_INT >= 11) {
                db.enableWriteAheadLogging();
                db.setLockingEnabled(false);

7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getPath
 
	@Override 
	public void onCreate(SQLiteDatabase db) {
		//TODO currently defers creation of database to SchemaCreationPolicy. 
		// and does not create database here. 
		Log.warn("Orman: SQLite database onCreate invoked. Database path %s.", db.getPath());
	} 
 
	@Override 
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		Log.warn("onUpgrade"); 
		Log.info( 
				"Orman: SQLite database onUpgrade invoked. Database path %s. Old %d, new %d.", 
				db.getPath(), oldVersion, newVersion);
	} 
 
	@Override 
	public QueryExecutionContainer getExecuter() { 
		return executer;
	} 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:close, getPath, query
    public static boolean setVersion(String version) {
        if (database != null) {
            if (databaseVersion.equals(version)) {
                return true; 
            } 
            Log.d(TAG, "close database \"" + database.getPath() + "\"");
            database.close();
        } 
 
        if (!setDatabasePath()) { 
            return false; 
        } 
        File file = new File(databasePath, version + ".sqlite3");
        if (file.exists() && file.isFile()) {
            databaseVersion = version;
            Log.d(TAG, "open database \"" + file.getAbsolutePath() + "\"");
            database = SQLiteDatabase.openDatabase(file.getAbsolutePath(), null,
                    SQLiteDatabase.OPEN_READONLY | SQLiteDatabase.NO_LOCALIZED_COLLATORS);
            setBooks(); 
            return true; 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:execSQL, getPath
		context = _context;
		//开启数据库 
		  
		db = context.openOrCreateDatabase(DATABASE_NAME, Context.MODE_PRIVATE,null);
		CreateTable(); 
		Log.v(TAG, "db path=" + db.getPath());
	} 
 
	/** 
	 * t_gprsData 记录数据变动 
	 * savetime 保存的时间,时间戳 
	 * gprsValue gprs流量的数据 
	 * totalValue 总流量的数据 
	 * action 执行的类型 1-正常保存,2-开机后第一次保存 
	 * notes 预留 
	 * 建表 
	 * 列名 区分大小写? 
	 * 都有什么数据类型? 
	 * SQLite 3  
	 * 	TEXT    文本 

5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getPath
		createTables(database);
	} 
 
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion)
	{ 
		Log.w(db.getPath(), "Upgrading database from version " + oldVersion + " to " + newVersion + ", which will destroy all old data");
		 
		dropTables(database);
		createTables(database);
	} 
	 
	public void startTransaction() 
	{ 
		database.beginTransaction();
	} 
	 
	public void commitTransaction() 
	{ 
		database.setTransactionSuccessful();
		database.endTransaction();
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:delete, getPath, isOpen
		SharedPreferences prefs = cont.getSharedPreferences("com.vanhlebarsoftware.kmmdroid_preferences", Context.MODE_WORLD_READABLE);
		 
		String widgetId = uri.getFragment();
		 
		// See if we need to open the database. 
		if( !db.isOpen() )
			db = openDatabase(widgetId);
		 
		// See which content uri is requested. 
		int match = sURIMatcher.match(uri);
		switch(match)
		{ 
			case ACCOUNTS:
				dbTable = "kmmAccounts";
				break; 
			case ACCOUNTS_ID:
				break; 
			case SCHEDULES:
				dbTable = "kmmSchedules";
				break; 

5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:close, getPath
		/** 
		 * Drops the table of the provided database. 
		 * @param db The database the table is to be dropped. 
		 */ 
		public void clear(SQLiteDatabase db) {
			File f = new File (db.getPath());
			if (f.exists()) {
				f.delete(); // NOSONAR
			} 
			db.close();
		} 
	} 
 
	/** 
	 * Constructor - takes the context to allow the database to be 
	 * opened/created 
	 *  
	 * @param ctx 
	 *            the Context within which to work 
	 */ 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getPath
    return super.getWritableDatabase(); 
  } 
 
  public void onCreate(SQLiteDatabase paramSQLiteDatabase)
  { 
    v.a(paramSQLiteDatabase.getPath());
  } 
 
  public void onOpen(SQLiteDatabase paramSQLiteDatabase)
  { 
    try 
    { 
      if (!a("hits2", paramSQLiteDatabase))
        paramSQLiteDatabase.execSQL(bh.f());
      return; 
    } 
    catch (SQLiteException localSQLiteException)
    { 
      while (true) 
      { 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getPath
	} 
	 
	//该函数是在第一次创建数据库的时候执行,实际上是在第一次得到SQLiteDatabse对象的时候,才会调用这个方法 
	@Override 
	public void onCreate(SQLiteDatabase db) {
		Log.d("databasehelp", db.getPath());
 
		//execSQL函数用于执行SQL语句 根据表明name创建,可以利用发射动态创建,目前先写死测试创建数据库 
		db.execSQL(createSql);
	} 
 
	@Override 
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		//System.out.println("update a Database"); 
	} 
 
} 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getPath
	 */ 
	public AppsDBAdapter open() throws SQLException 
	{ 
		mDbHelper = new DatabaseHelper(mCtx);
		mDb = mDbHelper.getWritableDatabase();
		check = mDb.getPath();
		return this;
	} 
 
	public void close() 
	{ 
		mDbHelper.close();
	} 
 
	/** 
	 * Create a new entry using the body provided. If the entry is successfully 
	 * created return the new rowId for that entry, otherwise return a -1 to 
	 * indicate failure. 
	 *  
	 * @param body 
4
CodeRank
Experience pair programming with AI  Get Codota for Java

Related SQLiteDatabase getPath Questions & Answers:

getPath Method Overview
Gets the path to the database file.
See Code Examples for other Android SQLiteDatabase Methods: