#############################################################  -*- c -*-
## generic include for XXX. Do not use directly.
##
## $Id: syntax-RowStatus-dependencies.m2i,v 1.3 2004/09/22 02:30:58 rstory Exp $
########################################################################
@if $m2c_mark_boundary == 1@
/** START code generated by $RCSfile: syntax-RowStatus-dependencies.m2i,v $ $Revision: 1.3 $ */
@end@
########################################################################
## {
    /*
     * check RowStatus dependencies
     */
    if (rowreq_ctx->column_set_flags & FLAG_$node.uc) {
        /*
         * check for valid RowStatus transition (old, new)
         * (Note: move transition check to $node_check_value
         *  to catch errors earlier)
         */
        rc = check_rowstatus_transition( ${m2c_undo_item}$node,
                                         ${m2c_data_item}$node );
        if (MFD_SUCCESS != rc)
            return rc;
        
@if $m2c_table_row_creation == 1@
        /*
         * row creation requirements
         */
        if (rowreq_ctx->rowreq_flags & MFD_ROW_CREATED) {
            if (ROWSTATUS_CREATEANDGO ==  ${m2c_data_item}$node) {
                if (rowreq_ctx->column_set_flags != $context.uc_REQUIRED_COLS) {
                    DEBUGMSGTL(("${context}",
                                "required columns missing\n"));
                    return MFD_CANNOT_CREATE_NOW;
                }
            }
        } /* row creation */
        else {
@end@
            /*
             * row change requirements
             */
            /*
             * don't allow a destroy if any other value was changed, since
             * that might call data access routines with bad info.
             *
             * you may or may not require the row be notInService before it
             * can be destroyed.
             */
            if (ROWSTATUS_DESTROY == ${m2c_data_item}$node) {
                if (rowreq_ctx->column_set_flags & ~FLAG_$node.uc) {
                    DEBUGMSGTL(("$context",
                                "destroy must be only varbind for row\n"));
                    return MFD_NOT_VALID_NOW;
                }
            } /* row destroy */
@if $m2c_table_row_creation == 1@
        } /* row change */
@end@
    }
    else {
        /*
@if $m2c_table_row_creation == 1@
         * must have row status to create a row
@else@
         * row creation snot supported
@end@
         */
        if (rowreq_ctx->rowreq_flags & MFD_ROW_CREATED) {
            DEBUGMSGTL(("$context",
                        "must use RowStatus to create rows\n"));
            return MFD_CANNOT_CREATE_NOW;
        }
    } /* row status not set */

## }
########################################################################
@if $m2c_mark_boundary == 1@
/** END code generated by $RCSfile: syntax-RowStatus-dependencies.m2i,v $ $Revision: 1.3 $ */
@end@
