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}");
        }
Esempio n. 5
0
 public static ExprTable WithFullName(this ExprTable original, IExprTableFullName newFullName)
 => new ExprTable(fullName: newFullName, alias: original.Alias);
Esempio n. 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)
 {
 }
Esempio n. 8
0
 protected internal TableBase(IExprTableFullName fullName, ExprTableAlias?alias) : base(fullName, alias)
 {
 }
Esempio n. 9
0
 public ExprInsert(IExprTableFullName target, IReadOnlyList <ExprColumnName>?targetColumns, IExprInsertSource source)
 {
     this.Target        = target;
     this.TargetColumns = targetColumns;
     this.Source        = source;
 }
Esempio n. 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;
 }