コード例 #1
0
ファイル: DBSubQuery.cs プロジェクト: sampath1983jan/TechData
        /// <summary>
        /// Adds an INNER JOIN from the results of this sub query to a second table
        /// where this tables parent field matched the child field
        /// </summary>
        /// <param name="table"></param>
        /// <param name="parentfield"></param>
        /// <param name="childfield"></param>
        /// <returns></returns>
        public DBJoin InnerJoin(string table, string parentfield, string childfield)
        {
            DBTable tbl    = DBTable.Table(table);
            DBField parent = DBField.Field(this.Alias, parentfield);
            DBField child  = DBField.Field(table, parentfield);

            return(InnerJoin(tbl, parent, child));
        }
コード例 #2
0
        public DBTableSet InnerJoin(string table, string parentfield, Compare op, string childfield)
        {
            DBTable tref = DBTable.Table(table);

            return(this.InnerJoin(tref, DBField.Field(parentfield), op, DBField.Field(childfield)));
        }
コード例 #3
0
        public static DBTableSet From(string catalog, string owner, string roottable)
        {
            DBTable tref = DBTable.Table(catalog, owner, roottable);

            return(From(tref));
        }
コード例 #4
0
        public static DBTableSet From(string roottable)
        {
            DBTable tref = DBTable.Table(roottable);

            return(From(tref));
        }
コード例 #5
0
ファイル: DBQuery.cs プロジェクト: sampath1983jan/TechData
        /// <summary>
        /// begins a new DELETE FROM [catalog].[owner].[table] statement
        /// </summary>
        /// <param name="table">The name of the table to delete from</param>
        /// <param name="owner">The schema owner of the table</param>
        /// <returns>A new DBDeleteQuery to support statement chaining</returns>
        public static DBDeleteQuery DeleteFrom(string catalog, string owner, string table)
        {
            DBTable ts = DBTable.Table(catalog, owner, table);

            return(DeleteFrom(ts));
        }
コード例 #6
0
ファイル: DBQuery.cs プロジェクト: sampath1983jan/TechData
        //
        // DBDeleteQuery factory methods
        //

        #region public static DBDeleteQuery DeleteFrom(string intoTable) + 2 overloads

        /// <summary>
        /// begins a new DELETE FROM [table] statement
        /// </summary>
        /// <param name="table">The name of the table to delete from</param>
        /// <returns>A new DBDeleteQuery to support statement chaining</returns>
        public static DBDeleteQuery DeleteFrom(string table)
        {
            DBTable ts = DBTable.Table(table);

            return(DeleteFrom(ts));
        }
コード例 #7
0
ファイル: DBQuery.cs プロジェクト: sampath1983jan/TechData
        public static DBInsertQuery InsertInto(string catalog, string owner, string table)
        {
            DBTable tbl = DBTable.Table(catalog, owner, table);

            return(InsertInto(tbl));
        }
コード例 #8
0
ファイル: DBQuery.cs プロジェクト: sampath1983jan/TechData
        /// <summary>
        /// Begins a new INSERT INTO [owner].[table] statement
        /// </summary>
        /// <param name="table">The table to insert the rows on</param>
        /// <param name="owner">The schema owner of the table</param>
        /// <returns>A new DBInsertQuery to support statement chaining</returns>
        public static DBInsertQuery InsertInto(string owner, string table)
        {
            DBTable ts = DBTable.Table(owner, table);

            return(InsertInto(ts));
        }
コード例 #9
0
ファイル: DBQuery.cs プロジェクト: sampath1983jan/TechData
        //
        // DBInsertQuery factory methods
        //

        #region public static DBInsertQuery InsertInto(string intoTable) + 3 overloads

        /// <summary>
        /// Begins a new INSERT INTO [table] statement
        /// </summary>
        /// <param name="intoTable">The table to insert the rows on</param>
        /// <returns>A new DBInsertQuery to support statement chaining</returns>
        public static DBInsertQuery InsertInto(string intoTable)
        {
            DBTable ts = DBTable.Table(intoTable);

            return(InsertInto(ts));
        }
コード例 #10
0
        protected virtual DBClause DoRead(string element, XmlReader reader, XmlReaderContext context)
        {
            DBClause c = null;

            switch (element)
            {
            case (XmlHelper.Select):
                c = DBSelectQuery.Select();
                break;

            case (XmlHelper.Delete):
                c = DBDeleteQuery.Delete();
                break;

            case (XmlHelper.Update):
                c = DBUpdateQuery.Update();
                break;

            case (XmlHelper.Insert):
                c = DBInsertQuery.InsertInto();
                break;

            case (XmlHelper.Script):
                c = DBQuery.Script();
                break;

            case (XmlHelper.Use):
                c = DBUseQuery.Use();
                break;

            case (XmlHelper.Table):
                c = DBTable.Table();
                break;

            case (XmlHelper.Fields):
                c = DBSelectSet.Select();
                break;

            case (XmlHelper.AField):
                c = DBField.Field();
                break;

            case (XmlHelper.AllFields):
                c = DBField.AllFields();
                break;

            case (XmlHelper.From):
                c = DBTableSet.From();
                break;

            case (XmlHelper.Where):
                c = DBFilterSet.Where();
                break;

            case (XmlHelper.Group):
                c = DBGroupBySet.GroupBy();
                break;

            case (XmlHelper.Order):
                c = DBOrderSet.OrderBy();
                break;

            case (XmlHelper.Assignments):
                c = DBAssignSet.Assign();
                break;

            case (XmlHelper.Values):
                c = DBValueSet.Values();
                break;

            case (XmlHelper.Join):
                c = DBJoin.Join();
                break;

            case (XmlHelper.Function):
                c = DBFunction.Function();
                break;

            case (XmlHelper.Constant):
                c = DBConst.Null();
                break;

            case (XmlHelper.Top):
                c = DBTop.Top();
                break;

            case (XmlHelper.UnaryOp):
                c = DBComparison.Not();
                break;

            case (XmlHelper.Compare):
                c = DBComparison.Compare();
                break;

            case (XmlHelper.Between):
                c = DBComparison.Between();
                break;

            case (XmlHelper.Parameter):
                //parameter is a special case.
                //we add them to akeyed colection if they are not already registered
                //then at the end we set the values at the end
                string  name = reader.GetAttribute(XmlHelper.Name);
                DBParam aparam;
                if (context.Parameters.TryGetParameter(name, out aparam))
                {
                    c = aparam;
                }
                else
                {
                    aparam      = DBParam.Param();
                    aparam.Name = name;
                    context.Parameters.Add(aparam);
                    c = aparam;
                }
                break;

            case (XmlHelper.OrderBy):
                c = DBOrder.OrderBy();
                break;

            case (XmlHelper.Calculation):
                c = DBCalc.Calculate();
                break;

            case (XmlHelper.Aggregate):
                c = DBAggregate.Aggregate();
                break;

            case (XmlHelper.ValueGroup):
                c = DBValueGroup.Empty();
                break;

            case (XmlHelper.BooleanOperator):
                c = DBBooleanOp.Compare();
                break;

            case (XmlHelper.Assign):
                c = DBAssign.Assign();
                break;

            case (XmlHelper.InnerSelect):
                c = DBSubQuery.SubSelect();
                break;

            case (XmlHelper.Multiple):
                c = DBMultiComparisonRef.Many();
                break;

            case (XmlHelper.QueryOptionSet):
                c = new DBQueryHintOptionSet();
                break;

            case (XmlHelper.QueryOption):
                c = DBQueryHintOption.QueryOption();
                break;

            case (XmlHelper.CreateSproc):
                c = DBCreateProcedureQuery.CreateProcedure();
                break;

            case (XmlHelper.Declare):
                c = DBDeclaration.Declare();
                break;

            case (XmlHelper.CreateTable):
                c = DBCreateTableQuery.Table();
                break;

            case (XmlHelper.ColumnDefinition):
                c = DBColumn.Column();
                break;

            case (XmlHelper.PrimaryKey):
                c = DBPrimaryKey.PrimaryKey();
                break;

            case (XmlHelper.ForeignKey):
                c = DBForeignKey.ForeignKey();
                break;

            case (XmlHelper.CreateIndex):
                c = DBCreateIndexQuery.Index();
                break;

            case (XmlHelper.CreateView):
                c = DBCreateViewQuery.CreateView();
                break;

            case (XmlHelper.CreateSequence):
                c = DBCreateSequenceQuery.Sequence();
                break;

            case (XmlHelper.DropTable):
                c = DBDropTableQuery.DropTable();
                break;

            case (XmlHelper.DropIndex):
                c = DBDropIndexQuery.DropIndex();
                break;

            case (XmlHelper.DropView):
                c = DBDropViewQuery.DropView();
                break;

            case (XmlHelper.DropSproc):
                c = DBDropProcedureQuery.DropProcedure();
                break;

            case (XmlHelper.DropSequence):
                c = DBDropSequenceQuery.DropSequence();
                break;

            default:
                throw XmlHelper.CreateException("The XML data could not be deserialized because the element {1} was not recognised. {0}", reader, null, element);
            }

            if (c != null)
            {
                c.ReadXml(reader, context);
            }

            return(c);
        }