Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 16 total
Thread Trigger
Mon, Mar 5 2007 2:03 PMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Tim

I decided to look to see if I could do something to remove trailing spaces via a trigger. Naturally I have no idea what I'm doing, but even so I think this is your's as a bug.

Look at the attached jpeg and you'll see I'm told _ID is not a column, but it is!

Roy Lambert

ps

I like this as a form of bug reporting. Saves me a lot of explaining, shows you all the info.

pps variableorname would benefit from a few spaces Smiley




Attachments: xx.jpg
Mon, Mar 5 2007 3:10 PMPermanent Link

"Ole Willy Tuv"
Roy,

<< Look at the attached jpeg and you'll see I'm told _ID is not a column,
but it is! >>

It's not a bug. You need to reference columns through the transition
variables NEWROW or OLDROW:

SET NEWROW._ID = RTRIM(NEWROW._ID);

Another problem is that ElevateDB doesn't seem to like spaces in delimited
identifiers. I needed to change "REmove Trailing Spaces" to
"REmove_Trailing_Spaces" to get the trigger definition work. This I believe
is a bug.

Ole Willy Tuv

Mon, Mar 5 2007 3:38 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Ole,

<< Another problem is that ElevateDB doesn't seem to like spaces in
delimited identifiers. I needed to change "REmove Trailing Spaces" to
"REmove_Trailing_Spaces" to get the trigger definition work. This I believe
is a bug. >>

Yep, but it's only an issue with routines, i.e. triggers, jobs, functions,
and stored procedures.  Those do some "reformatting" of the routine for
storage in the catalog and they don't include the name in double quotes like
they should.  A fix will be in 1.01 build 2.

--
Tim Young
Elevate Software
www.elevatesoft.com

Tue, Mar 6 2007 3:57 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Ole


Thanks. I knew I would be missing something, and I'm sure now I know the answer the manual/OLH will tell the same. Always they're right after I know what I'm talking about. I need an "ElevateDB for Dummies" Smiley

Roy Lambert
Tue, Mar 6 2007 8:44 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Ole


I've tried your code, and tried altering it to

SET NEWROW._ID = RTRIM(OLDROW._ID);

with a before update trigger. But in neither case does it do what I want ie remove the trailing spaces from the field. Any ideas?

Roy Lambert
Tue, Mar 6 2007 9:47 AMPermanent Link

"Ole Willy Tuv"
Roy,

<< I've tried your code, and tried altering it to

SET NEWROW._ID = RTRIM(OLDROW._ID);

with a before update trigger. But in neither case does it do what I want ie
remove the trailing spaces from the field. Any ideas? >>

It works here with 1.01 build 1. Is the _ID column defined as VARCHAR ?

Ole Willy Tuv

Tue, Mar 6 2007 10:04 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Ole


Yup. The way I've been testing it is to edit it in EDBMan, post it

1. I should get a PK violation (this is the primary index) and don't

and

2. when I try re-editing it the spaces are still at the end as best as I can tell.

Roy Lambert
Tue, Mar 6 2007 10:21 AMPermanent Link

"Ole Willy Tuv"
Roy,

<< Yup. The way I've been testing it is to edit it in EDBMan, post it

1. I should get a PK violation (this is the primary index) and don't

and

2. when I try re-editing it the spaces are still at the end as best as I can
tell. >>

Well, it works flawlessly here. Are you requesting a sensitive cursor ?

Also, could you try the following SQL statements in EDB Manager and see what
you get:

create table test (col1 char varying(10));

create trigger test_before_update
before update on test
begin
 set newrow.col1 = rtrim(newrow.col1);
end;

insert into test values ('Roy  '); -- length 5

select
 col1,
 length(col1) length_col1 -- length 5
from test;

update test set col1 = col1;

select
 col1,
 length(col1) length_col1 -- length 3
from test

Ole Willy Tuv

Tue, Mar 6 2007 11:34 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Ole


Naturally that works.

Roy Lambert
Tue, Mar 6 2007 12:34 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Roy,

<< with a before update trigger. But in neither case does it do what I want
ie remove the trailing spaces from the field. Any ideas? >>

I tried it yesterday with a before-insert trigger and it worked fine also.
Are you editing from within a table, or via an UPDATE statement ?   I did it
with a table.

--
Tim Young
Elevate Software
www.elevatesoft.com

Page 1 of 2Next Page »
Jump to Page:  1 2
Image