public override string Translate(SqlCompilerContext context,
                                         SequenceDescriptor descriptor, SequenceDescriptorSection section)
        {
            switch (section)
            {
            case SequenceDescriptorSection.RestartValue:
                if (descriptor.StartValue.HasValue)
                {
                    throw new NotSupportedException(Strings.ExAlterSequenceRestartWithIsNotSupported);
                }
                break;

            case SequenceDescriptorSection.AlterMaxValue:
                if (!descriptor.MaxValue.HasValue)
                {
                    return("NOMAXVALUE");
                }
                break;

            case SequenceDescriptorSection.AlterMinValue:
                if (!descriptor.MinValue.HasValue)
                {
                    return("NOMINVALUE");
                }
                break;
            }
            return(base.Translate(context, descriptor, section));
        }
        /// <inheritdoc/>
        public override string Translate(SqlCompilerContext context, SequenceDescriptor descriptor,
                                         SequenceDescriptorSection section)
        {
            switch (section)
            {
            case SequenceDescriptorSection.StartValue:
                return(string.Empty);

            case SequenceDescriptorSection.RestartValue:
                if (descriptor.StartValue.HasValue)
                {
                    return("RESTART WITH " + descriptor.StartValue.Value);
                }
                return(string.Empty);

            case SequenceDescriptorSection.Increment:
                return(string.Empty);

            case SequenceDescriptorSection.MaxValue:
                return(string.Empty);

            case SequenceDescriptorSection.MinValue:
                return(string.Empty);

            case SequenceDescriptorSection.AlterMaxValue:
                return(string.Empty);

            case SequenceDescriptorSection.AlterMinValue:
                return(string.Empty);

            case SequenceDescriptorSection.IsCyclic:
                return(string.Empty);

            default:
                return(string.Empty);
            }
        }
示例#3
0
 /// <inheritdoc/>
 public override string Translate(SqlCompilerContext context, SequenceDescriptor descriptor, SequenceDescriptorSection section)
 {
     //switch (section) {
     //  case SequenceDescriptorSection.Increment:
     //    if (descriptor.Increment.HasValue)
     //      return "AUTOINCREMENT";
     //    return string.Empty;
     //}
     return(string.Empty);
 }
        protected string TranslateIdentityDescriptor(SqlCompilerContext context, SequenceDescriptor descriptor, SequenceDescriptorSection section)
        {
            switch (section)
            {
            case SequenceDescriptorSection.StartValue:
            case SequenceDescriptorSection.RestartValue:
                if (descriptor.StartValue.HasValue)
                {
                    return("IDENTITY (" + descriptor.StartValue.Value + RowItemDelimiter);
                }
                return(String.Empty);

            case SequenceDescriptorSection.Increment:
                if (descriptor.Increment.HasValue)
                {
                    return(descriptor.Increment.Value + ")");
                }
                return(String.Empty);

            default:
                return(String.Empty);
            }
        }
 public override string Translate(SqlCompilerContext context, SequenceDescriptor descriptor, SequenceDescriptorSection section)
 {
     return(TranslateIdentityDescriptor(context, descriptor, section));
 }
 /// <inheritdoc/>
 public override string Translate(SqlCompilerContext context, SequenceDescriptor descriptor,
                                  SequenceDescriptorSection section)
 {
     return(string.Empty);
     //throw new NotSupportedException(Strings.ExDoesNotSupportSequences);
 }
 public override string Translate(SqlCompilerContext context, SequenceDescriptor descriptor, SequenceDescriptorSection section)
 {
     if (descriptor.Owner is Sequence)
     {
         return(TranslateSequenceDescriptorDefault(context, descriptor, section));
     }
     if (descriptor.Owner is TableColumn)
     {
         return(TranslateIdentityDescriptor(context, descriptor, section));
     }
     throw new NotSupportedException();
 }