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
Connect your IDE to all the code out there  Get Codota for Java
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
Connect your IDE to all the code out there  Get Codota for Java
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
Connect your IDE to all the code out there  Get Codota for Java
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
Connect your IDE to all the code out there  Get Codota for Java
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
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: bindString, executeInsert
This code example shows how to use the following methods: bindString, executeInsert
      this.insertStmt = this.db.compileStatement(INSERT);
   } 
 
   public long insert(String project_name, String lat, String lon, String file_path) 
   { 
      this.insertStmt.bindString(1, project_name);
      this.insertStmt.bindString(2, lat);
      this.insertStmt.bindString(3, lon);
      this.insertStmt.bindString(4, file_path);
      return this.insertStmt.executeInsert();
   } 
 
   public void deleteAll()  
   { 
      this.db.delete(TABLE_NAME, null, null);
   } 
 
   public List<String> selectAll() 
   { 
      List<String> list = new ArrayList<String>();
Full Snippet Info
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: bindLong
		return "INTEGER"; 
	} 
 
	@Override 
	void bindValue(SQLiteStatement writeStatement, Boolean value) {
		writeStatement.bindLong(3, value ? 1 : 0);
	} 
 
	@Override 
	public void migrate(SQLiteDatabase db, int toVersion) {
		super.migrate(db, toVersion);
		switch (toVersion) {
		case 52: 
			initialMigrate(db, "chat_notify_visible", "INTEGER");
			break; 
		default: 
			break; 
		} 
	} 
 
Full Snippet Info
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: close, bindString, execute
		boolean success = false;
		 
		SQLiteDatabase db = getReadableDatabase();
		 
		SQLiteStatement sqlStatement = db.compileStatement("INSERT INTO locations (locationName, coordinates, description) VALUES (?, ?, ?)");
			sqlStatement.bindString(1, locationName);
			sqlStatement.bindString(2, coordinates);
			sqlStatement.bindString(3, description);
		 
		db.beginTransaction();
		try 
		{ 
			sqlStatement.execute();
			db.setTransactionSuccessful();
			success = true;
		} 
		catch (SQLException ex)
		{ 
			ex.printStackTrace();
		} 

6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: close, bindString, executeInsert

Related Android SQLiteStatement Questions & Answers:

See Code Examples for Android SQLiteStatement Methods: