[Qt-interest] QSqlRecord pqsql & INSERT

Ross Driedger ross at earz.ca
Fri Dec 25 18:12:59 CET 2009


On Fri, 25 Dec 2009 06:00:01 -0500, <qt-interest-request at trolltech.com>  
wrote:

Merry Christams, All.

Hi Jan,

> The problem was that postgres does not increment the sequence
> (nextval()) if I manually insert id values (I need to manually populate
> other tables with foreign keys).

I've run into this issue before and I don't really see this as a Qt issue,  
but as a design problerm.  I think it is not good design to have the db  
schema exposed in the client app like this, in case the relational algebra  
needs to be reworked and the tables change.  When has that not happened?

The solution which I've used is to define the client/db interface and  
implement the actual SQL calls inside stored procedures; that way the  
changes only require adjustments on the database (usually).  There are  
security benefits to this, as well.  The downside with pgsql is the stored  
procedure language is a bit odd -- even more than Oracle's.

-- 
"When words leave off, music begins. "
Heinrich Heine

Ross Driedger
ross_at_earz.ca



More information about the Qt-interest-old mailing list