protected override void AppendTempKeyword(IExprTableFullName tableName)
 {
     if (tableName is ExprTempTableName)
     {
         this.Builder.Append("TEMP ");
     }
 }
        private string BuildFkName(IExprTableFullName tableIn, IExprTableFullName foreignTableIn)
        {
            StringBuilder nameBuilder = new StringBuilder();

            ExprTableFullName table = tableIn.AsExprTableFullName();

            ExprTableFullName foreignTable = foreignTableIn.AsExprTableFullName();

            var schemaName = table.DbSchema != null?this.Options.MapSchema(table.DbSchema.Schema.Name) + "_" : null;

            nameBuilder.Append("FK_");
            if (schemaName != null)
            {
                nameBuilder.Append(schemaName);
                nameBuilder.Append('_');
            }
            nameBuilder.Append(table.TableName.Name);
            nameBuilder.Append("_to_");
            if (schemaName != null)
            {
                nameBuilder.Append(schemaName);
                nameBuilder.Append('_');
            }
            nameBuilder.Append(foreignTable.TableName.Name);

            return(nameBuilder.ToString());
        }
        private string BuildPkName(IExprTableFullName tableIn)
        {
            var table = tableIn.AsExprTableFullName();

            var schemaName = table.DbSchema != null?this.Options.MapSchema(table.DbSchema.Schema.Name) + "_" : null;

            return($"PK_{schemaName}{table.TableName.Name}");
        }
        protected string BuildIndexName(IExprTableFullName tableIn, IndexMeta index)
        {
            if (index.Name != null && !string.IsNullOrEmpty(index.Name))
            {
                return(index.Name);
            }

            var table = tableIn.AsExprTableFullName();

            var schemaName = table.DbSchema != null?this.Options.MapSchema(table.DbSchema.Schema.Name) + "_" : null;

            var columns = string.Join("_", index.Columns.Select(c => c.Column.ColumnName.Name + (c.Descending ? "_DESC" : null)));

            return($"IX_{schemaName}{table.TableName.Name}_{columns}");
        }
示例#5
0
 public static ExprTable WithFullName(this ExprTable original, IExprTableFullName newFullName)
 => new ExprTable(fullName: newFullName, alias: original.Alias);
示例#6
0
 public static ExprInsert WithTarget(this ExprInsert original, IExprTableFullName newTarget)
 => new ExprInsert(target: newTarget, targetColumns: original.TargetColumns, source: original.Source);
 protected override void AppendTempKeyword(IExprTableFullName tableName)
 {
 }
示例#8
0
 protected internal TableBase(IExprTableFullName fullName, ExprTableAlias?alias) : base(fullName, alias)
 {
 }
示例#9
0
 public ExprInsert(IExprTableFullName target, IReadOnlyList <ExprColumnName>?targetColumns, IExprInsertSource source)
 {
     this.Target        = target;
     this.TargetColumns = targetColumns;
     this.Source        = source;
 }
示例#10
0
 public ExprTable(IExprTableFullName fullName, ExprTableAlias?alias)
 {
     this.Alias    = alias;
     this.FullName = fullName;
 }
 protected abstract void AppendTempKeyword(IExprTableFullName tableName);
 public StatementDropTable(IExprTableFullName table, bool ifExists)
 {
     this.Table    = table;
     this.IfExists = ifExists;
 }