[Interest] Finding a data item -- use an existing QSqlTableModel or and independent query?
K. Frank
kfrank29.c at gmail.com
Wed Jun 13 23:56:05 CEST 2012
Hello List!
I am using a QSqlTableModel to display the contents of a database table
in a QTableView. (I am building a lightweight application to edit some
small database tables.)
I now want to determine whether a given data item exists in the table: E.g.,
is the result of
select count(*) from my_table where my_field = 'some_value';
greater than zero?
I can simply run the above query to find out whether the data item exists,
but given that I already have the QSqlTableModel that has already read
the data from the database would it make more sense to "ask" the
QSqlTableModel if the data item exists? If so, how would I go about
doing so?
(And, if not, any suggestions on the cleanest Qt way to run the query
that looks for 'some_value' would be appreciated.)
Thanks.
K. Frank
More information about the Interest
mailing list