예제 #1
0
        public override string Translate(SqlCompilerContext context, SqlCreateTable node, CreateTableSection section)
        {
            switch (section)
            {
            case CreateTableSection.Entry:
                var builder = new StringBuilder();
                builder.Append("CREATE ");
                var temporaryTable = node.Table as TemporaryTable;
                if (temporaryTable != null)
                {
                    if (temporaryTable.IsGlobal)
                    {
                        temporaryTable.DbName = "##" + temporaryTable.Name;
                    }
                    else
                    {
                        temporaryTable.DbName = "#" + temporaryTable.Name;
                    }
                }
                builder.Append("TABLE " + Translate(context, node.Table));
                return(builder.ToString());

            case CreateTableSection.Exit:
                string result = string.IsNullOrEmpty(node.Table.Filegroup)
          ? string.Empty
          : " ON " + QuoteIdentifier(node.Table.Filegroup);
                return(result);
            }
            return(base.Translate(context, node, section));
        }
예제 #2
0
        protected override bool VisitCreateTableConstraints(SqlCreateTable node, IEnumerable <TableConstraint> constraints, bool hasItems)
        {
            // SQLite has special syntax for autoincrement primary keys
            // We write everything when doing translation for column definition
            // and should skip any PK definitions here.
            var hasAutoIncrementColumn = node.Table.TableColumns.Any(c => c.SequenceDescriptor != null);

            constraints = hasAutoIncrementColumn ? constraints.Where(c => !(c is PrimaryKey)) : constraints;
            return(base.VisitCreateTableConstraints(node, constraints, hasItems));
        }
예제 #3
0
        public override void Visit(SqlCreateTable node)
        {
            var table = node.Table as TemporaryTable;

            if (table != null && !table.IsGlobal)
            {
                throw new NotSupportedException(Strings.ExOracleDoesNotSupportLocalTemporaryTables);
            }
            base.Visit(node);
        }
예제 #4
0
        public override string Translate(SqlCompilerContext context, SqlCreateTable node, CreateTableSection section)
        {
            switch (section)
            {
            case CreateTableSection.Exit:
                return("WITHOUT OIDS " + base.Translate(context, node, section));

            default:
                return(base.Translate(context, node, section));
            }
        }
예제 #5
0
        protected override bool UpdateDBTables()
        {
            if (dbVersion < 2)
            {
                if (!SqlProxyDatabaseHelper.SearchColumn(CustomerTable.Email, GlobalInfo.SqlConnection))
                {
                    SqlCreateTable.AlterTable <CustomerTable>();
                    SqlCreateTable.AddColumn(CustomerTable.Email);
                    SqlCreateTable.Alter();
                }
            }

            return(true);
        }
예제 #6
0
        /// <inheritdoc/>
        public override string Translate(SqlCompilerContext context, SqlCreateTable node, CreateTableSection section)
        {
            switch (section)
            {
            case CreateTableSection.Entry:
                var builder = new StringBuilder();
                builder.Append("CREATE ");
                var temporaryTable = node.Table as TemporaryTable;
                if (temporaryTable != null)
                {
                    builder.Append("TEMPORARY TABLE " + Translate(context, temporaryTable));
                }
                else
                {
                    builder.Append("TABLE " + Translate(context, node.Table));
                }
                return(builder.ToString());

            case CreateTableSection.Exit:
                return(string.Empty);
            }
            return(base.Translate(context, node, section));
        }
예제 #7
0
 public virtual void Visit(SqlCreateTable node)
 {
 }
예제 #8
0
        public void Test150()
        {
            SqlCreateTable create = SqlDdl.Create(Catalog.Schemas["main"].Tables["customer"]);

            Console.Write(Compile(create));
        }
        public void Test150()
        {
            SqlCreateTable create = SqlDdl.Create(schema.Tables["customer"]);

            Console.Write(Compile(create));
        }
예제 #10
0
 public void Visit(SqlCreateTable node)
 {
 }