KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > daffodilwoods > daffodildb > server > datadictionarysystem > SystemTablesCreator


1 package com.daffodilwoods.daffodildb.server.datadictionarysystem;
2
3 import java.io.*;
4 import java.util.*;
5
6 import com.daffodilwoods.daffodildb.server.datasystem.interfaces.*;
7 import com.daffodilwoods.database.general.*;
8 import com.daffodilwoods.database.resource.*;
9
10 public class SystemTablesCreator {
11    public final static Integer JavaDoc SQLIdentifierSize = new Integer JavaDoc(128);
12    public final static Integer JavaDoc characterDataSize = new Integer JavaDoc(1026);
13    public final static Integer JavaDoc viewDefinitionSize = new Integer JavaDoc(4096);
14    public final static Integer JavaDoc dtdIdentifierSize = new Integer JavaDoc(257);
15    public final static Integer JavaDoc serializeObjectDataSize = new Integer JavaDoc(12000);
16
17    public final static String JavaDoc domainCatalog = "system";
18    public final static String JavaDoc domainSchema = "information_schema";
19    public final static String JavaDoc sqlIdentifier = "sql_Identifier";
20    public final static String JavaDoc characterData = "character_data";
21    public final static String JavaDoc cardinalNumber = "cardinal_number";
22    public final static String JavaDoc timeStamp = "time_stamp";
23    public final static String JavaDoc transactionIndexTable = "default_index_transactionId";
24    public final static String JavaDoc sessionIndexTable = "default_index_sessionId";
25    public final static String JavaDoc databaseInfoIndexTable = "databaseInfo";
26    public final static String JavaDoc tableInfoIndexTable = "tableInfo";
27    public final static String JavaDoc ColumnInfoIndexTable = "columnInfo";
28    public final static String JavaDoc ClusterInfoIndexTable = "clusterInfo";
29    static Properties properties;
30    static HashMap structureMap;
31    public static HashMap primaryKeymap;
32    static {
33       try {
34          properties = new Properties();
35          Class JavaDoc cl = Class.forName("com.daffodilwoods.daffodildb.server.datadictionarysystem.SystemTablesCreator");
36          java.net.URL JavaDoc urlw = cl.getResource("/com/daffodilwoods/daffodildb/server/datadictionarysystem/systemtablesStructure.obj");
37          ObjectInputStream ois = new ObjectInputStream(new BufferedInputStream(urlw.openStream()));
38          structureMap = (HashMap) ois.readObject();
39          ois.close();
40          java.net.URL JavaDoc urlprimary = cl.getResource("/com/daffodilwoods/daffodildb/server/datadictionarysystem/systemtablesPrimaryKeys.obj");
41          ObjectInputStream oisPrimary = new ObjectInputStream(new BufferedInputStream(urlprimary.openStream()));
42          primaryKeymap = (HashMap) oisPrimary.readObject();
43          oisPrimary.close();
44          java.net.URL JavaDoc url = cl.getResource("/com/daffodilwoods/daffodildb/server/datadictionarysystem/systemtablesdefinition.properties");
45          properties.load(url.openStream());
46       } catch (IOException ex) {
47       } catch (ClassNotFoundException JavaDoc ex) {
48       }
49    }
50
51    public SystemTablesCreator() throws DException {}
52
53
54    static String JavaDoc[] routine_columnUsage_primaryKeys() {
55       return new String JavaDoc[] {"SPECIFIC_CATALOG", "SPECIFIC_SCHEMA", "SPECIFIC_NAME", "TABLE_CATALOG", "TABLE_SCHEMA", "TABLE_NAME", "COLUMN_NAME"};
56    }
57
58    static String JavaDoc[] routine_TableUsage_primaryKeys() {
59       return new String JavaDoc[] {"SPECIFIC_CATALOG", "SPECIFIC_SCHEMA", "SPECIFIC_NAME", "TABLE_CATALOG", "TABLE_SCHEMA", "TABLE_NAME"};
60    }
61
62    public static String JavaDoc[] viewNames = {SystemTables.columns_ViewName.getIdentifier(), SystemTables.tables_ViewName.getIdentifier()};
63
64    public static String JavaDoc[] tableNames = {SystemTables.characterSets_TableName.getIdentifier(),
65        SystemTables.check_constraints_TableName.getIdentifier(),
66        SystemTables.check_column_usage_TableName.getIdentifier(),
67        SystemTables.check_table_usage_TableName.getIdentifier(),
68        /** @todo no use of collations_TableName */
69        SystemTables.collations_TableName.getIdentifier(),
70        SystemTables.column_privileges_TableName.getIdentifier(),
71        SystemTables.columns_TableName.getIdentifier(),
72        SystemTables.dataTypeDescriptor_TableName.getIdentifier(),
73        SystemTables.domains_TableName.getIdentifier(),
74        SystemTables.domain_constraints_TableName.getIdentifier(),
75        SystemTables.key_column_usage_TableName.getIdentifier(),
76        SystemTables.role_authorization_TableName.getIdentifier(),
77        SystemTables.roles_TableName.getIdentifier(),
78        SystemTables.referential_constraints_TableName.getIdentifier(),
79        SystemTables.schema_TableName.getIdentifier(),
80        SystemTables.table_constraints_TableName.getIdentifier(),
81        SystemTables.table_privileges_TableName.getIdentifier(),
82        SystemTables.tables_TableName.getIdentifier(),
83        SystemTables.triggers_TableName.getIdentifier(),
84        SystemTables.trigger_table_usage_TableName.getIdentifier(),
85        SystemTables.trigger_column_usage_TableName.getIdentifier(),
86        SystemTables.triggered_update_columns_TableName.getIdentifier(),
87        SystemTables.users_TableName.getIdentifier(),
88        SystemTables.usage_privileges_TableName.getIdentifier(),
89        SystemTables.views_TableName.getIdentifier(),
90        SystemTables.view_colum_usage_TableName.getIdentifier(),
91        SystemTables.view_table_usage_TableName.getIdentifier(),
92        SystemTables.transaction_TableName.getIdentifier(),
93        SystemTables.parameters_TableName.getIdentifier(),
94        SystemTables.routines_TableName.getIdentifier(),
95        SystemTables.routine_privileges_TableName.getIdentifier(),
96        SystemTables.INDEXINFO.getIdentifier(),
97        SystemTables.INDEXCOLUMNS.getIdentifier(),
98        SystemTables.FULLTEXTINFO.getIdentifier(),
99        SystemTables.FULLTEXTCOLUMNINFO.getIdentifier(),
100        SystemTables.DATABASEFULLTEXTINFO.getIdentifier(),
101        SystemTables.DATABASEFULLTEXTCOLUMNINFO.getIdentifier(),
102        /** @todo no use of following 4 tables */
103        SystemTables.user_defined_type_TableName.getIdentifier(),
104        SystemTables.user_defined_type_privileges_TableName.getIdentifier(),
105        SystemTables.method_specifications_TableName.getIdentifier(),
106        SystemTables.method_specification_parameters_TableName.getIdentifier(),
107        /** @todo no use of transforms_TableName */
108        SystemTables.transforms_TableName.getIdentifier(),
109        SystemTables.sequence_number_TableName.getIdentifier(),
110        SystemTables.DATABASEINFO.getIdentifier(),
111        SystemTables.TABLEINFO.getIdentifier(),
112        SystemTables.COLUMNINFO.getIdentifier(),
113        SystemTables.CLUSTERINFO.getIdentifier(),
114        SystemTables.dualSystemTable.getIdentifier(),
115        SystemTables.routine_table_usage_TableName.getIdentifier(),
116        SystemTables.routine_column_usage_TableName.getIdentifier()
117    };
118
119
120    public static String JavaDoc[] getPrimaryKeys(QualifiedIdentifier tableName) throws DException {
121       return (String JavaDoc[]) primaryKeymap.get(tableName);
122    }
123
124    public static Object JavaDoc[][] getTableStructure(QualifiedIdentifier tableName) throws DException {
125       if (tableName.getName().startsWith("default_index")) {
126          return DefaultIndexTableStructure();
127       } else if (tableName.getName().equalsIgnoreCase(transactionIndexTable)) {
128          return TransactionIndexTableStructure();
129       } else if (tableName.getName().startsWith(sessionIndexTable)) {
130          return SessionIndexTableStructure();
131       } else if (tableName.getName().equalsIgnoreCase("dualSystemTable")) {
132          return dualSystemTableStructure();
133       } else if (tableName.getName().equalsIgnoreCase("dualSystemTable")) {
134          return dualSystemTableStructure();
135       } else {
136          Object JavaDoc[][] asads = (Object JavaDoc[][]) structureMap.get(tableName);
137          return asads;
138       }
139    }
140
141
142
143    public static ArrayList getInformationSchemaStatements() throws DException {
144       ArrayList informationSchemaStatement = new ArrayList(10);
145       informationSchemaStatement.add("CREATE SCHEMA " + SystemTables.systemCatalog + ".INFORMATION_SCHEMA AUTHORIZATION _SYSTEM");
146       informationSchemaStatement.add("CREATE DOMAIN " + SystemTables.systemCatalog + ".INFORMATION_SCHEMA.CARDINAL_NUMBER AS INTEGER " +
147                                      "CONSTRAINT CARDINAL_NUMBER_DOMAIN_CHECK " +
148                                      "CHECK ( VALUE >= 0 )");
149       informationSchemaStatement.add("CREATE DOMAIN " + SystemTables.systemCatalog + ".INFORMATION_SCHEMA.CHARACTER_DATA AS " +
150                                      "CHARACTER VARYING (" + characterDataSize + ") ");
151       informationSchemaStatement.add("CREATE DOMAIN " + SystemTables.systemCatalog + ".INFORMATION_SCHEMA.SQL_IDENTIFIER AS " +
152                                      "CHARACTER VARYING (" + SQLIdentifierSize + ") ");
153       informationSchemaStatement.add(" CREATE DOMAIN " + SystemTables.systemCatalog + ".INFORMATION_SCHEMA.TIME_STAMP AS TIMESTAMP (2)");
154       return informationSchemaStatement;
155    }
156
157    public static ArrayList getDefinitionSchemaStatement() throws DException {
158       ArrayList tableDefinitionList = new ArrayList(50);
159       tableDefinitionList.add("Create Schema " + SystemTables.systemCatalog +
160                               ".Definition_Schema authorization _SYSTEM");
161       tableDefinitionList.add(properties.getProperty("UsersDefinition"));
162       tableDefinitionList.add(properties.getProperty("RolesDefinition"));
163       tableDefinitionList.add(properties.getProperty("Role_Authorization_DescriptorsDefinition"));
164       tableDefinitionList.add(properties.getProperty("SchemataDefinition"));
165       tableDefinitionList.add(properties.getProperty("Character_SetsDefinition"));
166       tableDefinitionList.add(properties.getProperty("CollationsDefinition"));
167       tableDefinitionList.add(properties.getProperty("DomainDefinition"));
168
169       tableDefinitionList.add(properties.getProperty("TablesDefinition"));
170
171       tableDefinitionList.add(properties.getProperty("ColumnsDefinition"));
172       tableDefinitionList.add(properties.getProperty("Data_Type_DescriptorDefinition"));
173
174       tableDefinitionList.add(properties.getProperty("Table_ConstraintsDefinition"));
175       tableDefinitionList.add(properties.getProperty("Key_Column_UsageDefinition"));
176       tableDefinitionList.add(properties.getProperty("Referential_ConstraintsDefinition"));
177       tableDefinitionList.add(properties.getProperty("Check_ConstraintsDefinition"));
178       tableDefinitionList.add(properties.getProperty("Check_Column_UsageDefinition"));
179       tableDefinitionList.add(properties.getProperty("Check_Table_UsageDefinition"));
180
181       tableDefinitionList.add(properties.getProperty("TriggersDefinition"));
182       tableDefinitionList.add(properties.getProperty("Trigger_Table_UsageDefinition"));
183       tableDefinitionList.add(properties.getProperty("Trigger_Column_UsageDefinition"));
184       tableDefinitionList.add(properties.getProperty("Triggered_Update_ColumnsDefinition"));
185
186       tableDefinitionList.add(properties.getProperty("ViewsDefinition"));
187       tableDefinitionList.add(properties.getProperty("View_Column_UsageDefinition"));
188       tableDefinitionList.add(properties.getProperty("View_Table_UsageDefinition"));
189
190       tableDefinitionList.add(properties.getProperty("Domain_ConstraintsDefinition"));
191
192       tableDefinitionList.add(properties.getProperty("Column_PrivilegesDefinition"));
193       tableDefinitionList.add(properties.getProperty("Table_PrivilegesDefinition"));
194       tableDefinitionList.add(properties.getProperty("Usage_PrivilegesDefinition"));
195
196       tableDefinitionList.add(properties.getProperty("RoutinesDefinition"));
197       tableDefinitionList.add(properties.getProperty("ParametersDefinition"));
198
199       tableDefinitionList.add(properties.getProperty("Routine_PrivilegesDefinition"));
200       tableDefinitionList.add(properties.getProperty("IndexInfoDefinition"));
201       tableDefinitionList.add(properties.getProperty("IndexColumnsDefinition"));
202
203       tableDefinitionList.add(properties.getProperty("FulltextindexDefinition"));
204       tableDefinitionList.add(properties.getProperty("FulltextIndexColumnsDefinition"));
205
206       tableDefinitionList.add(properties.getProperty("User_Defined_TypesDefinition"));
207       tableDefinitionList.add(properties.getProperty("User_Defined_Type_PrivilegesDefinition"));
208       tableDefinitionList.add(properties.getProperty("TransformDefinition"));
209       tableDefinitionList.add(properties.getProperty("Method_SpecificationDefinition"));
210       tableDefinitionList.add(properties.getProperty("Method_Specification_ParametersDefinition"));
211       tableDefinitionList.add(properties.getProperty("Sequence_NumberDefinition"));
212
213       return tableDefinitionList;
214    }
215
216    public static ArrayList getSystemViews() {
217       ArrayList viewDefinitionList = new ArrayList(4);
218       viewDefinitionList.add(properties.getProperty("TablesViewDefinition"));
219       viewDefinitionList.add(properties.getProperty("ColumnsViewDefinition"));
220       viewDefinitionList.add(properties.getProperty("GrantTablesViewQuery"));
221       viewDefinitionList.add(properties.getProperty("GrantColumnsViewQuery"));
222       return viewDefinitionList;
223    }
224
225    public static ArrayList getSystemTableIndexes() throws DException {
226       ArrayList indexesList = new ArrayList(7);
227       indexesList.add("create index psg_table_constraint_1 on " + SystemTables.table_constraints_TableName + " (table_catalog,table_schema,table_name,constraint_type,is_deferrable) ");
228       indexesList.add("create index psg_key_column_usage_1 on " + SystemTables.key_column_usage_TableName + " (table_catalog,table_schema,table_name,column_name) ");
229       indexesList.add("create index psg_domain_constraint_1 on " + SystemTables.domain_constraints_TableName + " (domain_catalog,domain_schema,domain_name) ");
230       indexesList.add("create index psg_referential_constraint_1 on " + SystemTables.referential_constraints_TableName + " (unique_constraint_catalog,unique_constraint_schema,unique_constraint_name) ");
231       indexesList.add("create index psg_triggers_1 on " + SystemTables.triggers_TableName + " (event_object_catalog,event_object_schema,event_object_table,event_manipulation,action_orientation,condition_timing) ");
232       indexesList.add("create index psg_triggered_update_columns_1 on " + SystemTables.triggered_update_columns_TableName + " (event_object_catalog,event_object_schema,event_object_table) ");
233       indexesList.add("create index psg_schemata_1 on " + SystemTables.schema_TableName + " (SCHEMA_OWNER) ");
234       indexesList.add("create index psg_views_1 on " + SystemTables.views_TableName + " (TABLE_CATALOG, TABLE_SCHEMA, MATERIALIZED_TABLE_NAME ) ");
235       return indexesList;
236    }
237
238
239
240
241    static Object JavaDoc[][] dualSystemTableStructure() {
242       return new Object JavaDoc[][] { {"Column_name", new Long JavaDoc(Datatype.INT), new Integer JavaDoc(Datatype.INTSIZE), Boolean.TRUE, null, null, null}
243       };
244    }
245
246    static Object JavaDoc[][] DefaultIndexTableStructure() {
247       return new Object JavaDoc[][] { {"RecordClusterAddress", new Long JavaDoc(Datatype.LONG), new Integer JavaDoc(Datatype.LONGSIZE), Boolean.TRUE, null, null, null}
248           , {"RecordNumber", new Long JavaDoc(Datatype.INTEGER), new Integer JavaDoc(Datatype.INTSIZE), Boolean.TRUE, null, null, null}
249           , {"ClusterSize", new Long JavaDoc(Datatype.INTEGER), new Integer JavaDoc(Datatype.INTSIZE), Boolean.TRUE, null, null, null}
250           , {"NextNodeAddress", new Long JavaDoc(Datatype.LONG), new Integer JavaDoc(Datatype.LONGSIZE), Boolean.TRUE, null, null, null}
251           , {"NextNodeRecordNumber", new Long JavaDoc(Datatype.INTEGER), new Integer JavaDoc(Datatype.INTSIZE), Boolean.TRUE, null, null, null}
252           , {"NextClusterSize", new Long JavaDoc(Datatype.INTEGER), new Integer JavaDoc(Datatype.INTSIZE), Boolean.TRUE, null, null, null}
253           , {CharacteristicsConstants.systemFields[CharacteristicsConstants.rowId], new Long JavaDoc(Datatype.LONG), new Integer JavaDoc(Datatype.LONGSIZE), Boolean.TRUE, null, null, null}
254           , {CharacteristicsConstants.systemFields[CharacteristicsConstants.transactionId], new Long JavaDoc(Datatype.LONG), new Integer JavaDoc(Datatype.LONGSIZE), Boolean.TRUE, null, null, null}
255           , {CharacteristicsConstants.systemFields[CharacteristicsConstants.sessionId], new Long JavaDoc(Datatype.LONG), new Integer JavaDoc(Datatype.LONGSIZE), Boolean.TRUE, null, null, null}
256           ,
257       };
258    }
259
260    static Object JavaDoc[][] TransactionIndexTableStructure() {
261       return new Object JavaDoc[][] { {"RecordClusterAddress", new Long JavaDoc(Datatype.LONG), new Integer JavaDoc(Datatype.LONGSIZE), Boolean.TRUE, null, null, null}
262           , {"RecordNumber", new Long JavaDoc(Datatype.INTEGER), new Integer JavaDoc(Datatype.INTSIZE), Boolean.TRUE, null, null, null}
263           , {"ClusterSize", new Long JavaDoc(Datatype.INTEGER), new Integer JavaDoc(Datatype.INTSIZE), Boolean.TRUE, null, null, null}
264           , {"NextNodeAddress", new Long JavaDoc(Datatype.LONG), new Integer JavaDoc(Datatype.LONGSIZE), Boolean.TRUE, null, null, null}
265           , {"NextNodeRecordNumber", new Long JavaDoc(Datatype.INTEGER), new Integer JavaDoc(Datatype.INTSIZE), Boolean.TRUE, null, null, null}
266           , {"NextClusterSize", new Long JavaDoc(Datatype.INTEGER), new Integer JavaDoc(Datatype.INTSIZE), Boolean.TRUE, null, null, null}
267           , {"SavedTransactionId", new Long JavaDoc(Datatype.LONG), new Integer JavaDoc(Datatype.LONGSIZE), Boolean.TRUE, null, null, null}
268           ,
269       };
270    }
271
272    static Object JavaDoc[][] SessionIndexTableStructure() {
273       return new Object JavaDoc[][] { {"RecordClusterAddress", new Long JavaDoc(Datatype.LONG), new Integer JavaDoc(Datatype.LONGSIZE), Boolean.TRUE, null, null, null}
274           , {"RecordNumber", new Long JavaDoc(Datatype.INTEGER), new Integer JavaDoc(Datatype.INTSIZE), Boolean.TRUE, null, null, null}
275           , {"ClusterSize", new Long JavaDoc(Datatype.INTEGER), new Integer JavaDoc(Datatype.INTSIZE), Boolean.TRUE, null, null, null}
276           , {"NextNodeAddress", new Long JavaDoc(Datatype.LONG), new Integer JavaDoc(Datatype.LONGSIZE), Boolean.TRUE, null, null, null}
277           , {"NextNodeRecordNumber", new Long JavaDoc(Datatype.INTEGER), new Integer JavaDoc(Datatype.INTSIZE), Boolean.TRUE, null, null, null}
278           , {"NextClusterSize", new Long JavaDoc(Datatype.INTEGER), new Integer JavaDoc(Datatype.INTSIZE), Boolean.TRUE, null, null, null}
279           , {"SavedSessionId", new Long JavaDoc(Datatype.LONG), new Integer JavaDoc(Datatype.LONGSIZE), Boolean.TRUE, null, null, null}
280           ,
281       };
282    }
283
284    /* static HashMap map = new HashMap();
285     public static void putTableStructure() throws DException {
286        map.put(SystemTables.characterSets_TableName ,characterSetsTableStructure());
287        map.put(SystemTables.collations_TableName ,collationsTableStructure());
288        map.put(SystemTables.column_privileges_TableName ,columnPrivilegesTableStructure());
289        map.put(SystemTables.schema_TableName ,schemaTableStructure());
290        map.put(SystemTables.tables_TableName ,tablesTableStructure());
291        map.put(SystemTables.columns_TableName ,columnsTableStructure());
292        map.put(SystemTables.dataTypeDescriptor_TableName ,dataTypeTableStructure());
293        map.put(SystemTables.triggers_TableName ,triggerTableStructure());
294        map.put(SystemTables.trigger_table_usage_TableName ,triggerTableUsageTableStructure());
295        map.put(SystemTables.trigger_column_usage_TableName ,triggerColumnUsageTableStructure());
296        map.put(SystemTables.triggered_update_columns_TableName ,triggerUpdateColumnTableStructure());
297        map.put(SystemTables.table_constraints_TableName ,tableConstraintsTableStructure());
298        map.put(SystemTables.referential_constraints_TableName,referentialConstraintsTableStructure());
299        map.put(SystemTables.check_constraints_TableName ,checkConstraintsTableStructure());
300        map.put(SystemTables.key_column_usage_TableName ,keyColumnUsageTableStructure());
301        map.put(SystemTables.check_column_usage_TableName ,checkColumnUsageTableStructure());
302        map.put(SystemTables.check_table_usage_TableName ,checkTableUsageTableStructure());
303        map.put(SystemTables.views_TableName ,viewsTableStructure());
304        map.put(SystemTables.view_colum_usage_TableName ,viewColumnUsageTableStructure());
305        map.put(SystemTables.view_table_usage_TableName ,viewTableUsageTableStructure());
306        map.put(SystemTables.domains_TableName ,domainTableStructure());
307        map.put(SystemTables.usage_privileges_TableName ,usagePrivilegesTableStructure());
308        map.put(SystemTables.table_privileges_TableName ,tablePrivilegesTableStructure());
309        map.put(SystemTables.domain_constraints_TableName,domain_constraintsTableStructure());
310        map.put(SystemTables.role_authorization_TableName ,role_Authorization_DescriptorsTableStructure());
311        map.put(SystemTables.roles_TableName ,rolesTableStructure());
312        map.put(SystemTables.routine_privileges_TableName ,routine_PrivilegesTableStructure());
313        map.put(SystemTables.users_TableName ,usersTableStructure());
314        map.put(SystemTables.sumtrigger_TableName ,sumtriggerTableStructure());
315        map.put(SystemTables.parameters_TableName,parametersTableStructure());
316        map.put(SystemTables.routines_TableName ,routinesTableStructure());
317        map.put(SystemTables.DATABASEINFO,databaseInfoTableStructure());
318        map.put(SystemTables.TABLEINFO,tableInfoTableStructure());
319        map.put(SystemTables.COLUMNINFO,columnInfoTableStructure());
320        map.put(SystemTables.CLUSTERINFO,clusterInfoTableStructure());
321        map.put(SystemTables.INDEXINFO ,indexInfoTableStructure());
322        map.put(SystemTables.INDEXCOLUMNS ,indexColumnsTableStructure());
323        map.put(SystemTables.fulltextindex_Table ,fullTextIndexTableStructure());
324        map.put(SystemTables.user_defined_type_TableName ,User_Defined_TypesTableStructure());
325        map.put(SystemTables.user_defined_type_privileges_TableName ,User_Defined_Type_PrivilegesTableStructure());
326        map.put(SystemTables.method_specifications_TableName ,method_SpecificationTableStructure());
327        map.put(SystemTables.method_specification_parameters_TableName ,method_Specification_ParametersTableStructure());
328        map.put(SystemTables.transforms_TableName ,transform_TableStructure());
329          DefaultIndexTableStructure();
330           TransactionIndexTableStructure();
331          SessionIndexTableStructure();
332        map.put(SystemTables.sequence_number_TableName,sequence_numberTableStructure());
333      }*/

334    /* static HashMap map1 = new HashMap();
335      public static void putPrimaryKeys() throws DException {
336        map1.put(SystemTables.characterSets_TableName,character_Sets_primaryKeys());
337        map1.put(SystemTables.collations_TableName,collations_primaryKeys());
338        map1.put(SystemTables.column_privileges_TableName,column_Privileges_primaryKeys());
339        map1.put(SystemTables.schema_TableName,schemata_primaryKeys());
340        map1.put(SystemTables.tables_TableName,tables_primaryKeys());
341        map1.put(SystemTables.columns_TableName,columns_primaryKeys());
342        map1.put(SystemTables.dataTypeDescriptor_TableName,data_Type_Descriptor_primaryKeys());
343        map1.put(SystemTables.triggers_TableName,triggers_primaryKeys());
344        map1.put(SystemTables.trigger_table_usage_TableName,trigger_Table_Usage_primaryKeys());
345        map1.put(SystemTables.trigger_column_usage_TableName,trigger_Column_Usage_primaryKeys());
346        map1.put(SystemTables.triggered_update_columns_TableName,triggered_Update_Columns_primaryKeys());
347        map1.put(SystemTables.table_constraints_TableName,table_Constraints_primaryKeys());
348        map1.put(SystemTables.referential_constraints_TableName,referential_Constraints_primaryKeys());
349        map1.put(SystemTables.check_constraints_TableName,check_constraints_primaryKeys());
350        map1.put(SystemTables.key_column_usage_TableName,key_Column_Usage_primaryKeys());
351        map1.put(SystemTables.check_column_usage_TableName,check_column_Usage_primaryKeys());
352        map1.put(SystemTables.check_table_usage_TableName,check_table_usage_primaryKeys());
353        map1.put(SystemTables.views_TableName,views_primaryKeys());
354        map1.put(SystemTables.view_colum_usage_TableName,view_Column_Usage_primaryKeys());
355        map1.put(SystemTables.view_table_usage_TableName,view_Table_Usage_primaryKeys());
356        map1.put(SystemTables.domains_TableName,domain_primaryKeys());
357        map1.put(SystemTables.usage_privileges_TableName,usage_Privileges_primaryKeys());
358        map1.put(SystemTables.table_privileges_TableName,table_privileges_primaryKeys());
359        map1.put(SystemTables.domain_constraints_TableName,domain_Constrains_primaryKeys());
360        map1.put(SystemTables.role_authorization_TableName,role_Authorizatin_Descriptors_primaryKeys());
361        map1.put(SystemTables.roles_TableName,roles_primaryKeys());
362        map1.put(SystemTables.routine_privileges_TableName,routine_Privileges_primaryKeys());
363        map1.put(SystemTables.users_TableName,users_primaryKeys());
364        map1.put(SystemTables.parameters_TableName,parameters_primaryKeys());
365        map1.put(SystemTables.routines_TableName,routines_primaryKeys());
366        map1.put(SystemTables.INDEXINFO,indexInfo_primaryKeys());
367         map1.put(SystemTables.INDEXCOLUMNS,indexColumns_primaryKeys());
368        map1.put(SystemTables.user_defined_type_TableName,user_Defined_Types_primaryKeys());
369        map1.put(SystemTables.user_defined_type_privileges_TableName,user_Defined_Type_Privileges_primaryKeys());
370        map1.put(SystemTables.method_specifications_TableName,method_Specification_primaryKeys());
371        map1.put(SystemTables.method_specification_parameters_TableName,method_Specification_Parameters_primaryKeys());
372        map1.put(SystemTables.transforms_TableName,transform_primaryKeys());
373        map1.put(SystemTables.sequence_number_TableName,sequence_Number_primaryKeys());
374        map1.put(SystemTables.fulltextindex_Table,fulltextIndex_primaryKeys());
375      }*/

376
377    /* public static void main(String[] args) {
378         try {
379         }
380         catch (Exception ex) {
381         }
382       }*/

383
384
385
386    /**
387     * New Method written by harvinder related to bug 11484. */

388    public static void changeStructure(double version) throws DException {
389       try {
390          Class JavaDoc cl = Class.forName("com.daffodilwoods.daffodildb.server.datadictionarysystem.SystemTablesCreator");
391          java.net.URL JavaDoc urlw = cl.getResource("/com/daffodilwoods/daffodildb/server/datadictionarysystem/systemtablesStructure.obj");
392          ObjectInputStream ois = new ObjectInputStream(new BufferedInputStream(urlw.openStream()));
393          structureMap = (HashMap) ois.readObject();
394          if (version >= 3.4) {
395             Object JavaDoc[][] columnsTableStructure = (Object JavaDoc[][]) structureMap.get( (Object JavaDoc) SystemTables.columns_TableName);
396             columnsTableStructure[9][2] = new Integer JavaDoc(1027);
397          }
398          ois.close();
399       } catch (IOException ex) {
400       } catch (ClassNotFoundException JavaDoc ex) {
401       }
402    }
403 }
404
Popular Tags