[Qt-interest] QSqlRecord pqsql & INSERT

Jan janusius at gmx.net
Sat Dec 26 12:48:54 CET 2009


Hi Ross,

you are certainly right. This is just a little test with sqlmodels. 
Therefore I create some temporary tables to test my model with sqlite 
and postgres. I was just confused because in sqlite "nextval()" is 
always correct even if you insert ids in an autoincremented field.

Jan


Ross Driedger schrieb:
> 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.
> 



More information about the Qt-interest-old mailing list