1 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 ; 46 import java.util.Hashtable ; 47 import java.util.Properties ; 48 import java.util.Vector ; 49 50 62 63 public interface DataDictionary 64 { 65 String MODULE = "org.apache.derby.iapi.sql.dictionary.DataDictionary"; 66 67 89 public static final int DD_VERSION_CURRENT = -1; 90 91 public static final int DD_VERSION_CS_5_0 = 80; 92 93 public static final int DD_VERSION_CS_5_1 = 90; 94 95 public static final int DD_VERSION_CS_5_2 = 100; 96 97 public static final int DD_VERSION_CS_8_1 = 110; 98 99 public static final int DD_VERSION_CS_10_0 = 120; 100 101 102 public static final int DD_VERSION_DERBY_10_1 = 130; 103 104 105 public static final int DD_VERSION_DERBY_10_2 = 140; 106 107 public static final String DATABASE_ID = "derby.databaseID"; 109 110 116 public static final String CORE_DATA_DICTIONARY_VERSION = "DataDictionaryVersion"; 117 122 public static final String CREATE_DATA_DICTIONARY_VERSION = "CreateDataDictionaryVersion"; 123 129 public static final String SOFT_DATA_DICTIONARY_VERSION = "derby.softDataDictionaryVersion"; 130 public static final String PROPERTY_CONGLOMERATE_VERSION = "PropertyConglomerateVersion"; 131 132 135 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 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 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 173 public static final int COMPILE_ONLY_MODE = 0; 174 public static final int DDL_MODE = 1; 175 176 182 DataDictionaryContext pushDataDictionaryContext(ContextManager cm); 183 184 189 public void clearCaches() throws StandardException; 190 191 203 public int startReading(LanguageConnectionContext lcc) throws StandardException; 204 205 214 public void doneReading(int mode, 215 LanguageConnectionContext lcc) 216 throws StandardException; 217 218 227 public void startWriting(LanguageConnectionContext lcc) 228 throws StandardException; 229 230 236 public void transactionFinished() throws StandardException; 237 238 243 public ExecutionFactory getExecutionFactory(); 244 245 250 public DataValueFactory getDataValueFactory(); 251 252 259 public DataDescriptorGenerator getDataDescriptorGenerator(); 260 261 266 public String getAuthorizationDatabaseOwner(); 267 268 273 public boolean usesSqlAuthorization(); 274 275 291 292 public SchemaDescriptor getSchemaDescriptor(String schemaName, 293 TransactionController tc, 294 boolean raiseError) 295 throws StandardException; 296 297 315 public SchemaDescriptor getSchemaDescriptor(UUID schemaId, TransactionController tc) 316 throws StandardException; 317 318 329 public SchemaDescriptor getSystemSchemaDescriptor( ) 330 throws StandardException; 331 332 343 public SchemaDescriptor getSysIBMSchemaDescriptor( ) 344 throws StandardException; 345 346 357 public SchemaDescriptor getSystemDiagSchemaDescriptor( ) 358 throws StandardException; 359 360 370 public SchemaDescriptor getDeclaredGlobalTemporaryTablesSchemaDescriptor() 371 throws StandardException; 372 373 381 public boolean isSystemSchemaName( String name) 382 throws StandardException; 383 384 392 public void dropSchemaDescriptor(String schemaName, 393 TransactionController tc) 394 throws StandardException; 395 396 408 public boolean isSchemaEmpty(SchemaDescriptor sd) 409 throws StandardException; 410 411 426 public TableDescriptor getTableDescriptor(String tableName, 427 SchemaDescriptor schema) 428 throws StandardException; 429 430 446 public TableDescriptor getTableDescriptor(UUID tableID) 447 throws StandardException; 448 449 460 public void dropTableDescriptor(TableDescriptor td, SchemaDescriptor schema, 461 TransactionController tc) 462 throws StandardException; 463 464 474 public void updateLockGranularity(TableDescriptor td, SchemaDescriptor schema, 475 char lockGranularity, TransactionController tc) 476 throws StandardException; 477 478 486 490 491 500 public ColumnDescriptor getColumnDescriptorByDefaultId(UUID uuid) 501 throws StandardException; 502 503 513 public void dropColumnDescriptor(UUID tableID, 514 String columnName, TransactionController tc) 515 throws StandardException; 516 517 527 public void dropAllColumnDescriptors(UUID tableID, TransactionController tc) 528 throws StandardException; 529 530 539 public void dropAllTableAndColPermDescriptors(UUID tableID, TransactionController tc) 540 throws StandardException; 541 542 543 558 public void updateSYSCOLPERMSforAddColumnToUserTable(UUID tableID, TransactionController tc) 559 throws StandardException; 560 561 562 571 public void dropAllRoutinePermDescriptors(UUID routineID, TransactionController tc) 572 throws StandardException; 573 574 583 public ViewDescriptor getViewDescriptor(UUID uuid) 584 throws StandardException; 585 586 595 public ViewDescriptor getViewDescriptor(TableDescriptor td) 596 throws StandardException; 597 598 606 public void dropViewDescriptor(ViewDescriptor viewDescriptor, 607 TransactionController tc) 608 throws StandardException; 609 610 619 public ConstraintDescriptor getConstraintDescriptor(UUID uuid) 620 throws StandardException; 621 622 632 public ConstraintDescriptor getConstraintDescriptor 633 ( 634 String constraintName, 635 UUID schemaID 636 ) 637 throws StandardException; 638 639 651 public ConstraintDescriptorList getConstraintDescriptors(TableDescriptor td) 652 throws StandardException; 653 654 671 public ConstraintDescriptorList getActiveConstraintDescriptors(ConstraintDescriptorList cdl) 672 throws StandardException; 673 674 690 public boolean activeConstraint( ConstraintDescriptor constraint ) 691 throws StandardException; 692 693 704 public ConstraintDescriptor getConstraintDescriptor(TableDescriptor td, 705 UUID uuid) 706 throws StandardException; 707 708 709 720 public ConstraintDescriptor getConstraintDescriptorById 721 ( 722 TableDescriptor td, 723 UUID uuid 724 ) 725 throws StandardException; 726 727 739 public ConstraintDescriptor getConstraintDescriptorByName(TableDescriptor td, 740 SchemaDescriptor sd, 741 String constraintName, 742 boolean forUpdate) 743 throws StandardException; 744 745 756 public TableDescriptor getConstraintTableDescriptor(UUID constraintId) 757 throws StandardException; 758 759 770 public ConstraintDescriptorList getForeignKeys(UUID constraintId) 771 throws StandardException; 772 773 782 public void addConstraintDescriptor( 783 ConstraintDescriptor descriptor, 784 TransactionController tc) 785 throws StandardException; 786 787 800 public void dropConstraintDescriptor(TableDescriptor table, 801 ConstraintDescriptor descriptor, 802 TransactionController tc) 803 throws StandardException; 804 805 817 public void dropAllConstraintDescriptors(TableDescriptor table, 818 TransactionController tc) 819 throws StandardException; 820 821 836 public void updateConstraintDescriptor(ConstraintDescriptor cd, 837 UUID formerUUID, 838 int[] colsToSet, 839 TransactionController tc) 840 throws StandardException; 841 842 855 public SubKeyConstraintDescriptor getSubKeyConstraint(UUID constraintId, int type) 856 throws StandardException; 857 858 868 public SPSDescriptor getSPSDescriptor(UUID uuid) 869 throws StandardException; 870 871 882 public SPSDescriptor getSPSDescriptor(String name, SchemaDescriptor sd) 883 throws StandardException; 884 885 893 public List getAllSPSDescriptors() 894 throws StandardException; 895 896 910 public DataTypeDescriptor[] getSPSParams(SPSDescriptor spsd, Vector defaults) 911 throws StandardException; 912 913 923 public void addSPSDescriptor 924 ( 925 SPSDescriptor descriptor, 926 TransactionController tc, 927 boolean wait 928 ) throws StandardException; 929 930 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 963 public void dropSPSDescriptor(SPSDescriptor descriptor, 964 TransactionController tc) 965 throws StandardException; 966 967 975 public void dropSPSDescriptor 976 ( 977 UUID uuid, 978 TransactionController tc 979 ) throws StandardException; 980 981 985 public void invalidateAllSPSPlans() throws StandardException; 986 987 997 public TriggerDescriptor getTriggerDescriptor(UUID uuid) 998 throws StandardException; 999 1000 1011 public TriggerDescriptor getTriggerDescriptor(String name, SchemaDescriptor sd) 1012 throws StandardException; 1013 1014 1026 public GenericDescriptorList getTriggerDescriptors(TableDescriptor td) 1027 throws StandardException; 1028 1029 1043 public void updateTriggerDescriptor 1044 ( 1045 TriggerDescriptor triggerd, 1046 UUID formerUUID, 1047 int[] colsToSet, 1048 TransactionController tc 1049 ) throws StandardException; 1050 1051 1060 public void dropTriggerDescriptor 1061 ( 1062 TriggerDescriptor descriptor, 1063 TransactionController tc 1064 ) throws StandardException; 1065 1066 1081 public Hashtable hashAllConglomerateDescriptorsByNumber(TransactionController tc) 1082 throws StandardException; 1083 1084 1099 public Hashtable hashAllTableDescriptorsByTableId(TransactionController tc) 1100 throws StandardException; 1101 1102 1114 public ConglomerateDescriptor getConglomerateDescriptor(UUID uuid) 1115 throws StandardException; 1116 1117 1129 public ConglomerateDescriptor[] getConglomerateDescriptors(UUID uuid) 1130 throws StandardException; 1131 1132 1145 public ConglomerateDescriptor getConglomerateDescriptor( 1146 long conglomerateNumber) 1147 throws StandardException; 1148 1149 1162 public ConglomerateDescriptor[] getConglomerateDescriptors( 1163 long conglomerateNumber) 1164 throws StandardException; 1165 1166 1181 public ConglomerateDescriptor getConglomerateDescriptor( 1182 String indexName, 1183 SchemaDescriptor sd, 1184 boolean forUpdate) 1185 throws StandardException; 1186 1187 1195 1196 public void dropConglomerateDescriptor( 1197 ConglomerateDescriptor conglomerate, 1198 TransactionController tc) 1199 throws StandardException; 1200 1201 1209 1210 public void dropAllConglomerateDescriptors( 1211 TableDescriptor td, 1212 TransactionController tc) 1213 throws StandardException; 1214 1215 1229 public void updateConglomerateDescriptor(ConglomerateDescriptor[] cds, 1230 long conglomerateNumber, 1231 TransactionController tc) 1232 throws StandardException; 1233 1234 1246 public void updateConglomerateDescriptor(ConglomerateDescriptor cd, 1247 long conglomerateNumber, 1248 TransactionController tc) 1249 throws StandardException; 1250 1251 1262 public List getDependentsDescriptorList(String dependentID) 1263 throws StandardException; 1264 1265 1276 public List getProvidersDescriptorList(String providerID) 1277 throws StandardException; 1278 1279 1288 public List getAllDependencyDescriptorsList() 1289 throws StandardException; 1290 1291 1299 public void dropStoredDependency(DependencyDescriptor dd, 1300 TransactionController tc ) 1301 throws StandardException; 1302 1303 1312 public void dropDependentsStoredDependencies(UUID dependentsUUID, 1313 TransactionController tc) 1314 throws StandardException; 1315 1316 1321 UUIDFactory getUUIDFactory(); 1322 1323 1333 public AliasDescriptor getAliasDescriptor(UUID uuid) 1334 throws StandardException; 1335 1336 1348 public AliasDescriptor getAliasDescriptor(String schemaID, String aliasName, char nameSpace) 1349 throws StandardException; 1350 1351 1354 public java.util.List getRoutineList(String schemaID, String routineName, char nameSpace) 1355 throws StandardException; 1356 1357 1365 1366 public void dropAliasDescriptor(AliasDescriptor ad, 1367 TransactionController tc) 1368 throws StandardException; 1369 1370 public int getEngineType(); 1371 1372 1379 public FileInfoDescriptor getFileInfoDescriptor(UUID id) 1380 throws StandardException; 1381 1382 1391 public FileInfoDescriptor getFileInfoDescriptor(SchemaDescriptor sd, String name) 1392 throws StandardException; 1393 1394 1399 public void dropFileInfoDescriptor(FileInfoDescriptor fid) 1400 throws StandardException; 1401 1402 1403 1417 public RowLocation[] computeAutoincRowLocations(TransactionController tc, 1418 TableDescriptor td) 1419 throws StandardException; 1420 1421 1422 public RowLocation getRowLocationTemplate( LanguageConnectionContext lcc, TableDescriptor td) 1423 throws StandardException; 1424 1425 1441 public NumberDataValue getSetAutoincrementValue(RowLocation rl, 1442 TransactionController tc, 1443 boolean doUpdate, 1444 NumberDataValue newValue, 1445 boolean wait) 1446 throws StandardException; 1447 1448 1459 public void setAutoincrementValue(TransactionController tc, 1460 UUID tableUUID, 1461 String columnName, 1462 long aiValue, 1463 boolean incrementNeeded) 1464 throws StandardException; 1465 1466 1469 public List getStatisticsDescriptors(TableDescriptor td) 1470 throws StandardException; 1471 1472 1481 public void dropStatisticsDescriptors(UUID tableUUID, UUID referenceUUID, 1482 TransactionController tc) 1483 throws StandardException; 1484 1485 1492 public DependencyManager getDependencyManager(); 1493 1494 1495 1498 public int getCacheMode(); 1499 1500 1508 public String getSystemSQLName(); 1509 1510 1533 public void addDescriptor(TupleDescriptor tuple, TupleDescriptor parent, 1534 int catalogNumber, boolean allowsDuplicates, 1535 TransactionController tc) 1536 throws StandardException; 1537 1538 1541 public void addDescriptorArray(TupleDescriptor[] tuple, TupleDescriptor parent, 1542 int catalogNumber, boolean allowsDuplicates, 1543 TransactionController tc) 1544 throws StandardException; 1545 1546 1547 1575 public boolean checkVersion(int majorVersion, String feature) throws StandardException; 1576 1577 1589 public boolean addRemovePermissionsDescriptor( boolean add, 1590 PermissionsDescriptor perm, 1591 String grantee, 1592 TransactionController tc) 1593 throws StandardException; 1594 1595 1605 public TablePermsDescriptor getTablePermissions( UUID tableUUID, String authorizationId) 1606 throws StandardException; 1607 1608 1617 public TablePermsDescriptor getTablePermissions( UUID tablePermsUUID) 1618 throws StandardException; 1619 1620 1636 public ColPermsDescriptor getColumnPermissions( UUID tableUUID, 1637 int privType, 1638 boolean forGrant, 1639 String authorizationId) 1640 throws StandardException; 1641 1642 1643 1660 public ColPermsDescriptor getColumnPermissions( UUID tableUUID, 1661 String privTypeStr, 1662 boolean forGrant, 1663 String authorizationId) 1664 throws StandardException; 1665 1674 public ColPermsDescriptor getColumnPermissions( UUID colPermsUUID) 1675 throws StandardException; 1676 1677 1687 public RoutinePermsDescriptor getRoutinePermissions( UUID routineUUID, String authorizationId) 1688 throws StandardException; 1689 1690 1699 public RoutinePermsDescriptor getRoutinePermissions( UUID routinePermsUUID) 1700 throws StandardException; 1701 1702 1707 public String getVTIClass(TableDescriptor td) 1708 throws StandardException; 1709 1710 1711 1736 public void addDescriptor(TupleDescriptor tuple, TupleDescriptor parent, 1737 int catalogNumber, boolean allowsDuplicates, 1738 TransactionController tc, boolean wait) 1739 throws StandardException; 1740 1741 1753 public void dropDependentsStoredDependencies(UUID dependentsUUID, 1754 TransactionController tc, 1755 boolean wait) 1756 throws StandardException; 1757 1758} 1759 | Popular Tags |