1 package com.daffodilwoods.daffodildb.server.sql99.ddl.descriptors; 2 3 import com.daffodilwoods.daffodildb.server.datadictionarysystem.*; 4 import com.daffodilwoods.daffodildb.server.sql99.expression.booleanvalueexpression.*; 5 13 import com.daffodilwoods.daffodildb.server.sql99.utils.parser.*; 14 22 import com.daffodilwoods.database.resource.*; 23 24 32 public class QueryGetter { 33 34 public QueryGetter() { 35 } 36 37 229 public static String tableConstraintQuery = "select * from " 230 + SystemTables.table_constraints_TableName 231 + " where constraint_catalog = ? and constraint_schema = ? " 232 + " and constraint_name = ? "; 233 234 public static String keyColumnUsageQuery = "select * from " 235 + SystemTables.key_column_usage_TableName 236 + " where constraint_catalog = ? and constraint_schema = ? " 237 + " and constraint_name = ? order by ordinal_position "; 238 239 public static String checkConstraintQuery = "select check_clause from " 240 + SystemTables.check_constraints_TableName 241 + " where constraint_catalog = ? and constraint_schema = ? " 242 + " and constraint_name = ? "; 243 244 public static String tablePrivilegeDescriptorDependent_A = "select * from " + SystemTables.table_privileges_TableName 245 + " where table_name = ? and table_schema = ? and table_catalog = ? and privilege_type = ?"; 246 public static String tablePrivilegeDescriptorDependent_B = "select * from " + SystemTables.table_privileges_TableName 247 + " as one where grantor='_SYSTEM'" 248 + " and privilege_type = ? " 249 + " and (? or ? = (select grantee from " + SystemTables.table_privileges_TableName 250 + " as two where two.grantor='_SYSTEM' and one.table_name = two.table_name" 251 + " and one.table_schema = two.table_schema and one.table_catalog = two.table_catalog))" 252 + " and "; 253 254 public static String columnPrivilegeDescriptorDependent_A = "select * from " + SystemTables.column_privileges_TableName 255 + " where table_name = ? and table_schema = ? and table_catalog = ? and column_name = ? and privilege_type = ?"; 256 public static String columnPrivilegeDescriptorDependent_B = "select * from " + SystemTables.column_privileges_TableName 257 + " as one where grantor='_SYSTEM'" 258 + " and privilege_type = ? " 259 + " and (? or ? = (select grantee from " + SystemTables.table_privileges_TableName 260 + " as two where two.grantor='_SYSTEM' and one.table_name = two.table_name" 261 + " and one.table_schema = two.table_schema and one.table_catalog = two.table_catalog))" 262 + " and "; 263 264 public static String routinePrivilegeDescriptorDependent_A = "select * from " + SystemTables.routine_privileges_TableName 265 + " where specific_name = ? and specific_schema = ? and specific_catalog = ? and privilege_type = ?"; 266 public static String routinePrivilegeDescriptorDependent_B; 267 268 public static String usagePrivilegeDescriptorDependent_A = "select * from " + SystemTables.usage_privileges_TableName 269 + " where object_name = ? and object_schema = ? and object_catalog = ? and object_type = ?"; 270 public static String usagePrivilegeDescriptorDependent_B; 271 272 public static String privilegeDescriptorDependents_C = "select * from " + SystemTables.usage_privileges_TableName 273 + " as A, " + SystemTables.usage_privileges_TableName + " as B " 274 + " where A.grantor='_SYSTEM' and A.object_type='DOMAIN' " 275 + " and ('PUBLIC' = ? or " 276 + " (? = B.grantee and B.grantor='_SYSTEM'" 277 + " and A.object_name=B.object_name " 278 + " and A.object_schema=B.object_schema " 279 + " and A.object_catalog=B.object_catalog " 280 + " and B.object_type='DOMAIN'))"; 281 282 public static String domainCheckConstraints = "select" 283 + " C.constraint_catalog, C.constraint_schema, C.constraint_name, C.check_clause" 284 + " from " + SystemTables.domain_constraints_TableName 285 + " as B, " + SystemTables.check_constraints_TableName + " as C " 286 + " where B.domain_name=? and B.domain_schema=? and B.domain_catalog=?" 287 + " and B.constraint_catalog=C.constraint_catalog and B.constraint_schema=C.constraint_schema and B.constraint_name=C.constraint_name"; 288 289 public static String usagePrivilegeDescriptorAncestor_C_Column = "select * from " + SystemTables.column_privileges_TableName 290 + " where (grantee = ? or grantee = 'PUBLIC') and privilege_type='REFERENCES'"; 291 public static String usagePrivilegeDescriptorAncestor_C_Usage = "select * from " + SystemTables.usage_privileges_TableName 292 + " where (grantee = ? or grantee = 'PUBLIC')"; 293 294 public static String checkViews = "select * from " + SystemTables.views_TableName 295 + " where table_name = ? and table_schema = ? and table_catalog = ?"; 296 public static String tableOwner = "select distinct grantee from " + SystemTables.table_privileges_TableName 297 + " where table_name = ? and table_schema = ? and table_catalog = ? and grantor = '_SYSTEM'"; 298 public static String routineOwner = "select distinct grantee from " + SystemTables.routine_privileges_TableName 299 + " where specific_name = ? and specific_schema = ? and specific_catalog = ? and grantor = '_SYSTEM'"; 300 public static String usageObjectOwner = "select distinct grantee from " + SystemTables.usage_privileges_TableName 301 + " where object_type = ? and object_name = ? and object_schema = ? and object_catalog = ?" 302 + " and grantor = '_SYSTEM'"; 303 public static String dependentRoles = "select * from " + SystemTables.role_authorization_TableName + " where role_name = ?"; 304 public static String userPasswordQuery = " Select * from " + SystemTables.users_TableName + " where user_name = ? and user_password = ? "; 305 306 public static String recordCondition; 307 308 public static booleanvalueexpression privilegeCondition; 309 public static String privilegeConditionString; 310 311 public static booleanvalueexpression getPrivilegeCondition() throws DException { 312 if (privilegeCondition == null) { 313 privilegeCondition = (booleanvalueexpression) SessionConditionParser.parseCondition(" true "); 314 privilegeConditionString = privilegeCondition.toString(); 315 } 316 return privilegeCondition; 317 } 318 319 public static booleanvalueexpression sequenceCondition; 320 321 public static booleanvalueexpression getSequenceCondition() throws DException { 322 if (sequenceCondition == null) { 323 sequenceCondition = (booleanvalueexpression) ConditionParser.parseCondition("sequence_catalog = ? and sequence_schema = ? and sequence_name = ?"); 324 } 325 return sequenceCondition; 326 } 327 } 328 | Popular Tags |