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.sql99.dql.iterator.*; 6 import com.daffodilwoods.daffodildb.server.sql99.expression.booleanvalueexpression.*; 7 import com.daffodilwoods.daffodildb.server.sql99.utils.parser.*; 8 import com.daffodilwoods.database.resource.*; 9 10 public class UserDefinedTypePrivilegesDescriptor extends PrivilegeDescriptor { 11 12 public String GRANTOR; 13 public String GRANTEE; 14 public String USER_DEFINED_TYPE_CATALOG; 15 public String USER_DEFINED_TYPE_SCHEMA; 16 public String USER_DEFINED_TYPE_NAME; 17 public String PRIVILEGE_TYPE; 18 public String IS_GRANTABLE; 19 20 public UserDefinedTypePrivilegesDescriptor() throws DException { 21 } 22 23 public void load(_ServerSession serverSession) throws com.daffodilwoods. 24 database.resource.DException { 25 String clause = "select * from " + 26 SystemTables.user_defined_type_privileges_TableName + " where Grantor = ? and Grantee = ? and User_Defined_Type_Catalog = ? and User_Defined_Type_Schema = ? and User_Defined_Type_Name = ? and Privilege_Type = ? "; 27 _SelectQueryIterator iter = SqlSchemaConstants.getIterator(serverSession, clause, 28 new Object [] {GRANTOR, GRANTEE, USER_DEFINED_TYPE_CATALOG, 29 USER_DEFINED_TYPE_SCHEMA, USER_DEFINED_TYPE_NAME, PRIVILEGE_TYPE}); 30 if (iter.first()) { 31 Object [] obj = (Object []) iter.getObject(); 32 33 IS_GRANTABLE = (String ) obj[SystemTablesFields. 34 user_Defined_Type_Privileges_Is_Grantable]; 35 } else { 36 throw new DException("DSE723", null); 37 } 38 } 39 40 public void loadDataFromRecord(_SelectQueryIterator iter) throws DException { 41 Object [] obj = (Object []) iter.getObject(); 42 GRANTOR = (String ) obj[SystemTablesFields. 43 user_Defined_Type_Privileges_Grantor]; 44 GRANTEE = (String ) obj[SystemTablesFields. 45 user_Defined_Type_Privileges_Grantee]; 46 USER_DEFINED_TYPE_CATALOG = (String ) obj[SystemTablesFields. 47 user_Defined_Type_Privileges_User_Defined_Type_Catalog]; 48 USER_DEFINED_TYPE_SCHEMA = (String ) obj[SystemTablesFields. 49 user_Defined_Type_Privileges_User_Defined_Type_Schema]; 50 USER_DEFINED_TYPE_NAME = (String ) obj[SystemTablesFields. 51 user_Defined_Type_Privileges_User_Defined_Type_Name]; 52 PRIVILEGE_TYPE = (String ) obj[SystemTablesFields. 53 user_Defined_Type_Privileges_Privilege_Type]; 54 55 IS_GRANTABLE = (String ) obj[SystemTablesFields. 56 user_Defined_Type_Privileges_Is_Grantable]; 57 58 } 59 60 public void save(_ServerSession serverSession) throws com.daffodilwoods. 61 database.resource.DException { 62 Object [] values = new Object [] { 63 GRANTOR, 64 GRANTEE, 65 USER_DEFINED_TYPE_CATALOG, 66 USER_DEFINED_TYPE_SCHEMA, 67 USER_DEFINED_TYPE_NAME, 68 PRIVILEGE_TYPE, 69 IS_GRANTABLE 70 }; 71 SqlSchemaConstants.insert(serverSession, 72 SystemTables.user_defined_type_privileges_TableName, null, 73 values); 74 } 75 76 public void delete(_ServerSession serverSession) throws DException { 77 String bve = "GRANTOR=? and GRANTEE=? and USER_DEFINED_TYPE_CATALOG=? and USER_DEFINED_TYPE_SCHEMA=? and USER_DEFINED_TYPE_NAME=? and PRIVILEGE_TYPE=?"; 78 _ServerSession globalSession = serverSession.getGlobalSession(); 79 booleanvalueexpression condition = ConditionParser.parseCondition(bve, 80 globalSession, 81 SqlSchemaConstants.user_defined_type_privileges_TableName); 82 super.delete(serverSession, 83 SqlSchemaConstants.user_defined_type_privileges_TableName, 84 condition, new Object [] {GRANTOR, GRANTEE, 85 USER_DEFINED_TYPE_CATALOG, 86 USER_DEFINED_TYPE_SCHEMA, 87 USER_DEFINED_TYPE_NAME, PRIVILEGE_TYPE} 88 ); 89 } 90 91 public int getDescriptorType() { 92 return USED_DEFINED_TYPE_PRIVILEGE_DESCRIPTOR; 93 } 94 95 public boolean equals(Object obj) { 96 return false; 97 } 98 99 public int hashCode() { 100 return -1; 101 } 102 103 public void updateIsGrantableValue(_ServerSession serversession, String isGrantable) throws DException { 104 105 } 106 } 107 | Popular Tags |