"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.
- Introduction
- Goals & Features
- Kotlin
- Immutable or Mutable Pojo
- Annotation Processor Args
- Credits
- Articles
- Benchmarks
- Setup
- Tutorial
- Usage
- Dependencies and inspirations
- Stackoverflow
- Documentation
- SQL logging
- Data source options
- Indices
- SQL Type adapter
- Global SQL Type adapter
- Constraints
- Live data: welcome Architectural components!!
- Paged Live data
- Dynamic parts
- Transactional and batch operations
- Async Transactional and batch operations
- Global transaction
- Support for immutable POJO
- Generate Content provider
- Generate Database schema generation
- Database migration
- BindSqlColumn
- BindContentProvider
- BindContentProviderEntry
- BindContentProviderPath
- BindDao
- BindDaoMany2Many
- BindDataSource
- BindDataSourceOptions
- BindDataSourceUpdateTask
- BindIndex
- BindSqlRelation
- BindSqlAdapter
- BindSqlChildSelect
- BindSqlDelete
- BindSqlDynamicOrderBy
- BindSqlDynamicWhere
- BindSqlDynamicWhereParams
- BindSqlInsert
- BindSqlPageSize
- BindSqlParam
- BindSqlSelect
- BindSqlUpdate
- BindSqlType
- BindSqlTransaction