Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QSqlModel* - get a domain or type of field
Forum Updated to NodeBB v4.3 + New Features

QSqlModel* - get a domain or type of field

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 2.1k Views 1 Watching
  • 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 Offline
    H Offline
    Hostel
    wrote on 26 Dec 2011, 18:10 last edited by
    #1

    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
    0
    • G Offline
      G Offline
      goetz
      wrote on 27 Dec 2011, 14:55 last edited by
      #2

      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
      0
      • H Offline
        H Offline
        Hostel
        wrote on 27 Dec 2011, 22:46 last edited by
        #3

        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
        0

        1/3

        26 Dec 2011, 18:10

        • Login

        • Login or register to search.
        1 out of 3
        • First post
          1/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved