private ColumnInfo CreateColumnInfo(IRequest context, string tableName, SqlTableColumn column, TableColumnChecker columnChecker)
        {
            var expression = column.DefaultExpression;

            if (column.IsIdentity && expression != null)
            {
                throw new InvalidOperationException(String.Format("Identity column '{0}' cannot define a DEFAULT expression.", column.ColumnName));
            }

            if (expression != null)
            {
                expression = columnChecker.CheckExpression(expression);
            }


            var columnName = columnChecker.StripTableName(tableName, column.ColumnName);
            var columnType = column.ColumnType.Resolve(context);

            return(new ColumnInfo(columnName, columnType)
            {
                DefaultExpression = expression,
                IsNotNull = column.IsNotNull,
                IndexType = column.IndexType
            });
        }
示例#2
0
        private ColumnInfo CreateColumnInfo(IContext context, string tableName, SqlTableColumn column, TableColumnChecker columnChecker)
        {
            var expression = column.DefaultExpression;

            if (column.IsIdentity && expression != null)
            {
                throw new InvalidOperationException($"Identity column '{column.ColumnName}' cannot define a DEFAULT expression.");
            }

            if (expression != null)
            {
                expression = columnChecker.CheckExpression(expression);
            }


            var columnName = columnChecker.StripTableName(tableName, column.ColumnName);
            // TODO: support for dynamic types such as #ROW ?
            var columnType = column.ColumnType;

            return(new ColumnInfo(columnName, columnType, expression));
        }
        private ColumnInfo CreateColumnInfo(string tableName, SqlTableColumn column, TableColumnChecker columnChecker)
        {
            var expression = column.DefaultExpression;

            if (column.IsIdentity && expression != null)
                throw new InvalidOperationException(String.Format("Identity column '{0}' cannot define a DEFAULT expression.", column.ColumnName));

            if (expression != null)
                expression = columnChecker.CheckExpression(expression);

            var columnName = columnChecker.StripTableName(tableName, column.ColumnName);

            return new ColumnInfo(columnName, column.ColumnType) {
                DefaultExpression = expression,
                IsNotNull = column.IsNotNull
            };
        }