@Override public void bindBlob(int index, byte[] value) { delegate.bindBlob(index, value); }
public void insertUser(){ SQLiteDatabase db = dbHelper.getWritableDatabase(); String delSql = "DELETE FROM ACCOUNTS"; SQLiteStatement delStmt = db.compileStatement(delSql); delStmt.execute(); String sql = "INSERT INTO ACCOUNTS (account_id,account_name,account_image) VALUES(?,?,?)"; SQLiteStatement insertStmt = db.compileStatement(sql); insertStmt.clearBindings(); insertStmt.bindString(1, Integer.toString(this.accId)); insertStmt.bindString(2,this.accName); insertStmt.bindBlob(3, this.accImage); insertStmt.executeInsert(); db.close(); }
insertStatement.bindBlob(2, record.getData()); long insertedId = insertStatement.executeInsert(); if (insertedId >= 0) {
@Override public void bindBlob(int index, byte[] value) { statement.bindBlob(index, value); }
stmt.bindBlob(10, simpleByteArray);
@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()); }
stmt.bindBlob(10, simpleByteArray);
@Override protected void executeInsert(Way way) { insert.bindLong(1, way.getId()); insert.bindLong(2, way.getVersion()); insert.bindBlob(3, serializer.toBytes(new ArrayList<>(way.getNodeIds()))); if(way.getTags() != null) { HashMap<String, String> map = new HashMap<>(way.getTags()); insert.bindBlob(4, serializer.toBytes(map)); } else { insert.bindNull(4); } insert.executeInsert(); insert.clearBindings(); }
@Override protected void executeInsert(Relation relation) { insert.bindLong(1, relation.getId()); insert.bindLong(2, relation.getVersion()); insert.bindBlob(3, serializer.toBytes(new ArrayList<>(relation.getMembers()))); if(relation.getTags() != null) { HashMap<String, String> map = new HashMap<>(relation.getTags()); insert.bindBlob(4, serializer.toBytes(map)); } else { insert.bindNull(4); } insert.executeInsert(); insert.clearBindings(); }
private void executeInsert(Element.Type type, long id, ElementGeometry geometry) { insert.bindString(1, type.name()); insert.bindLong(2, id); if (geometry.polygons != null) insert.bindBlob(3, serializer.toBytes(geometry.polygons)); else insert.bindNull(3); if (geometry.polylines != null) insert.bindBlob(4, serializer.toBytes(geometry.polylines)); else insert.bindNull(4); insert.bindDouble(5, geometry.center.getLatitude()); insert.bindDouble(6, geometry.center.getLongitude()); insert.executeInsert(); insert.clearBindings(); }
private void executeInsert(Note note) { insert.bindLong(1, note.id); insert.bindDouble(2, note.position.getLatitude()); insert.bindDouble(3, note.position.getLongitude()); insert.bindString(4, note.status.name()); insert.bindLong(5, note.dateCreated.getTime()); if(note.dateClosed != null) { insert.bindLong(6, note.dateClosed.getTime()); } else { insert.bindNull(6); } insert.bindBlob(7, serializer.toBytes(note.comments)); insert.executeInsert(); insert.clearBindings(); }
@Override public void bindBlob(int index, byte[] value) { statement.bindBlob(index, value); } }
@Override protected void executeInsert(Node node) { insert.bindLong(1, node.getId()); insert.bindLong(2, node.getVersion()); insert.bindDouble(3, node.getPosition().getLatitude()); insert.bindDouble(4, node.getPosition().getLongitude()); if(node.getTags() != null) { HashMap<String, String> map = new HashMap<>(node.getTags()); insert.bindBlob(5, serializer.toBytes(map)); } else { insert.bindNull(5); } insert.executeInsert(); insert.clearBindings(); }
@Override protected synchronized long executeInsert(OsmQuest quest, boolean replace) { SQLiteStatement stmt = replace ? this.replace : this.add; if(quest.getId() != null) { stmt.bindLong(1, quest.getId()); } else { stmt.bindNull(1); } stmt.bindString(2, quest.getType().getClass().getSimpleName()); stmt.bindString(3, quest.getStatus().name()); if(quest.getChanges() != null) { stmt.bindBlob(4, serializer.toBytes(quest.getChanges())); } else { stmt.bindNull(4); } if(quest.getChangesSource() != null) stmt.bindString(5, quest.getChangesSource()); else stmt.bindNull(5); stmt.bindLong(6, new Date().getTime()); stmt.bindLong(7, quest.getElementId()); stmt.bindString(8, quest.getElementType().name()); long result = stmt.executeInsert(); stmt.clearBindings(); return result; }
/** * Adds a value to the set. * * @param value the data for the value to put */ public void put(byte[] value) { if (value == null) { this.compiledStatement.bindNull(compiledStatementBindIndex++); } else { compiledStatement.bindBlob(compiledStatementBindIndex++, value); } }
/** * SQLiteStatement#bindBlobのヘルパーメソッド。intの配列をbyteの配列に変換して割り付ける * * @param stat * @param index * @param array */ public static void bindBlobIntArray(@NonNull final SQLiteStatement stat, final int index, @NonNull final int[] array, final int offset, final int num) { stat.bindBlob(index, intArrayToByteArray(array, offset, num)); }
/** * SQLiteStatement#bindBlobのヘルパーメソッド。longの配列をbyteの配列に変換して割り付ける * * @param stat * @param index * @param array */ public static void bindBlobLongArray(@NonNull final SQLiteStatement stat, final int index, @NonNull final long[] array) { stat.bindBlob(index, longArrayToByteArray(array, 0, array.length)); }
/** * SQLiteStatement#bindBlobのヘルパーメソッド。Bitmapをbyteの配列に変換して割り付ける * * @param stat * @param index * @param bitmap */ public static void bindBlobBitmap(@NonNull final SQLiteStatement stat, final int index, @NonNull final Bitmap bitmap) { stat.bindBlob(index, BitmapHelper.BitmapToByteArray(bitmap)); }
/** * SQLiteStatement#bindBlobのヘルパーメソッド。doubleの配列をbyteの配列に変換して割り付ける * * @param stat * @param index * @param array */ public static void bindBlobDoubleArray(@NonNull final SQLiteStatement stat, final int index, @NonNull final double[] array) { stat.bindBlob(index, doubleArrayToByteArray(array, 0, array.length)); }