Java Code Examples for android.database.sqlite.SQLiteStatement.bindLong()

The following are Jave code examples for showing how to use bindLong() of the android.database.sqlite.SQLiteStatement class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: FamilyBond   File: SMSDao.java   Source Code and License Vote up 6 votes
@Override
protected final void bindValues(SQLiteStatement stmt, SMS entity) {
    stmt.clearBindings();
 
    Long id = entity.getId();
    if (id != null) {
        stmt.bindLong(1, id);
    }
 
    String time = entity.getTime();
    if (time != null) {
        stmt.bindString(2, time);
    }
 
    String address = entity.getAddress();
    if (address != null) {
        stmt.bindString(3, address);
    }
 
    String content = entity.getContent();
    if (content != null) {
        stmt.bindString(4, content);
    }
    stmt.bindDouble(5, entity.getProbability());
}
 
Example 2
Project: AndroidBackendlessChat   File: BLinkedAccountDao.java   Source Code and License Vote up 6 votes
/** @inheritdoc */
@Override
protected void bindValues(SQLiteStatement stmt, BLinkedAccount entity) {
    stmt.clearBindings();
 
    Long id = entity.getId();
    if (id != null) {
        stmt.bindLong(1, id);
    }
 
    String Token = entity.getToken();
    if (Token != null) {
        stmt.bindString(2, Token);
    }
 
    Integer type = entity.getType();
    if (type != null) {
        stmt.bindLong(3, type);
    }
 
    Long BUserDaoId = entity.getBUserDaoId();
    if (BUserDaoId != null) {
        stmt.bindLong(4, BUserDaoId);
    }
}
 
Example 3
Project: FamilyBond   File: BpmDao.java   Source Code and License Vote up 6 votes
@Override
protected final void bindValues(SQLiteStatement stmt, Bpm entity) {
    stmt.clearBindings();
 
    Long id = entity.getId();
    if (id != null) {
        stmt.bindLong(1, id);
    }
 
    String mBpm = entity.getMBpm();
    if (mBpm != null) {
        stmt.bindString(2, mBpm);
    }
 
    String mTime = entity.getMTime();
    if (mTime != null) {
        stmt.bindString(3, mTime);
    }
 
    String mDescription = entity.getMDescription();
    if (mDescription != null) {
        stmt.bindString(4, mDescription);
    }
}
 
Example 4
Project: popomusic   File: SearchNameBeanDao.java   Source Code and License Vote up 5 votes
@Override
protected final void bindValues(SQLiteStatement stmt, SearchNameBean entity) {
    stmt.clearBindings();
 
    Long id = entity.getId();
    if (id != null) {
        stmt.bindLong(1, id);
    }
 
    String searchname = entity.getSearchname();
    if (searchname != null) {
        stmt.bindString(2, searchname);
    }
}
 
Example 5
Project: GitHub   File: RelationSource2Dao.java   Source Code and License Vote up 5 votes
@Override
protected final void bindValues(SQLiteStatement stmt, RelationSource2 entity) {
    stmt.clearBindings();
 
    Long id = entity.getId();
    if (id != null) {
        stmt.bindLong(1, id);
    }
 
    Long toOneId = entity.getToOneId();
    if (toOneId != null) {
        stmt.bindLong(2, toOneId);
    }
}
 
Example 6
Project: buildAPKsApps   File: DataManager.java   Source Code and License Vote up 5 votes
public void updateItemLabel(int itemId, String newLabel)
{
    Log.d(L.TAG, "Updating label of item " + itemId + " to " + newLabel);

    SQLiteDatabase db = helper.getWritableDatabase();
    SQLiteStatement stmt = db.compileStatement("update items set label=? where id=?");        
    stmt.bindString(1, newLabel);
    stmt.bindLong(2, itemId);
    stmt.execute();
    stmt.close();
    db.close();
}
 
Example 7
Project: GitHub   File: SimpleEntityNotNullDao.java   Source Code and License Vote up 5 votes
@Override
protected final void bindValues(SQLiteStatement stmt, SimpleEntityNotNull entity) {
    stmt.clearBindings();
    stmt.bindLong(1, entity.getId());
    stmt.bindLong(2, entity.getSimpleBoolean() ? 1L: 0L);
    stmt.bindLong(3, entity.getSimpleByte());
    stmt.bindLong(4, entity.getSimpleShort());
    stmt.bindLong(5, entity.getSimpleInt());
    stmt.bindLong(6, entity.getSimpleLong());
    stmt.bindDouble(7, entity.getSimpleFloat());
    stmt.bindDouble(8, entity.getSimpleDouble());
    stmt.bindString(9, entity.getSimpleString());
    stmt.bindBlob(10, entity.getSimpleByteArray());
}
 
Example 8
Project: weex-3d-map   File: DefaultWXStorage.java   Source Code and License Vote up 5 votes
private boolean performSetItem(String key, String value, boolean isPersistent, boolean allowRetryWhenFull) {
    SQLiteDatabase database = mDatabaseSupplier.getDatabase();
    if (database == null) {
        return false;
    }

    WXLogUtils.d(WXSQLiteOpenHelper.TAG_STORAGE, "set k-v to storage(key:" + key + ",value:" + value + ",isPersistent:" + isPersistent + ",allowRetry:" + allowRetryWhenFull + ")");
    String sql = "INSERT OR REPLACE INTO " + WXSQLiteOpenHelper.TABLE_STORAGE + " VALUES (?,?,?,?);";
    SQLiteStatement statement = null;
    String timeStamp = WXSQLiteOpenHelper.sDateFormatter.format(new Date());
    try {
        statement = database.compileStatement(sql);
        statement.clearBindings();
        statement.bindString(1, key);
        statement.bindString(2, value);
        statement.bindString(3, timeStamp);
        statement.bindLong(4, isPersistent ? 1 : 0);
        statement.execute();
        return true;
    } catch (Exception e) {
        WXLogUtils.e(WXSQLiteOpenHelper.TAG_STORAGE, "DefaultWXStorage occurred an exception when execute setItem :" + e.getMessage());
        if (e instanceof SQLiteFullException) {
            if (allowRetryWhenFull && trimToSize()) {
                //try again
                //setItem/setItemPersistent method only allow try once when occurred a sqliteFullException.
                WXLogUtils.d(WXSQLiteOpenHelper.TAG_STORAGE, "retry set k-v to storage(key:" + key + ",value:" + value + ")");
                return performSetItem(key, value, isPersistent, false);
            }
        }

        return false;
    } finally {
        if(statement != null) {
            statement.close();
        }
    }
}
 
Example 9
Project: CommonFramework   File: BannerDao.java   Source Code and License Vote up 5 votes
@Override
protected final void bindValues(SQLiteStatement stmt, Banner entity) {
    stmt.clearBindings();
    stmt.bindLong(1, entity.getId());
 
    String url = entity.getUrl();
    if (url != null) {
        stmt.bindString(2, url);
    }
 
    String type = entity.getType();
    if (type != null) {
        stmt.bindString(3, type);
    }
}
 
Example 10
Project: MapaDeIgarassuAdmin   File: DataBaseUtil.java   Source Code and License Vote up 5 votes
public void updateLocation(LocationModel locationModel) {
    SQLiteDatabase db = this.getWritableDatabase();
    SQLiteStatement stmt = db.compileStatement(Constants.UPDATE_TABLE_LOCATION);
    stmt.bindString(1, locationModel.getName());
    stmt.bindDouble(2, locationModel.getLongitude());
    stmt.bindDouble(3, locationModel.getLatitude());
    stmt.bindString(4, locationModel.getAddress());
    stmt.bindString(5, locationModel.getDescription());
    stmt.bindLong(6, locationModel.getId());
    stmt.execute();
}
 
Example 11
Project: GitHub   File: ToOneTarget2Dao.java   Source Code and License Vote up 5 votes
@Override
protected final void bindValues(SQLiteStatement stmt, ToOneTarget2 entity) {
    stmt.clearBindings();
 
    Long id = entity.getId();
    if (id != null) {
        stmt.bindLong(1, id);
    }
}
 
Example 12
Project: NeiHanDuanZiTV   File: UserDao.java   Source Code and License Vote up 5 votes
@Override
protected final void bindValues(SQLiteStatement stmt, User entity) {
    stmt.clearBindings();
 
    Long id = entity.getId();
    if (id != null) {
        stmt.bindLong(1, id);
    }
 
    String userName = entity.getUserName();
    if (userName != null) {
        stmt.bindString(2, userName);
    }
}
 
Example 13
Project: OpenHub   File: BookMarkUserDao.java   Source Code and License Vote up 5 votes
@Override
protected final void bindValues(SQLiteStatement stmt, BookMarkUser entity) {
    stmt.clearBindings();
    stmt.bindString(1, entity.getLogin());
 
    String name = entity.getName();
    if (name != null) {
        stmt.bindString(2, name);
    }
 
    String avatarUrl = entity.getAvatarUrl();
    if (avatarUrl != null) {
        stmt.bindString(3, avatarUrl);
    }
 
    Integer followers = entity.getFollowers();
    if (followers != null) {
        stmt.bindLong(4, followers);
    }
 
    Integer following = entity.getFollowing();
    if (following != null) {
        stmt.bindLong(5, following);
    }
 
    java.util.Date markTime = entity.getMarkTime();
    if (markTime != null) {
        stmt.bindLong(6, markTime.getTime());
    }
}
 
Example 14
Project: Android-SQLite-Master-Project   File: UserMessagesRelationDao.java   Source Code and License Vote up 5 votes
private static void insertUserMessage(@NonNull SQLiteStatement statement,
                                      long userId, long messageId) {
    statement.bindLong(1, userId);
    statement.bindLong(2, messageId);
    statement.executeInsert();
    statement.clearBindings();
}
 
Example 15
Project: buildAPKsApps   File: DataManager.java   Source Code and License Vote up 5 votes
public void updateListLabel(int listId, String newLabel)
{
    Log.d(L.TAG, "Updating label of list " + listId + " to " + newLabel);

    SQLiteDatabase db = helper.getWritableDatabase();
    SQLiteStatement stmt = db.compileStatement("update lists set label=? where id=?");        
    stmt.bindString(1, newLabel);
    stmt.bindLong(2, listId);
    stmt.execute();
    stmt.close();
    db.close();
}
 
Example 16
Project: cniao5   File: SearchHistoryDao.java   Source Code and License Vote up 5 votes
@Override
protected final void bindValues(SQLiteStatement stmt, SearchHistory entity) {
    stmt.clearBindings();
 
    Long id = entity.getId();
    if (id != null) {
        stmt.bindLong(1, id);
    }
 
    String searchContent = entity.getSearchContent();
    if (searchContent != null) {
        stmt.bindString(2, searchContent);
    }
    stmt.bindLong(3, entity.getOrder());
}
 
Example 17
Project: PeSanKita-android   File: PlaintextBackupImporter.java   Source Code and License Vote up 4 votes
private static void addLongToStatement(SQLiteStatement statement, int index, long value) {
  statement.bindLong(index, value);
}
 
Example 18
Project: NotifyTools   File: TangshiDao.java   Source Code and License Vote up 4 votes
@Override
protected final void bindValues(SQLiteStatement stmt, Tangshi entity) {
    stmt.clearBindings();
 
    Long id = entity.getId();
    if (id != null) {
        stmt.bindLong(1, id);
    }
 
    String author = entity.getAuthor();
    if (author != null) {
        stmt.bindString(2, author);
    }
 
    String title = entity.getTitle();
    if (title != null) {
        stmt.bindString(3, title);
    }
 
    String strains = entity.getStrains();
    if (strains != null) {
        stmt.bindString(4, strains);
    }
 
    String paragraphs = entity.getParagraphs();
    if (paragraphs != null) {
        stmt.bindString(5, paragraphs);
    }
 
    String pyquany = entity.getPyquany();
    if (pyquany != null) {
        stmt.bindString(6, pyquany);
    }
 
    String pyjian = entity.getPyjian();
    if (pyjian != null) {
        stmt.bindString(7, pyjian);
    }
 
    String authorjt = entity.getAuthorjt();
    if (authorjt != null) {
        stmt.bindString(8, authorjt);
    }
 
    String pyquan = entity.getPyquan();
    if (pyquan != null) {
        stmt.bindString(9, pyquan);
    }
}
 
Example 19
Project: MapaDeIgarassu   File: DataBaseUtil.java   Source Code and License Vote up 4 votes
public void deleteLocation(int locationId) {
    SQLiteDatabase db = this.getWritableDatabase();
    SQLiteStatement stmt = db.compileStatement(Constants.DELETE_LOCATION);
    stmt.bindLong(1, locationId);
    stmt.execute();
}
 
Example 20
Project: chat-sdk-android-push-firebase   File: BUserDao.java   Source Code and License Vote up 4 votes
/** @inheritdoc */
@Override
protected void bindValues(SQLiteStatement stmt, BUser entity) {
    stmt.clearBindings();
 
    Long id = entity.getId();
    if (id != null) {
        stmt.bindLong(1, id);
    }
 
    String entityID = entity.getEntityID();
    if (entityID != null) {
        stmt.bindString(2, entityID);
    }
 
    Integer AuthenticationType = entity.getAuthenticationType();
    if (AuthenticationType != null) {
        stmt.bindLong(3, AuthenticationType);
    }
 
    String messageColor = entity.getMessageColor();
    if (messageColor != null) {
        stmt.bindString(4, messageColor);
    }
 
    java.util.Date lastOnline = entity.getLastOnline();
    if (lastOnline != null) {
        stmt.bindLong(5, lastOnline.getTime());
    }
 
    java.util.Date lastUpdated = entity.getLastUpdated();
    if (lastUpdated != null) {
        stmt.bindLong(6, lastUpdated.getTime());
    }
 
    Boolean Online = entity.getOnline();
    if (Online != null) {
        stmt.bindLong(7, Online ? 1l: 0l);
    }
 
    String Metadata = entity.getMetadata();
    if (Metadata != null) {
        stmt.bindString(8, Metadata);
    }
}