Source Code Cross Referenced for DataDictionary.java in  » Database-DBMS » db-derby-10.2 » org » apache » derby » iapi » sql » dictionary » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database DBMS » db derby 10.2 » org.apache.derby.iapi.sql.dictionary 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:
0003:           Derby - Class org.apache.derby.iapi.sql.dictionary.DataDictionary
0004:
0005:           Licensed to the Apache Software Foundation (ASF) under one or more
0006:           contributor license agreements.  See the NOTICE file distributed with
0007:           this work for additional information regarding copyright ownership.
0008:           The ASF licenses this file to you under the Apache License, Version 2.0
0009:           (the "License"); you may not use this file except in compliance with
0010:           the License.  You may obtain a copy of the License at
0011:
0012:              http://www.apache.org/licenses/LICENSE-2.0
0013:
0014:           Unless required by applicable law or agreed to in writing, software
0015:           distributed under the License is distributed on an "AS IS" BASIS,
0016:           WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0017:           See the License for the specific language governing permissions and
0018:           limitations under the License.
0019:
0020:         */
0021:
0022:        package org.apache.derby.iapi.sql.dictionary;
0023:
0024:        import org.apache.derby.iapi.services.context.ContextManager;
0025:
0026:        import org.apache.derby.iapi.sql.depend.DependencyManager;
0027:        import org.apache.derby.iapi.sql.depend.Dependent;
0028:        import org.apache.derby.iapi.sql.depend.Provider;
0029:
0030:        import org.apache.derby.iapi.sql.PreparedStatement;
0031:        import org.apache.derby.iapi.types.DataTypeDescriptor;
0032:        import org.apache.derby.iapi.types.NumberDataValue;
0033:        import org.apache.derby.iapi.types.DataValueFactory;
0034:        import org.apache.derby.iapi.types.DataValueDescriptor;
0035:        import org.apache.derby.iapi.sql.compile.CostEstimate;
0036:        import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;
0037:        import org.apache.derby.iapi.sql.execute.ExecutionFactory;
0038:        import org.apache.derby.iapi.error.StandardException;
0039:        import org.apache.derby.iapi.store.access.TransactionController;
0040:        import org.apache.derby.iapi.types.RowLocation;
0041:
0042:        import org.apache.derby.catalog.UUID;
0043:        import org.apache.derby.iapi.services.uuid.UUIDFactory;
0044:
0045:        import java.util.List;
0046:        import java.util.Hashtable;
0047:        import java.util.Properties;
0048:        import java.util.Vector;
0049:
0050:        /**
0051:         * The DataDictionary interface is used with the data dictionary to get
0052:         * descriptors for binding and compilation. Some descriptors (such as table
0053:         * and column descriptors) are added to and deleted from the data dictionary
0054:         * by other modules (like the object store). Other descriptors are added and
0055:         * deleted by the language module itself (e.g. the language module adds and
0056:         * deletes views, because views are too high-level for modules like the object
0057:         * store to know about).
0058:         *
0059:         * @version 0.1
0060:         * @author Jeff Lichtman
0061:         */
0062:
0063:        public interface DataDictionary {
0064:            String MODULE = "org.apache.derby.iapi.sql.dictionary.DataDictionary";
0065:
0066:            /** Special version indicating the database must be upgraded to or created at the current engine level 
0067:             * 
0068:             * DatabaseMetaData will use this to determine if the data dictionary 
0069:             * is at the latest System Catalog version number. A data dictionary version
0070:             * will not be at latest System Catalog version when the database is getting
0071:             * booted in soft upgrade mode. In soft upgrade mode, engine should goto 
0072:             * metadata.properties to get the sql for the metadata calls rather
0073:             * than going to the system tables (and using stored versions of these queries). 
0074:             * This is required because if the metadata sql has changed between the 
0075:             * releases, we want to use the latest metadata sql rather than what is 
0076:             * stored in the system catalogs. Had to introduce this behavior for
0077:             * EmbeddedDatabaseMetaData in 10.2 release where optimizer overrides 
0078:             * syntax was changed. If 10.2 engine in soft upgrade mode for a pre-10.2 
0079:             * database went to system tables for stored metadata queires, the metadata 
0080:             * calls would fail because 10.2 release doesn't recognize the pre-10.2 
0081:             * optimizer overrides syntax. To get around this, the 10.2 engine in 
0082:             * soft upgrade mode should get the sql from metata.properties which has 
0083:             * been changed to 10.2 syntax for optimizer overrides. To make this 
0084:             * approach more generic for all soft upgrades, from 10.2 release onwards, 
0085:             * DatabaseMetaData calls will always look at metadata.properties so it 
0086:             * will get the compatible syntax for that release.
0087:             */
0088:            public static final int DD_VERSION_CURRENT = -1;
0089:            /** Cloudscape 5.0 System Catalog version */
0090:            public static final int DD_VERSION_CS_5_0 = 80;
0091:            /** Cloudscape 5.1 (Arwen) System Catalog version */
0092:            public static final int DD_VERSION_CS_5_1 = 90;
0093:            /** Cloudscape 5.2 (Frodo) System Catalog version */
0094:            public static final int DD_VERSION_CS_5_2 = 100;
0095:            /** Cloudscape 8.1 (Pre-Gandalf) System Catalog version */
0096:            public static final int DD_VERSION_CS_8_1 = 110;
0097:            /** Cloudscape/Derby 10.0 (Gandalf) System Catalog version */
0098:            public static final int DD_VERSION_CS_10_0 = 120;
0099:
0100:            /** Derby 10.1 System Catalog version */
0101:            public static final int DD_VERSION_DERBY_10_1 = 130;
0102:
0103:            /** Derby 10.2 System Catalog version */
0104:            public static final int DD_VERSION_DERBY_10_2 = 140;
0105:
0106:            // general info
0107:            public static final String DATABASE_ID = "derby.databaseID";
0108:
0109:            // version ids
0110:            /**
0111:             * DataDictionaryVersion property indicates the updgrade level of the system catalogs.
0112:             * Stored as a database property. Set to an instance of DD_Version with
0113:             * the major number one of the DataDictionary.DD_* values.
0114:             */
0115:            public static final String CORE_DATA_DICTIONARY_VERSION = "DataDictionaryVersion";
0116:            /**
0117:             * CreateDataDictionaryVersion property indicates the level of the system catalogs,
0118:             * at the time of database creation.
0119:             * Stored as a database property. Set to an instance of DD_Version.
0120:             */
0121:            public static final String CREATE_DATA_DICTIONARY_VERSION = "CreateDataDictionaryVersion";
0122:            /**
0123:             * derby.softDataDictionaryVersion property indicates the soft upgrade level of the system catalogs.
0124:             * Soft upgrade will sometime make minor changes to the system catalogs that can be safely consumed by
0125:             * earlier versions, such as correcting values.
0126:             * Stored as a database property. Set to an instance of DD_Version.
0127:             */
0128:            public static final String SOFT_DATA_DICTIONARY_VERSION = "derby.softDataDictionaryVersion";
0129:            public static final String PROPERTY_CONGLOMERATE_VERSION = "PropertyConglomerateVersion";
0130:
0131:            /*
0132:             ** CORE TABLES
0133:             */
0134:            /* NOTE - SYSCONGLOMERATES must be first, since that table must exist before
0135:             * any other conglomerates can be created/added to the system.
0136:             */
0137:            public static final int SYSCONGLOMERATES_CATALOG_NUM = 0;
0138:            public static final int SYSTABLES_CATALOG_NUM = 1;
0139:            public static final int SYSCOLUMNS_CATALOG_NUM = 2;
0140:            public static final int SYSSCHEMAS_CATALOG_NUM = 3;
0141:
0142:            /**
0143:             * Catalog numbers for non core system catalogs.
0144:             */
0145:            public static final int SYSCONSTRAINTS_CATALOG_NUM = 4;
0146:            public static final int SYSKEYS_CATALOG_NUM = 5;
0147:            public static final int SYSDEPENDS_CATALOG_NUM = 6;
0148:            public static final int SYSALIASES_CATALOG_NUM = 7;
0149:            public static final int SYSVIEWS_CATALOG_NUM = 8;
0150:            public static final int SYSCHECKS_CATALOG_NUM = 9;
0151:            public static final int SYSFOREIGNKEYS_CATALOG_NUM = 10;
0152:            public static final int SYSSTATEMENTS_CATALOG_NUM = 11;
0153:            public static final int SYSFILES_CATALOG_NUM = 12;
0154:            public static final int SYSTRIGGERS_CATALOG_NUM = 13;
0155:            public static final int SYSSTATISTICS_CATALOG_NUM = 14;
0156:            public static final int SYSDUMMY1_CATALOG_NUM = 15;
0157:            public static final int SYSTABLEPERMS_CATALOG_NUM = 16;
0158:            public static final int SYSCOLPERMS_CATALOG_NUM = 17;
0159:            public static final int SYSROUTINEPERMS_CATALOG_NUM = 18;
0160:
0161:            /* static finals for constraints 
0162:             * (Here because they are needed by parser, compilation and execution.)
0163:             */
0164:            public static final int NOTNULL_CONSTRAINT = 1;
0165:            public static final int PRIMARYKEY_CONSTRAINT = 2;
0166:            public static final int UNIQUE_CONSTRAINT = 3;
0167:            public static final int CHECK_CONSTRAINT = 4;
0168:            public static final int DROP_CONSTRAINT = 5;
0169:            public static final int FOREIGNKEY_CONSTRAINT = 6;
0170:
0171:            /** Modes returned from startReading() */
0172:            public static final int COMPILE_ONLY_MODE = 0;
0173:            public static final int DDL_MODE = 1;
0174:
0175:            /**
0176:             * Push a data dictionary context onto the
0177:             * current context manager.
0178:             *
0179:             * @param cm Context manager
0180:             */
0181:            DataDictionaryContext pushDataDictionaryContext(ContextManager cm);
0182:
0183:            /**
0184:             * Clear all of the DataDictionary caches.
0185:             *
0186:             * @exception StandardException Standard Cloudscape error policy
0187:             */
0188:            public void clearCaches() throws StandardException;
0189:
0190:            /**
0191:             * Inform this DataDictionary that we are about to start reading it.  This
0192:             * means using the various get methods in the DataDictionary.
0193:             * Generally, this is done during query compilation.
0194:             *
0195:             * @param lcc	The LanguageConnectionContext to use.
0196:             *
0197:             * @return	The mode that the reader will use, to be passed to doneReading()
0198:             *			Either COMPILE_ONLY_MODE or DDL_MODE.
0199:             *
0200:             * @exception StandardException		Thrown on error
0201:             */
0202:            public int startReading(LanguageConnectionContext lcc)
0203:                    throws StandardException;
0204:
0205:            /**
0206:             * Inform this DataDictionary that we have finished reading it.  This
0207:             * typically happens at the end of compilation.
0208:             *
0209:             * @param mode	The mode that was returned by startReading().
0210:             * @param lcc	The LanguageConnectionContext to use.
0211:             *
0212:             * @exception StandardException		Thrown on error
0213:             */
0214:            public void doneReading(int mode, LanguageConnectionContext lcc)
0215:                    throws StandardException;
0216:
0217:            /**
0218:             * Inform this DataDictionary that we are about to start writing to it.
0219:             * This means using the various add and drop methods in the DataDictionary.
0220:             * Generally, this is done during execution of DDL.
0221:             *
0222:             * @param lcc	The LanguageConnectionContext to use.
0223:             *
0224:             * @exception StandardException		Thrown on error
0225:             */
0226:            public void startWriting(LanguageConnectionContext lcc)
0227:                    throws StandardException;
0228:
0229:            /**
0230:             * Inform this DataDictionary that the transaction in which writes have
0231:             * been done (or may have been done) has been committed or rolled back.
0232:             *
0233:             * @exception StandardException		Thrown on error
0234:             */
0235:            public void transactionFinished() throws StandardException;
0236:
0237:            /**
0238:             * Get the ExecutionFactory associated with this database.
0239:             *
0240:             * @return	The ExecutionFactory
0241:             */
0242:            public ExecutionFactory getExecutionFactory();
0243:
0244:            /**
0245:             * Get the DataValueFactory associated with this database.
0246:             *
0247:             * @return	The ExecutionFactory
0248:             */
0249:            public DataValueFactory getDataValueFactory();
0250:
0251:            /**
0252:             * Get a DataDescriptorGenerator, through which we can create
0253:             * objects to be stored in the DataDictionary.
0254:             *
0255:             * @return	A DataDescriptorGenerator
0256:             *
0257:             */
0258:            public DataDescriptorGenerator getDataDescriptorGenerator();
0259:
0260:            /**
0261:             * Get authorizationID of Database Owner
0262:             *
0263:             * @return	authorizationID
0264:             */
0265:            public String getAuthorizationDatabaseOwner();
0266:
0267:            /**
0268:             * Get authorization model in force, SqlStandard or legacy mode
0269:             *
0270:             * @return	Whether sqlAuthorization is being used
0271:             */
0272:            public boolean usesSqlAuthorization();
0273:
0274:            /**
0275:             * Get the descriptor for the named schema.
0276:               Schema descriptors include authorization ids and schema ids.
0277:             * SQL92 allows a schema to specify a default character set - we will
0278:             * not support this.  Will check default schema for a match
0279:             * before scanning a system table.
0280:             * 
0281:             * @param schemaName	The name of the schema we're interested in. Must not be null.
0282:             * @param tc			TransactionController
0283:             *
0284:             * @param raiseError    whether an exception should be thrown if the schema does not exist.
0285:             *
0286:             * @return	The descriptor for the schema. Can be null (not found) if raiseError is false.
0287:             *
0288:             * @exception StandardException		Thrown on error
0289:             */
0290:
0291:            public SchemaDescriptor getSchemaDescriptor(String schemaName,
0292:                    TransactionController tc, boolean raiseError)
0293:                    throws StandardException;
0294:
0295:            /**
0296:             * Get the descriptor for the named schema. If the schemaId
0297:             * parameter is NULL, it gets the descriptor for the current (default)
0298:             * schema. Schema descriptors include authorization ids and schema ids.
0299:             * SQL92 allows a schema to specify a default character set - we will
0300:             * not support this.
0301:             *
0302:             * @param schemaId	The id of the schema we're interested in.
0303:             *			If the name is NULL, get the descriptor for the
0304:             *			current schema.
0305:             *
0306:             * @param tc		The transaction controller to us when scanning
0307:             *					SYSSCHEMAS
0308:             *
0309:             * @return	The descriptor for the schema.
0310:             *
0311:             * @exception StandardException		Thrown on failure
0312:             */
0313:            public SchemaDescriptor getSchemaDescriptor(UUID schemaId,
0314:                    TransactionController tc) throws StandardException;
0315:
0316:            /**
0317:             * Get the descriptor for the system schema. Schema descriptors include 
0318:             * authorization ids and schema ids.
0319:             *
0320:             * SQL92 allows a schema to specify a default character set - we will
0321:             * not support this.
0322:             *
0323:             * @return	The descriptor for the schema.
0324:             *
0325:             * @exception StandardException		Thrown on failure
0326:             */
0327:            public SchemaDescriptor getSystemSchemaDescriptor()
0328:                    throws StandardException;
0329:
0330:            /**
0331:             * Get the descriptor for the SYSIBM schema. Schema descriptors include 
0332:             * authorization ids and schema ids.
0333:             *
0334:             * SQL92 allows a schema to specify a default character set - we will
0335:             * not support this.
0336:             *
0337:             * @return	The descriptor for the schema.
0338:             *
0339:             * @exception StandardException		Thrown on failure
0340:             */
0341:            public SchemaDescriptor getSysIBMSchemaDescriptor()
0342:                    throws StandardException;
0343:
0344:            /**
0345:             * Get the descriptor for the SYSCS_DIAG schema. Schema descriptors 
0346:             * include authorization ids and schema ids.
0347:             *
0348:             * SQL92 allows a schema to specify a default character set - we will
0349:             * not support this.
0350:             *
0351:             * @return	The descriptor for the schema.
0352:             *
0353:             * @exception StandardException		Thrown on failure
0354:             */
0355:            public SchemaDescriptor getSystemDiagSchemaDescriptor()
0356:                    throws StandardException;
0357:
0358:            /**
0359:             * Get the descriptor for the declared global temporary table schema which is always named "SESSION".
0360:             *
0361:             * SQL92 allows a schema to specify a default character set - we will
0362:             * not support this.
0363:             *
0364:             * @return	The descriptor for the schema.
0365:             *
0366:             * @exception StandardException		Thrown on failure
0367:             */
0368:            public SchemaDescriptor getDeclaredGlobalTemporaryTablesSchemaDescriptor()
0369:                    throws StandardException;
0370:
0371:            /**
0372:             * Determine whether a string is the name of the system schema.
0373:             *
0374:             * @param name
0375:             * @return	true or false
0376:             *
0377:             * @exception StandardException		Thrown on failure
0378:             */
0379:            public boolean isSystemSchemaName(String name)
0380:                    throws StandardException;
0381:
0382:            /**
0383:             * Drop the descriptor for a schema, given the schema's name
0384:             *
0385:             * @param schemaName	The name of the schema to drop
0386:             * @param tc			Transaction Controller	
0387:             *
0388:             * @exception StandardException		Thrown on failure
0389:             */
0390:            public void dropSchemaDescriptor(String schemaName,
0391:                    TransactionController tc) throws StandardException;
0392:
0393:            /**
0394:             * Indicate whether there is anything in the 
0395:             * particular schema.  Checks for tables in the
0396:             * the schema, on the assumption that there cannot
0397:             * be any other objects in a schema w/o a table.
0398:             *
0399:             * @param sd schema descriptor
0400:             *
0401:             * @return true/false
0402:             *
0403:             * @exception StandardException on error
0404:             */
0405:            public boolean isSchemaEmpty(SchemaDescriptor sd)
0406:                    throws StandardException;
0407:
0408:            /**
0409:             * Get the descriptor for the named table within the given schema.
0410:             * If the schema parameter is NULL, it looks for the table in the
0411:             * current (default) schema. Table descriptors include object ids,
0412:             * object types (table, view, etc.)
0413:             *
0414:             * @param tableName	The name of the table to get the descriptor for
0415:             * @param schema	The descriptor for the schema the table lives in.
0416:             *			If null, use the current (default) schema.
0417:             *
0418:             * @return	The descriptor for the table, null if table does not
0419:             *		existe.
0420:             *
0421:             * @exception StandardException		Thrown on failure
0422:             */
0423:            public TableDescriptor getTableDescriptor(String tableName,
0424:                    SchemaDescriptor schema) throws StandardException;
0425:
0426:            /**
0427:             * Get the descriptor for the table with the given UUID.
0428:             *
0429:             * NOTE: I'm assuming that the object store will define an UUID for
0430:             * persistent objects. I'm also assuming that UUIDs are unique across
0431:             * schemas, and that the object store will be able to do efficient
0432:             * lookups across schemas (i.e. that no schema descriptor parameter
0433:             * is needed).
0434:             *
0435:             * @param tableID	The UUID of the table to get the descriptor for
0436:             *
0437:             * @return	The descriptor for the table, null if the table does
0438:             *		not exist.
0439:             *
0440:             * @exception StandardException		Thrown on failure
0441:             */
0442:            public TableDescriptor getTableDescriptor(UUID tableID)
0443:                    throws StandardException;
0444:
0445:            /**
0446:             * Drop the table descriptor.
0447:             *
0448:             * @param td	The table descriptor to drop
0449:             * @param schema		A descriptor for the schema the table
0450:             *						is a part of.  If this parameter is
0451:             *						NULL, then the table is part of the
0452:             *						current (default) schema
0453:             * @param tc			TransactionController for the transaction
0454:             * @exception StandardException		Thrown on error
0455:             */
0456:            public void dropTableDescriptor(TableDescriptor td,
0457:                    SchemaDescriptor schema, TransactionController tc)
0458:                    throws StandardException;
0459:
0460:            /**
0461:             * Update the lockGranularity for the specified table.
0462:             *
0463:             * @param td				The TableDescriptor for the table
0464:             * @param schema			The SchemaDescriptor for the table
0465:             * @param lockGranularity	The new lockGranularity
0466:             * @param tc				The TransactionController to use.
0467:             *
0468:             * @exception StandardException		Thrown on error
0469:             */
0470:            public void updateLockGranularity(TableDescriptor td,
0471:                    SchemaDescriptor schema, char lockGranularity,
0472:                    TransactionController tc) throws StandardException;
0473:
0474:            /**
0475:             * Drop all table descriptors for a schema.
0476:             *
0477:             * @param schema	A descriptor for the schema to drop the tables
0478:             *			from.
0479:             *
0480:             * @exception StandardException		Thrown on failure
0481:             */
0482:            /*
0483:            public void dropAllTableDescriptors(SchemaDescriptor schema)
0484:            					throws StandardException;
0485:             */
0486:
0487:            /**
0488:             * Get a ColumnDescriptor given its Default ID.
0489:             *
0490:             * @param uuid	The UUID of the default
0491:             *
0492:             * @return The ColumnDescriptor for the column.
0493:             *
0494:             * @exception StandardException		Thrown on failure
0495:             */
0496:            public ColumnDescriptor getColumnDescriptorByDefaultId(UUID uuid)
0497:                    throws StandardException;
0498:
0499:            /**
0500:             * Given a column name and a table ID, drops the column descriptor
0501:             * from the table.
0502:             *
0503:             * @param tableID	The UUID of the table to drop the column from
0504:             * @param columnName	The name of the column to drop
0505:             * @param tc		TransactionController for the transaction
0506:             *
0507:             * @exception StandardException		Thrown on failure
0508:             */
0509:            public void dropColumnDescriptor(UUID tableID, String columnName,
0510:                    TransactionController tc) throws StandardException;
0511:
0512:            /**
0513:             * Drops all column descriptors from the given table.  Useful for
0514:             * DROP TABLE.
0515:             *
0516:             * @param tableID	The UUID of the table from which to drop
0517:             *			all the column descriptors
0518:             * @param tc		TransactionController for the transaction
0519:             *
0520:             * @exception StandardException		Thrown on failure
0521:             */
0522:            public void dropAllColumnDescriptors(UUID tableID,
0523:                    TransactionController tc) throws StandardException;
0524:
0525:            /**
0526:             * Drops all table and column permission descriptors for the given table.
0527:             *
0528:             * @param tableID	The UUID of the table for which to drop
0529:             *			all the table and column permission descriptors
0530:             * @param tc		TransactionController for the transaction
0531:             *
0532:             * @exception StandardException		Thrown on failure
0533:             */
0534:            public void dropAllTableAndColPermDescriptors(UUID tableID,
0535:                    TransactionController tc) throws StandardException;
0536:
0537:            /**
0538:             * Need to update SYSCOLPERMS for a given table because a new column has 
0539:             * been added to that table. SYSCOLPERMS has a column called "COLUMNS"
0540:             * which is a bit map for all the columns in a given user table. Since
0541:             * ALTER TABLE .. ADD COLUMN .. has added one more column, we need to
0542:             * expand "COLUMNS" for that new column
0543:             *
0544:             * Currently, this code gets called during execution phase of
0545:             * ALTER TABLE .. ADD COLUMN .. 
0546:             *
0547:             * @param tableID	The UUID of the table to which a column has been added
0548:             * @param tc		TransactionController for the transaction
0549:             *
0550:             * @exception StandardException		Thrown on error
0551:             */
0552:            public void updateSYSCOLPERMSforAddColumnToUserTable(UUID tableID,
0553:                    TransactionController tc) throws StandardException;
0554:
0555:            /**
0556:             * Drops all routine permission descriptors for the given routine.
0557:             *
0558:             * @param routineID	The UUID of the routine for which to drop
0559:             *			all the permission descriptors
0560:             * @param tc		TransactionController for the transaction
0561:             *
0562:             * @exception StandardException		Thrown on failure
0563:             */
0564:            public void dropAllRoutinePermDescriptors(UUID routineID,
0565:                    TransactionController tc) throws StandardException;
0566:
0567:            /**
0568:             * Gets the viewDescriptor for the view with the given UUID.
0569:             *
0570:             * @param uuid	The UUID for the view
0571:             *
0572:             * @return  A descriptor for the view
0573:             *
0574:             * @exception StandardException		Thrown on error
0575:             */
0576:            public ViewDescriptor getViewDescriptor(UUID uuid)
0577:                    throws StandardException;
0578:
0579:            /**
0580:             * Gets the viewDescriptor for the view given its TableDescriptor.
0581:             *
0582:             * @param td	The TableDescriptor for the view.
0583:             *
0584:             * @return	A descriptor for the view
0585:             *
0586:             * @exception StandardException		Thrown on error
0587:             */
0588:            public ViewDescriptor getViewDescriptor(TableDescriptor td)
0589:                    throws StandardException;
0590:
0591:            /**
0592:             * Drops the view descriptor from the data dictionary.
0593:             *
0594:             * @param viewDescriptor	A descriptor for the view to be dropped
0595:             * @param tc				TransactionController to use
0596:             *
0597:             * @exception StandardException		Thrown on failure
0598:             */
0599:            public void dropViewDescriptor(ViewDescriptor viewDescriptor,
0600:                    TransactionController tc) throws StandardException;
0601:
0602:            /**
0603:             * Get a ConstraintDescriptor given its UUID.
0604:             *
0605:             * @param uuid	The UUID
0606:             *
0607:             * @return The ConstraintDescriptor for the constraint.
0608:             *
0609:             * @exception StandardException		Thrown on failure
0610:             */
0611:            public ConstraintDescriptor getConstraintDescriptor(UUID uuid)
0612:                    throws StandardException;
0613:
0614:            /**
0615:             * Get a ConstraintDescriptor given its name and schema ID.
0616:             *
0617:             * @param constraintName	Constraint name.
0618:             * @param schemaID			The schema UUID
0619:             *
0620:             * @return The ConstraintDescriptor for the constraint.
0621:             *
0622:             * @exception StandardException		Thrown on failure
0623:             */
0624:            public ConstraintDescriptor getConstraintDescriptor(
0625:                    String constraintName, UUID schemaID)
0626:                    throws StandardException;
0627:
0628:            /**
0629:             * Load up the constraint descriptor list for this table
0630:             * descriptor and return it.  If the descriptor list
0631:             * is already loaded up, it is retuned without further
0632:             * ado.
0633:             *
0634:             * @param td			The table descriptor.
0635:             *
0636:             * @return The ConstraintDescriptorList for the table
0637:             *
0638:             * @exception StandardException		Thrown on failure
0639:             */
0640:            public ConstraintDescriptorList getConstraintDescriptors(
0641:                    TableDescriptor td) throws StandardException;
0642:
0643:            /**
0644:             * Convert a constraint descriptor list into a list
0645:             * of active constraints, that is, constraints which
0646:             * must be enforced. For the Core product, these
0647:             * are just the constraints on the original list.
0648:             * However, during REFRESH we may have deferred some
0649:             * constraints until statement end. This method returns
0650:             * the corresponding list of constraints which AREN'T
0651:             * deferred.
0652:             *
0653:             * @param cdl	The constraint descriptor list to wrap with
0654:             *				an Active constraint descriptor list.
0655:             *
0656:             * @return The corresponding Active ConstraintDescriptorList
0657:             *
0658:             * @exception StandardException		Thrown on failure
0659:             */
0660:            public ConstraintDescriptorList getActiveConstraintDescriptors(
0661:                    ConstraintDescriptorList cdl) throws StandardException;
0662:
0663:            /**
0664:             * Reports whether an individual constraint must be
0665:             * enforced. For the Core product, this routine always
0666:             * returns true.
0667:             *
0668:             * However, during REFRESH we may have deferred some
0669:             * constraints until statement end. This method returns
0670:             * false if the constraint deferred
0671:             *
0672:             * @param constraint	the constraint to check
0673:             *
0674:             *
0675:             * @return The corresponding Active ConstraintDescriptorList
0676:             *
0677:             * @exception StandardException		Thrown on failure
0678:             */
0679:            public boolean activeConstraint(ConstraintDescriptor constraint)
0680:                    throws StandardException;
0681:
0682:            /** 
0683:             * Get the constraint descriptor given a table and the UUID String
0684:             * of the backing index.
0685:             *
0686:             * @param td			The table descriptor.
0687:             * @param uuid			The UUID  for the backing index.
0688:             *
0689:             * @return The ConstraintDescriptor for the constraint.
0690:             *
0691:             * @exception StandardException		Thrown on failure
0692:             */
0693:            public ConstraintDescriptor getConstraintDescriptor(
0694:                    TableDescriptor td, UUID uuid) throws StandardException;
0695:
0696:            /**
0697:             * Get the constraint descriptor given a table and the UUID String
0698:             * of the constraint
0699:             *
0700:             * @param td			The table descriptor.
0701:             * @param uuid			The UUID for the constraint
0702:             *
0703:             * @return The ConstraintDescriptor for the constraint.
0704:             *
0705:             * @exception StandardException		Thrown on failure
0706:             */
0707:            public ConstraintDescriptor getConstraintDescriptorById(
0708:                    TableDescriptor td, UUID uuid) throws StandardException;
0709:
0710:            /** 
0711:             * Get the constraint descriptor given a TableDescriptor and the constraint name.
0712:             *
0713:             * @param td				The table descriptor.
0714:             * @param sd				The schema descriptor for the constraint
0715:             * @param constraintName	The constraint name.
0716:             * @param forUpdate			Whether or not access is for update
0717:             *
0718:             * @return The ConstraintDescriptor for the constraint.
0719:             *
0720:             * @exception StandardException		Thrown on failure
0721:             */
0722:            public ConstraintDescriptor getConstraintDescriptorByName(
0723:                    TableDescriptor td, SchemaDescriptor sd,
0724:                    String constraintName, boolean forUpdate)
0725:                    throws StandardException;
0726:
0727:            /**
0728:             * Return a table descriptor corresponding to the TABLEID
0729:             * field in SYSCONSTRAINTS where CONSTRAINTID matches
0730:             * the constraintId passed in.
0731:             *
0732:             * @param constraintId	The id of the constraint
0733:             *
0734:             * @return	the corresponding table descriptor
0735:             *
0736:             * @exception StandardException		Thrown on error
0737:             */
0738:            public TableDescriptor getConstraintTableDescriptor(
0739:                    UUID constraintId) throws StandardException;
0740:
0741:            /**
0742:             * Return a list of foreign keys constraints referencing
0743:             * this constraint.  Returns both enabled and disabled
0744:             * constraints.  
0745:             *
0746:             * @param constraintId	The id of the referenced constraint
0747:             *
0748:             * @return	list of constraints
0749:             *
0750:             * @exception StandardException		Thrown on error
0751:             */
0752:            public ConstraintDescriptorList getForeignKeys(UUID constraintId)
0753:                    throws StandardException;
0754:
0755:            /**
0756:             * Adds the given ConstraintDescriptor to the data dictionary,
0757:             * associated with the given table and constraint type.
0758:             *
0759:             * @param descriptor	The descriptor to add
0760:             * @param tc			The transaction controller
0761:             *
0762:             * @exception StandardException		Thrown on error
0763:             */
0764:            public void addConstraintDescriptor(
0765:                    ConstraintDescriptor descriptor, TransactionController tc)
0766:                    throws StandardException;
0767:
0768:            /**
0769:             * Drops the given ConstraintDescriptor that is associated
0770:             * with the given table and constraint type from the data dictionary.
0771:             *
0772:             * NOTE: Caller is responsible for dropping any backing index
0773:             *
0774:             * @param table	The table from which to drop the
0775:             *			constraint descriptor
0776:             * @param descriptor	The descriptor to drop
0777:             * @param tc	The TransactionController.
0778:             *
0779:             * @exception StandardException		Thrown on failure
0780:             */
0781:            public void dropConstraintDescriptor(TableDescriptor table,
0782:                    ConstraintDescriptor descriptor, TransactionController tc)
0783:                    throws StandardException;
0784:
0785:            /**
0786:             * Drops all ConstraintDescriptors from the data dictionary
0787:             * that are associated with the given table.
0788:             *
0789:             * NOTE: Caller is responsible for dropping any backing index
0790:             *
0791:             * @param table	The table from which to drop all
0792:             *			constraint descriptors
0793:             * @param tc	The TransactionController.
0794:             *
0795:             * @exception StandardException		Thrown on failure
0796:             */
0797:            public void dropAllConstraintDescriptors(TableDescriptor table,
0798:                    TransactionController tc) throws StandardException;
0799:
0800:            /**
0801:             * Update the constraint descriptor in question.  Updates
0802:             * every row in the base conglomerate.  
0803:             *
0804:             * @param cd					The Constraintescriptor
0805:             * @param formerUUID			The UUID for this column in SYSCONSTRAINTS,
0806:             *								may differ from what is in cd if this
0807:             *								is the column that is being set.
0808:             * @param colsToSet 			Array of ints of columns to be modified,
0809:             *								1 based.  May be null (all cols).
0810:             * @param tc					The TransactionController to use
0811:             *
0812:             *
0813:             * @exception StandardException		Thrown on failure
0814:             */
0815:            public void updateConstraintDescriptor(ConstraintDescriptor cd,
0816:                    UUID formerUUID, int[] colsToSet, TransactionController tc)
0817:                    throws StandardException;
0818:
0819:            /**
0820:             * Get a SubKeyConstraintDescriptor from syskeys or sysforeignkeys for
0821:             * the specified constraint id.  For primary foreign and and unique
0822:             * key constraints.
0823:             *
0824:             * @param constraintId	The UUID for the constraint.
0825:             * @param type	The type of the constraint 
0826:             *		(e.g. DataDictionary.FOREIGNKEY_CONSTRAINT)
0827:             *
0828:             * @return SubKeyConstraintDescriptor	The Sub descriptor for the constraint.
0829:             *
0830:             * @exception StandardException		Thrown on failure
0831:             */
0832:            public SubKeyConstraintDescriptor getSubKeyConstraint(
0833:                    UUID constraintId, int type) throws StandardException;
0834:
0835:            /**
0836:             * Get a SPSDescriptor given its UUID.
0837:             *
0838:             * @param uuid	The UUID
0839:             *
0840:             *
0841:             * @return The SPSDescriptor for the constraint.
0842:             *
0843:             * @exception StandardException		Thrown on failure
0844:             */
0845:            public SPSDescriptor getSPSDescriptor(UUID uuid)
0846:                    throws StandardException;
0847:
0848:            /** 
0849:             * Get the stored prepared statement descriptor given 
0850:             * a sps name.
0851:             *
0852:             * @param name	The sps name.
0853:             * @param sd	The schema descriptor.
0854:             *
0855:             * @return The SPSDescriptor for the constraint.
0856:             *
0857:             * @exception StandardException		Thrown on failure
0858:             */
0859:            public SPSDescriptor getSPSDescriptor(String name,
0860:                    SchemaDescriptor sd) throws StandardException;
0861:
0862:            /**
0863:             * Get every statement in this database.
0864:             * Return the SPSDescriptors in an list.
0865:             *
0866:             * @return the list of descriptors
0867:             *
0868:             * @exception StandardException		Thrown on failure
0869:             */
0870:            public List getAllSPSDescriptors() throws StandardException;
0871:
0872:            /**
0873:             * Get all the parameter descriptors for an SPS.
0874:             * Look up the params in SYSCOLUMNS and turn them
0875:             * into parameter descriptors.  
0876:             *
0877:             * @param spsd	sps descriptor
0878:             * @param defaults the parameter defaults.  If not null,
0879:             *					all the parameter defaults will be stuffed
0880:             *					in here.
0881:             *
0882:             * @return array of data type descriptors
0883:             *
0884:             * @exception StandardException		Thrown on error
0885:             */
0886:            public DataTypeDescriptor[] getSPSParams(SPSDescriptor spsd,
0887:                    Vector defaults) throws StandardException;
0888:
0889:            /**
0890:             * Adds the given SPSDescriptor to the data dictionary,
0891:             * associated with the given table and constraint type.
0892:             *
0893:             * @param descriptor	The descriptor to add
0894:             * @param tc			The transaction controller
0895:             * @param wait			To wait for lock or not
0896:             *
0897:             * @exception StandardException		Thrown on error
0898:             */
0899:            public void addSPSDescriptor(SPSDescriptor descriptor,
0900:                    TransactionController tc, boolean wait)
0901:                    throws StandardException;
0902:
0903:            /**
0904:             * Updates SYS.SYSSTATEMENTS with the info from the
0905:             * SPSD. 
0906:             *
0907:             * @param spsd	The descriptor to add
0908:             * @param tc			The transaction controller
0909:             * @param recompile		whether to recompile or invalidate
0910:             * @param updateSYSCOLUMNS indicate whether syscolumns needs to be updated
0911:             *							or not.
0912:             * @param wait		If true, then the caller wants to wait for locks. False will be
0913:             * @param firstCompilation  first time SPS is getting compiled.
0914:             * when we using a nested user xaction - we want to timeout right away if
0915:             * the parent holds the lock.  (bug 4821)
0916:             *
0917:             * @exception StandardException		Thrown on error
0918:             */
0919:            public void updateSPS(SPSDescriptor spsd, TransactionController tc,
0920:                    boolean recompile, boolean updateSYSCOLUMNS, boolean wait,
0921:                    boolean firstCompilation) throws StandardException;
0922:
0923:            /**
0924:             * Drops the given SPSDescriptor.
0925:             *
0926:             * @param descriptor	The descriptor to drop
0927:             * @param tc	The TransactionController.
0928:             *
0929:             * @exception StandardException		Thrown on failure
0930:             */
0931:            public void dropSPSDescriptor(SPSDescriptor descriptor,
0932:                    TransactionController tc) throws StandardException;
0933:
0934:            /**
0935:             * Drops the given SPSDescriptor. 
0936:             *
0937:             * @param uuid	the statement uuid
0938:             * @param tc	The TransactionController.
0939:             *
0940:             * @exception StandardException		Thrown on failure
0941:             */
0942:            public void dropSPSDescriptor(UUID uuid, TransactionController tc)
0943:                    throws StandardException;
0944:
0945:            /**
0946:             * Invalidate all the stored plans in SYS.SYSSTATEMENTS. 
0947:             * @exception StandardException		Thrown on error
0948:             */
0949:            public void invalidateAllSPSPlans() throws StandardException;
0950:
0951:            /**
0952:             * Get a TriggerDescriptor given its UUID.
0953:             *
0954:             * @param uuid	The UUID
0955:             *
0956:             *
0957:             * @return The TriggerDescriptor for the constraint.
0958:             *
0959:             * @exception StandardException		Thrown on failure
0960:             */
0961:            public TriggerDescriptor getTriggerDescriptor(UUID uuid)
0962:                    throws StandardException;
0963:
0964:            /** 
0965:             * Get the stored prepared statement descriptor given 
0966:             * a sps name.
0967:             *
0968:             * @param name	The sps name.
0969:             * @param sd	The schema descriptor.
0970:             *
0971:             * @return The TriggerDescriptor for the constraint.
0972:             *
0973:             * @exception StandardException		Thrown on failure
0974:             */
0975:            public TriggerDescriptor getTriggerDescriptor(String name,
0976:                    SchemaDescriptor sd) throws StandardException;
0977:
0978:            /**
0979:             * Load up the trigger descriptor list for this table
0980:             * descriptor and return it.  If the descriptor list
0981:             * is already loaded up, it is retuned without further
0982:             * ado.
0983:             *
0984:             * @param td			The table descriptor.
0985:             *
0986:             * @return The ConstraintDescriptorList for the table
0987:             *
0988:             * @exception StandardException		Thrown on failure
0989:             */
0990:            public GenericDescriptorList getTriggerDescriptors(
0991:                    TableDescriptor td) throws StandardException;
0992:
0993:            /**
0994:             * Update the trigger descriptor in question.  Updates
0995:             * every row in the base conglomerate.  
0996:             *
0997:             * @param triggerd				The Triggerescriptor
0998:             * @param formerUUID			The UUID for this column in SYSTRIGGERS,
0999:             *								may differ from what is in triggerd if this
1000:             *								is the column that is being set.
1001:             * @param colsToSet 			Array of ints of columns to be modified,
1002:             *								1 based.  May be null (all cols).
1003:             * @param tc					The TransactionController to use
1004:             *
1005:             * @exception StandardException		Thrown on failure
1006:             */
1007:            public void updateTriggerDescriptor(TriggerDescriptor triggerd,
1008:                    UUID formerUUID, int[] colsToSet, TransactionController tc)
1009:                    throws StandardException;
1010:
1011:            /**
1012:             * Drops the given TriggerDescriptor that is associated
1013:             * with the given table and constraint type from the data dictionary.
1014:             *
1015:             * @param descriptor	The descriptor to drop
1016:             * @param tc	The TransactionController.
1017:             *
1018:             * @exception StandardException		Thrown on failure
1019:             */
1020:            public void dropTriggerDescriptor(TriggerDescriptor descriptor,
1021:                    TransactionController tc) throws StandardException;
1022:
1023:            /**
1024:             * Get all of the ConglomerateDescriptors in the database and
1025:             * hash them by conglomerate number.
1026:             * This is useful as a performance optimization for the locking VTIs.
1027:             * NOTE:  This method will scan SYS.SYSCONGLOMERATES at READ COMMITTED.
1028:             * It should really scan at READ UNCOMMITTED, but there is no such
1029:             * thing yet.
1030:             *
1031:             * @param tc		TransactionController for the transaction
1032:             *
1033:             * @return	A Hashtable with all of the ConglomerateDescriptors
1034:             *		in the database hashed by conglomerate number.
1035:             *
1036:             * @exception StandardException		Thrown on failure
1037:             */
1038:            public Hashtable hashAllConglomerateDescriptorsByNumber(
1039:                    TransactionController tc) throws StandardException;
1040:
1041:            /**
1042:             * Get all of the TableDescriptors in the database and hash them by TableId
1043:             * This is useful as a performance optimization for the locking VTIs.
1044:             * NOTE:  This method will scan SYS.SYSTABLES at READ COMMITTED.
1045:             * It should really scan at READ UNCOMMITTED, but there is no such
1046:             * thing yet.
1047:             *
1048:             * @param tc		TransactionController for the transaction
1049:             *
1050:             * @return	A Hashtable with all of the Table descriptors in the database
1051:             *			hashed by TableId
1052:             *
1053:             *
1054:             * @exception StandardException		Thrown on failure
1055:             */
1056:            public Hashtable hashAllTableDescriptorsByTableId(
1057:                    TransactionController tc) throws StandardException;
1058:
1059:            /**
1060:             * Get a ConglomerateDescriptor given its UUID.  If it is an index
1061:             * conglomerate shared by at least another duplicate index, this returns
1062:             * one of the ConglomerateDescriptors for those indexes. 
1063:             *
1064:             * @param uuid	The UUID
1065:             *
1066:             *
1067:             * @return A ConglomerateDescriptor for the conglomerate.
1068:             *
1069:             * @exception StandardException		Thrown on failure
1070:             */
1071:            public ConglomerateDescriptor getConglomerateDescriptor(UUID uuid)
1072:                    throws StandardException;
1073:
1074:            /**
1075:             * Get an array of ConglomerateDescriptors given the UUID.  If it is a
1076:             * heap conglomerate or an index conglomerate not shared by a duplicate
1077:             * index, the size of the return array is 1.
1078:             *
1079:             * @param uuid	The UUID
1080:             *
1081:             *
1082:             * @return An array of ConglomerateDescriptors for the conglomerate.
1083:             *
1084:             * @exception StandardException		Thrown on failure
1085:             */
1086:            public ConglomerateDescriptor[] getConglomerateDescriptors(UUID uuid)
1087:                    throws StandardException;
1088:
1089:            /**
1090:             * Get a ConglomerateDescriptor given its conglomerate number.  If it is an
1091:             * index conglomerate shared by at least another duplicate index, this
1092:             * returns one of the ConglomerateDescriptors for those indexes. 
1093:             *
1094:             * @param conglomerateNumber	The conglomerate number.
1095:             *
1096:             *
1097:             * @return A ConglomerateDescriptor for the conglomerate.  Returns NULL if
1098:             *				no such conglomerate.
1099:             *
1100:             * @exception StandardException		Thrown on failure
1101:             */
1102:            public ConglomerateDescriptor getConglomerateDescriptor(
1103:                    long conglomerateNumber) throws StandardException;
1104:
1105:            /**
1106:             * Get an array of conglomerate descriptors for the given conglomerate
1107:             * number.  If it is a heap conglomerate or an index conglomerate not
1108:             * shared by a duplicate index, the size of the return array is 1.
1109:             *
1110:             * @param conglomerateNumber	The number for the conglomerate
1111:             *				we're interested in
1112:             *
1113:             * @return	An array of ConglomerateDescriptors that share the requested
1114:             *		conglomerate. Returns size 0 array if no such conglomerate.
1115:             *
1116:             * @exception StandardException		Thrown on failure
1117:             */
1118:            public ConglomerateDescriptor[] getConglomerateDescriptors(
1119:                    long conglomerateNumber) throws StandardException;
1120:
1121:            /**
1122:             * Gets a conglomerate descriptor for the named index in the given schema,
1123:             * getting an exclusive row lock on the matching row in 
1124:             * sys.sysconglomerates (for DDL concurrency) if requested.
1125:             *
1126:             * @param indexName	The name of the index we're looking for
1127:             * @param sd		The schema descriptor
1128:             * @param forUpdate	Whether or not to get an exclusive row 
1129:             *					lock on the row in sys.sysconglomerates.
1130:             *
1131:             * @return	A ConglomerateDescriptor describing the requested
1132:             *		conglomerate. Returns NULL if no such conglomerate.
1133:             *
1134:             * @exception StandardException		Thrown on failure
1135:             */
1136:            public ConglomerateDescriptor getConglomerateDescriptor(
1137:                    String indexName, SchemaDescriptor sd, boolean forUpdate)
1138:                    throws StandardException;
1139:
1140:            /**
1141:             * Drops a conglomerate descriptor
1142:             *
1143:             * @param conglomerate	The ConglomerateDescriptor for the conglomerate
1144:             * @param tc		TransactionController for the transaction
1145:             *
1146:             * @exception StandardException		Thrown on failure
1147:             */
1148:
1149:            public void dropConglomerateDescriptor(
1150:                    ConglomerateDescriptor conglomerate,
1151:                    TransactionController tc) throws StandardException;
1152:
1153:            /**
1154:             * Drops all conglomerates associated with a table.
1155:             *
1156:             * @param td		The TableDescriptor of the table 
1157:             * @param tc		TransactionController for the transaction
1158:             *
1159:             * @exception StandardException		Thrown on failure
1160:             */
1161:
1162:            public void dropAllConglomerateDescriptors(TableDescriptor td,
1163:                    TransactionController tc) throws StandardException;
1164:
1165:            /**
1166:             * Update the conglomerateNumber for an array of ConglomerateDescriptors.
1167:             * In case of more than one ConglomerateDescriptor, they are for duplicate
1168:             * indexes sharing one conglomerate.
1169:             * This is useful, in 1.3, when doing a bulkInsert into an 
1170:             * empty table where we insert into a new conglomerate.
1171:             * (This will go away in 1.4.)
1172:             *
1173:             * @param cds					The array of ConglomerateDescriptors
1174:             * @param conglomerateNumber	The new conglomerate number
1175:             * @param tc					The TransactionController to use
1176:             *
1177:             * @exception StandardException		Thrown on failure
1178:             */
1179:            public void updateConglomerateDescriptor(
1180:                    ConglomerateDescriptor[] cds, long conglomerateNumber,
1181:                    TransactionController tc) throws StandardException;
1182:
1183:            /**
1184:             * Update the conglomerateNumber for a ConglomerateDescriptor.
1185:             * This is useful, in 1.3, when doing a bulkInsert into an 
1186:             * empty table where we insert into a new conglomerate.
1187:             * (This will go away in 1.4.)
1188:             *
1189:             * @param cd					The ConglomerateDescriptor
1190:             * @param conglomerateNumber	The new conglomerate number
1191:             * @param tc					The TransactionController to use
1192:             *
1193:             * @exception StandardException		Thrown on failure
1194:             */
1195:            public void updateConglomerateDescriptor(ConglomerateDescriptor cd,
1196:                    long conglomerateNumber, TransactionController tc)
1197:                    throws StandardException;
1198:
1199:            /**
1200:             * Gets a list of the dependency descriptors for the given dependent's id.
1201:             *
1202:             * @param dependentID		The ID of the dependent we're interested in
1203:             *
1204:             * @return	List			Returns a list of DependencyDescriptors. 
1205:             *							Returns an empty list if no stored dependencies for the
1206:             *							dependent's ID.
1207:             *
1208:             * @exception StandardException		Thrown on failure
1209:             */
1210:            public List getDependentsDescriptorList(String dependentID)
1211:                    throws StandardException;
1212:
1213:            /**
1214:             * Gets a list of the dependency descriptors for the given provider's id.
1215:             *
1216:             * @param providerID		The ID of the provider we're interested in
1217:             *
1218:             * @return	List			Returns a list of DependencyDescriptors. 
1219:             *							Returns an empty List if no stored dependencies for the
1220:             *							provider's ID.
1221:             *
1222:             * @exception StandardException		Thrown on failure
1223:             */
1224:            public List getProvidersDescriptorList(String providerID)
1225:                    throws StandardException;
1226:
1227:            /**
1228:             * Build and return an List with DependencyDescriptors for
1229:             * all of the stored dependencies.  
1230:             * This is useful for consistency checking.
1231:             *
1232:             * @return List		List of all DependencyDescriptors.
1233:             *
1234:             * @exception StandardException		Thrown on failure
1235:             */
1236:            public List getAllDependencyDescriptorsList()
1237:                    throws StandardException;
1238:
1239:            /** 
1240:             * Drop a dependency from the data dictionary.
1241:             * 
1242:             * @param dd	The DependencyDescriptor.
1243:             * @param tc	TransactionController for the transaction
1244:             *
1245:             * @exception StandardException		Thrown on failure
1246:             */
1247:            public void dropStoredDependency(DependencyDescriptor dd,
1248:                    TransactionController tc) throws StandardException;
1249:
1250:            /** 
1251:             * Remove all of the stored dependencies for a given dependent's ID 
1252:             * from the data dictionary.
1253:             * 
1254:             * @param dependentsUUID	Dependent's uuid
1255:             * @param tc				TransactionController for the transaction
1256:             *
1257:             * @exception StandardException		Thrown on failure
1258:             */
1259:            public void dropDependentsStoredDependencies(UUID dependentsUUID,
1260:                    TransactionController tc) throws StandardException;
1261:
1262:            /**
1263:             * Get the UUID Factory.  (No need to make the UUIDFactory a module.)
1264:             *
1265:             * @return UUIDFactory	The UUID Factory for this DataDictionary.
1266:             */
1267:            UUIDFactory getUUIDFactory();
1268:
1269:            /**
1270:             * Get an AliasDescriptor given its UUID.
1271:             *
1272:             * @param uuid	The UUID
1273:             *
1274:             *
1275:             * @return The AliasDescriptor for method alias.
1276:             *
1277:             * @exception StandardException		Thrown on failure
1278:             */
1279:            public AliasDescriptor getAliasDescriptor(UUID uuid)
1280:                    throws StandardException;
1281:
1282:            /**
1283:             * Get a AliasDescriptor by alias name and name space.
1284:             * NOTE: caller responsible for handling no match.
1285:             *
1286:               @param schemaID		schema identifier
1287:             * @param aliasName		The alias name.
1288:             * @param nameSpace		The alias name space.
1289:             *
1290:             * @return AliasDescriptor	AliasDescriptor for the alias name and name space
1291:             *
1292:             * @exception StandardException		Thrown on failure
1293:             */
1294:            public AliasDescriptor getAliasDescriptor(String schemaID,
1295:                    String aliasName, char nameSpace) throws StandardException;
1296:
1297:            /**
1298:            	Get the list of routines matching the schema and routine name.
1299:             */
1300:            public java.util.List getRoutineList(String schemaID,
1301:                    String routineName, char nameSpace)
1302:                    throws StandardException;
1303:
1304:            /** 
1305:             * Drop an AliasDescriptor from the DataDictionary
1306:             *
1307:             * @param ad	The AliasDescriptor to drop
1308:             * @param tc	The TransactionController
1309:             *
1310:             * @exception StandardException		Thrown on failure
1311:             */
1312:
1313:            public void dropAliasDescriptor(AliasDescriptor ad,
1314:                    TransactionController tc) throws StandardException;
1315:
1316:            public int getEngineType();
1317:
1318:            /**
1319:             * Get a FileInfoDescriptor given its id.
1320:             *
1321:             * @param id The descriptor's id.
1322:             *
1323:             * @exception StandardException		Thrown on failure
1324:             */
1325:            public FileInfoDescriptor getFileInfoDescriptor(UUID id)
1326:                    throws StandardException;
1327:
1328:            /**
1329:             * Get a FileInfoDescriptor given its SQL name and
1330:             * schema name.  
1331:             *
1332:             * @param sd        the schema that holds the FileInfoDescriptor.
1333:             * @param name		SQL name of file.
1334:             *
1335:             * @exception StandardException		Thrown on failure
1336:             */
1337:            public FileInfoDescriptor getFileInfoDescriptor(
1338:                    SchemaDescriptor sd, String name) throws StandardException;
1339:
1340:            /**
1341:             * Drop a FileDescriptor from the datadictionary.
1342:             *
1343:             * @exception StandardException Oops
1344:             */
1345:            public void dropFileInfoDescriptor(FileInfoDescriptor fid)
1346:                    throws StandardException;
1347:
1348:            /**
1349:             * returns an array of RowLocations corresponding to
1350:             * the autoincrement columns in the table. The RowLocation points to the 
1351:             * row in SYSCOLUMNS for this particular ai column.
1352:             * The array has as many elements as there are columns in the table. If a column
1353:             * is not an ai column, the entry is NULL.
1354:             *
1355:             * @param 	tc		TransactionControler to use to compute the row location.
1356:             * @param   td		TableDescriptor
1357:             * 
1358:             * @return  array of row locations, null if table has no autoinc columns.
1359:             *
1360:             * @exception standard exception on error.
1361:             */
1362:            public RowLocation[] computeAutoincRowLocations(
1363:                    TransactionController tc, TableDescriptor td)
1364:                    throws StandardException;
1365:
1366:            /* Returns a row location template for a table */
1367:            public RowLocation getRowLocationTemplate(
1368:                    LanguageConnectionContext lcc, TableDescriptor td)
1369:                    throws StandardException;
1370:
1371:            /**
1372:             * getSetAutoincrementValue fetches the autoincrement value from 
1373:             * SYSCOLUMNS given a row location. If doUpdate is true it updates
1374:             * the autoincrement column with the new value.
1375:             * the value returned by this routine is the new value and *NOT* the
1376:             * value in the system catalogs.
1377:             * 
1378:             * @param rl		RowLocation of the entry in SYSCOLUMNS.
1379:             * @param tc		TransactionController to use.
1380:             * @param doUpdate  Write the new value to disk if TRUE.
1381:             * @param newValue	A NumberDataValue to use to return incremented value. If
1382:             * null, then the caller simply wants the current value fromd disk.
1383:             * @param wait		If true, then the caller wants to wait for locks. When
1384:             * using a nested user xaction we want to timeout right away if the parent
1385:             * holds the lock.
1386:             */
1387:            public NumberDataValue getSetAutoincrementValue(RowLocation rl,
1388:                    TransactionController tc, boolean doUpdate,
1389:                    NumberDataValue newValue, boolean wait)
1390:                    throws StandardException;
1391:
1392:            /**
1393:             * sets a new value in SYSCOLUMNS for a particular
1394:             * autoincrement column.
1395:             * 
1396:             * @param tc		 Transaction Controller to use.
1397:             * @param tableUUID		 Table Descriptor
1398:             * @param columnName Name of the column.
1399:             * @param aiValue	 Value to write to SYSCOLUMNS.
1400:             * @param incrementNeeded Whether we should increment the value passed in by
1401:             * the user (aiValue) before writing the value to SYSCOLUMNS.
1402:             */
1403:            public void setAutoincrementValue(TransactionController tc,
1404:                    UUID tableUUID, String columnName, long aiValue,
1405:                    boolean incrementNeeded) throws StandardException;
1406:
1407:            /**
1408:             * Gets all statistics Descriptors for a given table.
1409:             */
1410:            public List getStatisticsDescriptors(TableDescriptor td)
1411:                    throws StandardException;
1412:
1413:            /**
1414:             * Drops all statistics descriptors for a given table/index column
1415:             * combination. If the index is not specified, then all statistics for the
1416:             * table are dropped.
1417:             *
1418:             * @param 	tableUUID 	  UUID of the table 
1419:             * @param   referenceUUID UUID of the index. This can be null.
1420:             * @param   tc 			  Transcation Controller to use.
1421:             */
1422:            public void dropStatisticsDescriptors(UUID tableUUID,
1423:                    UUID referenceUUID, TransactionController tc)
1424:                    throws StandardException;
1425:
1426:            /**
1427:             * Returns the dependency manager for this DataDictionary. Associated with
1428:             * each DataDictionary object there is a DependencyManager object which
1429:             * keeps track of both persistent and stored dependencies. 
1430:             * 
1431:             * @see org.apache.derby.iapi.sql.depend.DependencyManager
1432:             */
1433:            public DependencyManager getDependencyManager();
1434:
1435:            /**
1436:             * Returns the cache mode of the data dictionary.
1437:             */
1438:            public int getCacheMode();
1439:
1440:            /**
1441:             *	Returns a unique system generated name of the form SQLyymmddhhmmssxxn
1442:             *	  yy - year, mm - month, dd - day of month, hh - hour, mm - minute, ss - second,
1443:             *	  xx - the first 2 digits of millisec because we don't have enough space to keep the exact millisec value,
1444:             *	  n - number between 0-9
1445:             *
1446:             *	@return	system generated unique name
1447:             */
1448:            public String getSystemSQLName();
1449:
1450:            /**
1451:             * Adds a descriptor to a system catalog identified by the catalogNumber. 
1452:             *
1453:             * @param tuple			   descriptor to insert.
1454:             * @param parent           parent descriptor; e.g for a column parent is the
1455:             * tabledescriptor to which the descriptor is beign inserted. for most other
1456:             * objects it is the schema descriptor.
1457:             * @param catalogNumber	   a value which identifies the catalog into which
1458:             * the descriptor should be inserted. It is the users responsibility to
1459:             * ensure that the catalogNumber is consistent with the tuple being
1460:             * inserted. 
1461:             * @see DataDictionary#SYSCONGLOMERATES_CATALOG_NUM
1462:             * @param allowsDuplicates whether an exception should be thrown if the
1463:             * insert results in a duplicate; if this parameter is FALSE then one
1464:             * of the following exception will be thrown; LANG_OBJECT_ALREADY_EXISTS (if
1465:             * parent is null) or LANG_OBJECT_ALREADY_EXISTS_IN_OBJECT (if parent is not
1466:             * null). The error message is created by getting the name and type of the
1467:             * tuple and parent.
1468:             * @see org.apache.derby.impl.sql.catalog.DataDictionaryImpl#duplicateDescriptorException
1469:             * @param 	tc	the transaction controller to use to do all of this.
1470:             *
1471:             * @see #addDescriptorArray
1472:             */
1473:            public void addDescriptor(TupleDescriptor tuple,
1474:                    TupleDescriptor parent, int catalogNumber,
1475:                    boolean allowsDuplicates, TransactionController tc)
1476:                    throws StandardException;
1477:
1478:            /** array version of addDescriptor.
1479:             * @see #addDescriptor
1480:             */
1481:            public void addDescriptorArray(TupleDescriptor[] tuple,
1482:                    TupleDescriptor parent, int catalogNumber,
1483:                    boolean allowsDuplicates, TransactionController tc)
1484:                    throws StandardException;
1485:
1486:            /**
1487:            	Check to see if a database has been upgraded to the required
1488:            	level in order to use a langauge feature that is.
1489:            	<P>
1490:            	This is used to ensure new functionality that would lead on disk
1491:            	information not understood by a previous release is not executed
1492:            	while in soft upgrade mode. Ideally this is called at compile time
1493:            	and the parser has a utility method to enable easy use at parse time.
1494:            	<P>
1495:            	To use this method, a feature implemented in a certain release (DataDictionary version)
1496:            	would call it with the constant matching the release. E.g. for a new feature added
1497:            	in 10.1, a call such as 
1498:            	<PRE>
1499:            	// check and throw an exception if the database is not at 10.1
1500:            	dd.checkVersion(DataDictionary.DD_VERSION_DERBY_10_1, "NEW FEATURE NAME");
1501:            	
1502:            	</PRE>
1503:            	This call would occur during the compile time, usually indirectly through
1504:            	the parser utility method, but direct calls can be made during QueryNode initialization,
1505:            	or even at bind time.
1506:            	<BR>
1507:            	It is not expected that this method would be called at execution time.
1508:
1509:            	@param majorVersion Data Dictionary major version (DataDictionary.DD_ constant)
1510:            	@param feature Non-null to throw an error, null to return the state of the version match.
1511:
1512:            	@return True if the database has been upgraded to the required level, false otherwise.
1513:             */
1514:            public boolean checkVersion(int majorVersion, String feature)
1515:                    throws StandardException;
1516:
1517:            /**
1518:             * Add or remove a permission to the permission database.
1519:             *
1520:             * @param add if true then add the permission, if false remove it.
1521:             * @param perm
1522:             * @param grantee
1523:             * @param tc
1524:             *
1525:             * @return True means revoke has removed a privilege from system
1526:             * table and hence the caller of this method should send invalidation 
1527:             * actions to PermssionDescriptor's dependents.
1528:             */
1529:            public boolean addRemovePermissionsDescriptor(boolean add,
1530:                    PermissionsDescriptor perm, String grantee,
1531:                    TransactionController tc) throws StandardException;
1532:
1533:            /**
1534:             * Get one user's privileges on a table using tableUUID and authorizationid
1535:             *
1536:             * @param tableUUID
1537:             * @param authorizationId The user name
1538:             *
1539:             * @return a TablePermsDescriptor or null if the user has no permissions on the table.
1540:             *
1541:             * @exception StandardException
1542:             */
1543:            public TablePermsDescriptor getTablePermissions(UUID tableUUID,
1544:                    String authorizationId) throws StandardException;
1545:
1546:            /**
1547:             * Get one user's privileges on a table using tablePermsUUID
1548:             *
1549:             * @param tablePermsUUID
1550:             *
1551:             * @return a TablePermsDescriptor
1552:             *
1553:             * @exception StandardException
1554:             */
1555:            public TablePermsDescriptor getTablePermissions(UUID tablePermsUUID)
1556:                    throws StandardException;
1557:
1558:            /**
1559:             * Get one user's column privileges for a table.
1560:             *
1561:             * @param tableUUID
1562:             * @param privType Authorizer.SELECT_PRIV, Authorizer.UPDATE_PRIV, or Authorizer.REFERENCES_PRIV
1563:             * @param forGrant
1564:             * @param authorizationId The user name
1565:             *
1566:             * @return a ColPermsDescriptor or null if the user has no separate column
1567:             *         permissions of the specified type on the table. Note that the user may have been granted
1568:             *         permission on all the columns of the table (no column list), in which case this routine
1569:             *         will return null. You must also call getTablePermissions to see if the user has permission
1570:             *         on a set of columns.
1571:             *
1572:             * @exception StandardException
1573:             */
1574:            public ColPermsDescriptor getColumnPermissions(UUID tableUUID,
1575:                    int privType, boolean forGrant, String authorizationId)
1576:                    throws StandardException;
1577:
1578:            /**
1579:             * Get one user's column privileges for a table. This routine gets called 
1580:             * during revoke privilege processing
1581:             *
1582:             * @param tableUUID
1583:             * @param privTypeStr (as String) Authorizer.SELECT_PRIV, Authorizer.UPDATE_PRIV, or Authorizer.REFERENCES_PRIV
1584:             * @param forGrant
1585:             * @param authorizationId The user name
1586:             *
1587:             * @return a ColPermsDescriptor or null if the user has no separate column
1588:             *         permissions of the specified type on the table. Note that the user may have been granted
1589:             *         permission on all the columns of the table (no column list), in which case this routine
1590:             *         will return null. You must also call getTablePermissions to see if the user has permission
1591:             *         on a set of columns.
1592:             *
1593:             * @exception StandardException
1594:             */
1595:            public ColPermsDescriptor getColumnPermissions(UUID tableUUID,
1596:                    String privTypeStr, boolean forGrant, String authorizationId)
1597:                    throws StandardException;
1598:
1599:            /**
1600:             * Get one user's column privileges on a table using colPermsUUID
1601:             *
1602:             * @param colPermsUUID
1603:             *
1604:             * @return a ColPermsDescriptor
1605:             *
1606:             * @exception StandardException
1607:             */
1608:            public ColPermsDescriptor getColumnPermissions(UUID colPermsUUID)
1609:                    throws StandardException;
1610:
1611:            /**
1612:             * Get one user's permissions for a routine (function or procedure).
1613:             *
1614:             * @param routineUUID
1615:             * @param authorizationId The user's name
1616:             *
1617:             * @return The descriptor of the users permissions for the routine.
1618:             *
1619:             * @exception StandardException
1620:             */
1621:            public RoutinePermsDescriptor getRoutinePermissions(
1622:                    UUID routineUUID, String authorizationId)
1623:                    throws StandardException;
1624:
1625:            /**
1626:             * Get one user's privileges for a routine using routinePermsUUID
1627:             *
1628:             * @param routinePermsUUID
1629:             *
1630:             * @return a RoutinePermsDescriptor
1631:             *
1632:             * @exception StandardException
1633:             */
1634:            public RoutinePermsDescriptor getRoutinePermissions(
1635:                    UUID routinePermsUUID) throws StandardException;
1636:
1637:            /**
1638:             * Return the Java class to use for the VTI for
1639:             * the virtual table. Assumes the descriptor is
1640:             * of type TableDescriptor.VTI_TYPE.
1641:             */
1642:            public String getVTIClass(TableDescriptor td)
1643:                    throws StandardException;
1644:
1645:            /**
1646:             * Adds a descriptor to a system catalog identified by the catalogNumber. 
1647:             *
1648:             * @param tuple			   descriptor to insert.
1649:             * @param parent           parent descriptor; e.g for a column parent is the
1650:             * tabledescriptor to which the descriptor is beign inserted. for most other
1651:             * objects it is the schema descriptor.
1652:             * @param catalogNumber	   a value which identifies the catalog into which
1653:             * the descriptor should be inserted. It is the users responsibility to
1654:             * ensure that the catalogNumber is consistent with the tuple being
1655:             * inserted. 
1656:             * @see DataDictionary#SYSCONGLOMERATES_CATALOG_NUM
1657:             * @param allowsDuplicates whether an exception should be thrown if the
1658:             * insert results in a duplicate; if this parameter is FALSE then one
1659:             * of the following exception will be thrown; LANG_OBJECT_ALREADY_EXISTS (if
1660:             * parent is null) or LANG_OBJECT_ALREADY_EXISTS_IN_OBJECT (if parent is not
1661:             * null). The error message is created by getting the name and type of the
1662:             * tuple and parent.
1663:             * @see org.apache.derby.impl.sql.catalog.DataDictionaryImpl#duplicateDescriptorException
1664:             * @param 	tc	the transaction controller to use to do all of this.
1665:             * @param wait  If true, then the caller wants to wait for locks. False will
1666:             *	            be when we using a nested user xaction - we want to timeout 
1667:             *              right away if the parent holds the lock. 
1668:             * @see #addDescriptorArray
1669:             */
1670:            public void addDescriptor(TupleDescriptor tuple,
1671:                    TupleDescriptor parent, int catalogNumber,
1672:                    boolean allowsDuplicates, TransactionController tc,
1673:                    boolean wait) throws StandardException;
1674:
1675:            /** 
1676:             * Remove all of the stored dependencies for a given dependent's ID 
1677:             * from the data dictionary.
1678:             * 
1679:             * @param dependentsUUID	Dependent's uuid
1680:             * @param tc				TransactionController for the transaction
1681:             * @param wait  If true, then the caller wants to wait for locks. False will
1682:             *	            be when we using a nested user xaction - we want to timeout 
1683:             *              right away if the parent holds the lock. 
1684:             *
1685:             * @exception StandardException		Thrown on failure
1686:             */
1687:            public void dropDependentsStoredDependencies(UUID dependentsUUID,
1688:                    TransactionController tc, boolean wait)
1689:                    throws StandardException;
1690:
1691:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.