1 package com.daffodilwoods.daffodildb.server.sql99.ddl.descriptors; 2 3 import com.daffodilwoods.daffodildb.server.datadictionarysystem.*; 4 import com.daffodilwoods.daffodildb.server.serversystem.*; 5 import com.daffodilwoods.daffodildb.server.serversystem.dmlvalidation.constraintsystem.*; 6 import com.daffodilwoods.daffodildb.server.sql99.dql.iterator.*; 7 import com.daffodilwoods.daffodildb.server.sql99.expression.booleanvalueexpression.*; 8 import com.daffodilwoods.daffodildb.server.sql99.utils.parser.*; 9 import com.daffodilwoods.database.general.*; 10 import com.daffodilwoods.database.resource.*; 11 12 public class MethodSpecificationDescriptor extends Descriptor { 13 14 public String SPECIFIC_CATALOG; 15 public String SPECIFIC_SCHEMA; 16 public String SPECIFIC_NAME; 17 public String USER_DEFINED_TYPE_CATALOG; 18 public String USER_DEFINED_TYPE_SCHEMA; 19 public String USER_DEFINED_TYPE_NAME; 20 public String METHOD_NAME; 21 public String IS_STATIC; 22 public String IS_OVERRIDING; 23 public String METHOD_LANGUAGE; 24 public String PARAMETER_STYLE; 25 public String DTD_IDENTIFIER; 26 public String IS_DETERMINISTIC; 27 public String SQL_DATA_ACCESS; 28 public String IS_NULL_CALL; 29 public String TO_SQL_SPECIFIC_CATALOG; 30 public String TO_SQL_SPECIFIC_SCHEMA; 31 public String TO_SQL_SPECIFIC_NAME; 32 public String AS_LOCATOR; 33 public java.sql.Timestamp CREATED; 34 public java.sql.Timestamp LAST_ALTERED; 35 36 public MethodSpecificationDescriptor() throws DException { 37 } 38 39 public void load(_ServerSession serverSession) throws com.daffodilwoods.database.resource.DException { 40 String clause = "select * from " + SystemTables.method_specifications_TableName 41 + " where specific_catalog = ? and specific_schema = ? and specific_name = ?"; 42 _SelectQueryIterator iter = SqlSchemaConstants.getIterator(serverSession, clause, new Object [] {SPECIFIC_CATALOG, SPECIFIC_SCHEMA, SPECIFIC_NAME}); 43 if (iter.first()) { 44 loadDataFromRecord(iter); 45 46 } else { 47 throw new DException("DSE723", null); 48 } 49 } 50 51 public void loadDataFromRecord(_SelectQueryIterator iter) throws DException { 52 Object [] obj = (Object []) iter.getObject(); 53 SPECIFIC_CATALOG = (String ) obj[SystemTablesFields.method_Specifications_Specific_Catalog]; 54 SPECIFIC_SCHEMA = (String ) obj[SystemTablesFields.method_Specifications_Specific_Schema]; 55 SPECIFIC_NAME = (String ) obj[SystemTablesFields.method_Specifications_Specific_Name]; 56 USER_DEFINED_TYPE_CATALOG = (String ) obj[SystemTablesFields.method_Specifications_User_Defined_Type_Catalog]; 57 USER_DEFINED_TYPE_SCHEMA = (String ) obj[SystemTablesFields.method_Specifications_User_Defined_Type_Schema]; 58 USER_DEFINED_TYPE_NAME = (String ) obj[SystemTablesFields.method_Specifications_User_Defined_Type_Name]; 59 METHOD_NAME = (String ) obj[SystemTablesFields.method_Specifications_Method_Name]; 60 IS_STATIC = (String ) obj[SystemTablesFields.method_Specifications_Is_Static]; 61 IS_OVERRIDING = (String ) obj[SystemTablesFields.method_Specifications_Is_Overriding]; 62 METHOD_LANGUAGE = (String ) obj[SystemTablesFields.method_Specifications_Method_Language]; 63 PARAMETER_STYLE = (String ) obj[SystemTablesFields.method_Specifications_Parameter_Style]; 64 DTD_IDENTIFIER = (String ) obj[SystemTablesFields.method_Specifications_Dtd_Identifier]; 65 IS_DETERMINISTIC = (String ) obj[SystemTablesFields.method_Specifications_Is_Deterministic]; 66 SQL_DATA_ACCESS = (String ) obj[SystemTablesFields.method_Specifications_SQL_Data_Access]; 67 IS_NULL_CALL = (String ) obj[SystemTablesFields.method_Specifications_Is_Null_Call]; 68 TO_SQL_SPECIFIC_CATALOG = (String ) obj[SystemTablesFields.method_Specifications_To_SQL_Specific_Catalog]; 69 TO_SQL_SPECIFIC_SCHEMA = (String ) obj[SystemTablesFields.method_Specifications_To_SQL_Specific_Schema]; 70 TO_SQL_SPECIFIC_NAME = (String ) obj[SystemTablesFields.method_Specifications_To_SQL_Specific_Name]; 71 AS_LOCATOR = (String ) obj[SystemTablesFields.method_Specifications_As_Locator]; 72 CREATED = (java.sql.Timestamp ) obj[SystemTablesFields.method_Specifications_Created]; 73 LAST_ALTERED = (java.sql.Timestamp ) obj[SystemTablesFields.method_Specifications_Last_Altered]; 74 75 } 76 77 public void save(_ServerSession serverSession) throws com.daffodilwoods.database.resource.DException { 78 Object [] values = new Object [] { 79 SPECIFIC_CATALOG, 80 SPECIFIC_SCHEMA, 81 SPECIFIC_NAME, 82 USER_DEFINED_TYPE_CATALOG, 83 USER_DEFINED_TYPE_SCHEMA, 84 USER_DEFINED_TYPE_NAME, 85 METHOD_NAME, 86 IS_STATIC, 87 IS_OVERRIDING, 88 METHOD_LANGUAGE, 89 PARAMETER_STYLE, 90 DTD_IDENTIFIER, 91 IS_DETERMINISTIC, 92 SQL_DATA_ACCESS, 93 IS_NULL_CALL, 94 TO_SQL_SPECIFIC_CATALOG, 95 TO_SQL_SPECIFIC_SCHEMA, 96 TO_SQL_SPECIFIC_NAME, 97 AS_LOCATOR, 98 CREATED, 99 LAST_ALTERED 100 }; 101 try { 102 SqlSchemaConstants.insert(serverSession, SystemTables.method_specifications_TableName, null, values); 103 } catch (PrimaryConstraintException de) { 104 DException tde = new DException("DSE1152", new Object [] {SPECIFIC_CATALOG, SPECIFIC_SCHEMA, SPECIFIC_NAME}); 105 throw tde; 106 } catch (SizeMisMatchException de) { 107 if (de.getDseCode().equals("DSE773")) { 108 DException tde = new DException("DSE8103", null); 109 throw tde; 110 } 111 } catch (DException de) { 112 if (de.getDseCode().equals("DSE1255")) { 113 DException tde = new DException("DSE1152", new Object [] {SPECIFIC_CATALOG, SPECIFIC_SCHEMA, SPECIFIC_NAME}); 114 throw tde; 115 } 116 if (de.getDseCode().equals("DSE773")) { 117 DException tde = new DException("DSE8103", null); 118 throw tde; 119 } 120 throw de; 121 } 122 } 123 124 public void delete(_ServerSession serverSession) throws com.daffodilwoods.database.resource.DException { 125 String bve = "SPECIFIC_CATALOG=? and SPECIFIC_SCHEMA=? and SPECIFIC_NAME=?"; 126 _ServerSession globalSession = serverSession.getGlobalSession(); 127 booleanvalueexpression condition = ConditionParser.parseCondition(bve, globalSession, SqlSchemaConstants.method_specifications_TableName); 128 super.delete(serverSession, SqlSchemaConstants.method_specifications_TableName, condition, new Object [] {SPECIFIC_CATALOG, SPECIFIC_SCHEMA, SPECIFIC_NAME}); 129 } 130 131 public int getDescriptorType() { 132 return METHOD_SPECIFICATION_DESCRIPTOR; 133 } 134 } 135 | Popular Tags |