public Map<String, PointTag> getTagsDeclare() { List<PointTag> listeTagDansLaBase = SQLite.select().from(PointTag.class).queryList(); ImmutableMap.Builder<String, PointTag> listeTagIndexee = ImmutableMap.builder(); for (PointTag t : listeTagDansLaBase) { listeTagIndexee.put(t.nomTag, t); } return listeTagIndexee.build(); }
@Test public void test_delete() { long time = System.currentTimeMillis(); Where<TestModel2> delete = SQLite.delete(TestModel2.class) .where(TestModel2_Table.model_order.plus(PropertyFactory.from(5)).lessThan((int) time)); assertEquals( "DELETE FROM `TestModel2` WHERE `model_order` + 5<" + (int) time, delete.getQuery().trim()); }
@OneToMany( methods = {OneToMany.Method.ALL}, variableName = "ants", isVariablePrivate = true) public List<Ant> getMyAnts() { if (ants == null || ants.isEmpty()) { ants = SQLite.select() .from(Ant.class) .where(Ant_Table.queenForeignKeyContainer_id.eq(id)) .queryList(); } return ants; }
public Uri getPhotoURLForMarkerId(Integer markerId) { try { Image imageAssociee = SQLite.select() .from(Image.class) .as("Image") .crossJoin(ElementDeCarte.class) .as("ElementDeCarte") .on( ElementDeCarte_Table.ref_image_id.eq(Image_Table.image_id), ElementDeCarte_Table.element_id.eq(markerId)) .querySingle(); return Uri.fromFile(new File(imageAssociee.imageURL)); } catch (Exception e) { throw new RuntimeException(e); } }
@Test public void test_queryProperty() { Property<TestModel1> model1Property = PropertyFactory.from( SQLite.select().from(TestModel1.class).where(TestModel1_Table.name.eq("Test"))) .as("Cool"); assertEquals( "(SELECT * FROM `TestModel1` WHERE `name`='Test') AS `Cool`", model1Property.getDefinition()); QueryBuilder queryBuilder = new QueryBuilder(); model1Property .minus(ConditionModel_Table.fraction) .plus(TestModel1_Table.name.withTable()) .like("%somethingnotvalid%") .appendConditionToQuery(queryBuilder); assertEquals( "(SELECT * FROM `TestModel1` WHERE `name`='Test') - `fraction` + `TestModel1`.`name` LIKE '%somethingnotvalid%'", queryBuilder.getQuery().trim()); }
@Test public void testCipherModel() { Delete.table(CipherModel.class); CipherModel model = new CipherModel(); model.name = "name"; model.save(); assertTrue(model.exists()); CipherModel retrieval = SQLite.select() .from(CipherModel.class) .where(CipherModel_Table.name.eq("name")) .querySingle(); assertTrue(retrieval.id == model.id); Delete.table(CipherModel.class); }
private List<PicksetGames> getRoundGameList(int round) { return SQLite.select( Game_Table.gameId, Game_Table.bracketRound, Game_Table.bracketRegion, Game_Table.gameOver, Game_Table.teamOne, Game_Table.teamOneScore, Game_Table.teamTwo, Game_Table.teamTwoScore, Game_Table.gameDetails, Pick_Table.pickedWinner) .from(Game.class) .innerJoin(Pick.class) .on(Game_Table.gameId.withTable().eq(Pick_Table.gameId.withTable())) .where(Pick_Table.picksetId.eq(mActivity.getcPickset())) .queryCustomList(PicksetGames.class); // return SQLite // .select() // .from(Game.class) // .where(Game_Table.bracketRound.eq(round)) // .and(Game_Table.bracketId.eq(mActivity.getcBracket())).queryList(); }
public ElementDeCarte getElementDeCarteParId(Integer id) { return SQLite.select() .from(ElementDeCarte.class) .where(ElementDeCarte_Table.element_id.eq(id)) .querySingle(); }
public List<? extends ElementDeCarte> getElementDeCarteDansZone(Polygon zone) { return SQLite.select().from(ElementDeCarte.class).queryList(); }