سؤال

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