KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2
3    Derby - Class org.apache.derby.iapi.sql.dictionary.DataDictionary
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.context.ContextManager;
25
26 import org.apache.derby.iapi.sql.depend.DependencyManager;
27 import org.apache.derby.iapi.sql.depend.Dependent;
28 import org.apache.derby.iapi.sql.depend.Provider;
29
30 import org.apache.derby.iapi.sql.PreparedStatement;
31 import org.apache.derby.iapi.types.DataTypeDescriptor;
32 import org.apache.derby.iapi.types.NumberDataValue;
33 import org.apache.derby.iapi.types.DataValueFactory;
34 import org.apache.derby.iapi.types.DataValueDescriptor;
35 import org.apache.derby.iapi.sql.compile.CostEstimate;
36 import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;
37 import org.apache.derby.iapi.sql.execute.ExecutionFactory;
38 import org.apache.derby.iapi.error.StandardException;
39 import org.apache.derby.iapi.store.access.TransactionController;
40 import org.apache.derby.iapi.types.RowLocation;
41
42 import org.apache.derby.catalog.UUID;
43 import org.apache.derby.iapi.services.uuid.UUIDFactory;
44
45 import java.util.List JavaDoc;
46 import java.util.Hashtable JavaDoc;
47 import java.util.Properties JavaDoc;
48 import java.util.Vector JavaDoc;
49
50 /**
51  * The DataDictionary interface is used with the data dictionary to get
52  * descriptors for binding and compilation. Some descriptors (such as table
53  * and column descriptors) are added to and deleted from the data dictionary
54  * by other modules (like the object store). Other descriptors are added and
55  * deleted by the language module itself (e.g. the language module adds and
56  * deletes views, because views are too high-level for modules like the object
57  * store to know about).
58  *
59  * @version 0.1
60  * @author Jeff Lichtman
61  */

62
63 public interface DataDictionary
64 {
65     String JavaDoc MODULE = "org.apache.derby.iapi.sql.dictionary.DataDictionary";
66
67     /** Special version indicating the database must be upgraded to or created at the current engine level
68      *
69      * DatabaseMetaData will use this to determine if the data dictionary
70      * is at the latest System Catalog version number. A data dictionary version
71      * will not be at latest System Catalog version when the database is getting
72      * booted in soft upgrade mode. In soft upgrade mode, engine should goto
73      * metadata.properties to get the sql for the metadata calls rather
74      * than going to the system tables (and using stored versions of these queries).
75      * This is required because if the metadata sql has changed between the
76      * releases, we want to use the latest metadata sql rather than what is
77      * stored in the system catalogs. Had to introduce this behavior for
78      * EmbeddedDatabaseMetaData in 10.2 release where optimizer overrides
79      * syntax was changed. If 10.2 engine in soft upgrade mode for a pre-10.2
80      * database went to system tables for stored metadata queires, the metadata
81      * calls would fail because 10.2 release doesn't recognize the pre-10.2
82      * optimizer overrides syntax. To get around this, the 10.2 engine in
83      * soft upgrade mode should get the sql from metata.properties which has
84      * been changed to 10.2 syntax for optimizer overrides. To make this
85      * approach more generic for all soft upgrades, from 10.2 release onwards,
86      * DatabaseMetaData calls will always look at metadata.properties so it
87      * will get the compatible syntax for that release.
88      */

89     public static final int DD_VERSION_CURRENT = -1;
90     /** Cloudscape 5.0 System Catalog version */
91     public static final int DD_VERSION_CS_5_0 = 80;
92     /** Cloudscape 5.1 (Arwen) System Catalog version */
93     public static final int DD_VERSION_CS_5_1 = 90;
94     /** Cloudscape 5.2 (Frodo) System Catalog version */
95     public static final int DD_VERSION_CS_5_2 = 100;
96     /** Cloudscape 8.1 (Pre-Gandalf) System Catalog version */
97     public static final int DD_VERSION_CS_8_1 = 110;
98     /** Cloudscape/Derby 10.0 (Gandalf) System Catalog version */
99     public static final int DD_VERSION_CS_10_0 = 120;
100
101     /** Derby 10.1 System Catalog version */
102     public static final int DD_VERSION_DERBY_10_1 = 130;
103
104     /** Derby 10.2 System Catalog version */
105     public static final int DD_VERSION_DERBY_10_2 = 140;
106
107     // general info
108
public static final String JavaDoc DATABASE_ID = "derby.databaseID";
109
110     // version ids
111
/**
112      * DataDictionaryVersion property indicates the updgrade level of the system catalogs.
113      * Stored as a database property. Set to an instance of DD_Version with
114      * the major number one of the DataDictionary.DD_* values.
115      */

116     public static final String JavaDoc CORE_DATA_DICTIONARY_VERSION = "DataDictionaryVersion";
117     /**
118      * CreateDataDictionaryVersion property indicates the level of the system catalogs,
119      * at the time of database creation.
120      * Stored as a database property. Set to an instance of DD_Version.
121      */

122     public static final String JavaDoc CREATE_DATA_DICTIONARY_VERSION = "CreateDataDictionaryVersion";
123     /**
124      * derby.softDataDictionaryVersion property indicates the soft upgrade level of the system catalogs.
125      * Soft upgrade will sometime make minor changes to the system catalogs that can be safely consumed by
126      * earlier versions, such as correcting values.
127      * Stored as a database property. Set to an instance of DD_Version.
128      */

129     public static final String JavaDoc SOFT_DATA_DICTIONARY_VERSION = "derby.softDataDictionaryVersion";
130     public static final String JavaDoc PROPERTY_CONGLOMERATE_VERSION = "PropertyConglomerateVersion";
131
132     /*
133     ** CORE TABLES
134     */

135     /* NOTE - SYSCONGLOMERATES must be first, since that table must exist before
136      * any other conglomerates can be created/added to the system.
137      */

138     public static final int SYSCONGLOMERATES_CATALOG_NUM = 0;
139     public static final int SYSTABLES_CATALOG_NUM = 1;
140     public static final int SYSCOLUMNS_CATALOG_NUM = 2;
141     public static final int SYSSCHEMAS_CATALOG_NUM = 3;
142     
143     /**
144      * Catalog numbers for non core system catalogs.
145      */

146     public static final int SYSCONSTRAINTS_CATALOG_NUM = 4;
147     public static final int SYSKEYS_CATALOG_NUM = 5;
148     public static final int SYSDEPENDS_CATALOG_NUM = 6;
149     public static final int SYSALIASES_CATALOG_NUM = 7;
150     public static final int SYSVIEWS_CATALOG_NUM = 8;
151     public static final int SYSCHECKS_CATALOG_NUM = 9;
152     public static final int SYSFOREIGNKEYS_CATALOG_NUM = 10;
153     public static final int SYSSTATEMENTS_CATALOG_NUM = 11;
154     public static final int SYSFILES_CATALOG_NUM = 12;
155     public static final int SYSTRIGGERS_CATALOG_NUM = 13;
156     public static final int SYSSTATISTICS_CATALOG_NUM = 14;
157     public static final int SYSDUMMY1_CATALOG_NUM = 15;
158     public static final int SYSTABLEPERMS_CATALOG_NUM = 16;
159     public static final int SYSCOLPERMS_CATALOG_NUM = 17;
160     public static final int SYSROUTINEPERMS_CATALOG_NUM = 18;
161
162     /* static finals for constraints
163      * (Here because they are needed by parser, compilation and execution.)
164      */

165     public static final int NOTNULL_CONSTRAINT = 1;
166     public static final int PRIMARYKEY_CONSTRAINT = 2;
167     public static final int UNIQUE_CONSTRAINT = 3;
168     public static final int CHECK_CONSTRAINT = 4;
169     public static final int DROP_CONSTRAINT = 5;
170     public static final int FOREIGNKEY_CONSTRAINT = 6;
171
172     /** Modes returned from startReading() */
173     public static final int COMPILE_ONLY_MODE = 0;
174     public static final int DDL_MODE = 1;
175
176     /**
177      * Push a data dictionary context onto the
178      * current context manager.
179      *
180      * @param cm Context manager
181      */

182     DataDictionaryContext pushDataDictionaryContext(ContextManager cm);
183
184     /**
185      * Clear all of the DataDictionary caches.
186      *
187      * @exception StandardException Standard Cloudscape error policy
188      */

189     public void clearCaches() throws StandardException;
190
191     /**
192      * Inform this DataDictionary that we are about to start reading it. This
193      * means using the various get methods in the DataDictionary.
194      * Generally, this is done during query compilation.
195      *
196      * @param lcc The LanguageConnectionContext to use.
197      *
198      * @return The mode that the reader will use, to be passed to doneReading()
199      * Either COMPILE_ONLY_MODE or DDL_MODE.
200      *
201      * @exception StandardException Thrown on error
202      */

203     public int startReading(LanguageConnectionContext lcc) throws StandardException;
204
205     /**
206      * Inform this DataDictionary that we have finished reading it. This
207      * typically happens at the end of compilation.
208      *
209      * @param mode The mode that was returned by startReading().
210      * @param lcc The LanguageConnectionContext to use.
211      *
212      * @exception StandardException Thrown on error
213      */

214     public void doneReading(int mode,
215             LanguageConnectionContext lcc)
216         throws StandardException;
217
218     /**
219      * Inform this DataDictionary that we are about to start writing to it.
220      * This means using the various add and drop methods in the DataDictionary.
221      * Generally, this is done during execution of DDL.
222      *
223      * @param lcc The LanguageConnectionContext to use.
224      *
225      * @exception StandardException Thrown on error
226      */

227     public void startWriting(LanguageConnectionContext lcc)
228         throws StandardException;
229
230     /**
231      * Inform this DataDictionary that the transaction in which writes have
232      * been done (or may have been done) has been committed or rolled back.
233      *
234      * @exception StandardException Thrown on error
235      */

236     public void transactionFinished() throws StandardException;
237
238     /**
239      * Get the ExecutionFactory associated with this database.
240      *
241      * @return The ExecutionFactory
242      */

243     public ExecutionFactory getExecutionFactory();
244
245     /**
246      * Get the DataValueFactory associated with this database.
247      *
248      * @return The ExecutionFactory
249      */

250     public DataValueFactory getDataValueFactory();
251
252     /**
253      * Get a DataDescriptorGenerator, through which we can create
254      * objects to be stored in the DataDictionary.
255      *
256      * @return A DataDescriptorGenerator
257      *
258      */

259     public DataDescriptorGenerator getDataDescriptorGenerator();
260
261     /**
262      * Get authorizationID of Database Owner
263      *
264      * @return authorizationID
265      */

266     public String JavaDoc getAuthorizationDatabaseOwner();
267
268     /**
269      * Get authorization model in force, SqlStandard or legacy mode
270      *
271      * @return Whether sqlAuthorization is being used
272      */

273     public boolean usesSqlAuthorization();
274
275     /**
276      * Get the descriptor for the named schema.
277        Schema descriptors include authorization ids and schema ids.
278      * SQL92 allows a schema to specify a default character set - we will
279      * not support this. Will check default schema for a match
280      * before scanning a system table.
281      *
282      * @param schemaName The name of the schema we're interested in. Must not be null.
283      * @param tc TransactionController
284      *
285      * @param raiseError whether an exception should be thrown if the schema does not exist.
286      *
287      * @return The descriptor for the schema. Can be null (not found) if raiseError is false.
288      *
289      * @exception StandardException Thrown on error
290      */

291
292     public SchemaDescriptor getSchemaDescriptor(String JavaDoc schemaName,
293                                                 TransactionController tc,
294                                                 boolean raiseError)
295                         throws StandardException;
296
297     /**
298      * Get the descriptor for the named schema. If the schemaId
299      * parameter is NULL, it gets the descriptor for the current (default)
300      * schema. Schema descriptors include authorization ids and schema ids.
301      * SQL92 allows a schema to specify a default character set - we will
302      * not support this.
303      *
304      * @param schemaId The id of the schema we're interested in.
305      * If the name is NULL, get the descriptor for the
306      * current schema.
307      *
308      * @param tc The transaction controller to us when scanning
309      * SYSSCHEMAS
310      *
311      * @return The descriptor for the schema.
312      *
313      * @exception StandardException Thrown on failure
314      */

315     public SchemaDescriptor getSchemaDescriptor(UUID schemaId, TransactionController tc)
316                         throws StandardException;
317
318     /**
319      * Get the descriptor for the system schema. Schema descriptors include
320      * authorization ids and schema ids.
321      *
322      * SQL92 allows a schema to specify a default character set - we will
323      * not support this.
324      *
325      * @return The descriptor for the schema.
326      *
327      * @exception StandardException Thrown on failure
328      */

329     public SchemaDescriptor getSystemSchemaDescriptor( )
330                         throws StandardException;
331
332     /**
333      * Get the descriptor for the SYSIBM schema. Schema descriptors include
334      * authorization ids and schema ids.
335      *
336      * SQL92 allows a schema to specify a default character set - we will
337      * not support this.
338      *
339      * @return The descriptor for the schema.
340      *
341      * @exception StandardException Thrown on failure
342      */

343     public SchemaDescriptor getSysIBMSchemaDescriptor( )
344                         throws StandardException;
345
346     /**
347      * Get the descriptor for the SYSCS_DIAG schema. Schema descriptors
348      * include authorization ids and schema ids.
349      *
350      * SQL92 allows a schema to specify a default character set - we will
351      * not support this.
352      *
353      * @return The descriptor for the schema.
354      *
355      * @exception StandardException Thrown on failure
356      */

357     public SchemaDescriptor getSystemDiagSchemaDescriptor( )
358                         throws StandardException;
359
360     /**
361      * Get the descriptor for the declared global temporary table schema which is always named "SESSION".
362      *
363      * SQL92 allows a schema to specify a default character set - we will
364      * not support this.
365      *
366      * @return The descriptor for the schema.
367      *
368      * @exception StandardException Thrown on failure
369      */

370     public SchemaDescriptor getDeclaredGlobalTemporaryTablesSchemaDescriptor()
371         throws StandardException;
372
373     /**
374      * Determine whether a string is the name of the system schema.
375      *
376      * @param name
377      * @return true or false
378      *
379      * @exception StandardException Thrown on failure
380      */

381     public boolean isSystemSchemaName( String JavaDoc name)
382         throws StandardException;
383     
384     /**
385      * Drop the descriptor for a schema, given the schema's name
386      *
387      * @param schemaName The name of the schema to drop
388      * @param tc Transaction Controller
389      *
390      * @exception StandardException Thrown on failure
391      */

392     public void dropSchemaDescriptor(String JavaDoc schemaName,
393                             TransactionController tc)
394                         throws StandardException;
395
396     /**
397      * Indicate whether there is anything in the
398      * particular schema. Checks for tables in the
399      * the schema, on the assumption that there cannot
400      * be any other objects in a schema w/o a table.
401      *
402      * @param sd schema descriptor
403      *
404      * @return true/false
405      *
406      * @exception StandardException on error
407      */

408     public boolean isSchemaEmpty(SchemaDescriptor sd)
409         throws StandardException;
410
411     /**
412      * Get the descriptor for the named table within the given schema.
413      * If the schema parameter is NULL, it looks for the table in the
414      * current (default) schema. Table descriptors include object ids,
415      * object types (table, view, etc.)
416      *
417      * @param tableName The name of the table to get the descriptor for
418      * @param schema The descriptor for the schema the table lives in.
419      * If null, use the current (default) schema.
420      *
421      * @return The descriptor for the table, null if table does not
422      * existe.
423      *
424      * @exception StandardException Thrown on failure
425      */

426     public TableDescriptor getTableDescriptor(String JavaDoc tableName,
427                     SchemaDescriptor schema)
428                         throws StandardException;
429
430     /**
431      * Get the descriptor for the table with the given UUID.
432      *
433      * NOTE: I'm assuming that the object store will define an UUID for
434      * persistent objects. I'm also assuming that UUIDs are unique across
435      * schemas, and that the object store will be able to do efficient
436      * lookups across schemas (i.e. that no schema descriptor parameter
437      * is needed).
438      *
439      * @param tableID The UUID of the table to get the descriptor for
440      *
441      * @return The descriptor for the table, null if the table does
442      * not exist.
443      *
444      * @exception StandardException Thrown on failure
445      */

446     public TableDescriptor getTableDescriptor(UUID tableID)
447                         throws StandardException;
448
449     /**
450      * Drop the table descriptor.
451      *
452      * @param td The table descriptor to drop
453      * @param schema A descriptor for the schema the table
454      * is a part of. If this parameter is
455      * NULL, then the table is part of the
456      * current (default) schema
457      * @param tc TransactionController for the transaction
458      * @exception StandardException Thrown on error
459      */

460     public void dropTableDescriptor(TableDescriptor td, SchemaDescriptor schema,
461                                     TransactionController tc)
462         throws StandardException;
463
464     /**
465      * Update the lockGranularity for the specified table.
466      *
467      * @param td The TableDescriptor for the table
468      * @param schema The SchemaDescriptor for the table
469      * @param lockGranularity The new lockGranularity
470      * @param tc The TransactionController to use.
471      *
472      * @exception StandardException Thrown on error
473      */

474     public void updateLockGranularity(TableDescriptor td, SchemaDescriptor schema,
475                                       char lockGranularity, TransactionController tc)
476         throws StandardException;
477
478     /**
479      * Drop all table descriptors for a schema.
480      *
481      * @param schema A descriptor for the schema to drop the tables
482      * from.
483      *
484      * @exception StandardException Thrown on failure
485      */

486     /*
487     public void dropAllTableDescriptors(SchemaDescriptor schema)
488                         throws StandardException;
489     */

490
491     /**
492      * Get a ColumnDescriptor given its Default ID.
493      *
494      * @param uuid The UUID of the default
495      *
496      * @return The ColumnDescriptor for the column.
497      *
498      * @exception StandardException Thrown on failure
499      */

500     public ColumnDescriptor getColumnDescriptorByDefaultId(UUID uuid)
501                 throws StandardException;
502
503     /**
504      * Given a column name and a table ID, drops the column descriptor
505      * from the table.
506      *
507      * @param tableID The UUID of the table to drop the column from
508      * @param columnName The name of the column to drop
509      * @param tc TransactionController for the transaction
510      *
511      * @exception StandardException Thrown on failure
512      */

513     public void dropColumnDescriptor(UUID tableID,
514                 String JavaDoc columnName, TransactionController tc)
515                         throws StandardException;
516
517     /**
518      * Drops all column descriptors from the given table. Useful for
519      * DROP TABLE.
520      *
521      * @param tableID The UUID of the table from which to drop
522      * all the column descriptors
523      * @param tc TransactionController for the transaction
524      *
525      * @exception StandardException Thrown on failure
526      */

527     public void dropAllColumnDescriptors(UUID tableID, TransactionController tc)
528                         throws StandardException;
529
530     /**
531      * Drops all table and column permission descriptors for the given table.
532      *
533      * @param tableID The UUID of the table for which to drop
534      * all the table and column permission descriptors
535      * @param tc TransactionController for the transaction
536      *
537      * @exception StandardException Thrown on failure
538      */

539     public void dropAllTableAndColPermDescriptors(UUID tableID, TransactionController tc)
540                         throws StandardException;
541
542
543     /**
544      * Need to update SYSCOLPERMS for a given table because a new column has
545      * been added to that table. SYSCOLPERMS has a column called "COLUMNS"
546      * which is a bit map for all the columns in a given user table. Since
547      * ALTER TABLE .. ADD COLUMN .. has added one more column, we need to
548      * expand "COLUMNS" for that new column
549      *
550      * Currently, this code gets called during execution phase of
551      * ALTER TABLE .. ADD COLUMN ..
552      *
553      * @param tableID The UUID of the table to which a column has been added
554      * @param tc TransactionController for the transaction
555      *
556      * @exception StandardException Thrown on error
557      */

558     public void updateSYSCOLPERMSforAddColumnToUserTable(UUID tableID, TransactionController tc)
559     throws StandardException;
560     
561     
562     /**
563      * Drops all routine permission descriptors for the given routine.
564      *
565      * @param routineID The UUID of the routine for which to drop
566      * all the permission descriptors
567      * @param tc TransactionController for the transaction
568      *
569      * @exception StandardException Thrown on failure
570      */

571     public void dropAllRoutinePermDescriptors(UUID routineID, TransactionController tc)
572                         throws StandardException;
573
574     /**
575      * Gets the viewDescriptor for the view with the given UUID.
576      *
577      * @param uuid The UUID for the view
578      *
579      * @return A descriptor for the view
580      *
581      * @exception StandardException Thrown on error
582      */

583     public ViewDescriptor getViewDescriptor(UUID uuid)
584         throws StandardException;
585
586     /**
587      * Gets the viewDescriptor for the view given its TableDescriptor.
588      *
589      * @param td The TableDescriptor for the view.
590      *
591      * @return A descriptor for the view
592      *
593      * @exception StandardException Thrown on error
594      */

595     public ViewDescriptor getViewDescriptor(TableDescriptor td)
596                         throws StandardException;
597
598     /**
599      * Drops the view descriptor from the data dictionary.
600      *
601      * @param viewDescriptor A descriptor for the view to be dropped
602      * @param tc TransactionController to use
603      *
604      * @exception StandardException Thrown on failure
605      */

606     public void dropViewDescriptor(ViewDescriptor viewDescriptor,
607                                    TransactionController tc)
608                         throws StandardException;
609
610     /**
611      * Get a ConstraintDescriptor given its UUID.
612      *
613      * @param uuid The UUID
614      *
615      * @return The ConstraintDescriptor for the constraint.
616      *
617      * @exception StandardException Thrown on failure
618      */

619     public ConstraintDescriptor getConstraintDescriptor(UUID uuid)
620                 throws StandardException;
621
622     /**
623      * Get a ConstraintDescriptor given its name and schema ID.
624      *
625      * @param constraintName Constraint name.
626      * @param schemaID The schema UUID
627      *
628      * @return The ConstraintDescriptor for the constraint.
629      *
630      * @exception StandardException Thrown on failure
631      */

632     public ConstraintDescriptor getConstraintDescriptor
633     (
634         String JavaDoc constraintName,
635         UUID schemaID
636     )
637         throws StandardException;
638
639     /**
640      * Load up the constraint descriptor list for this table
641      * descriptor and return it. If the descriptor list
642      * is already loaded up, it is retuned without further
643      * ado.
644      *
645      * @param td The table descriptor.
646      *
647      * @return The ConstraintDescriptorList for the table
648      *
649      * @exception StandardException Thrown on failure
650      */

651     public ConstraintDescriptorList getConstraintDescriptors(TableDescriptor td)
652         throws StandardException;
653
654     /**
655      * Convert a constraint descriptor list into a list
656      * of active constraints, that is, constraints which
657      * must be enforced. For the Core product, these
658      * are just the constraints on the original list.
659      * However, during REFRESH we may have deferred some
660      * constraints until statement end. This method returns
661      * the corresponding list of constraints which AREN'T
662      * deferred.
663      *
664      * @param cdl The constraint descriptor list to wrap with
665      * an Active constraint descriptor list.
666      *
667      * @return The corresponding Active ConstraintDescriptorList
668      *
669      * @exception StandardException Thrown on failure
670      */

671     public ConstraintDescriptorList getActiveConstraintDescriptors(ConstraintDescriptorList cdl)
672         throws StandardException;
673
674     /**
675      * Reports whether an individual constraint must be
676      * enforced. For the Core product, this routine always
677      * returns true.
678      *
679      * However, during REFRESH we may have deferred some
680      * constraints until statement end. This method returns
681      * false if the constraint deferred
682      *
683      * @param constraint the constraint to check
684      *
685      *
686      * @return The corresponding Active ConstraintDescriptorList
687      *
688      * @exception StandardException Thrown on failure
689      */

690     public boolean activeConstraint( ConstraintDescriptor constraint )
691         throws StandardException;
692
693     /**
694      * Get the constraint descriptor given a table and the UUID String
695      * of the backing index.
696      *
697      * @param td The table descriptor.
698      * @param uuid The UUID for the backing index.
699      *
700      * @return The ConstraintDescriptor for the constraint.
701      *
702      * @exception StandardException Thrown on failure
703      */

704     public ConstraintDescriptor getConstraintDescriptor(TableDescriptor td,
705                                                         UUID uuid)
706                 throws StandardException;
707
708
709     /**
710      * Get the constraint descriptor given a table and the UUID String
711      * of the constraint
712      *
713      * @param td The table descriptor.
714      * @param uuid The UUID for the constraint
715      *
716      * @return The ConstraintDescriptor for the constraint.
717      *
718      * @exception StandardException Thrown on failure
719      */

720     public ConstraintDescriptor getConstraintDescriptorById
721     (
722         TableDescriptor td,
723         UUID uuid
724     )
725         throws StandardException;
726
727     /**
728      * Get the constraint descriptor given a TableDescriptor and the constraint name.
729      *
730      * @param td The table descriptor.
731      * @param sd The schema descriptor for the constraint
732      * @param constraintName The constraint name.
733      * @param forUpdate Whether or not access is for update
734      *
735      * @return The ConstraintDescriptor for the constraint.
736      *
737      * @exception StandardException Thrown on failure
738      */

739     public ConstraintDescriptor getConstraintDescriptorByName(TableDescriptor td,
740                                                               SchemaDescriptor sd,
741                                                               String JavaDoc constraintName,
742                                                               boolean forUpdate)
743                 throws StandardException;
744
745     /**
746      * Return a table descriptor corresponding to the TABLEID
747      * field in SYSCONSTRAINTS where CONSTRAINTID matches
748      * the constraintId passed in.
749      *
750      * @param constraintId The id of the constraint
751      *
752      * @return the corresponding table descriptor
753      *
754      * @exception StandardException Thrown on error
755      */

756     public TableDescriptor getConstraintTableDescriptor(UUID constraintId)
757             throws StandardException;
758
759     /**
760      * Return a list of foreign keys constraints referencing
761      * this constraint. Returns both enabled and disabled
762      * constraints.
763      *
764      * @param constraintId The id of the referenced constraint
765      *
766      * @return list of constraints
767      *
768      * @exception StandardException Thrown on error
769      */

770     public ConstraintDescriptorList getForeignKeys(UUID constraintId)
771             throws StandardException;
772
773     /**
774      * Adds the given ConstraintDescriptor to the data dictionary,
775      * associated with the given table and constraint type.
776      *
777      * @param descriptor The descriptor to add
778      * @param tc The transaction controller
779      *
780      * @exception StandardException Thrown on error
781      */

782     public void addConstraintDescriptor(
783             ConstraintDescriptor descriptor,
784             TransactionController tc)
785                         throws StandardException;
786
787     /**
788      * Drops the given ConstraintDescriptor that is associated
789      * with the given table and constraint type from the data dictionary.
790      *
791      * NOTE: Caller is responsible for dropping any backing index
792      *
793      * @param table The table from which to drop the
794      * constraint descriptor
795      * @param descriptor The descriptor to drop
796      * @param tc The TransactionController.
797      *
798      * @exception StandardException Thrown on failure
799      */

800     public void dropConstraintDescriptor(TableDescriptor table,
801             ConstraintDescriptor descriptor,
802             TransactionController tc)
803                         throws StandardException;
804
805     /**
806      * Drops all ConstraintDescriptors from the data dictionary
807      * that are associated with the given table.
808      *
809      * NOTE: Caller is responsible for dropping any backing index
810      *
811      * @param table The table from which to drop all
812      * constraint descriptors
813      * @param tc The TransactionController.
814      *
815      * @exception StandardException Thrown on failure
816      */

817     public void dropAllConstraintDescriptors(TableDescriptor table,
818                                              TransactionController tc)
819                         throws StandardException;
820
821     /**
822      * Update the constraint descriptor in question. Updates
823      * every row in the base conglomerate.
824      *
825      * @param cd The Constraintescriptor
826      * @param formerUUID The UUID for this column in SYSCONSTRAINTS,
827      * may differ from what is in cd if this
828      * is the column that is being set.
829      * @param colsToSet Array of ints of columns to be modified,
830      * 1 based. May be null (all cols).
831      * @param tc The TransactionController to use
832      *
833      *
834      * @exception StandardException Thrown on failure
835      */

836     public void updateConstraintDescriptor(ConstraintDescriptor cd,
837                                         UUID formerUUID,
838                                         int[] colsToSet,
839                                         TransactionController tc)
840         throws StandardException;
841
842     /**
843      * Get a SubKeyConstraintDescriptor from syskeys or sysforeignkeys for
844      * the specified constraint id. For primary foreign and and unique
845      * key constraints.
846      *
847      * @param constraintId The UUID for the constraint.
848      * @param type The type of the constraint
849      * (e.g. DataDictionary.FOREIGNKEY_CONSTRAINT)
850      *
851      * @return SubKeyConstraintDescriptor The Sub descriptor for the constraint.
852      *
853      * @exception StandardException Thrown on failure
854      */

855     public SubKeyConstraintDescriptor getSubKeyConstraint(UUID constraintId, int type)
856         throws StandardException;
857
858     /**
859      * Get a SPSDescriptor given its UUID.
860      *
861      * @param uuid The UUID
862      *
863      *
864      * @return The SPSDescriptor for the constraint.
865      *
866      * @exception StandardException Thrown on failure
867      */

868     public SPSDescriptor getSPSDescriptor(UUID uuid)
869                 throws StandardException;
870
871     /**
872      * Get the stored prepared statement descriptor given
873      * a sps name.
874      *
875      * @param name The sps name.
876      * @param sd The schema descriptor.
877      *
878      * @return The SPSDescriptor for the constraint.
879      *
880      * @exception StandardException Thrown on failure
881      */

882     public SPSDescriptor getSPSDescriptor(String JavaDoc name, SchemaDescriptor sd)
883                 throws StandardException;
884
885     /**
886      * Get every statement in this database.
887      * Return the SPSDescriptors in an list.
888      *
889      * @return the list of descriptors
890      *
891      * @exception StandardException Thrown on failure
892      */

893     public List JavaDoc getAllSPSDescriptors()
894         throws StandardException;
895
896     /**
897      * Get all the parameter descriptors for an SPS.
898      * Look up the params in SYSCOLUMNS and turn them
899      * into parameter descriptors.
900      *
901      * @param spsd sps descriptor
902      * @param defaults the parameter defaults. If not null,
903      * all the parameter defaults will be stuffed
904      * in here.
905      *
906      * @return array of data type descriptors
907      *
908      * @exception StandardException Thrown on error
909      */

910     public DataTypeDescriptor[] getSPSParams(SPSDescriptor spsd, Vector JavaDoc defaults)
911         throws StandardException;
912
913     /**
914      * Adds the given SPSDescriptor to the data dictionary,
915      * associated with the given table and constraint type.
916      *
917      * @param descriptor The descriptor to add
918      * @param tc The transaction controller
919      * @param wait To wait for lock or not
920      *
921      * @exception StandardException Thrown on error
922      */

923     public void addSPSDescriptor
924     (
925         SPSDescriptor descriptor,
926         TransactionController tc,
927         boolean wait
928     ) throws StandardException;
929
930     /**
931      * Updates SYS.SYSSTATEMENTS with the info from the
932      * SPSD.
933      *
934      * @param spsd The descriptor to add
935      * @param tc The transaction controller
936      * @param recompile whether to recompile or invalidate
937      * @param updateSYSCOLUMNS indicate whether syscolumns needs to be updated
938      * or not.
939      * @param wait If true, then the caller wants to wait for locks. False will be
940      * @param firstCompilation first time SPS is getting compiled.
941      * when we using a nested user xaction - we want to timeout right away if
942      * the parent holds the lock. (bug 4821)
943      *
944      * @exception StandardException Thrown on error
945      */

946     public void updateSPS(
947             SPSDescriptor spsd,
948             TransactionController tc,
949             boolean recompile,
950             boolean updateSYSCOLUMNS,
951             boolean wait,
952             boolean firstCompilation)
953                         throws StandardException;
954
955     /**
956      * Drops the given SPSDescriptor.
957      *
958      * @param descriptor The descriptor to drop
959      * @param tc The TransactionController.
960      *
961      * @exception StandardException Thrown on failure
962      */

963     public void dropSPSDescriptor(SPSDescriptor descriptor,
964             TransactionController tc)
965                         throws StandardException;
966
967     /**
968      * Drops the given SPSDescriptor.
969      *
970      * @param uuid the statement uuid
971      * @param tc The TransactionController.
972      *
973      * @exception StandardException Thrown on failure
974      */

975     public void dropSPSDescriptor
976     (
977         UUID uuid,
978         TransactionController tc
979     ) throws StandardException;
980
981     /**
982      * Invalidate all the stored plans in SYS.SYSSTATEMENTS.
983      * @exception StandardException Thrown on error
984      */

985     public void invalidateAllSPSPlans() throws StandardException;
986                         
987     /**
988      * Get a TriggerDescriptor given its UUID.
989      *
990      * @param uuid The UUID
991      *
992      *
993      * @return The TriggerDescriptor for the constraint.
994      *
995      * @exception StandardException Thrown on failure
996      */

997     public TriggerDescriptor getTriggerDescriptor(UUID uuid)
998                 throws StandardException;
999
1000    /**
1001     * Get the stored prepared statement descriptor given
1002     * a sps name.
1003     *
1004     * @param name The sps name.
1005     * @param sd The schema descriptor.
1006     *
1007     * @return The TriggerDescriptor for the constraint.
1008     *
1009     * @exception StandardException Thrown on failure
1010     */

1011    public TriggerDescriptor getTriggerDescriptor(String JavaDoc name, SchemaDescriptor sd)
1012                throws StandardException;
1013
1014    /**
1015     * Load up the trigger descriptor list for this table
1016     * descriptor and return it. If the descriptor list
1017     * is already loaded up, it is retuned without further
1018     * ado.
1019     *
1020     * @param td The table descriptor.
1021     *
1022     * @return The ConstraintDescriptorList for the table
1023     *
1024     * @exception StandardException Thrown on failure
1025     */

1026    public GenericDescriptorList getTriggerDescriptors(TableDescriptor td)
1027        throws StandardException;
1028
1029    /**
1030     * Update the trigger descriptor in question. Updates
1031     * every row in the base conglomerate.
1032     *
1033     * @param triggerd The Triggerescriptor
1034     * @param formerUUID The UUID for this column in SYSTRIGGERS,
1035     * may differ from what is in triggerd if this
1036     * is the column that is being set.
1037     * @param colsToSet Array of ints of columns to be modified,
1038     * 1 based. May be null (all cols).
1039     * @param tc The TransactionController to use
1040     *
1041     * @exception StandardException Thrown on failure
1042     */

1043    public void updateTriggerDescriptor
1044    (
1045        TriggerDescriptor triggerd,
1046        UUID formerUUID,
1047        int[] colsToSet,
1048        TransactionController tc
1049    ) throws StandardException;
1050
1051    /**
1052     * Drops the given TriggerDescriptor that is associated
1053     * with the given table and constraint type from the data dictionary.
1054     *
1055     * @param descriptor The descriptor to drop
1056     * @param tc The TransactionController.
1057     *
1058     * @exception StandardException Thrown on failure
1059     */

1060    public void dropTriggerDescriptor
1061    (
1062        TriggerDescriptor descriptor,
1063        TransactionController tc
1064    ) throws StandardException;
1065
1066    /**
1067     * Get all of the ConglomerateDescriptors in the database and
1068     * hash them by conglomerate number.
1069     * This is useful as a performance optimization for the locking VTIs.
1070     * NOTE: This method will scan SYS.SYSCONGLOMERATES at READ COMMITTED.
1071     * It should really scan at READ UNCOMMITTED, but there is no such
1072     * thing yet.
1073     *
1074     * @param tc TransactionController for the transaction
1075     *
1076     * @return A Hashtable with all of the ConglomerateDescriptors
1077     * in the database hashed by conglomerate number.
1078     *
1079     * @exception StandardException Thrown on failure
1080     */

1081    public Hashtable JavaDoc hashAllConglomerateDescriptorsByNumber(TransactionController tc)
1082        throws StandardException;
1083
1084    /**
1085     * Get all of the TableDescriptors in the database and hash them by TableId
1086     * This is useful as a performance optimization for the locking VTIs.
1087     * NOTE: This method will scan SYS.SYSTABLES at READ COMMITTED.
1088     * It should really scan at READ UNCOMMITTED, but there is no such
1089     * thing yet.
1090     *
1091     * @param tc TransactionController for the transaction
1092     *
1093     * @return A Hashtable with all of the Table descriptors in the database
1094     * hashed by TableId
1095     *
1096     *
1097     * @exception StandardException Thrown on failure
1098     */

1099    public Hashtable JavaDoc hashAllTableDescriptorsByTableId(TransactionController tc)
1100        throws StandardException;
1101
1102    /**
1103     * Get a ConglomerateDescriptor given its UUID. If it is an index
1104     * conglomerate shared by at least another duplicate index, this returns
1105     * one of the ConglomerateDescriptors for those indexes.
1106     *
1107     * @param uuid The UUID
1108     *
1109     *
1110     * @return A ConglomerateDescriptor for the conglomerate.
1111     *
1112     * @exception StandardException Thrown on failure
1113     */

1114    public ConglomerateDescriptor getConglomerateDescriptor(UUID uuid)
1115                throws StandardException;
1116
1117    /**
1118     * Get an array of ConglomerateDescriptors given the UUID. If it is a
1119     * heap conglomerate or an index conglomerate not shared by a duplicate
1120     * index, the size of the return array is 1.
1121     *
1122     * @param uuid The UUID
1123     *
1124     *
1125     * @return An array of ConglomerateDescriptors for the conglomerate.
1126     *
1127     * @exception StandardException Thrown on failure
1128     */

1129    public ConglomerateDescriptor[] getConglomerateDescriptors(UUID uuid)
1130                throws StandardException;
1131
1132    /**
1133     * Get a ConglomerateDescriptor given its conglomerate number. If it is an
1134     * index conglomerate shared by at least another duplicate index, this
1135     * returns one of the ConglomerateDescriptors for those indexes.
1136     *
1137     * @param conglomerateNumber The conglomerate number.
1138     *
1139     *
1140     * @return A ConglomerateDescriptor for the conglomerate. Returns NULL if
1141     * no such conglomerate.
1142     *
1143     * @exception StandardException Thrown on failure
1144     */

1145    public ConglomerateDescriptor getConglomerateDescriptor(
1146                        long conglomerateNumber)
1147                        throws StandardException;
1148
1149    /**
1150     * Get an array of conglomerate descriptors for the given conglomerate
1151     * number. If it is a heap conglomerate or an index conglomerate not
1152     * shared by a duplicate index, the size of the return array is 1.
1153     *
1154     * @param conglomerateNumber The number for the conglomerate
1155     * we're interested in
1156     *
1157     * @return An array of ConglomerateDescriptors that share the requested
1158     * conglomerate. Returns size 0 array if no such conglomerate.
1159     *
1160     * @exception StandardException Thrown on failure
1161     */

1162    public ConglomerateDescriptor[] getConglomerateDescriptors(
1163                        long conglomerateNumber)
1164                        throws StandardException;
1165
1166    /**
1167     * Gets a conglomerate descriptor for the named index in the given schema,
1168     * getting an exclusive row lock on the matching row in
1169     * sys.sysconglomerates (for DDL concurrency) if requested.
1170     *
1171     * @param indexName The name of the index we're looking for
1172     * @param sd The schema descriptor
1173     * @param forUpdate Whether or not to get an exclusive row
1174     * lock on the row in sys.sysconglomerates.
1175     *
1176     * @return A ConglomerateDescriptor describing the requested
1177     * conglomerate. Returns NULL if no such conglomerate.
1178     *
1179     * @exception StandardException Thrown on failure
1180     */

1181    public ConglomerateDescriptor getConglomerateDescriptor(
1182                        String JavaDoc indexName,
1183                        SchemaDescriptor sd,
1184                        boolean forUpdate)
1185                        throws StandardException;
1186
1187    /**
1188     * Drops a conglomerate descriptor
1189     *
1190     * @param conglomerate The ConglomerateDescriptor for the conglomerate
1191     * @param tc TransactionController for the transaction
1192     *
1193     * @exception StandardException Thrown on failure
1194     */

1195
1196    public void dropConglomerateDescriptor(
1197                        ConglomerateDescriptor conglomerate,
1198                        TransactionController tc)
1199                        throws StandardException;
1200 
1201    /**
1202     * Drops all conglomerates associated with a table.
1203     *
1204     * @param td The TableDescriptor of the table
1205     * @param tc TransactionController for the transaction
1206     *
1207     * @exception StandardException Thrown on failure
1208     */

1209
1210    public void dropAllConglomerateDescriptors(
1211                        TableDescriptor td,
1212                        TransactionController tc)
1213                        throws StandardException;
1214
1215    /**
1216     * Update the conglomerateNumber for an array of ConglomerateDescriptors.
1217     * In case of more than one ConglomerateDescriptor, they are for duplicate
1218     * indexes sharing one conglomerate.
1219     * This is useful, in 1.3, when doing a bulkInsert into an
1220     * empty table where we insert into a new conglomerate.
1221     * (This will go away in 1.4.)
1222     *
1223     * @param cds The array of ConglomerateDescriptors
1224     * @param conglomerateNumber The new conglomerate number
1225     * @param tc The TransactionController to use
1226     *
1227     * @exception StandardException Thrown on failure
1228     */

1229    public void updateConglomerateDescriptor(ConglomerateDescriptor[] cds,
1230                                             long conglomerateNumber,
1231                                             TransactionController tc)
1232        throws StandardException;
1233
1234    /**
1235     * Update the conglomerateNumber for a ConglomerateDescriptor.
1236     * This is useful, in 1.3, when doing a bulkInsert into an
1237     * empty table where we insert into a new conglomerate.
1238     * (This will go away in 1.4.)
1239     *
1240     * @param cd The ConglomerateDescriptor
1241     * @param conglomerateNumber The new conglomerate number
1242     * @param tc The TransactionController to use
1243     *
1244     * @exception StandardException Thrown on failure
1245     */

1246    public void updateConglomerateDescriptor(ConglomerateDescriptor cd,
1247                                             long conglomerateNumber,
1248                                             TransactionController tc)
1249        throws StandardException;
1250
1251    /**
1252     * Gets a list of the dependency descriptors for the given dependent's id.
1253     *
1254     * @param dependentID The ID of the dependent we're interested in
1255     *
1256     * @return List Returns a list of DependencyDescriptors.
1257     * Returns an empty list if no stored dependencies for the
1258     * dependent's ID.
1259     *
1260     * @exception StandardException Thrown on failure
1261     */

1262    public List JavaDoc getDependentsDescriptorList(String JavaDoc dependentID)
1263        throws StandardException;
1264
1265    /**
1266     * Gets a list of the dependency descriptors for the given provider's id.
1267     *
1268     * @param providerID The ID of the provider we're interested in
1269     *
1270     * @return List Returns a list of DependencyDescriptors.
1271     * Returns an empty List if no stored dependencies for the
1272     * provider's ID.
1273     *
1274     * @exception StandardException Thrown on failure
1275     */

1276    public List JavaDoc getProvidersDescriptorList(String JavaDoc providerID)
1277        throws StandardException;
1278
1279    /**
1280     * Build and return an List with DependencyDescriptors for
1281     * all of the stored dependencies.
1282     * This is useful for consistency checking.
1283     *
1284     * @return List List of all DependencyDescriptors.
1285     *
1286     * @exception StandardException Thrown on failure
1287     */

1288    public List JavaDoc getAllDependencyDescriptorsList()
1289                throws StandardException;
1290
1291    /**
1292     * Drop a dependency from the data dictionary.
1293     *
1294     * @param dd The DependencyDescriptor.
1295     * @param tc TransactionController for the transaction
1296     *
1297     * @exception StandardException Thrown on failure
1298     */

1299    public void dropStoredDependency(DependencyDescriptor dd,
1300                                    TransactionController tc )
1301                throws StandardException;
1302
1303    /**
1304     * Remove all of the stored dependencies for a given dependent's ID
1305     * from the data dictionary.
1306     *
1307     * @param dependentsUUID Dependent's uuid
1308     * @param tc TransactionController for the transaction
1309     *
1310     * @exception StandardException Thrown on failure
1311     */

1312    public void dropDependentsStoredDependencies(UUID dependentsUUID,
1313                                       TransactionController tc)
1314                throws StandardException;
1315
1316    /**
1317     * Get the UUID Factory. (No need to make the UUIDFactory a module.)
1318     *
1319     * @return UUIDFactory The UUID Factory for this DataDictionary.
1320     */

1321    UUIDFactory getUUIDFactory();
1322
1323    /**
1324     * Get an AliasDescriptor given its UUID.
1325     *
1326     * @param uuid The UUID
1327     *
1328     *
1329     * @return The AliasDescriptor for method alias.
1330     *
1331     * @exception StandardException Thrown on failure
1332     */

1333    public AliasDescriptor getAliasDescriptor(UUID uuid)
1334                throws StandardException;
1335
1336    /**
1337     * Get a AliasDescriptor by alias name and name space.
1338     * NOTE: caller responsible for handling no match.
1339     *
1340       @param schemaID schema identifier
1341     * @param aliasName The alias name.
1342     * @param nameSpace The alias name space.
1343     *
1344     * @return AliasDescriptor AliasDescriptor for the alias name and name space
1345     *
1346     * @exception StandardException Thrown on failure
1347     */

1348    public AliasDescriptor getAliasDescriptor(String JavaDoc schemaID, String JavaDoc aliasName, char nameSpace)
1349            throws StandardException;
1350
1351    /**
1352        Get the list of routines matching the schema and routine name.
1353     */

1354    public java.util.List JavaDoc getRoutineList(String JavaDoc schemaID, String JavaDoc routineName, char nameSpace)
1355            throws StandardException;
1356    
1357    /**
1358     * Drop an AliasDescriptor from the DataDictionary
1359     *
1360     * @param ad The AliasDescriptor to drop
1361     * @param tc The TransactionController
1362     *
1363     * @exception StandardException Thrown on failure
1364     */

1365
1366    public void dropAliasDescriptor(AliasDescriptor ad,
1367                                    TransactionController tc)
1368            throws StandardException;
1369
1370    public int getEngineType();
1371
1372    /**
1373     * Get a FileInfoDescriptor given its id.
1374     *
1375     * @param id The descriptor's id.
1376     *
1377     * @exception StandardException Thrown on failure
1378     */

1379    public FileInfoDescriptor getFileInfoDescriptor(UUID id)
1380                throws StandardException;
1381
1382    /**
1383     * Get a FileInfoDescriptor given its SQL name and
1384     * schema name.
1385     *
1386     * @param sd the schema that holds the FileInfoDescriptor.
1387     * @param name SQL name of file.
1388     *
1389     * @exception StandardException Thrown on failure
1390     */

1391    public FileInfoDescriptor getFileInfoDescriptor(SchemaDescriptor sd, String JavaDoc name)
1392                throws StandardException;
1393
1394    /**
1395     * Drop a FileDescriptor from the datadictionary.
1396     *
1397     * @exception StandardException Oops
1398     */

1399    public void dropFileInfoDescriptor(FileInfoDescriptor fid)
1400                throws StandardException;
1401
1402
1403    /**
1404     * returns an array of RowLocations corresponding to
1405     * the autoincrement columns in the table. The RowLocation points to the
1406     * row in SYSCOLUMNS for this particular ai column.
1407     * The array has as many elements as there are columns in the table. If a column
1408     * is not an ai column, the entry is NULL.
1409     *
1410     * @param tc TransactionControler to use to compute the row location.
1411     * @param td TableDescriptor
1412     *
1413     * @return array of row locations, null if table has no autoinc columns.
1414     *
1415     * @exception standard exception on error.
1416     */

1417    public RowLocation[] computeAutoincRowLocations(TransactionController tc,
1418                                               TableDescriptor td)
1419        throws StandardException;
1420
1421        /* Returns a row location template for a table */
1422    public RowLocation getRowLocationTemplate( LanguageConnectionContext lcc, TableDescriptor td)
1423        throws StandardException;
1424
1425    /**
1426     * getSetAutoincrementValue fetches the autoincrement value from
1427     * SYSCOLUMNS given a row location. If doUpdate is true it updates
1428     * the autoincrement column with the new value.
1429     * the value returned by this routine is the new value and *NOT* the
1430     * value in the system catalogs.
1431     *
1432     * @param rl RowLocation of the entry in SYSCOLUMNS.
1433     * @param tc TransactionController to use.
1434     * @param doUpdate Write the new value to disk if TRUE.
1435     * @param newValue A NumberDataValue to use to return incremented value. If
1436     * null, then the caller simply wants the current value fromd disk.
1437     * @param wait If true, then the caller wants to wait for locks. When
1438     * using a nested user xaction we want to timeout right away if the parent
1439     * holds the lock.
1440     */

1441    public NumberDataValue getSetAutoincrementValue(RowLocation rl,
1442                                             TransactionController tc,
1443                                             boolean doUpdate,
1444                                             NumberDataValue newValue,
1445                                             boolean wait)
1446        throws StandardException;
1447
1448    /**
1449     * sets a new value in SYSCOLUMNS for a particular
1450     * autoincrement column.
1451     *
1452     * @param tc Transaction Controller to use.
1453     * @param tableUUID Table Descriptor
1454     * @param columnName Name of the column.
1455     * @param aiValue Value to write to SYSCOLUMNS.
1456     * @param incrementNeeded Whether we should increment the value passed in by
1457     * the user (aiValue) before writing the value to SYSCOLUMNS.
1458     */

1459    public void setAutoincrementValue(TransactionController tc,
1460                                      UUID tableUUID,
1461                                      String JavaDoc columnName,
1462                                      long aiValue,
1463                                      boolean incrementNeeded)
1464        throws StandardException;
1465    
1466    /**
1467     * Gets all statistics Descriptors for a given table.
1468     */

1469    public List JavaDoc getStatisticsDescriptors(TableDescriptor td)
1470        throws StandardException;
1471
1472    /**
1473     * Drops all statistics descriptors for a given table/index column
1474     * combination. If the index is not specified, then all statistics for the
1475     * table are dropped.
1476     *
1477     * @param tableUUID UUID of the table
1478     * @param referenceUUID UUID of the index. This can be null.
1479     * @param tc Transcation Controller to use.
1480     */

1481    public void dropStatisticsDescriptors(UUID tableUUID, UUID referenceUUID,
1482                                          TransactionController tc)
1483        throws StandardException;
1484    
1485    /**
1486     * Returns the dependency manager for this DataDictionary. Associated with
1487     * each DataDictionary object there is a DependencyManager object which
1488     * keeps track of both persistent and stored dependencies.
1489     *
1490     * @see org.apache.derby.iapi.sql.depend.DependencyManager
1491     */

1492    public DependencyManager getDependencyManager();
1493
1494
1495    /**
1496     * Returns the cache mode of the data dictionary.
1497     */

1498    public int getCacheMode();
1499
1500    /**
1501      * Returns a unique system generated name of the form SQLyymmddhhmmssxxn
1502      * yy - year, mm - month, dd - day of month, hh - hour, mm - minute, ss - second,
1503      * xx - the first 2 digits of millisec because we don't have enough space to keep the exact millisec value,
1504      * n - number between 0-9
1505      *
1506      * @return system generated unique name
1507      */

1508    public String JavaDoc getSystemSQLName();
1509
1510    /**
1511     * Adds a descriptor to a system catalog identified by the catalogNumber.
1512     *
1513     * @param tuple descriptor to insert.
1514     * @param parent parent descriptor; e.g for a column parent is the
1515     * tabledescriptor to which the descriptor is beign inserted. for most other
1516     * objects it is the schema descriptor.
1517     * @param catalogNumber a value which identifies the catalog into which
1518     * the descriptor should be inserted. It is the users responsibility to
1519     * ensure that the catalogNumber is consistent with the tuple being
1520     * inserted.
1521     * @see DataDictionary#SYSCONGLOMERATES_CATALOG_NUM
1522     * @param allowsDuplicates whether an exception should be thrown if the
1523     * insert results in a duplicate; if this parameter is FALSE then one
1524     * of the following exception will be thrown; LANG_OBJECT_ALREADY_EXISTS (if
1525     * parent is null) or LANG_OBJECT_ALREADY_EXISTS_IN_OBJECT (if parent is not
1526     * null). The error message is created by getting the name and type of the
1527     * tuple and parent.
1528     * @see org.apache.derby.impl.sql.catalog.DataDictionaryImpl#duplicateDescriptorException
1529     * @param tc the transaction controller to use to do all of this.
1530     *
1531     * @see #addDescriptorArray
1532     */

1533    public void addDescriptor(TupleDescriptor tuple, TupleDescriptor parent,
1534                              int catalogNumber, boolean allowsDuplicates,
1535                              TransactionController tc)
1536        throws StandardException;
1537
1538    /** array version of addDescriptor.
1539     * @see #addDescriptor
1540     */

1541    public void addDescriptorArray(TupleDescriptor[] tuple, TupleDescriptor parent,
1542                                   int catalogNumber, boolean allowsDuplicates,
1543                                   TransactionController tc)
1544        throws StandardException;
1545
1546
1547    /**
1548        Check to see if a database has been upgraded to the required
1549        level in order to use a langauge feature that is.
1550        <P>
1551        This is used to ensure new functionality that would lead on disk
1552        information not understood by a previous release is not executed
1553        while in soft upgrade mode. Ideally this is called at compile time
1554        and the parser has a utility method to enable easy use at parse time.
1555        <P>
1556        To use this method, a feature implemented in a certain release (DataDictionary version)
1557        would call it with the constant matching the release. E.g. for a new feature added
1558        in 10.1, a call such as
1559        <PRE>
1560        // check and throw an exception if the database is not at 10.1
1561        dd.checkVersion(DataDictionary.DD_VERSION_DERBY_10_1, "NEW FEATURE NAME");
1562        
1563        </PRE>
1564        This call would occur during the compile time, usually indirectly through
1565        the parser utility method, but direct calls can be made during QueryNode initialization,
1566        or even at bind time.
1567        <BR>
1568        It is not expected that this method would be called at execution time.
1569
1570        @param majorVersion Data Dictionary major version (DataDictionary.DD_ constant)
1571        @param feature Non-null to throw an error, null to return the state of the version match.
1572
1573        @return True if the database has been upgraded to the required level, false otherwise.
1574    */

1575    public boolean checkVersion(int majorVersion, String JavaDoc feature) throws StandardException;
1576    
1577    /**
1578     * Add or remove a permission to the permission database.
1579     *
1580     * @param add if true then add the permission, if false remove it.
1581     * @param perm
1582     * @param grantee
1583     * @param tc
1584     *
1585     * @return True means revoke has removed a privilege from system
1586     * table and hence the caller of this method should send invalidation
1587     * actions to PermssionDescriptor's dependents.
1588     */

1589    public boolean addRemovePermissionsDescriptor( boolean add,
1590                                                 PermissionsDescriptor perm,
1591                                                 String JavaDoc grantee,
1592                                                 TransactionController tc)
1593        throws StandardException;
1594
1595    /**
1596     * Get one user's privileges on a table using tableUUID and authorizationid
1597     *
1598     * @param tableUUID
1599     * @param authorizationId The user name
1600     *
1601     * @return a TablePermsDescriptor or null if the user has no permissions on the table.
1602     *
1603     * @exception StandardException
1604     */

1605    public TablePermsDescriptor getTablePermissions( UUID tableUUID, String JavaDoc authorizationId)
1606        throws StandardException;
1607
1608    /**
1609     * Get one user's privileges on a table using tablePermsUUID
1610     *
1611     * @param tablePermsUUID
1612     *
1613     * @return a TablePermsDescriptor
1614     *
1615     * @exception StandardException
1616     */

1617    public TablePermsDescriptor getTablePermissions( UUID tablePermsUUID)
1618    throws StandardException;
1619
1620    /**
1621     * Get one user's column privileges for a table.
1622     *
1623     * @param tableUUID
1624     * @param privType Authorizer.SELECT_PRIV, Authorizer.UPDATE_PRIV, or Authorizer.REFERENCES_PRIV
1625     * @param forGrant
1626     * @param authorizationId The user name
1627     *
1628     * @return a ColPermsDescriptor or null if the user has no separate column
1629     * permissions of the specified type on the table. Note that the user may have been granted
1630     * permission on all the columns of the table (no column list), in which case this routine
1631     * will return null. You must also call getTablePermissions to see if the user has permission
1632     * on a set of columns.
1633     *
1634     * @exception StandardException
1635     */

1636    public ColPermsDescriptor getColumnPermissions( UUID tableUUID,
1637                                                    int privType,
1638                                                    boolean forGrant,
1639                                                    String JavaDoc authorizationId)
1640        throws StandardException;
1641
1642
1643    /**
1644     * Get one user's column privileges for a table. This routine gets called
1645     * during revoke privilege processing
1646     *
1647     * @param tableUUID
1648     * @param privTypeStr (as String) Authorizer.SELECT_PRIV, Authorizer.UPDATE_PRIV, or Authorizer.REFERENCES_PRIV
1649     * @param forGrant
1650     * @param authorizationId The user name
1651     *
1652     * @return a ColPermsDescriptor or null if the user has no separate column
1653     * permissions of the specified type on the table. Note that the user may have been granted
1654     * permission on all the columns of the table (no column list), in which case this routine
1655     * will return null. You must also call getTablePermissions to see if the user has permission
1656     * on a set of columns.
1657     *
1658     * @exception StandardException
1659     */

1660    public ColPermsDescriptor getColumnPermissions( UUID tableUUID,
1661            String JavaDoc privTypeStr,
1662            boolean forGrant,
1663            String JavaDoc authorizationId)
1664    throws StandardException;
1665    /**
1666     * Get one user's column privileges on a table using colPermsUUID
1667     *
1668     * @param colPermsUUID
1669     *
1670     * @return a ColPermsDescriptor
1671     *
1672     * @exception StandardException
1673     */

1674    public ColPermsDescriptor getColumnPermissions( UUID colPermsUUID)
1675    throws StandardException;
1676
1677    /**
1678     * Get one user's permissions for a routine (function or procedure).
1679     *
1680     * @param routineUUID
1681     * @param authorizationId The user's name
1682     *
1683     * @return The descriptor of the users permissions for the routine.
1684     *
1685     * @exception StandardException
1686     */

1687    public RoutinePermsDescriptor getRoutinePermissions( UUID routineUUID, String JavaDoc authorizationId)
1688        throws StandardException;
1689    
1690    /**
1691     * Get one user's privileges for a routine using routinePermsUUID
1692     *
1693     * @param routinePermsUUID
1694     *
1695     * @return a RoutinePermsDescriptor
1696     *
1697     * @exception StandardException
1698     */

1699    public RoutinePermsDescriptor getRoutinePermissions( UUID routinePermsUUID)
1700    throws StandardException;
1701
1702    /**
1703     * Return the Java class to use for the VTI for
1704     * the virtual table. Assumes the descriptor is
1705     * of type TableDescriptor.VTI_TYPE.
1706     */

1707    public String JavaDoc getVTIClass(TableDescriptor td)
1708        throws StandardException;
1709
1710    
1711    /**
1712     * Adds a descriptor to a system catalog identified by the catalogNumber.
1713     *
1714     * @param tuple descriptor to insert.
1715     * @param parent parent descriptor; e.g for a column parent is the
1716     * tabledescriptor to which the descriptor is beign inserted. for most other
1717     * objects it is the schema descriptor.
1718     * @param catalogNumber a value which identifies the catalog into which
1719     * the descriptor should be inserted. It is the users responsibility to
1720     * ensure that the catalogNumber is consistent with the tuple being
1721     * inserted.
1722     * @see DataDictionary#SYSCONGLOMERATES_CATALOG_NUM
1723     * @param allowsDuplicates whether an exception should be thrown if the
1724     * insert results in a duplicate; if this parameter is FALSE then one
1725     * of the following exception will be thrown; LANG_OBJECT_ALREADY_EXISTS (if
1726     * parent is null) or LANG_OBJECT_ALREADY_EXISTS_IN_OBJECT (if parent is not
1727     * null). The error message is created by getting the name and type of the
1728     * tuple and parent.
1729     * @see org.apache.derby.impl.sql.catalog.DataDictionaryImpl#duplicateDescriptorException
1730     * @param tc the transaction controller to use to do all of this.
1731     * @param wait If true, then the caller wants to wait for locks. False will
1732     * be when we using a nested user xaction - we want to timeout
1733     * right away if the parent holds the lock.
1734     * @see #addDescriptorArray
1735     */

1736    public void addDescriptor(TupleDescriptor tuple, TupleDescriptor parent,
1737                              int catalogNumber, boolean allowsDuplicates,
1738                              TransactionController tc, boolean wait)
1739        throws StandardException;
1740    
1741    /**
1742     * Remove all of the stored dependencies for a given dependent's ID
1743     * from the data dictionary.
1744     *
1745     * @param dependentsUUID Dependent's uuid
1746     * @param tc TransactionController for the transaction
1747     * @param wait If true, then the caller wants to wait for locks. False will
1748     * be when we using a nested user xaction - we want to timeout
1749     * right away if the parent holds the lock.
1750     *
1751     * @exception StandardException Thrown on failure
1752     */

1753    public void dropDependentsStoredDependencies(UUID dependentsUUID,
1754                                       TransactionController tc,
1755                                       boolean wait)
1756                throws StandardException;
1757
1758}
1759
Popular Tags