コード例 #1
0
  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();
  }
コード例 #2
0
  @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());
  }
コード例 #3
0
ファイル: Queen.java プロジェクト: onehilltech/DBFlow
 @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;
 }
コード例 #4
0
  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);
    }
  }
コード例 #5
0
 @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());
 }
コード例 #6
0
ファイル: CipherTest.java プロジェクト: onehilltech/DBFlow
  @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);
  }
コード例 #7
0
ファイル: RoundFragment.java プロジェクト: daweber/brackets
  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();
  }
コード例 #8
0
 public ElementDeCarte getElementDeCarteParId(Integer id) {
   return SQLite.select()
       .from(ElementDeCarte.class)
       .where(ElementDeCarte_Table.element_id.eq(id))
       .querySingle();
 }
コード例 #9
0
 public List<? extends ElementDeCarte> getElementDeCarteDansZone(Polygon zone) {
   return SQLite.select().from(ElementDeCarte.class).queryList();
 }