Вопрос

Can someone explain to me how arrays work in SQLite?

I've tried: CREATE TABLE foo (bar ARRAY);

Works without errors but: INSERT INTO foo VALUES ([1,2]); doesn't.

Note: The array can have any number of elements, element number is not limited.

Это было полезно?

Решение

SQLite3 does not support arrays directly. Here are all types which are supported in SQLLite -> http://www.sqlite.org/datatype3.html.

To accomplish what you need, you have to use a custom encoding (JSON for example), or use an FK, i.e. create another table, where each item in the array is stored as a row.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top