Пример #1
0
        public virtual IEnumerable <string> GenerateDescriptionStatements(Expressions.CreateTableExpression expression)
        {
            var statements = new List <string>();

            if (!string.IsNullOrEmpty(expression.TableDescription))
            {
                statements.Add(GenerateTableDescription(expression.SchemaName, expression.TableName, expression.TableDescription));
            }

            foreach (var column in expression.Columns)
            {
                if (string.IsNullOrEmpty(column.ColumnDescription))
                {
                    continue;
                }

                statements.Add(GenerateColumnDescription(
                                   expression.SchemaName,
                                   expression.TableName,
                                   column.Name,
                                   column.ColumnDescription));
            }

            return(statements);
        }
        public virtual IEnumerable <string> GenerateDescriptionStatements(Expressions.CreateTableExpression expression)
        {
            var statements = new List <string>();

            if (!string.IsNullOrEmpty(expression.TableDescription))
            {
                statements.Add(GenerateTableDescription(expression.SchemaName, expression.TableName, expression.TableDescription));
            }

            foreach (var column in expression.Columns)
            {
                if (string.IsNullOrEmpty(column.ColumnDescription))
                {
                    continue;
                }

                string initialDescriptionStatement = GenerateColumnDescription(
                    "Description",
                    expression.SchemaName,
                    expression.TableName,
                    column.Name,
                    "Description:" + column.ColumnDescription);

                if (column.AdditionalColumnDescriptions.Count == 0)
                {
                    statements.Add(initialDescriptionStatement);
                }
                else
                {
                    initialDescriptionStatement = "Description:" + column.ColumnDescription;
                    var descriptionsList = new List <string>
                    {
                        initialDescriptionStatement
                    };
                    descriptionsList.AddRange(from description in column.AdditionalColumnDescriptions
                                              let newDescriptionStatement = description.Key + ":" + description.Value
                                                                            select newDescriptionStatement);
                    statements.Add(GenerateColumnDescription("Description", expression.SchemaName, expression.TableName, column.Name, string.Join("\r\n", descriptionsList)));
                }
            }

            return(statements);
        }
Пример #3
0
        public override void Process(Expressions.CreateTableExpression expression)
        {
            truncator.Truncate(expression);
            LockTable(expression.TableName);
            RegisterTableCreation(expression.TableName);
            InternalProcess(Generator.Generate(expression));
            foreach (ColumnDefinition colDef in expression.Columns)
            {
                if (colDef.IsIdentity)
                {
                    CreateSequenceForIdentity(expression.TableName, colDef.Name);
                }
            }

            /*if(FBOptions.TransactionModel == FirebirdTransactionModel.AutoCommitOnCheckFail)
             *  CommitRetaining();*/
            if (FBOptions.TransactionModel != FirebirdTransactionModel.None)
            {
                CommitRetaining();
            }
        }
Пример #4
0
 public override string Generate(Expressions.CreateTableExpression expression)
 {
     return(string.Format("CREATE TABLE {0} ({1})", Quoter.QuoteTableName(expression.TableName, expression.SchemaName), Column.Generate(expression.Columns, expression.TableName)));
 }
Пример #5
0
 public void Process(Expressions.CreateTableExpression expression)
 {
     Process(Generator.Generate(expression));
 }