[Qt-interest] QSqlRecord population error checking
Israel Brewster
israel at frontierflying.com
Fri Dec 11 18:10:30 CET 2009
On Dec 10, 2009, at 2:20 PM, Robert Hairgrove wrote:
> Israel Brewster wrote:
>> What is the best way to do error checking when populating a
>> QSqlRecord
>> with data? Or, a slightly different question that might solve the
>> first,
>> what is the best way to add and populate a new row on a
>> QSqlTableModel?
>> [snip]
>> At the moment what I am doing is
>> after each setValue call, I do an inverse value call and make sure
>> the
>> return is what I just set. This seems rather kludgy, however. Is
>> there a
>> better way?
>
> There is definitely a "better way", but it involves a rethink on the
> database side of things. The danger that "someone" will change a
> column
> name, or a constraint such as changing a column allowing NULLs to NOT
> NULL, is very real and can cause major headaches on the application
> side
> of things.
>
> The best (and only) solution that I know of is to grant ordinary users
> (i.e. non-DBA users) only SELECT and EXECUTE permissions on the
> database
> and do any DML (i.e. updates, inserts and deletes) through stored
> procedures.
Agreed. Unfortunately as my application gets distributed to the
general public, I'll obviously have no way of knowing or controlling
things like what permissions ordinary users have, so I have to be
prepared for as much as I can.
> If the database back-end doesn't support permissions or
> stored procedures (i.e. SQLite or MS-Access) then a lot of work has to
> be done on the application side to ensure database consistency.
>
> What is/are your supported back-end RDBMS?
SQLite for local installs, PostgreSQL or MySQL for larger installs.
Thankfully Qt makes the distinction mostly transparent. On the
downside, that also means that I am stuck with a back-end that doesn't
support stored procedures or permissions, so I have to program for it.
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
-----------------------------------------------
Israel Brewster
Computer Support Technician II
Frontier Flying Service Inc.
5245 Airport Industrial Rd
Fairbanks, AK 99709
(907) 450-7250 x293
-----------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Israel Brewster.vcf
Type: text/directory
Size: 417 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091211/67e56c3f/attachment.bin
-------------- next part --------------
More information about the Qt-interest-old
mailing list