Does Room database support boolean variables in entity?

隐身守侯 提交于 2020-06-25 00:10:22

问题


I know that sqlite does not support Boolean and we need to use int columns to mimic the behavior of Boolean . But does Room support Boolean ? What if have a Boolean in my entity ? Will it work as expected?


回答1:


Yes it does. When you store boolean using room, it automatically stores 1 for true and 0 for false.

And same case while reading. It converts 1 or 0 to true/ false respectively.



来源:https://stackoverflow.com/questions/51130777/does-room-database-support-boolean-variables-in-entity

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!