Unix Technical Forum

trigger code format changes

This is a discussion on trigger code format changes within the Informix forums, part of the Database Server Software category; --> Why does Informix reformat the trigger code? A sample:- CREATE TRIGGER tflight_req INSERT ON flight_req REFERENCING NEW AS freq ...


Go Back   Unix Technical Forum > Database Server Software > Informix

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-19-2008, 08:35 PM
rkusenet
 
Posts: n/a
Default trigger code format changes

Why does Informix reformat the trigger code?

A sample:-

CREATE TRIGGER tflight_req
INSERT ON flight_req
REFERENCING NEW AS freq
FOR EACH ROW
(
INSERT INTO history
(company,corp_id,user_id,s_date,s_time,newid,city1 ,city2,
city_jaw,date_depart,date_back,airline,airclass,
login_name,corp_name,trip_type)
SELECT id[1,2],id[3,6],id[8,11],TODAY,TO_CHAR(CURRENT,'%H%M%S'),
id,city1,city2,city_jaw,date_depart,
CASE WHEN (date_back = 'N/A' ) THEN
NULL
ELSE date_back END ,
airline ,
airclass,
NVL (u.uname,login_name ),
NVL (b.bname,id[3,6]),
trip_type
FROM flight_req f,outer users u, outer branch b
WHERE id[3,6] = b.bid AND id[3,11] = u.uid
and f.id = freq.id
);


This is the format reported by dbschema:-


create trigger "dba".tflight_req insert on "dba".flight_req referencing
new as freq
for each row
(
insert into "dba".history (company,corp_id,user_id,s_date,
s_time,newid,city1,city2,city_jaw,date_depart,date _back,airline,airclass,
login_name,corp_name,trip_type) select x0.id [1,2] ,x0.id [3,6] ,
x0.id [8,11] ,TODAY ,TO_CHAR (CURRENT year to fraction(3) ,'%H%M%S'
),x0.id ,x0.city1 ,x0.city2 ,x0.city_jaw ,x0.date_depart ,CASE WHEN
(x0.date_back = 'N/A' ) THEN NULL ELSE x0.date_back END ,x0.airline
,x0.airclass ,NVL (x1.uname ,x0.login_name ),NVL (x2.bname ,x0.id
[3,6] ),x0.trip_type from "dba".flight_req x0 ,outer("dba".users x1
) ,outer("dba".branch x2 ) where (((x0.id [3,6] = x2.bid ) AND (x0.id
[3,11] = x1.uid ) ) AND (x0.id = freq.id ) ) );

As can be seen, the SQL query inside the trigger block gets rewritten and from readability
point of view, gets a C rating. This does not happen in Stored procedures.

Why this is a concern? Well we check the code (entire dbschema) into CVS and I fear that everytime
I had to pull the schema out of CVS, I get this crude format. I am finicky about indentations,
and this code just pisses me off.

We use 9.21. So I am not sure how much of it is fixed in later versions.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 06:21 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com