[odb-users] How to create an index for 'value' field in the relation table

علی دانش adanesh at noornet.net
Wed Jun 29 08:55:40 EDT 2016


Hi Boris!

How to create an index for 'value' field in the relation table?

e.g.:

#pragma db object pointer(std::shared_ptr) session
class SubjectIndex
{
public:
#pragma db id auto
   int m_id;
   QString m_subject;
#pragma db unordered
   QList<odb::lazy_shared_ptr<TagIndex>> m_tags;
};

#pragma db object pointer(std::shared_ptr) session
class TagIndex
{
public:
#pragma db id auto
   int m_id;
   QString m_tag;
};

An index for 'object_id' is already created automatically.
          db.execute ("CREATE INDEX \"SubjectIndex_tags_object_id_i\"\n"
                      "  ON \"SubjectIndex_tags\" (\"object_id\")");
But I need an index for 'value' field. How can I create that?

Thanks,
Ali



More information about the odb-users mailing list