Does Room database support boolean variables in entity?

前端 未结 1 1327
慢半拍i
慢半拍i 2021-02-19 05:16

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

1条回答
  •  一整个雨季
    2021-02-19 05:34

    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.

    0 讨论(0)
提交回复
热议问题