Skip to content

"In" conditions

xcesco edited this page Nov 27, 2020 · 3 revisions

In some case, you need to create a where condition where a field has to be in a set. In SQL code:

SELECT id, name FROM city WHERE id in (:{dummy})

Kripton supports this situation: you can use a list of String or long values as query's parameter. Kripton will do the magic for us. An example

@BindDao(City.class)
public interface DaoCity {
	
  @BindSqlSelect(where="id in (:{dummy})")
  List<City> selectAll2(@BindSqlParam("dummy") List<Long> args);
}

Kripton will translate this annotation in the following SQL:

select * from city where id in (?, ?, ?, ? ... )

The question mark will be generated at runtime considering the number of elements of args list parameter.

See the associated JUnit on here.

Table of Contents

Query definition

Features

Relations

Multithread supports

Modularization

Annotations for data convertion

Annotations for SQLite ORM

Annotations for shared preferences

Clone this wiki locally