0

I am starting to work with SQLite in Qt Creator. I never worked with SQLite before. How can I create a table to store the following data?

int id;
QString fullName;
int age;
QVector<QString> friendsFirstName;
QVector<QString> friendsSurname;

In fact, my doubt is how to store vectors that must be linked to a single record? SQLite provides some vector type?

Thanks in advance

0

Only some basic types.
You can however use the BLOB type to save whatever you want.
Are you going to do the vector processing outside to SQLite?

https://www.sqlite.org/datatype3.html

  • NULL. The value is a NULL value.
  • INTEGER. The value is a signed integer, stored in 1, 2, 3, 4, 6, or 8 bytes depending on the magnitude of the value.
  • REAL. The value is a floating point value, stored as an 8-byte IEEE
    floating point number.
  • TEXT. The value is a text string, stored using the database encoding (UTF-8, UTF-16BE or UTF-16LE).
  • BLOB. The value is a blob of data, stored exactly as it was input.
  • Thanks @Dudu Markovitz. Yes, I will process the vectors outside of SQLite. I will search about the BLOB type, I never used it before. – KelvinS Dec 7 '16 at 18:14
  • Binary Large OBject – David דודו Markovitz Dec 7 '16 at 18:15
  • Great. Then BLOB is independent of the vector data type !? – KelvinS Dec 7 '16 at 18:20
  • Yes. You can use It basically to store everything. – David דודו Markovitz Dec 7 '16 at 18:24
  • Wonderful, it is exactly what I was looking for. Thank you so much. – KelvinS Dec 7 '16 at 18:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.