예제 #1
0
        public virtual Statement[] Render(AddTableChange change)
        {
            TableInfo table = change.Table;

            StringBuilder sql = new StringBuilder("create table ")
                                .Append(GetQualifiedName(table))
                                .Append(" (");

            string columns = StringUtilities.Combine(
                CollectionUtils.Map <ColumnInfo, string>(table.Columns,
                                                         delegate(ColumnInfo col)
            {
                return(GetColumnDefinitionString(col));
            }), ", ");

            sql.Append(columns);

            if (table.PrimaryKey != null)
            {
                sql.Append(',').Append(GetPrimaryKeyString(table.PrimaryKey));
            }

            sql.Append(")");

            return(new Statement[] { new Statement(sql.ToString()) });
        }
예제 #2
0
		public virtual Statement[] Render(AddTableChange change)
		{
			TableInfo table = change.Table;

			StringBuilder sql = new StringBuilder("create table ")
				.Append(GetQualifiedName(table))
				.Append(" (");

			string columns = StringUtilities.Combine(
				CollectionUtils.Map<ColumnInfo, string>(table.Columns,
					delegate(ColumnInfo col)
					{
						return GetColumnDefinitionString(col);
					}), ", ");

			sql.Append(columns);

			if (table.PrimaryKey != null)
			{
				sql.Append(',').Append(GetPrimaryKeyString(table.PrimaryKey));
			}

			sql.Append(")");

			return new Statement[] { new Statement(sql.ToString()) };
		}