Subject | Re: [ib-support] Firebird RC1 |
---|---|
Author | Claudio Valderrama C. |
Post date | 2001-11-30T05:09:49Z |
""Ivan Prenosil"" <prenosil@...> wrote in message
news:20011129160941.71DCE1508D@......
landscape?
:-) :-) :-)
Seriously speaking, it seems that nobody else took time to summarize the
alternatives like you. But there's another: a non updatable view based on
another view based on another table. If the intermediate view needs to be
non-updatable is a thing you could verify, because I've tried so many things
in latest days that I barely remember where I started testing.
Here's a script transcript, hope you get the full idea. The center of the
hell is the zero. Easy to define better functionality than this in paper;
hard to implement.
SQL> set count;
SQL> create table tab(a int);
SQL> insert into tab values(0);
Records affected: 1
SQL> set term ^;
SQL> create trigger tab_tr for tab before insert as begin new.a=new.a; end^
SQL> set term ;^
SQL> insert into tab values(0);
Records affected: 1
SQL> create view v_upd as select a from tab;
SQL> insert into v_upd values(0);
Records affected: 1
SQL> set term ^;
SQL> create trigger v_upd_tr for v_upd before insert as begin new.a=new.a;
end^
SQL> set term ;^
SQL> insert into v_upd values(0);
Records affected: 1
===> the following line is just to make sure:
SQL> commit;
SQL> insert into v_upd values(0);
Records affected: 1
SQL> create view v2 as select a from v_upd;
SQL> insert into v2 values(0);
Records affected: 1
SQL> create view vnup(x,y) as select r.a,s.a from tab r join tab s on 1=1;
SQL> insert into vnup values(0);
Statement failed, SQLCODE = -804
Dynamic SQL Error
-SQL error code = -804
-Count of read-write columns does not equal count of values
=> this error message shown above is a change WRT what IB says.
SQL> insert into vnup values(0,0);
Statement failed, SQLCODE = -150
cannot update read-only view VNUP
SQL> set term ^;
SQL> create trigger vnup_tr for vnup before insert as begin new.x=new.y;
end^
SQL> set term ;^
SQL> insert into vnup values(0,0);
Records affected: 0 ===> guaranteed hell
SQL>
C. (I don't have answers. <g>)
--
Claudio Valderrama C. - http://www.cvalde.com - http://www.firebirdSql.org
Independent developer
Owner of the Interbase® WebRing
news:20011129160941.71DCE1508D@......
> Finally (perhaps) I got it. The description of problem few messages agowas not complete.
>Can you afford a joke, right? How many months did you need to figure out the
> So, when inserting into
> Table,
> Table with Triggers,
> Non Updatable View with Triggers
> I get "Records affected:1"
>
> Only when inserting into
> Updatable View with Triggers
> I get "Records affected:3"
landscape?
:-) :-) :-)
Seriously speaking, it seems that nobody else took time to summarize the
alternatives like you. But there's another: a non updatable view based on
another view based on another table. If the intermediate view needs to be
non-updatable is a thing you could verify, because I've tried so many things
in latest days that I barely remember where I started testing.
> Now tell me what results I get with RC1 (still had no time todownload/install it).
Here's a script transcript, hope you get the full idea. The center of the
hell is the zero. Easy to define better functionality than this in paper;
hard to implement.
SQL> set count;
SQL> create table tab(a int);
SQL> insert into tab values(0);
Records affected: 1
SQL> set term ^;
SQL> create trigger tab_tr for tab before insert as begin new.a=new.a; end^
SQL> set term ;^
SQL> insert into tab values(0);
Records affected: 1
SQL> create view v_upd as select a from tab;
SQL> insert into v_upd values(0);
Records affected: 1
SQL> set term ^;
SQL> create trigger v_upd_tr for v_upd before insert as begin new.a=new.a;
end^
SQL> set term ;^
SQL> insert into v_upd values(0);
Records affected: 1
===> the following line is just to make sure:
SQL> commit;
SQL> insert into v_upd values(0);
Records affected: 1
SQL> create view v2 as select a from v_upd;
SQL> insert into v2 values(0);
Records affected: 1
SQL> create view vnup(x,y) as select r.a,s.a from tab r join tab s on 1=1;
SQL> insert into vnup values(0);
Statement failed, SQLCODE = -804
Dynamic SQL Error
-SQL error code = -804
-Count of read-write columns does not equal count of values
=> this error message shown above is a change WRT what IB says.
SQL> insert into vnup values(0,0);
Statement failed, SQLCODE = -150
cannot update read-only view VNUP
SQL> set term ^;
SQL> create trigger vnup_tr for vnup before insert as begin new.x=new.y;
end^
SQL> set term ;^
SQL> insert into vnup values(0,0);
Records affected: 0 ===> guaranteed hell
SQL>
C. (I don't have answers. <g>)
--
Claudio Valderrama C. - http://www.cvalde.com - http://www.firebirdSql.org
Independent developer
Owner of the Interbase® WebRing