• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# AggInfo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中AggInfo的典型用法代码示例。如果您正苦于以下问题:C# AggInfo类的具体用法?C# AggInfo怎么用?C# AggInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AggInfo类属于命名空间,在下文中一共展示了AggInfo类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: updateAccumulator

    /*
    ** Update the accumulator memory cells for an aggregate based on
    ** the current cursor position.
    */
    static void updateAccumulator( Parse pParse, AggInfo pAggInfo )
    {
      Vdbe v = pParse.pVdbe;
      int i;
      AggInfo_func pF;
      AggInfo_col pC;

      pAggInfo.directMode = 1;
      sqlite3ExprCacheClear( pParse );
      for ( i = 0; i < pAggInfo.nFunc; i++ )
      {//, pF++){
        pF = pAggInfo.aFunc[i];
        int nArg;
        int addrNext = 0;
        int regAgg;
        Debug.Assert( !ExprHasProperty( pF.pExpr, EP_xIsSelect ) );
        ExprList pList = pF.pExpr.x.pList;
        if ( pList != null )
        {
          nArg = pList.nExpr;
          regAgg = sqlite3GetTempRange( pParse, nArg );
          sqlite3ExprCodeExprList( pParse, pList, regAgg, true );
        }
        else
        {
          nArg = 0;
          regAgg = 0;
        }
        if ( pF.iDistinct >= 0 )
        {
          addrNext = sqlite3VdbeMakeLabel( v );
          Debug.Assert( nArg == 1 );
          codeDistinct( pParse, pF.iDistinct, addrNext, 1, regAgg );
        }
        if ( ( pF.pFunc.flags & SQLITE_FUNC_NEEDCOLL ) != 0 )
        {
          CollSeq pColl = null;
          ExprList_item pItem;
          int j;
          Debug.Assert( pList != null );  /* pList!=0 if pF->pFunc has NEEDCOLL */
          for ( j = 0; pColl == null && j < nArg; j++ )
          {//, pItem++){
            pItem = pList.a[j];
            pColl = sqlite3ExprCollSeq( pParse, pItem.pExpr );
          }
          if ( pColl == null )
          {
            pColl = pParse.db.pDfltColl;
          }
          sqlite3VdbeAddOp4( v, OP_CollSeq, 0, 0, 0, pColl, P4_COLLSEQ );
        }
        sqlite3VdbeAddOp4( v, OP_AggStep, 0, regAgg, pF.iMem,
        pF.pFunc, P4_FUNCDEF );
        sqlite3VdbeChangeP5( v, (u8)nArg );
        sqlite3ExprCacheAffinityChange( pParse, regAgg, nArg );
        sqlite3ReleaseTempRange( pParse, regAgg, nArg );
        if ( addrNext != 0 )
        {
          sqlite3VdbeResolveLabel( v, addrNext );
          sqlite3ExprCacheClear( pParse );
        }
      }

      /* Before populating the accumulator registers, clear the column cache.
      ** Otherwise, if any of the required column values are already present 
      ** in registers, sqlite3ExprCode() may use OP_SCopy to copy the value
      ** to pC->iMem. But by the time the value is used, the original register
      ** may have been used, invalidating the underlying buffer holding the
      ** text or blob value. See ticket [883034dcb5].
      **
      ** Another solution would be to change the OP_SCopy used to copy cached
      ** values to an OP_Copy.
      */
      sqlite3ExprCacheClear( pParse );
      for ( i = 0; i < pAggInfo.nAccumulator; i++ )//, pC++)
      {
        pC = pAggInfo.aCol[i];
        sqlite3ExprCode( pParse, pC.pExpr, pC.iMem );
      }
      pAggInfo.directMode = 0;
      sqlite3ExprCacheClear( pParse );
    }
开发者ID:CryptoManiac,项目名称:csharpsqlite,代码行数:86,代码来源:select_c.cs


示例2: sqlite3Select

    static int sqlite3Select(
    Parse pParse,         /* The parser context */
    Select p,             /* The SELECT statement being coded. */
    ref SelectDest pDest /* What to do with the query results */
    )
    {
      int i, j;               /* Loop counters */
      WhereInfo pWInfo;       /* Return from sqlite3WhereBegin() */
      Vdbe v;                 /* The virtual machine under construction */
      bool isAgg;             /* True for select lists like "count()" */
      ExprList pEList = new ExprList();      /* List of columns to extract. */
      SrcList pTabList = new SrcList();     /* List of tables to select from */
      Expr pWhere;            /* The WHERE clause.  May be NULL */
      ExprList pOrderBy;      /* The ORDER BY clause.  May be NULL */
      ExprList pGroupBy;      /* The GROUP BY clause.  May be NULL */
      Expr pHaving;           /* The HAVING clause.  May be NULL */
      bool isDistinct;        /* True if the DISTINCT keyword is present */
      int distinct;           /* Table to use for the distinct set */
      int rc = 1;             /* Value to return from this function */
      int addrSortIndex;      /* Address of an OP_OpenEphemeral instruction */
      AggInfo sAggInfo;       /* Information used by aggregate queries */
      int iEnd;               /* Address of the end of the query */
      sqlite3 db;             /* The database connection */

#if !SQLITE_OMIT_EXPLAIN
      int iRestoreSelectId = pParse.iSelectId;
      pParse.iSelectId = pParse.iNextSelectId++;
#endif

      db = pParse.db;
      if ( p == null /*|| db.mallocFailed != 0 */ || pParse.nErr != 0 )
      {
        return 1;
      }
#if !SQLITE_OMIT_AUTHORIZATION
if (sqlite3AuthCheck(pParse, SQLITE_SELECT, 0, 0, 0)) return 1;
#endif
      sAggInfo = new AggInfo();// memset(sAggInfo, 0, sAggInfo).Length;

      if ( pDest.eDest <= SRT_Discard ) //IgnorableOrderby(pDest))
      {
        Debug.Assert( pDest.eDest == SRT_Exists || pDest.eDest == SRT_Union ||
        pDest.eDest == SRT_Except || pDest.eDest == SRT_Discard );
        /* If ORDER BY makes no difference in the output then neither does
        ** DISTINCT so it can be removed too. */
        sqlite3ExprListDelete( db, ref p.pOrderBy );
        p.pOrderBy = null;
        p.selFlags = (u16)( p.selFlags & ~SF_Distinct );
      }
      sqlite3SelectPrep( pParse, p, null );
      pOrderBy = p.pOrderBy;
      pTabList = p.pSrc;
      pEList = p.pEList;
      if ( pParse.nErr != 0 /*|| db.mallocFailed != 0 */ )
      {
        goto select_end;
      }
      isAgg = ( p.selFlags & SF_Aggregate ) != 0;
      Debug.Assert( pEList != null );

      /* Begin generating code.
      */
      v = sqlite3GetVdbe( pParse );
      if ( v == null )
        goto select_end;

      /* If writing to memory or generating a set
      ** only a single column may be output.
      */
#if !SQLITE_OMIT_SUBQUERY
      if ( checkForMultiColumnSelectError( pParse, pDest, pEList.nExpr ) )
      {
        goto select_end;
      }
#endif

      /* Generate code for all sub-queries in the FROM clause
*/
#if !SQLITE_OMIT_SUBQUERY || !SQLITE_OMIT_VIEW
      for ( i = 0; p.pPrior == null && i < pTabList.nSrc; i++ )
      {
        SrcList_item pItem = pTabList.a[i];
        SelectDest dest = new SelectDest();
        Select pSub = pItem.pSelect;
        bool isAggSub;

        if ( pSub == null || pItem.isPopulated != 0 )
          continue;

        /* Increment Parse.nHeight by the height of the largest expression
        ** tree refered to by this, the parent select. The child select
        ** may contain expression trees of at most
        ** (SQLITE_MAX_EXPR_DEPTH-Parse.nHeight) height. This is a bit
        ** more conservative than necessary, but much easier than enforcing
        ** an exact limit.
        */
        pParse.nHeight += sqlite3SelectExprHeight( p );

        /* Check to see if the subquery can be absorbed into the parent. */
        isAggSub = ( pSub.selFlags & SF_Aggregate ) != 0;
//.........这里部分代码省略.........
开发者ID:CryptoManiac,项目名称:csharpsqlite,代码行数:101,代码来源:select_c.cs


示例3: resetAccumulator

 /*
 ** Reset the aggregate accumulator.
 **
 ** The aggregate accumulator is a set of memory cells that hold
 ** intermediate results while calculating an aggregate.  This
 ** routine simply stores NULLs in all of those memory cells.
 */
 static void resetAccumulator( Parse pParse, AggInfo pAggInfo )
 {
   Vdbe v = pParse.pVdbe;
   int i;
   AggInfo_func pFunc;
   if ( pAggInfo.nFunc + pAggInfo.nColumn == 0 )
   {
     return;
   }
   for ( i = 0; i < pAggInfo.nColumn; i++ )
   {
     sqlite3VdbeAddOp2( v, OP_Null, 0, pAggInfo.aCol[i].iMem );
   }
   for ( i = 0; i < pAggInfo.nFunc; i++ )
   {//, pFunc++){
     pFunc = pAggInfo.aFunc[i];
     sqlite3VdbeAddOp2( v, OP_Null, 0, pFunc.iMem );
     if ( pFunc.iDistinct >= 0 )
     {
       Expr pE = pFunc.pExpr;
       Debug.Assert( !ExprHasProperty( pE, EP_xIsSelect ) );
       if ( pE.x.pList == null || pE.x.pList.nExpr != 1 )
       {
         sqlite3ErrorMsg( pParse, "DISTINCT aggregates must have exactly one " +
         "argument" );
         pFunc.iDistinct = -1;
       }
       else
       {
         KeyInfo pKeyInfo = keyInfoFromExprList( pParse, pE.x.pList );
         sqlite3VdbeAddOp4( v, OP_OpenEphemeral, pFunc.iDistinct, 0, 0,
         pKeyInfo, P4_KEYINFO_HANDOFF );
       }
     }
   }
 }
开发者ID:CryptoManiac,项目名称:csharpsqlite,代码行数:43,代码来源:select_c.cs


示例4: finalizeAggFunctions

 /*
 ** Invoke the OP_AggFinalize opcode for every aggregate function
 ** in the AggInfo structure.
 */
 static void finalizeAggFunctions( Parse pParse, AggInfo pAggInfo )
 {
   Vdbe v = pParse.pVdbe;
   int i;
   AggInfo_func pF;
   for ( i = 0; i < pAggInfo.nFunc; i++ )
   {//, pF++){
     pF = pAggInfo.aFunc[i];
     ExprList pList = pF.pExpr.x.pList;
     Debug.Assert( !ExprHasProperty( pF.pExpr, EP_xIsSelect ) );
     sqlite3VdbeAddOp4( v, OP_AggFinal, pF.iMem, pList != null ? pList.nExpr : 0, 0,
     pF.pFunc, P4_FUNCDEF );
   }
 }
开发者ID:CryptoManiac,项目名称:csharpsqlite,代码行数:18,代码来源:select_c.cs


示例5: isSimpleCount

    /*
    ** The select statement passed as the first argument is an aggregate query.
    ** The second argment is the associated aggregate-info object. This
    ** function tests if the SELECT is of the form:
    **
    **   SELECT count() FROM <tbl>
    **
    ** where table is a database table, not a sub-select or view. If the query
    ** does match this pattern, then a pointer to the Table object representing
    ** <tbl> is returned. Otherwise, 0 is returned.
    */
    static Table isSimpleCount( Select p, AggInfo pAggInfo )
    {
      Table pTab;
      Expr pExpr;

      Debug.Assert( null == p.pGroupBy );

      if ( p.pWhere != null || p.pEList.nExpr != 1
      || p.pSrc.nSrc != 1 || p.pSrc.a[0].pSelect != null
      )
      {
        return null;
      }
      pTab = p.pSrc.a[0].pTab;
      pExpr = p.pEList.a[0].pExpr;
      Debug.Assert( pTab != null && null == pTab.pSelect && pExpr != null );

      if ( IsVirtual( pTab ) )
        return null;
      if ( pExpr.op != TK_AGG_FUNCTION )
        return null;
      if ( ( pAggInfo.aFunc[0].pFunc.flags & SQLITE_FUNC_COUNT ) == 0 )
        return null;
      if ( ( pExpr.flags & EP_Distinct ) != 0 )
        return null;

      return pTab;
    }
开发者ID:CryptoManiac,项目名称:csharpsqlite,代码行数:39,代码来源:select_c.cs


示例6: addAggInfoFunc

 /*
 ** Add a new element to the pAggInfo.aFunc[] array.  Return the index of
 ** the new element.  Return a negative number if malloc fails.
 */
 static int addAggInfoFunc( sqlite3 db, AggInfo pInfo )
 {
   int i = 0;
   pInfo.aFunc = sqlite3ArrayAllocate(
   db,
   pInfo.aFunc,
   -1,//sizeof(pInfo.aFunc[0]),
   3,
   ref pInfo.nFunc,
   ref pInfo.nFuncAlloc,
   ref i
   );
   return i;
 }
开发者ID:laboratoryyingong,项目名称:BARLESS,代码行数:18,代码来源:expr_c.cs


示例7: addAggInfoColumn

 /*
 ** Add a new element to the pAggInfo.aCol[] array.  Return the index of
 ** the new element.  Return a negative number if malloc fails.
 */
 static int addAggInfoColumn( sqlite3 db, AggInfo pInfo )
 {
   int i = 0;
   pInfo.aCol = sqlite3ArrayAllocate(
   db,
   pInfo.aCol,
   -1,//sizeof(pInfo.aCol[0]),
   3,
   ref pInfo.nColumn,
   ref pInfo.nColumnAlloc,
   ref i
   );
   return i;
 }
开发者ID:laboratoryyingong,项目名称:BARLESS,代码行数:18,代码来源:expr_c.cs


示例8: updateAccumulator

    /*
    ** Update the accumulator memory cells for an aggregate based on
    ** the current cursor position.
    */
    static void updateAccumulator( Parse pParse, AggInfo pAggInfo )
    {
      Vdbe v = pParse.pVdbe;
      int i;
      AggInfo_func pF;
      AggInfo_col pC;

      pAggInfo.directMode = 1;
      sqlite3ExprCacheClear( pParse );
      for ( i = 0; i < pAggInfo.nFunc; i++ )
      {//, pF++){
        pF = pAggInfo.aFunc[i];
        int nArg;
        int addrNext = 0;
        int regAgg;
        Debug.Assert( !ExprHasProperty( pF.pExpr, EP_xIsSelect ) );
        ExprList pList = pF.pExpr.x.pList;
        if ( pList != null )
        {
          nArg = pList.nExpr;
          regAgg = sqlite3GetTempRange( pParse, nArg );
          sqlite3ExprCodeExprList( pParse, pList, regAgg, false );
        }
        else
        {
          nArg = 0;
          regAgg = 0;
        }
        if ( pF.iDistinct >= 0 )
        {
          addrNext = sqlite3VdbeMakeLabel( v );
          Debug.Assert( nArg == 1 );
          codeDistinct( pParse, pF.iDistinct, addrNext, 1, regAgg );
        }
        if ( ( pF.pFunc.flags & SQLITE_FUNC_NEEDCOLL ) != 0 )
        {
          CollSeq pColl = null;
          ExprList_item pItem;
          int j;
          Debug.Assert( pList != null );  /* pList!=0 if pF->pFunc has NEEDCOLL */
          for ( j = 0; pColl == null && j < nArg; j++ )
          {//, pItem++){
            pItem = pList.a[j];
            pColl = sqlite3ExprCollSeq( pParse, pItem.pExpr );
          }
          if ( pColl == null )
          {
            pColl = pParse.db.pDfltColl;
          }
          sqlite3VdbeAddOp4( v, OP_CollSeq, 0, 0, 0, pColl, P4_COLLSEQ );
        }
        sqlite3VdbeAddOp4( v, OP_AggStep, 0, regAgg, pF.iMem,
        pF.pFunc, P4_FUNCDEF );
        sqlite3VdbeChangeP5( v, (u8)nArg );
        sqlite3ExprCacheAffinityChange( pParse, regAgg, nArg );
        sqlite3ReleaseTempRange( pParse, regAgg, nArg );
        if ( addrNext != 0 )
        {
          sqlite3VdbeResolveLabel( v, addrNext );
          sqlite3ExprCacheClear( pParse );
        }
      }
      for ( i = 0; i < pAggInfo.nAccumulator; i++ )//, pC++)
      {
        pC = pAggInfo.aCol[i];
        sqlite3ExprCode( pParse, pC.pExpr, pC.iMem );
      }
      pAggInfo.directMode = 0;
      sqlite3ExprCacheClear( pParse );
    }
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:74,代码来源:select_c.cs


示例9: CopyFrom

        public ITable pZombieTab;      // List of Table objects to delete after code gen
#endif
        #endregion

        public void CopyFrom(Expr cf)
        {
            op = cf.op;
            affinity = cf.affinity;
            flags = cf.flags;
            u = cf.u;
            pColl = (cf.pColl == null ? null : cf.pColl.Copy());
            iTable = cf.iTable;
            iColumn = cf.iColumn;
            pAggInfo = (cf.pAggInfo == null ? null : cf.pAggInfo.Copy());
            iAgg = cf.iAgg;
            iRightJoinTable = cf.iRightJoinTable;
            flags2 = cf.flags2;
            pTab = (cf.pTab == null ? null : cf.pTab);
#if SQLITE_MAX_EXPR_DEPTH
            nHeight = cf.nHeight;
            pZombieTab = cf.pZombieTab;
#endif
            pLeft = (cf.pLeft == null ? null : cf.pLeft.Copy());
            pRight = (cf.pRight == null ? null : cf.pRight.Copy());
            x.pList = (cf.x.pList == null ? null : cf.x.pList.Copy());
            x.pSelect = (cf.x.pSelect == null ? null : cf.x.pSelect.Copy());
        }
开发者ID:JiujiangZhu,项目名称:feaserver,代码行数:27,代码来源:Expr.cs



注:本文中的AggInfo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# AggregateClause类代码示例发布时间:2022-05-24
下一篇:
C# AgentType类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap