Exemplo n.º 1
0
        /// <inheritdoc/>
        public override string Translate(SqlCompilerContext context, TableColumn column, TableColumnSection section)
        {
            switch (section)
            {
            case TableColumnSection.Type:
                if (column.SequenceDescriptor == null)
                {
                    return(base.Translate(context, column, section));
                }
                return("integer"); // SQLite requires autoincrement columns to have exactly 'integer' type.

            case TableColumnSection.Exit:
                if (column.SequenceDescriptor == null)
                {
                    return(string.Empty);
                }
                var primaryKey = column.Table.TableConstraints.OfType <PrimaryKey>().FirstOrDefault();
                if (primaryKey == null)
                {
                    return(string.Empty);
                }
                return(string.Format("CONSTRAINT {0} PRIMARY KEY AUTOINCREMENT", QuoteIdentifier(primaryKey.Name)));

            case TableColumnSection.GeneratedExit:
                return(string.Empty);

            default:
                return(base.Translate(context, column, section));
            }
        }
Exemplo n.º 2
0
        public override string Translate(SqlCompilerContext context, TableColumn column, TableColumnSection section)
        {
            switch (section)
            {
            case TableColumnSection.Exit:
                return(string.Empty);

            case TableColumnSection.GeneratedExit:
                return("AUTO_INCREMENT"); //Workaround based on fake sequence.

            default:
                return(base.Translate(context, column, section));
            }
        }
Exemplo n.º 3
0
        public override string Translate(SqlCompilerContext context, TableColumn column, TableColumnSection section)
        {
            switch (section)
            {
            case TableColumnSection.Type:
                return(column.Domain == null
          ? Translate(column.DataType)
          : QuoteIdentifier(column.Domain.Schema.DbName, column.Domain.DbName));

            case TableColumnSection.GenerationExpressionEntry:
                return("AS (");

            case TableColumnSection.GeneratedEntry:
            case TableColumnSection.GeneratedExit:
            case TableColumnSection.SetIdentityInfoElement:
            case TableColumnSection.Exit:
                return(string.Empty);

            default:
                return(base.Translate(context, column, section));
            }
        }
Exemplo n.º 4
0
        public override string Translate(SqlCompilerContext context, TableColumn column, TableColumnSection section)
        {
            switch (section)
            {
            case TableColumnSection.Exit:
            case TableColumnSection.SetIdentityInfoElement:
            case TableColumnSection.GenerationExpressionExit:
            case TableColumnSection.Collate:
                return(string.Empty);

            default:
                return(base.Translate(context, column, section));
            }
        }