Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    QSqlModel* - get a domain or type of field

    General and Desktop
    2
    3
    1961
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Hostel last edited by

      QSqlRecord returns a QVariant, and QVariant has a type of column from table. Is there a build-in method which can returns a name of type or name of domain?

      For example - I have a table named FOO with two fields:
      FOO_TEXT - varchar(20);
      FOO_NUMBER - D_NUM_0_20 - this is a domain with check 0 < 20;

      I have to make query to get a type name or domain of fields? Maybe this info I can get from Qt? I want to get the domain names to automate validation.

      1 Reply Last reply Reply Quote 0
      • G
        goetz last edited by

        You're looking for "QSqlRecord::field() ":/doc/qt-4.8/qsqlrecord.html#field and then type(). You will only get the basic type (not the alias type name) and you will not get the constraints besides not null/default value.

        http://www.catb.org/~esr/faqs/smart-questions.html

        1 Reply Last reply Reply Quote 0
        • H
          Hostel last edited by

          I knew about QSqlRecord::field() and method type(), but information of basic type is too basic ;) I will make query to get a domain names. Thanks for reply.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post