QSqlModel* - get a domain or type of field



  • 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.



  • 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.



  • 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.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.