Android SQLiteStatement - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android SQLiteStatement class.

This code example shows how to use the following methods: bindLong, clearBindings
    } 
 
    /** @inheritdoc */ 
    @Override 
    protected void bindValues(SQLiteStatement stmt, AutoincrementEntity entity) {
        stmt.clearBindings();
  
        Long id = entity.getId();
        if (id != null) {
            stmt.bindLong(1, id);
        } 
    } 
 
    /** @inheritdoc */ 
    @Override 
    public Long readKey(Cursor cursor, int offset) {
        return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0);
    }     
 
    /** @inheritdoc */ 
Full Snippet Info
10
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: bindLong, bindString, execute
		   mInsertFile.bindLong(2, new Date().getTime());
	      return mInsertFile.executeInsert();
	   } 
 
	   public void updateFileBookmark(String path, int bookmark) {
		   mUpdateBookmark.bindLong(1, bookmark);
		   mUpdateBookmark.bindString(2, path);
		   mUpdateBookmark.execute();
	   } 
	    
	   public void increaseFileViews(String path) {
		   mIncreaseViews.bindString(1, path);
		   mIncreaseViews.execute();
	   } 
	    
	   public void updateLastOpened(String path) {
		   mUpdateLastOpened.bindLong(1, new Date().getTime());
		   mUpdateLastOpened.bindString(2, path);
		   mUpdateLastOpened.execute();
	   } 
Full Snippet Info
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: bindBlob, bindLong, bindString, clearBindings, executeInsert
	@Override 
	public Long save(RpgCharacter rpgCharacter) {
		if (rpgCharacter.getId() == 0) {
			 
			//db.insert(RpgCharacterTable.NAME, nullColumnHack, values) 
			insertStatement.clearBindings();
			 
			insertStatement.bindString(1, rpgCharacter.getCharacteristics().getName());
			insertStatement.bindLong(2, RpgCharacter.getSerialVersionUID());
			insertStatement.bindBlob(3, RpgCharacter.serialize(rpgCharacter));
			 
			rpgCharacter.setId(insertStatement.executeInsert());
			 
		} else { 
			this.update(rpgCharacter);
		} 
		 
		return rpgCharacter.getId();
	} 
 
Full Snippet Info
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: bindString, execute
		return answer;
	} 
 
	@Override 
	synchronized public void setValue(String group, String name, String value) {
		mySetValueStatement.bindString(1, group);
		mySetValueStatement.bindString(2, name);
		mySetValueStatement.bindString(3, value);
		try { 
			mySetValueStatement.execute();
		} catch (SQLException e) {
		} 
	} 
 
	@Override 
	synchronized public void unsetValue(String group, String name) {
		myUnsetValueStatement.bindString(1, group);
		myUnsetValueStatement.bindString(2, name);
		try { 
			myUnsetValueStatement.execute();
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: simpleQueryForLong
    } 
 
    public int getNumberOfPosts() { 
        final SQLiteDatabase db = openHelper.getReadableDatabase();
        final SQLiteStatement statement = db.compileStatement("select count(*) from " + DATABASE_TABLE + ";");
        return (int) (statement.simpleQueryForLong());
    } 
 
    public boolean exists(String key) {
        final SQLiteDatabase db = openHelper.getReadableDatabase();
        SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
        qb.setTables(DATABASE_TABLE);
        Cursor c = qb.query(db, new String[]{COL_KEY}, COL_KEY + " = ?", new String[]{key}, null, null, null);
        try { 
            return c.moveToFirst();
        } finally { 
            c.close();
        } 
    } 
 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Android SQLiteStatement Questions & Answers:

See Code Examples for Android SQLiteStatement Methods: