Dear my friends...
I am developing a database application with postgres
7.2.x, qt on SuSE 9.1 . I am in a situation where I
have to use QDataTable and I have to use QSqlCursor
that support only 1 table manipulation ( QSqlCursor *
cursor = QSqlCursor("vie wpatrix", true, db); ).
So, as a strategy I make a view. with this view I hope
I can work with more than 1 table at a time.
kv=# create view viewpatrix as select customer.custid ,
customerdescrip tion.descr
iption, customer.firstn ame,
customer.lastna me from customer, customerdescrip tion
where
customer.custid =customerdescri ption.custid;
but I have problems if I want to make data update and
data insertion from the QDataTable because I don't
know how the rule should be.
kv=# create rule viewpatrixcustd esc as on update to
viewpatrix do instead update customerdescrip tion set
description=new .description where custid=old.cust id;
CREATE RULE
kv=#
OK, it works if the user wants to update the data in
table "customerdescri ption".
should I simply create another rule like this:
kv=# create rule viewpatrixcust as on update to
viewpatrix do instead update customer set
firstname=new.f irstname, lastname=new.la stname where
custid=old.cust id;
CREATE RULE
kv=#
But how to make that the user can I also update the
data in the table "customer" (customer.first name and
customer.lastna me).
Is it possible to create one view but from
updating/inserting the data in the coresponded rule
than the records in more then 2 tables are also
updated/inserted?
Thank you very much for your help.
_______________ _______________ ____
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match