Firebird SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesFirebird SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 4th, 2006, 04:59 AM
DelphiPen DelphiPen is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2006
Posts: 6 DelphiPen User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 50 m 12 sec
Reputation Power: 0
Triggers for autoinc ID in Firebird

Hi all,
Excuse my English...
I'm working with Database Workbench (= DBW) on my Firebird for 9 month with great pleasure.
But now when I'm going to put the autoinc IDs on my tables I get problems.
I can put a trigger on my table and view it nicely in DBW as trigger on the table, but next time I refresh/connect the trigger has gone and the depending object on the generator is marked as a check symbol and if I try to create the trigger again I'm told it's existing.
I've already made this kind of trigger successfully on 12 tables with no problems.

create table CHECKELPOLSTAFF (
ID Integer NOT NULL,
StaffID Integer,
Dato Date,
Tid Time,
WhereWas varchar(20),
BreakTime Time,
CONSTRAINT PK_CHECKELPOLSTAFF PRIMARY KEY (ID)
);

CREATE
INDEX inxStaffID_CHECKELPOLSTAFF ON CHECKELPOLSTAFF (StaffID, Dato, Tid, WhereWas);

CREATE GENERATOR CHECKELPOLSTAFF_GEN;
SET TERM ^^ ;
CREATE TRIGGER CHECKELPOLSTAFF_ID FOR CHECKELPOLSTAFF ACTIVE BEFORE INSERT POSITION 0 AS
begin
if ( (new.ID is null) or (new.ID = 0) )
then new.ID = gen_id(CHECKELPOLSTAFF_GEN, 1);
end
^^
SET TERM ; ^^

Thanks
Pia

Reply With Quote
  #2  
Old October 4th, 2006, 05:06 AM
pabloj's Avatar
pabloj pabloj is offline
Modding: Oracle MsSQL Firebird
Dev Shed God 6th Plane (7500 - 7999 posts)
 
Join Date: Jun 2001
Location: Outside US
Posts: 7,808 pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 2 Months 3 Weeks 21 h 29 m 33 sec
Reputation Power: 278
Note that there is a specific Firebird forum, please move your question there

Reply With Quote
  #3  
Old October 4th, 2006, 05:12 AM
DelphiPen DelphiPen is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2006
Posts: 6 DelphiPen User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 50 m 12 sec
Reputation Power: 0
Thumbs up

Quote:
Originally Posted by pabloj
Note that there is a specific Firebird forum, please move your question there


Soory, I didn't know. I'll look for the Firebird forum.
Maybee you can tell me a quick way to move my question there ????

Thanks
Pia

Reply With Quote
  #4  
Old October 6th, 2006, 01:12 AM
upscene upscene is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 223 upscene User rank is Corporal (100 - 500 Reputation Level)upscene User rank is Corporal (100 - 500 Reputation Level)upscene User rank is Corporal (100 - 500 Reputation Level)upscene User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 7 h 14 m 50 sec
Reputation Power: 8
It's a bug in Database Workbench. It sounds pretty stupid actually -- it's the name of your trigger that confuses it. Check constraints automatically create triggers, but these triggers will show up as a check constraint in Database Workbench. These will be named CHECK_ something and that is why GUI tools filter on them.

I've created a bugreport here:
http://tracker.upscene.com/view.php?id=686


Thanks.

--
Martijn Tonies
Upscene Productions
www.upscene.com

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesFirebird SQL Development > Triggers for autoinc ID in Firebird


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway