public string GetAllTableConstraintsByTypeSystemTables(eDBVersion version, eConstraintType ContraintsType)
        {
            var sb = new StringBuilder();

            sb.Append($@"select ");
            sb.Append($@"rc.rdb$constraint_name,");
            sb.Append($@"rc.rdb$constraint_type,");
            sb.Append($@"rc.rdb$relation_name,");
            sb.Append($@"rc.rdb$deferrable,");
            sb.Append($@"rc.rdb$initially_deferred,");
            sb.Append($@"rc.rdb$index_name,");
            sb.Append($@"cc.rdb$trigger_name,");
            sb.Append($@"rfc.rdb$const_name_uq,");
            sb.Append($@"rfc.rdb$match_option,");
            sb.Append($@"rfc.rdb$update_rule,");
            sb.Append($@"rfc.rdb$delete_rule,");
            sb.Append($@"inx.rdb$field_name,inx.rdb$field_position ");
            sb.Append($@"from rdb$relation_constraints rc ");
            sb.Append($@"left join rdb$check_constraints cc on cc.rdb$constraint_name = rc.rdb$constraint_name ");
            sb.Append($@"left join rdb$ref_constraints rfc on rfc.rdb$constraint_name = rc.rdb$constraint_name ");
            sb.Append($@"left join rdb$index_segments inx on inx.rdb$index_name = rc.rdb$index_name ");
            sb.Append($@"where rc.rdb$relation_name like '%$%' AND rc.rdb$constraint_type = '{EnumHelper.GetDescription(ContraintsType)}' ");
            sb.Append($@"order by rc.rdb$constraint_name,rc.rdb$relation_name,  inx.rdb$field_name,inx.rdb$field_position;");
            return(sb.ToString());
        }
        /// <summary>
        /// The function returns the constraint type for the specified constraint.
        /// </summary>
        /// <param name="nameConstraint">The name of an existing constraint.</param>
        /// <param name="constraintType">Constraint type assigned to the named cosntraint.</param>
        /// <exception cref="CSiException"><see cref="CSiApiBase.API_DEFAULT_ERROR_CODE" /></exception>
        public void GetConstraintType(string nameConstraint,
                                      ref eConstraintType constraintType)
        {
            CSiProgram.eConstraintType csiConstraintType = CSiProgram.eConstraintType.Beam;
            _callCode = _sapModel.ConstraintDef.GetConstraintType(nameConstraint, ref csiConstraintType);
            if (throwCurrentApiException(_callCode))
            {
                throw new CSiException(API_DEFAULT_ERROR_CODE);
            }

            constraintType = (eConstraintType)csiConstraintType;
        }
Example #3
0
        public static string GetConstraintTypeStr(eConstraintType ct)
        {
            switch (ct)
            {
            case eConstraintType.NOTNULL:
                return("NOT NULL");

            case eConstraintType.PRIMARYKEY:
                return("PRIMARY KEY");

            case eConstraintType.UNIQUE:
                return("UNIQUE");
            }
            return(string.Empty);
        }
Example #4
0
        public string GetAllTableConstraintsByTableName(eDBVersion version, eConstraintType ContraintsType, string TableName)
        {
            var sb = new StringBuilder();

            sb.Append($@"select ");
            sb.Append($@"rc.rdb$constraint_name,");
            sb.Append($@"rc.rdb$constraint_type,");
            sb.Append($@"rc.rdb$relation_name,");
            sb.Append($@"rc.rdb$deferrable,");
            sb.Append($@"rc.rdb$initially_deferred,");
            sb.Append($@"rc.rdb$index_name,");
            sb.Append($@"cc.rdb$trigger_name,");
            sb.Append($@"rfc.rdb$const_name_uq, rfc.rdb$match_option, rfc.rdb$update_rule, rfc.rdb$delete_rule,");
            sb.Append($@"inx.rdb$field_name,inx.rdb$field_position ");
            sb.Append($@"from rdb$relation_constraints rc ");
            sb.Append($@"LEFT JOIN rdb$check_constraints cc ON cc.rdb$constraint_name = rc.rdb$constraint_name ");
            sb.Append($@"LEFT JOIN rdb$ref_constraints rfc ON rfc.rdb$constraint_name = rc.rdb$constraint_name ");
            sb.Append($@"LEFT JOIN rdb$index_segments inx ON inx.rdb$index_name = rc.rdb$index_name ");
            sb.Append($@"where rc.rdb$relation_name = '{TableName}' and rc.rdb$constraint_name NOT LIKE '%$%' AND rc.rdb$constraint_type = '{EnumHelper.GetDescription(ContraintsType)}' ");
            //sb.Append($@"and cc.rdb$trigger_name = '{FieldName}' ");
            sb.Append($@"order by rc.rdb$constraint_name,rc.rdb$relation_name,  inx.rdb$field_name,inx.rdb$field_position;");
            return(sb.ToString());
        }
Example #5
0
 public void GetConstraintType(string nameConstraint,
                               ref eConstraintType constraintType)
 {
 }
Example #6
0
 public void Count(eConstraintType constraintType)
 {
 }
 /// <summary>
 /// Returns the number of defined constraints of the specified type.
 /// </summary>
 /// <param name="constraintType">Type of constraint to return a count for.</param>
 /// <returns>System.Int32.</returns>
 public int Count(eConstraintType constraintType)
 {
     return(_sapModel.ConstraintDef.Count(EnumLibrary.Convert <eConstraintType, CSiProgram.eConstraintType>(constraintType)));
 }
 public string GetSystemTableConstraintsByType(eConstraintType ContraintsType)
 {
     return(GetSystemTableConstraintsByType(Version, ContraintsType));
 }
Example #9
0
 // eConstraintType
 internal static CSiProgram.eConstraintType ToCSi(eConstraintType enumValue)
 {
     return((CSiProgram.eConstraintType)enumValue);
 }