Esempio n. 1
0
 protected override void EmitAlterColumnDefinition(SQL.AlterColumnDefinition column)
 {
     if (column.DomainName != null)
     {
         AppendFormat("{0} {1} ", SQL.Keywords.Alter, SQL.Keywords.Column);
         EmitIdentifier(column.ColumnName);
         AppendFormat(" type {0}", column.DomainName);
         if (column.AlterNullable)
         {
             Append(", ");
         }
     }
     if (column.AlterNullable)
     {
         AppendFormat("{0} {1} ", SQL.Keywords.Alter, SQL.Keywords.Column);
         EmitIdentifier(column.ColumnName);
         if (column.IsNullable)
         {
             AppendFormat(" set {0}", SQL.Keywords.Null);
         }
         else
         {
             AppendFormat(" set {0} {1}", SQL.Keywords.Not, SQL.Keywords.Null);
         }
     }
 }
Esempio n. 2
0
 protected virtual void EmitAlterColumnDefinition(AlterColumnDefinition column)
 {
     AppendFormat("{0} {1} ", Keywords.Alter, Keywords.Column);
     EmitIdentifier(column.ColumnName);
     if (column.DomainName != null)
     {
         AppendFormat(" {0}", column.DomainName);
     }
     if (column.AlterNullable)
     {
         if (column.IsNullable)
         {
             AppendFormat(" {0}", Keywords.Null);
         }
         else
         {
             AppendFormat(" {0} {1}", Keywords.Not, Keywords.Null);
         }
     }
 }
Esempio n. 3
0
        protected override void EmitAlterTableStatement(SQL.AlterTableStatement statement)
        {
            Indent();
            AppendFormat("{0} {1} ", SQL.Keywords.Alter, SQL.Keywords.Table);
            EmitIdentifier(statement.TableName);

            for (int index = 0; index < statement.AddColumns.Count; index++)
            {
                AppendFormat(" {0} {1}", SQL.Keywords.Add, SQL.Keywords.BeginGroup);
                EmitColumnDefinition(statement.AddColumns[index]);
                Append(SQL.Keywords.EndGroup);
            }

            for (int index = 0; index < statement.AlterColumns.Count; index++)
            {
                SQL.AlterColumnDefinition definition = statement.AlterColumns[index];
                if (definition.AlterNullable)
                {
                    AppendFormat(" {0} ", "modify");
                    EmitIdentifier(definition.ColumnName);
                    if (definition.IsNullable)
                    {
                        AppendFormat(" {0}", SQL.Keywords.Null);
                    }
                    else
                    {
                        AppendFormat(" {0} {1}", SQL.Keywords.Not, SQL.Keywords.Null);
                    }
                }
            }

            for (int index = 0; index < statement.DropColumns.Count; index++)
            {
                AppendFormat(" {0} {1}", SQL.Keywords.Drop, SQL.Keywords.BeginGroup);
                EmitIdentifier(statement.DropColumns[index].ColumnName);
                Append(SQL.Keywords.EndGroup);
            }
        }