Mailinglist Archive: opensuse-programming (84 mails)
| < Previous | Next > |
Re: [suse-programming-e] one view for 2 different tables
- From: Jan.Trippler@xxxxxxxxxxx (Jan Trippler)
- Date: Tue, 3 Aug 2004 01:58:57 +0200
- Message-id: <200408030158.57808.Jan.Trippler@xxxxxxxxxxx>
Am Montag, 2. August 2004 19:30 schrieb Prabu Subroto:
> 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("viewpatrix", 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.
[...]
> 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?
http://www.postgresql.org/docs/7.2/interactive/sql-createrule.html
[...]
CREATE RULE name AS ON event
TO object [ WHERE condition ]
DO [ INSTEAD ] action
where action can be:
NOTHING
|
query
|
( query ; query ... )
|
[ query ; query ... ]
[...]
So you can add several insert or update statements using () or [] to
group them.
Jan
--
Linux-Quickies: http://www.jan-trippler.de
PingoS: http://www.pingos.org
> 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("viewpatrix", 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.
[...]
> 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?
http://www.postgresql.org/docs/7.2/interactive/sql-createrule.html
[...]
CREATE RULE name AS ON event
TO object [ WHERE condition ]
DO [ INSTEAD ] action
where action can be:
NOTHING
|
query
|
( query ; query ... )
|
[ query ; query ... ]
[...]
So you can add several insert or update statements using () or [] to
group them.
Jan
--
Linux-Quickies: http://www.jan-trippler.de
PingoS: http://www.pingos.org
| < Previous | Next > |