@Override public void bindDouble(int index, double value) { delegate.bindDouble(index, value); }
private void insertTestData() { String sql = "insert into producttable (name, description, price, stock_available) values (?, ?, ?, ?);"; dbHandler.getWritableDatabase(); database.beginTransaction(); SQLiteStatement stmt = database.compileStatement(sql); for (int i = 0; i < NUMBER_OF_ROWS; i++) { //generate some values stmt.bindString(1, randomName); stmt.bindString(2, randomDescription); stmt.bindDouble(3, randomPrice); stmt.bindLong(4, randomNumber); long entryID = stmt.executeInsert(); stmt.clearBindings(); } database.setTransactionSuccessful(); database.endTransaction(); dbHandler.close(); }
@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 public void bindDouble(int index, double value) { statement.bindDouble(index, value); }
private void bindArgsToStatement(SQLiteStatement myStatement, ReadableArray sqlArgs) { for (int i = 0; i < sqlArgs.size(); i++) { ReadableType type = sqlArgs.getType(i); if (type == ReadableType.Number){ double tmp = sqlArgs.getDouble(i); if (tmp == (long) tmp) { myStatement.bindLong(i + 1, (long) tmp); } else { myStatement.bindDouble(i + 1, tmp); } } else if (sqlArgs.isNull(i)) { myStatement.bindNull(i + 1); } else { myStatement.bindString(i + 1, SQLitePluginConverter.getString(sqlArgs,i,"")); } } }
private void bindArgsToStatement(SQLiteStatement myStatement, ReadableArray sqlArgs) { if (sqlArgs == null) return; for (int i = 0; i < sqlArgs.size(); i++) { ReadableType type = sqlArgs.getType(i); if (type == ReadableType.Number) { double tmp = sqlArgs.getDouble(i); if (tmp == (long) tmp) { myStatement.bindLong(i + 1, (long) tmp); } else { myStatement.bindDouble(i + 1, tmp); } } else if (sqlArgs.isNull(i)) { myStatement.bindNull(i + 1); } else { myStatement.bindString(i + 1, sqlArgs.getString(i)); } } }
stmt.bindDouble(7, simpleFloat); stmt.bindDouble(8, simpleDouble);
stmt.bindString(8, uploader); stmt.bindDouble(9, entity.getRating());
stmt.bindString(8, uploader); stmt.bindDouble(9, entity.getRating());
stmt.bindString(8, uploader); stmt.bindDouble(9, entity.getRating());
stmt.bindString(8, uploader); stmt.bindDouble(9, entity.getRating());
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 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(); }
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(); }
@Override public void bindDouble(int index, double value) { statement.bindDouble(index, value); }
@Override protected long executeInsert(Quest quest, boolean replace) { String orWhat = replace ? "REPLACE" : "IGNORE"; SQLiteDatabase db = dbHelper.getWritableDatabase(); SQLiteStatement insert = db.compileStatement( "INSERT OR "+orWhat+" INTO " + TABLE_NAME + "("+ID_COL+","+QS_COL+","+LAT_COL+","+LON_COL+","+LAST_UPDATE_COL+ ") VALUES (?,?,?,?,?)"); insert.bindLong(1, quest.getId()); insert.bindString(2, quest.getStatus().name()); insert.bindDouble(3, quest.getCenter().getLatitude()); insert.bindDouble(4, quest.getCenter().getLongitude()); insert.bindDouble(5, quest.getLastUpdate().getTime()); return insert.executeInsert(); }
/** * Adds a value to the set. * * @param value the data for the value to put */ public void put(Float value) { if (value == null) { this.compiledStatement.bindNull(compiledStatementBindIndex++); } else { compiledStatement.bindDouble(compiledStatementBindIndex++, (float) value); } }
/** * Adds a value to the set. * * @param value the data for the value to put */ public void put(Double value) { if (value == null) { this.compiledStatement.bindNull(compiledStatementBindIndex++); } else { this.compiledStatement.bindDouble(compiledStatementBindIndex++, value); } }
/** * Adds a value to the set. * * @param value the data for the value to put */ public void put(Double value) { if (value == null) { this.compiledStatement.bindNull(compiledStatementBindIndex++); } else { this.compiledStatement.bindDouble(compiledStatementBindIndex++, value); } }
/** * Adds a value to the set. * * @param value the data for the value to put */ public void put(Float value) { if (value == null) { this.compiledStatement.bindNull(compiledStatementBindIndex++); } else { compiledStatement.bindDouble(compiledStatementBindIndex++, (float) value); } }