// // constructor // StmtDDLDropSchema::StmtDDLDropSchema(//const SchemaName & schemaName, const ElemDDLSchemaName & aSchemaNameParseNode, ComDropBehavior dropBehavior, ComBoolean cleanupMode, ComBoolean dropObjectsOnly) : StmtDDLNode(DDL_DROP_SCHEMA), schemaQualName_(aSchemaNameParseNode.getSchemaName(), PARSERHEAP()), dropBehavior_(dropBehavior), cleanupMode_(cleanupMode), dropObjectsOnly_(dropObjectsOnly), dropIfExists_(FALSE), schemaName_(PARSERHEAP()) { if (schemaQualName_.getCatalogName().isNull()) { schemaName_ = ToAnsiIdentifier(schemaQualName_.getSchemaName()); } else { schemaName_ = ToAnsiIdentifier(schemaQualName_.getCatalogName()) + "." + ToAnsiIdentifier(schemaQualName_.getSchemaName()); } // If the schema name specified is reserved name, users cannot drop them. // They can only be dropped internally. if ((! Get_SqlParser_Flags(INTERNAL_QUERY_FROM_EXEUTIL)) && (ComIsTrafodionReservedSchemaName(schemaQualName_.getSchemaName()))) { // error. *SqlParser_Diags << DgSqlCode(-1430) << DgSchemaName(schemaName_); } }
// ----------------------------------------------------------------------- // member functions for class StmtDDLSchGrant // ----------------------------------------------------------------------- StmtDDLSchGrant::StmtDDLSchGrant(ElemDDLNode * pPrivileges, const ElemDDLSchemaName & aSchemaNameParseNode, ElemDDLNode * pGranteeList, ElemDDLNode * pWithGrantOption, ElemDDLNode * pByGrantorOption, CollHeap * heap) : StmtDDLNode(DDL_GRANT_SCHEMA), schemaName_(heap), schemaQualName_(aSchemaNameParseNode.getSchemaName(), heap), isAllDMLPrivileges_(FALSE), isAllDDLPrivileges_(FALSE), isAllOtherPrivileges_(FALSE), isWithGrantOptionSpec_(FALSE), privActArray_(heap), granteeArray_(heap), isByGrantorOptionSpec_(FALSE), byGrantor_(NULL) { if (schemaQualName_.getSchemaName().isNull()) { schemaQualName_ = ActiveSchemaDB()->getDefaultSchema(); } setChild(INDEX_PRIVILEGES, pPrivileges); setChild(INDEX_GRANTEE_LIST, pGranteeList); setChild(INDEX_WITH_GRANT_OPTION, pWithGrantOption); setChild(INDEX_BY_GRANTOR_OPTION, pByGrantorOption); //objectName_ = objectQualName_.getQualifiedNameAsAnsiString(); // // inserts pointers to parse nodes representing privilege // actions to privActArray_ so the user can access the // information about privilege actions easier. // ComASSERT(pPrivileges NEQ NULL); ElemDDLPrivileges * pPrivsNode = pPrivileges->castToElemDDLPrivileges(); ComASSERT(pPrivsNode NEQ NULL); if (pPrivsNode->isAllPrivileges()) { isAllDMLPrivileges_ = TRUE; isAllDDLPrivileges_ = TRUE; isAllOtherPrivileges_ = TRUE; } if (pPrivsNode->isAllDMLPrivileges()) { isAllDMLPrivileges_ = TRUE; } if (pPrivsNode->isAllDDLPrivileges()) { isAllDDLPrivileges_ = TRUE; } if (pPrivsNode->isAllOtherPrivileges()) { isAllOtherPrivileges_ = TRUE; } ElemDDLNode * pPrivActs = pPrivsNode->getPrivilegeActionList(); if (pPrivActs) { for (CollIndex i = 0; i < pPrivActs->entries(); i++) { privActArray_.insert((*pPrivActs)[i]->castToElemDDLPrivAct()); } } // // copies pointers to parse nodes representing grantee // to granteeArray_ so the user can access the information // easier. // ComASSERT(pGranteeList NEQ NULL); for (CollIndex i = 0; i < pGranteeList->entries(); i++) { granteeArray_.insert((*pGranteeList)[i]->castToElemDDLGrantee()); } // // looks for With Grant option phrase // if (pWithGrantOption NEQ NULL) { isWithGrantOptionSpec_ = TRUE; } if ( pByGrantorOption NEQ NULL ) { isByGrantorOptionSpec_ = TRUE; byGrantor_ = pByGrantorOption->castToElemDDLGrantee(); } } // StmtDDLSchGrant::StmtDDLSchGrant()
StmtDDLSchRevoke::StmtDDLSchRevoke(NABoolean isGrantOptionFor, ElemDDLNode * pPrivileges, const ElemDDLSchemaName & aSchemaNameParseNode, ElemDDLNode * pGranteeList, ComDropBehavior dropBehavior, ElemDDLNode * pByGrantorOption, CollHeap * heap) : StmtDDLNode(DDL_REVOKE_SCHEMA), schemaName_(heap), schemaQualName_(aSchemaNameParseNode.getSchemaName(), heap), isAllDDLPrivileges_(FALSE), isAllDMLPrivileges_(FALSE), isAllOtherPrivileges_(FALSE), isGrantOptionForSpec_(isGrantOptionFor), dropBehavior_(dropBehavior), privActArray_(heap), granteeArray_(heap), isByGrantorOptionSpec_(FALSE), byGrantor_(NULL) { setChild(INDEX_PRIVILEGES, pPrivileges); setChild(INDEX_GRANTEE_LIST, pGranteeList); setChild(INDEX_BY_GRANTOR_OPTION, pByGrantorOption); // // inserts pointers to parse nodes representing privilege // actions to privActArray_ so the user can access the // information about privilege actions easier. // ComASSERT(pPrivileges NEQ NULL); ElemDDLPrivileges * pPrivsNode = pPrivileges->castToElemDDLPrivileges(); ComASSERT(pPrivsNode NEQ NULL); if (pPrivsNode->isAllPrivileges()) { isAllDDLPrivileges_ = TRUE; isAllDMLPrivileges_ = TRUE; isAllOtherPrivileges_ = TRUE; } if (pPrivsNode->isAllDDLPrivileges()) { isAllDDLPrivileges_ = TRUE; } if (pPrivsNode->isAllDMLPrivileges()) { isAllDMLPrivileges_ = TRUE; } if (pPrivsNode->isAllOtherPrivileges()) { isAllOtherPrivileges_ = TRUE; } ElemDDLNode * pPrivActs = pPrivsNode->getPrivilegeActionList(); if (pPrivActs) { for (CollIndex i = 0; i < pPrivActs->entries(); i++) { privActArray_.insert((*pPrivActs)[i]->castToElemDDLPrivAct()); } } // // copies pointers to parse nodes representing grantee // to granteeArray_ so the user can access the information // easier. // ComASSERT(pGranteeList NEQ NULL); for (CollIndex i = 0; i < pGranteeList->entries(); i++) { granteeArray_.insert((*pGranteeList)[i]->castToElemDDLGrantee()); } if ( pByGrantorOption NEQ NULL ) { isByGrantorOptionSpec_ = TRUE; byGrantor_ = pByGrantorOption->castToElemDDLGrantee(); } } // StmtDDLSchRevoke::StmtDDLSchRevoke()