示例#1
0
        // no statement building
#else
        public override bool BuildStatement(DBStatementBuilder builder)
        {
            builder.BeginCreate(DBSchemaTypes.ForeignKey, string.Empty, this.Name, string.Empty, false);


            BuildColumnListStatement(builder, this.TableColumns);

            builder.BeginReferences(this.ReferenceOwner, this.ReferenceName);

            BuildColumnListStatement(builder, this.ReferenceColumns);

            builder.EndReferences(this.ReferenceOwner, this.ReferenceName);

            if (this.OnDeleteAction != DBFKAction.Undefined || this.OnUpdateAction != DBFKAction.Undefined)
            {
                builder.BeginForeignKeyUpdateActions();

                if (this.OnDeleteAction != DBFKAction.Undefined)
                {
                    builder.WriteDeleteAction(this.OnDeleteAction);
                }
                if (this.OnUpdateAction != DBFKAction.Undefined)
                {
                    builder.WriteUpdateAction(this.OnUpdateAction);
                }

                builder.EndForeignKeyUpdateActions();
            }

            builder.EndCreate(DBSchemaTypes.ForeignKey, false);
            return(true);
        }
示例#2
0
        // no statement building
#else
        public override bool BuildStatement(DBStatementBuilder builder)
        {
            builder.BeginCreate(DBSchemaTypes.Sequence, this.Owner, this.SequenceName, string.Empty, this.CheckExists == DBExistState.NotExists);

            if (this.MinValue != DEF_MIN)
            {
                builder.WriteSequenceOption(DBSequenceBuilderOption.Minimum, this.MinValue);
            }

            if (this.MaxValue != DEF_MAX)
            {
                builder.WriteSequenceOption(DBSequenceBuilderOption.Maximim, this.MaxValue);
            }

            if (this.StartWithValue != DEF_START)
            {
                builder.WriteSequenceOption(DBSequenceBuilderOption.StartValue, this.StartWithValue);
            }

            if (this.IncrementValue != DEF_INCREMENT)
            {
                builder.WriteSequenceOption(DBSequenceBuilderOption.Increment, this.IncrementValue);
            }

            if (this.CacheSize == NO_CACHE_VALUE)
            {
                builder.WriteSequenceOption(DBSequenceBuilderOption.NoCaching);
            }
            else if (this.CacheSize != DEF_CACHE)
            {
                builder.WriteSequenceOption(DBSequenceBuilderOption.Cache, this.CacheSize);
            }

            if (this.Cycling == DBSequenceCycling.Cycle)
            {
                builder.WriteSequenceOption(DBSequenceBuilderOption.Cycling);
            }
            else if (this.Cycling == DBSequenceCycling.NoCycle)
            {
                builder.WriteSequenceOption(DBSequenceBuilderOption.NoCycling);
            }

            if (this.Order == DBSequenceOrdering.NotOrdered)
            {
                builder.WriteSequenceOption(DBSequenceBuilderOption.NotOrdered);
            }
            else if (this.Order == DBSequenceOrdering.Ordered)
            {
                builder.WriteSequenceOption(DBSequenceBuilderOption.Ordered);
            }


            builder.EndCreate(DBSchemaTypes.Sequence, this.CheckExists == DBExistState.NotExists);

            return(true);
        }
示例#3
0
        // no statement building
#else
        /// <summary>
        ///
        /// </summary>
        /// <param name="builder"></param>
        /// <returns></returns>
        public override bool BuildStatement(DBStatementBuilder builder)
        {
            builder.BeginCreate(DBSchemaTypes.PrimaryKey, string.Empty, this.Name, string.Empty, false);

            this.BuildColumnListStatement(builder, this.PKColumns);

            builder.EndCreate(DBSchemaTypes.PrimaryKey, false);

            return(true);
        }
示例#4
0
        // no statement building
#else
        public override bool BuildStatement(DBStatementBuilder builder, bool isInorNot = false)
        {
            bool check = (this.CheckExists == DBExistState.NotExists);

            builder.BeginCreate(DBSchemaTypes.View, this.ViewOwner, this.ViewName, string.Empty, check);
            builder.BeginEntityDefinition();
            this.Select.BuildStatement(builder);
            builder.EndEntityDefinition();
            builder.EndCreate(DBSchemaTypes.View, check);
            return(true);
        }
示例#5
0
        // no statement building
#else
        public override bool BuildStatement(DBStatementBuilder builder, bool isInorNot = false)
        {
            builder.BeginCreate(DBSchemaTypes.Index, string.Empty, this.Name, string.Empty, false);
            builder.BeginBlock(false);
            foreach (DBOrder order in this.ColumnOrders)
            {
                builder.BeginOrderClause(order.Order);
                order.Clause.BuildStatement(builder);
                builder.EndOrderClause(order.Order);
            }
            builder.EndBlock(false);
            builder.EndCreate(DBSchemaTypes.Index, false);
            return(true);
        }
示例#6
0
        // no statement building
#else
        public override bool BuildStatement(DBStatementBuilder builder)
        {
            string opts = GetConstraints(builder);

            builder.BeginCreate(DBSchemaTypes.Index, this.Owner, this.Name, opts, this.CheckExists == DBExistState.NotExists);
            builder.BeginReferenceOn();
            builder.WriteSourceTable(this.TableOwner, this.TableName, string.Empty);
            builder.EndReferenceOn();
            builder.BeginBlock();
            this.ColumnOrders.BuildStatement(builder);
            builder.EndBlock();
            builder.EndCreate(DBSchemaTypes.Index, this.CheckExists == DBExistState.NotExists);
            return(true);
        }
        public override bool BuildStatement(DBStatementBuilder builder, bool isInorNot = false)
        {
            bool checknotexists = this.CheckExists == DBExistState.NotExists;

            builder.BeginCreate(DBSchemaTypes.Table, this.TableOwner, this.TableName, string.Empty, checknotexists);

            //    builder.BeginBlock(true);

            this.Columns.BuildStatement(builder, true, true);
            //if (this.HasConstraints)
            //{
            //    builder.BeginTableConstraints();
            //    this.ConstraintList.BuildStatement(builder, true, true);
            //    builder.EndTableConstraints();
            //}
            //builder.EndBlock(true);
            //builder.EndCreate(DBSchemaTypes.Table, checknotexists);
            return(true);
        }
示例#8
0
        // no statement building
#else
        public override bool BuildStatement(DBStatementBuilder builder, bool isInorNot = false)
        {
            bool checknotexists = (this.CheckExists == DBExistState.NotExists);

            builder.BeginCreate(DBSchemaTypes.StoredProcedure, this.Owner, this.Name, string.Empty, checknotexists);
            builder.StopRegisteringParameters();
            try
            {
                if (this.HasParameters)
                {
                    builder.BeginProcedureParameters();
                    bool outputSeparator = false;
                    foreach (DBParam p in this.Parameters)
                    {
                        if (outputSeparator)
                        {
                            builder.WriteReferenceSeparator();
                        }
                        builder.WriteSpace();
                        builder.WriteParameter(p, true);
                        outputSeparator = true;
                    }
                    builder.EndProcedureParameters();
                }
                builder.BeginNewLine();
                builder.BeginEntityDefinition();
                if (this.Script != null)
                {
                    this.Script.BuildStatement(builder);
                }
                builder.EndEntityDefinition();

                builder.EndCreate(DBSchemaTypes.StoredProcedure, checknotexists);
            }
            finally
            {
                builder.ResumeRegisteringParameters();
            }
            //Clear the parameters as we are declaring them rather than actually using them
            return(true);
        }