KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > iapi > sql > dictionary > TriggerDescriptor


1 /*
2
3    Derby - Class org.apache.derby.iapi.sql.dictionary.TriggerDescriptor
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to you under the Apache License, Version 2.0
9    (the "License"); you may not use this file except in compliance with
10    the License. You may obtain a copy of the License at
11
12       http://www.apache.org/licenses/LICENSE-2.0
13
14    Unless required by applicable law or agreed to in writing, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19
20  */

21
22 package org.apache.derby.iapi.sql.dictionary;
23
24 import org.apache.derby.iapi.services.io.Formatable;
25 import org.apache.derby.iapi.sql.depend.Dependent;
26 import org.apache.derby.iapi.sql.depend.Provider;
27 import org.apache.derby.iapi.error.StandardException;
28 import org.apache.derby.catalog.UUID;
29 import java.sql.Timestamp JavaDoc;
30
31 import org.apache.derby.iapi.reference.SQLState;
32 import org.apache.derby.iapi.services.sanity.SanityManager;
33 import org.apache.derby.iapi.sql.StatementType;
34 import org.apache.derby.catalog.DependableFinder;
35 import org.apache.derby.catalog.Dependable;
36 import org.apache.derby.iapi.services.io.StoredFormatIds;
37 import org.apache.derby.iapi.sql.depend.DependencyManager;
38 import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;
39 import org.apache.derby.iapi.services.context.ContextService;
40
41 import org.apache.derby.impl.sql.execute.DropTriggerConstantAction;
42
43 import java.io.ObjectOutput JavaDoc;
44 import java.io.ObjectInput JavaDoc;
45 import java.io.IOException JavaDoc;
46
47 /**
48  * A trigger.
49  * <p>
50  * We are dependent on TableDescriptors, SPSDescriptors (for our
51  * WHEN clause and our action). Note that we don't strictly
52  * need to be dependent on out SPSes because we could just disallow
53  * anyone from dropping an sps of type 'T', but to keep dependencies
54  * uniform, we'll do be dependent.
55  * <p>
56  * We are a provider for DML (PreparedStatements or SPSes)
57  *
58  * The public methods for this class are:
59  *
60  * <ol>
61  * <li>getUUID
62  * <li>getName
63  * <li>getSchemaDescriptor
64  * <li> public boolean listensForEvent(int event);
65  * <li> public int getTriggerEventMask();
66  * <li> public Timestamp getCreationTimestamp();
67  * <li> public boolean isBeforeTrigger();
68  * <li> public boolean isRowTrigger();
69  * <li> public UUID getActionId();
70  * <li> public SPSDescriptor getActionSPS();
71  * <li> public UUID getWhenClauseId();
72  * <li> public SPSDescriptor getWhenClauseSPS()
73  * <li> public TableDescriptor getTableDescriptor()
74  * <li> public ReferencedColumns getReferencedColumnsDescriptor()
75  * <li> public int[] getReferencedCols();
76  * <li> public boolean isEnabled();
77  * <li> public void setEnabled();
78  * <li> public void setDisabled();
79  * <li> public boolean needsToFire(int stmtType, int[] modifiedCols)
80  * <li> public String getTriggerDefinition();
81  * <li> public boolean getReferencingOld();
82  * <li> public boolean getReferencingNew();
83  * <li> public String getOldReferencingName();
84  * <li> public String getNewReferencingName();
85  * </ol>
86  * @author Jamie
87  */

88 public class TriggerDescriptor extends TupleDescriptor
89     implements UniqueSQLObjectDescriptor, Provider, Dependent, Formatable
90 {
91     // field that we want users to be able to know about
92
public static final int SYSTRIGGERS_STATE_FIELD = 8;
93
94     public static final int TRIGGER_EVENT_UPDATE = 1;
95     public static final int TRIGGER_EVENT_DELETE = 2;
96     public static final int TRIGGER_EVENT_INSERT = 4;
97
98     
99     private UUID id;
100     private String JavaDoc name;
101     private String JavaDoc oldReferencingName;
102     private String JavaDoc newReferencingName;
103     private String JavaDoc triggerDefinition;
104     private SchemaDescriptor sd;
105     private int eventMask;
106     private boolean isBefore;
107     private boolean isRow;
108     private boolean referencingOld;
109     private boolean referencingNew;
110     private TableDescriptor td;
111     private UUID actionSPSId;
112     private SPSDescriptor actionSPS;
113     private UUID whenSPSId;
114     private SPSDescriptor whenSPS;
115     private boolean isEnabled;
116     private int[] referencedCols;
117     private Timestamp JavaDoc creationTimestamp;
118     private UUID triggerSchemaId;
119     private UUID triggerTableId;
120
121
122     /**
123      * Niladic constructor, for formatable
124      */

125     public TriggerDescriptor() {}
126
127     /**
128      * Constructor. Used when creating a trigger from SYS.SYSTRIGGERS
129      *
130      * @param dataDictionary the data dictionary
131      * @param sd the schema descriptor for this trigger
132      * @param id the trigger id
133      * @param name the trigger name
134      * @param eventMask TriggerDescriptor.TRIGGER_EVENT_XXXX
135      * @param isBefore is this a before (as opposed to after) trigger
136      * @param isRow is this a row trigger or statement trigger
137      * @param isEnabled is this trigger enabled or disabled
138      * @param td the table upon which this trigger is defined
139      * @param whenSPSId the sps id for the when clause (may be null)
140      * @param actionSPSId the spsid for the trigger action (may be null)
141      * @param creationTimestamp when was this trigger created?
142      * @param referencedCols what columns does this trigger reference (may be null)
143      * @param triggerDefinition The original user text of the trigger action
144      * @param referencingOld whether or not OLD appears in REFERENCING clause
145      * @param referencingNew whether or not NEW appears in REFERENCING clause
146      * @param oldReferencingName old referencing table name, if any, that appears in REFERCING clause
147      * @param newReferencingName new referencing table name, if any, that appears in REFERCING clause
148      */

149     public TriggerDescriptor
150     (
151         DataDictionary dataDictionary,
152         SchemaDescriptor sd,
153         UUID id,
154         String JavaDoc name,
155         int eventMask,
156         boolean isBefore,
157         boolean isRow,
158         boolean isEnabled,
159         TableDescriptor td,
160         UUID whenSPSId,
161         UUID actionSPSId,
162         Timestamp JavaDoc creationTimestamp,
163         int[] referencedCols,
164         String JavaDoc triggerDefinition,
165         boolean referencingOld,
166         boolean referencingNew,
167         String JavaDoc oldReferencingName,
168         String JavaDoc newReferencingName
169     )
170     {
171         super(dataDictionary);
172         this.id = id;
173         this.sd = sd;
174         this.name = name;
175         this.eventMask = eventMask;
176         this.isBefore = isBefore;
177         this.isRow = isRow;
178         this.td = td;
179         this.actionSPSId = actionSPSId;
180         this.whenSPSId = whenSPSId;
181         this.isEnabled = isEnabled;
182         this.referencedCols = referencedCols;
183         this.creationTimestamp = creationTimestamp;
184         this.triggerDefinition = triggerDefinition;
185         this.referencingOld = referencingOld;
186         this.referencingNew = referencingNew;
187         this.oldReferencingName = oldReferencingName;
188         this.newReferencingName = newReferencingName;
189         triggerSchemaId = sd.getUUID();
190         triggerTableId = td.getUUID();
191     }
192         
193         
194     /**
195      * Get the trigger UUID
196      *
197      * @return the id
198      */

199     public UUID getUUID()
200     {
201         return id;
202     }
203
204     /**
205      * Get the trigger name
206      *
207      * @return the name
208      */

209     public String JavaDoc getName()
210     {
211         return name;
212     }
213
214     public UUID getTableId() {
215         return triggerTableId;
216     }
217
218     /**
219      * Get the triggers schema descriptor
220      *
221      * @return the schema descriptor
222      *
223      * @exception StandardException on error
224      */

225      public SchemaDescriptor getSchemaDescriptor()
226          throws StandardException
227     {
228         if (sd == null)
229         {
230             sd = getDataDictionary().getSchemaDescriptor(triggerSchemaId, null);
231         }
232         return sd;
233     }
234
235     /**
236      * Indicate whether this trigger listens for this
237      * type of event.
238      *
239      * @param event TRIGGER_EVENT_XXXX
240      *
241      * @return true if it listens to the specified event.
242      */

243     public boolean listensForEvent(int event)
244     {
245         return (event & eventMask) == event;
246     }
247
248
249     /**
250      * Get the trigger event mask. Currently, a trigger
251      * may only listen for a single event, though it may
252      * OR multiple events in the future.
253      *
254      * @return the trigger event mask
255      */

256     public int getTriggerEventMask()
257     {
258         return eventMask;
259     }
260
261     /**
262      * Get the time that this trigger was created.
263      *
264      * @return the time the trigger was created
265      */

266     public Timestamp JavaDoc getCreationTimestamp()
267     {
268         return creationTimestamp;
269     }
270
271     /**
272      * Is this a before trigger
273      *
274      * @return true if it is a before trigger
275      */

276     public boolean isBeforeTrigger()
277     {
278         return isBefore;
279     }
280
281     /**
282      * Is this a row trigger
283      *
284      * @return true if it is a before trigger
285      */

286     public boolean isRowTrigger()
287     {
288         return isRow;
289     }
290
291
292     /**
293      * Get the trigger action sps UUID
294      *
295      * @return the uuid of the sps action
296      */

297     public UUID getActionId()
298     {
299         return actionSPSId;
300     }
301
302     /**
303      * Get the trigger action sps
304      *
305      * @return the trigger action sps
306      *
307      * @exception StandardException on error
308      */

309     public SPSDescriptor getActionSPS(LanguageConnectionContext lcc)
310         throws StandardException
311     {
312         if (actionSPS == null)
313         {
314             //bug 4821 - do the sysstatement look up in a nested readonly
315
//transaction rather than in the user transaction. Because of
316
//this, the nested compile transaction which is attempting to
317
//compile the trigger will not run into any locking issues with
318
//the user transaction for sysstatements.
319
lcc.beginNestedTransaction(true);
320             actionSPS = getDataDictionary().getSPSDescriptor(actionSPSId);
321             lcc.commitNestedTransaction();
322         }
323         return actionSPS;
324     }
325
326     /**
327      * Get the trigger when clause sps UUID
328      *
329      * @return the uuid of the sps action
330      */

331     public UUID getWhenClauseId()
332     {
333         return whenSPSId;
334     }
335
336     /**
337      * Get the trigger when clause sps
338      *
339      * @return the sps of the when clause
340      *
341      * @exception StandardException on error
342      */

343     public SPSDescriptor getWhenClauseSPS()
344         throws StandardException
345     {
346         if (whenSPS == null)
347         {
348             whenSPS = getDataDictionary().getSPSDescriptor(whenSPSId);
349         }
350         return whenSPS;
351     }
352
353     /**
354      * Get the trigger table descriptor
355      *
356      * @return the table descripor upon which this trigger
357      * is declared
358      *
359      * @exception StandardException on error
360      */

361     public TableDescriptor getTableDescriptor()
362         throws StandardException
363     {
364         if (td == null)
365         {
366             td = getDataDictionary().getTableDescriptor(triggerTableId);
367         }
368         return td;
369     }
370
371     /**
372      * Get the referenced table descriptor for this trigger.
373      *
374      * @return the referenced table descriptor
375      *
376      * @exception StandardException on error
377      */

378     // caller converts referencedCols to referencedColsDescriptor...
379
// public ReferencedColumns getReferencedColumnsDescriptor()
380
// throws StandardException
381
// {
382
// return (referencedCols == null) ?
383
// (ReferencedColumns)null :
384
// new ReferencedColumnsDescriptorImpl(referencedCols);
385
// }
386

387     /**
388      * Get the referenced column array for this trigger, used in "alter table
389      * drop column", we get the handle and change it
390      *
391      * @return the referenced column array
392      */

393     public int[] getReferencedCols()
394     {
395         return referencedCols;
396     }
397
398     /**
399      * Is this trigger enabled
400      *
401      * @return true if it is enabled
402      */

403     public boolean isEnabled()
404     {
405         return isEnabled;
406     }
407
408     /**
409      * Mark this trigger as enabled
410      *
411      */

412     public void setEnabled()
413     {
414         isEnabled = true;
415     }
416
417     /**
418      * Mark this trigger as disabled
419      *
420      */

421     public void setDisabled()
422     {
423         isEnabled = false;
424     }
425
426     /**
427      * Does this trigger need to fire on this type of
428      * DML?
429      *
430      * @param stmtType the type of DML
431      * (StatementType.INSERT|StatementType.UPDATE|StatementType.DELETE)
432      * @param modifiedCols the columns modified, or null for all
433      *
434      * @return true/false
435      *
436      * @exception StandardException on error
437      */

438     public boolean needsToFire(int stmtType, int[] modifiedCols)
439         throws StandardException
440     {
441
442         if (SanityManager.DEBUG)
443         {
444             if (!((stmtType == StatementType.INSERT) ||
445                                  (stmtType == StatementType.BULK_INSERT_REPLACE) ||
446                                  (stmtType == StatementType.UPDATE) ||
447                                  (stmtType == StatementType.DELETE)))
448             {
449                 SanityManager.THROWASSERT("invalid statement type "+stmtType);
450             }
451         }
452
453         /*
454         ** If we are disabled, we never fire
455         */

456         if (!isEnabled)
457         {
458             return false;
459         }
460
461         if (stmtType == StatementType.INSERT)
462         {
463             return (eventMask & TRIGGER_EVENT_INSERT) == eventMask;
464         }
465         if (stmtType == StatementType.DELETE)
466         {
467             return (eventMask & TRIGGER_EVENT_DELETE) == eventMask;
468         }
469
470         // this is a temporary restriction, but it may not be lifted
471
// anytime soon.
472
if (stmtType == StatementType.BULK_INSERT_REPLACE)
473         {
474             throw StandardException.newException(SQLState.LANG_NO_BULK_INSERT_REPLACE_WITH_TRIGGER,
475                                                  getTableDescriptor().getQualifiedName(), name);
476         }
477
478         // if update, only relevant if columns intersect
479
return ((eventMask & TRIGGER_EVENT_UPDATE) == eventMask) &&
480                 ConstraintDescriptor.doColumnsIntersect(modifiedCols, referencedCols);
481     }
482
483     /**
484      * Get the original trigger definition.
485      *
486      * @return The trigger definition.
487      */

488     public String JavaDoc getTriggerDefinition()
489     {
490         return triggerDefinition;
491     }
492
493     /**
494      * Get whether or not OLD was replaced
495      * in the REFERENCING clause.
496      *
497      * @return Whether or not OLD was replaced
498      * in the REFERENCING clause.
499      */

500     public boolean getReferencingOld()
501     {
502         return referencingOld;
503     }
504
505     /**
506      * Get whether or not NEW was replaced
507      * in the REFERENCING clause.
508      *
509      * @return Whether or not NEW was replaced
510      * in the REFERENCING clause.
511      */

512     public boolean getReferencingNew()
513     {
514         return referencingNew;
515     }
516
517     /**
518      * Get the old Referencing name, if any,
519      * from the REFERENCING clause.
520      *
521      * @return The old Referencing name, if any,
522      * from the REFERENCING clause.
523      */

524     public String JavaDoc getOldReferencingName()
525     {
526         return oldReferencingName;
527     }
528
529     /**
530      * Get the new Referencing name, if any,
531      * from the REFERENCING clause.
532      *
533      * @return The new Referencing name, if any,
534      * from the REFERENCING clause.
535      */

536     public String JavaDoc getNewReferencingName()
537     {
538         return newReferencingName;
539     }
540
541     public String JavaDoc toString()
542     {
543         if (SanityManager.DEBUG)
544         {
545             return "TRIGGER: "+name;
546         }
547         else
548         {
549             return "";
550         }
551     }
552
553     ////////////////////////////////////////////////////////////////////
554
//
555
// PROVIDER INTERFACE
556
//
557
////////////////////////////////////////////////////////////////////
558

559     /**
560      * @return the stored form of this provider
561      *
562      * @see Dependable#getDependableFinder
563      */

564     public DependableFinder getDependableFinder()
565     {
566         return getDependableFinder(StoredFormatIds.TRIGGER_DESCRIPTOR_FINDER_V01_ID);
567     }
568
569     /**
570      * Return the name of this Provider. (Useful for errors.)
571      *
572      * @return String The name of this provider.
573      */

574     public String JavaDoc getObjectName()
575     {
576         return name;
577     }
578
579     /**
580      * Get the provider's UUID
581      *
582      * @return The provider's UUID
583      */

584     public UUID getObjectID()
585     {
586         return id;
587     }
588
589     /**
590      * Get the provider's type.
591      *
592      * @return char The provider's type.
593      */

594     public String JavaDoc getClassType()
595     {
596         return Dependable.TRIGGER;
597     }
598
599     //////////////////////////////////////////////////////
600
//
601
// DEPENDENT INTERFACE
602
//
603
// Triggers are dependent on the underlying table,
604
// and their spses (for the trigger action and the WHEN
605
// clause).
606
//
607
//////////////////////////////////////////////////////
608
/**
609      * Check that all of the dependent's dependencies are valid.
610      *
611      * @return true if the dependent is currently valid
612      */

613     public synchronized boolean isValid()
614     {
615         return true;
616     }
617
618     /**
619      * Prepare to mark the dependent as invalid (due to at least one of
620      * its dependencies being invalid).
621      *
622      * @param action The action causing the invalidation
623      * @param p the provider
624      * @param lcc the language connection context
625      *
626      * @exception StandardException thrown if unable to make it invalid
627      */

628     public void prepareToInvalidate
629     (
630         Provider p,
631         int action,
632         LanguageConnectionContext lcc
633     ) throws StandardException
634     {
635         switch (action)
636         {
637             /*
638             ** We are only dependent on the underlying table, and our spses and
639             ** privileges on various objects. (we should be dropped before our
640             ** table is dropped. Also, we should be dropped before revoke
641             ** RESTRICT privilege is issued otherwise revoke RESTRICT will
642             ** throw an exception).
643             ** Currently, in Derby, an execute routine privilege can be revoked
644             ** only if there are no dependents on that privilege. When revoke
645             ** execute RESTRICT is exectued, all the dependents will receive
646             ** REVOKE_PRIVILEGE_RESTRICT and they should throw exception.
647             ** We handle this for TriggerDescriptor by throwning an exception
648             ** below. For all the other types of revoke privileges, for
649             ** instance, SELECT, UPDATE, DELETE, INSERT, REFERENCES,
650             ** TRIGGER, we don't do anything here and later in makeInvalid, we
651             ** make the TriggerDescriptor drop itself.
652             */

653             case DependencyManager.DROP_TABLE:
654             case DependencyManager.DROP_SYNONYM:
655             case DependencyManager.DROP_SPS:
656             case DependencyManager.RENAME:
657             case DependencyManager.REVOKE_PRIVILEGE_RESTRICT:
658                 DependencyManager dm = getDataDictionary().getDependencyManager();
659                 throw StandardException.newException(SQLState.LANG_PROVIDER_HAS_DEPENDENT_OBJECT,
660                                     dm.getActionString(action),
661                                     p.getObjectName(), "TRIGGER", name);
662
663                 /*
664             ** The trigger descriptor depends on the trigger table.
665             ** This means that we get called whenever anything happens
666             ** to the trigger table. There are so many cases where this
667             ** can happen that it doesn't make sense to have an assertion
668             ** here to check whether the action was expected (it makes
669             ** the code hard to maintain, and creates a big switch statement).
670             */

671             default:
672                 break;
673         }
674     }
675
676     /**
677      * Mark the dependent as invalid (due to at least one of
678      * its dependencies being invalid). Always an error
679      * for a trigger -- should never have gotten here.
680      *
681      * @param lcc the language connection context
682      * @param action The action causing the invalidation
683      *
684      * @exception StandardException thrown if called in sanity mode
685      */

686     public void makeInvalid(int action, LanguageConnectionContext lcc) throws StandardException
687     {
688         // No sanity check for valid action. Trigger descriptors depend on
689
// the trigger table, so there is a very large number of actions
690
// that we would have to check against. This is hard to maintain,
691
// so don't bother.
692

693         switch (action)
694         {
695             // invalidate this trigger descriptor
696
case DependencyManager.USER_RECOMPILE_REQUEST:
697                 DependencyManager dm = getDataDictionary().getDependencyManager();
698                 dm.invalidateFor(this, DependencyManager.PREPARED_STATEMENT_RELEASE, lcc);
699                 break;
700
701             // When REVOKE_PRIVILEGE gets sent (this happens for privilege
702
// types SELECT, UPDATE, DELETE, INSERT, REFERENCES, TRIGGER), we
703
// make the TriggerDescriptor drop itself.
704
case DependencyManager.REVOKE_PRIVILEGE:
705                 DropTriggerConstantAction.dropTriggerDescriptor(
706                     lcc, getDataDictionary().getDependencyManager(),
707                     getDataDictionary(), lcc.getTransactionExecute(), this,
708                     null);
709                 break;
710
711             default:
712                 break;
713         }
714         
715     }
716
717     /**
718      * Attempt to revalidate the dependent. Meaningless
719      * for a trigger.
720      *
721      * @param lcc the language connection context
722      */

723     public void makeValid(LanguageConnectionContext lcc)
724     {
725     }
726
727
728     //////////////////////////////////////////////////////////////
729
//
730
// FORMATABLE
731
//
732
//////////////////////////////////////////////////////////////
733

734     /**
735      * Read this object from a stream of stored objects.
736      *
737      * @param in read this.
738      *
739      * @exception IOException thrown on error
740      * @exception ClassNotFoundException thrown on error
741      */

742     public void readExternal(ObjectInput JavaDoc in)
743          throws IOException JavaDoc, ClassNotFoundException JavaDoc
744     {
745         id = (UUID)in.readObject();
746         name = (String JavaDoc)in.readObject();
747         triggerSchemaId = (UUID)in.readObject();
748         triggerTableId = (UUID)in.readObject();
749         eventMask = in.readInt();
750         isBefore = in.readBoolean();
751         isRow = in.readBoolean();
752         isEnabled = in.readBoolean();
753         whenSPSId = (UUID)in.readObject();
754         actionSPSId = (UUID)in.readObject();
755         int length = in.readInt();
756         if (length != 0)
757         {
758             referencedCols = new int[length];
759             for (int i = 0; i < length; i++)
760             {
761                 referencedCols[i] = in.readInt();
762             }
763         }
764         triggerDefinition = (String JavaDoc)in.readObject();
765         referencingOld = in.readBoolean();
766         referencingNew = in.readBoolean();
767         oldReferencingName = (String JavaDoc)in.readObject();
768         newReferencingName = (String JavaDoc)in.readObject();
769         
770     }
771
772     protected DataDictionary getDataDictionary() throws StandardException
773     {
774         /*
775           note: we need to do this since when this trigger is read back from
776           disk (when it is associated with a sps), the dataDictionary has not
777           been initialized and therefore can give a NullPointerException
778         */

779         DataDictionary dd = super.getDataDictionary();
780         if (dd == null)
781         {
782             LanguageConnectionContext lcc = (LanguageConnectionContext)
783                 ContextService.getContext(LanguageConnectionContext.CONTEXT_ID);
784             dd = lcc.getDataDictionary();
785             setDataDictionary(dd);
786         }
787         return dd;
788     }
789
790     /**
791      * Write this object to a stream of stored objects.
792      *
793      * @param out write bytes here.
794      *
795      * @exception IOException thrown on error
796      */

797     public void writeExternal( ObjectOutput JavaDoc out )
798          throws IOException JavaDoc
799     {
800         if (SanityManager.DEBUG)
801         {
802             SanityManager.ASSERT(triggerSchemaId != null,
803                 "triggerSchemaId expected to be non-null");
804             SanityManager.ASSERT(triggerTableId != null,
805                 "triggerTableId expected to be non-null");
806         }
807         out.writeObject(id);
808         out.writeObject(name);
809         out.writeObject(triggerSchemaId);
810         out.writeObject(triggerTableId);
811         out.writeInt(eventMask);
812         out.writeBoolean(isBefore);
813         out.writeBoolean(isRow);
814         out.writeBoolean(isEnabled);
815         out.writeObject(whenSPSId);
816         out.writeObject(actionSPSId);
817         if (referencedCols == null)
818         {
819             out.writeInt(0);
820         }
821         else
822         {
823             out.writeInt(referencedCols.length);
824             for (int i = 0; i < referencedCols.length; i++)
825             {
826                 out.writeInt(referencedCols[i]);
827             }
828         }
829         out.writeObject(triggerDefinition);
830         out.writeBoolean(referencingOld);
831         out.writeBoolean(referencingNew);
832         out.writeObject(oldReferencingName);
833         out.writeObject(newReferencingName);
834     }
835  
836     /**
837      * Get the formatID which corresponds to this class.
838      *
839      * @return the formatID of this class
840      */

841     public int getTypeFormatId() { return StoredFormatIds.TRIGGER_DESCRIPTOR_V01_ID; }
842
843     /** @see TupleDescriptor#getDescriptorType */
844     public String JavaDoc getDescriptorType()
845     {
846         return "Trigger";
847     }
848
849     /** @see TupleDescriptor#getDescriptorName */
850     public String JavaDoc getDescriptorName() { return name; }
851     
852 }
853
854
Popular Tags