@Override public void bindLong(int index, long value) { delegate.bindLong(index, value); }
@Override protected final void bindValues(SQLiteStatement stmt, DateEntity entity) { stmt.clearBindings(); Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } java.util.Date date = entity.getDate(); if (date != null) { stmt.bindLong(2, date.getTime()); } stmt.bindLong(3, entity.getDateNotNull().getTime()); }
@Override protected final void bindValues(SQLiteStatement stmt, JoinManyToDateEntity entity) { stmt.clearBindings(); Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } Long idToMany = entity.getIdToMany(); if (idToMany != null) { stmt.bindLong(2, idToMany); } Long idDate = entity.getIdDate(); if (idDate != null) { stmt.bindLong(3, idDate); } }
@Override protected final void bindValues(SQLiteStatement stmt, AutoincrementEntity entity) { stmt.clearBindings(); Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } }
@Override protected final void bindValues(SQLiteStatement stmt, CustomTypeEntity entity) { stmt.clearBindings(); Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } MyTimestamp myCustomTimestamp = entity.getMyCustomTimestamp(); if (myCustomTimestamp != null) { stmt.bindLong(2, myCustomTimestampConverter.convertToDatabaseValue(myCustomTimestamp)); } }
@Override protected final void bindValues(SQLiteStatement stmt, KeepEntity entity) { stmt.clearBindings(); Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } }
@Override protected final void bindValues(SQLiteStatement stmt, ToOneTarget2 entity) { stmt.clearBindings(); Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } }
String sql = "INSERT INTO table_name (column_1, column_2) VALUES (?, ?)"; SQLiteStatement statement = db.compileStatement(sql); int intValue = 57; String stringValue = "hello"; statement.bindLong(1, intValue); // These match to the two question marks in the sql string statement.bindString(2, stringValue); long rowId = statement.executeInsert();
String sql = "UPDATE table_name SET column_2=? WHERE column_1=?"; SQLiteStatement statement = db.compileStatement(sql); int id = 7; String stringValue = "hi there"; statement.bindString(1, stringValue); statement.bindLong(2, id); int numberOfRowsAffected = statement.executeUpdateDelete();
@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()); }
@Override protected final void bindValues(SQLiteStatement stmt, ToManyTargetEntity entity) { stmt.clearBindings(); Long toManyId = entity.getToManyId(); if (toManyId != null) { stmt.bindLong(1, toManyId); } Long toManyIdDesc = entity.getToManyIdDesc(); if (toManyIdDesc != null) { stmt.bindLong(2, toManyIdDesc); } Long id = entity.getId(); if (id != null) { stmt.bindLong(3, id); } String targetJoinProperty = entity.getTargetJoinProperty(); if (targetJoinProperty != null) { stmt.bindString(4, targetJoinProperty); } }
@Override protected final void bindValues(SQLiteStatement stmt, ExtendsImplementsEntity entity) { stmt.clearBindings(); Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } String text = entity.getText(); if (text != null) { stmt.bindString(2, text); } }
@Override protected final void bindValues(SQLiteStatement stmt, ToManyEntity entity) { stmt.clearBindings(); Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } String sourceJoinProperty = entity.getSourceJoinProperty(); if (sourceJoinProperty != null) { stmt.bindString(2, sourceJoinProperty); } }
@Override protected final void bindValues(SQLiteStatement stmt, IndexedStringEntity entity) { stmt.clearBindings(); Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } String indexedString = entity.getIndexedString(); if (indexedString != null) { stmt.bindString(2, indexedString); } }
@Override protected final void bindValues(SQLiteStatement stmt, AnActiveEntity entity) { stmt.clearBindings(); Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } String text = entity.getText(); if (text != null) { stmt.bindString(2, text); } }
protected void updateInsideSynchronized(T entity, SQLiteStatement stmt, boolean lock) { // To do? Check if it's worth not to bind PKs here (performance). bindValues(stmt, entity); int index = config.allColumns.length + 1; K key = getKey(entity); if (key instanceof Long) { stmt.bindLong(index, (Long) key); } else if (key == null) { throw new DaoException("Cannot update entity without key - was it inserted before?"); } else { stmt.bindString(index, key.toString()); } stmt.execute(); attachEntity(key, entity, lock); }
@Override protected final void bindValues(SQLiteStatement stmt, MinimalEntity entity) { stmt.clearBindings(); Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } }