亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? select.c

?? Trolltech公司發布的基于C++圖形開發環境
?? C
?? 第 1 頁 / 共 5 頁
字號:
** optimized.**** This routine attempts to rewrite queries such as the above into** a single flat select, like this:****     SELECT x+y AS a FROM t1 WHERE z<100 AND a>5**** The code generated for this simpification gives the same result** but only has to scan the data once.  And because indices might ** exist on the table t1, a complete scan of the data might be** avoided.**** Flattening is only attempted if all of the following are true:****   (1)  The subquery and the outer query do not both use aggregates.****   (2)  The subquery is not an aggregate or the outer query is not a join.****   (3)  The subquery is not the right operand of a left outer join, or**        the subquery is not itself a join.  (Ticket #306)****   (4)  The subquery is not DISTINCT or the outer query is not a join.****   (5)  The subquery is not DISTINCT or the outer query does not use**        aggregates.****   (6)  The subquery does not use aggregates or the outer query is not**        DISTINCT.****   (7)  The subquery has a FROM clause.****   (8)  The subquery does not use LIMIT or the outer query is not a join.****   (9)  The subquery does not use LIMIT or the outer query does not use**        aggregates.****  (10)  The subquery does not use aggregates or the outer query does not**        use LIMIT.****  (11)  The subquery and the outer query do not both have ORDER BY clauses.****  (12)  The subquery is not the right term of a LEFT OUTER JOIN or the**        subquery has no WHERE clause.  (added by ticket #350)**** In this routine, the "p" parameter is a pointer to the outer query.** The subquery is p->pSrc->a[iFrom].  isAgg is true if the outer query** uses aggregates and subqueryIsAgg is true if the subquery uses aggregates.**** If flattening is not attempted, this routine is a no-op and returns 0.** If flattening is attempted this routine returns 1.**** All of the expression analysis must occur on both the outer query and** the subquery before this routine runs.*/static int flattenSubquery(  Parse *pParse,       /* The parsing context */  Select *p,           /* The parent or outer SELECT statement */  int iFrom,           /* Index in p->pSrc->a[] of the inner subquery */  int isAgg,           /* True if outer SELECT uses aggregate functions */  int subqueryIsAgg    /* True if the subquery uses aggregate functions */){  Select *pSub;       /* The inner query or "subquery" */  SrcList *pSrc;      /* The FROM clause of the outer query */  SrcList *pSubSrc;   /* The FROM clause of the subquery */  ExprList *pList;    /* The result set of the outer query */  int iParent;        /* VDBE cursor number of the pSub result set temp table */  int i;  Expr *pWhere;  /* Check to see if flattening is permitted.  Return 0 if not.  */  if( p==0 ) return 0;  pSrc = p->pSrc;  assert( pSrc && iFrom>=0 && iFrom<pSrc->nSrc );  pSub = pSrc->a[iFrom].pSelect;  assert( pSub!=0 );  if( isAgg && subqueryIsAgg ) return 0;  if( subqueryIsAgg && pSrc->nSrc>1 ) return 0;  pSubSrc = pSub->pSrc;  assert( pSubSrc );  if( pSubSrc->nSrc==0 ) return 0;  if( (pSub->isDistinct || pSub->nLimit>=0) &&  (pSrc->nSrc>1 || isAgg) ){     return 0;  }  if( (p->isDistinct || p->nLimit>=0) && subqueryIsAgg ) return 0;  if( p->pOrderBy && pSub->pOrderBy ) return 0;  /* Restriction 3:  If the subquery is a join, make sure the subquery is   ** not used as the right operand of an outer join.  Examples of why this  ** is not allowed:  **  **         t1 LEFT OUTER JOIN (t2 JOIN t3)  **  ** If we flatten the above, we would get  **  **         (t1 LEFT OUTER JOIN t2) JOIN t3  **  ** which is not at all the same thing.  */  if( pSubSrc->nSrc>1 && iFrom>0 && (pSrc->a[iFrom-1].jointype & JT_OUTER)!=0 ){    return 0;  }  /* Restriction 12:  If the subquery is the right operand of a left outer  ** join, make sure the subquery has no WHERE clause.  ** An examples of why this is not allowed:  **  **         t1 LEFT OUTER JOIN (SELECT * FROM t2 WHERE t2.x>0)  **  ** If we flatten the above, we would get  **  **         (t1 LEFT OUTER JOIN t2) WHERE t2.x>0  **  ** But the t2.x>0 test will always fail on a NULL row of t2, which  ** effectively converts the OUTER JOIN into an INNER JOIN.  */  if( iFrom>0 && (pSrc->a[iFrom-1].jointype & JT_OUTER)!=0       && pSub->pWhere!=0 ){    return 0;  }  /* If we reach this point, it means flattening is permitted for the  ** iFrom-th entry of the FROM clause in the outer query.  */  /* Move all of the FROM elements of the subquery into the  ** the FROM clause of the outer query.  Before doing this, remember  ** the cursor number for the original outer query FROM element in  ** iParent.  The iParent cursor will never be used.  Subsequent code  ** will scan expressions looking for iParent references and replace  ** those references with expressions that resolve to the subquery FROM  ** elements we are now copying in.  */  iParent = pSrc->a[iFrom].iCursor;  {    int nSubSrc = pSubSrc->nSrc;    int jointype = pSrc->a[iFrom].jointype;    if( pSrc->a[iFrom].pTab && pSrc->a[iFrom].pTab->isTransient ){      sqliteDeleteTable(0, pSrc->a[iFrom].pTab);    }    sqliteFree(pSrc->a[iFrom].zDatabase);    sqliteFree(pSrc->a[iFrom].zName);    sqliteFree(pSrc->a[iFrom].zAlias);    if( nSubSrc>1 ){      int extra = nSubSrc - 1;      for(i=1; i<nSubSrc; i++){        pSrc = sqliteSrcListAppend(pSrc, 0, 0);      }      p->pSrc = pSrc;      for(i=pSrc->nSrc-1; i-extra>=iFrom; i--){        pSrc->a[i] = pSrc->a[i-extra];      }    }    for(i=0; i<nSubSrc; i++){      pSrc->a[i+iFrom] = pSubSrc->a[i];      memset(&pSubSrc->a[i], 0, sizeof(pSubSrc->a[i]));    }    pSrc->a[iFrom+nSubSrc-1].jointype = jointype;  }  /* Now begin substituting subquery result set expressions for   ** references to the iParent in the outer query.  **   ** Example:  **  **   SELECT a+5, b*10 FROM (SELECT x*3 AS a, y+10 AS b FROM t1) WHERE a>b;  **   \                     \_____________ subquery __________/          /  **    \_____________________ outer query ______________________________/  **  ** We look at every expression in the outer query and every place we see  ** "a" we substitute "x*3" and every place we see "b" we substitute "y+10".  */  substExprList(p->pEList, iParent, pSub->pEList);  pList = p->pEList;  for(i=0; i<pList->nExpr; i++){    Expr *pExpr;    if( pList->a[i].zName==0 && (pExpr = pList->a[i].pExpr)->span.z!=0 ){      pList->a[i].zName = sqliteStrNDup(pExpr->span.z, pExpr->span.n);    }  }  if( isAgg ){    substExprList(p->pGroupBy, iParent, pSub->pEList);    substExpr(p->pHaving, iParent, pSub->pEList);  }  if( pSub->pOrderBy ){    assert( p->pOrderBy==0 );    p->pOrderBy = pSub->pOrderBy;    pSub->pOrderBy = 0;  }else if( p->pOrderBy ){    substExprList(p->pOrderBy, iParent, pSub->pEList);  }  if( pSub->pWhere ){    pWhere = sqliteExprDup(pSub->pWhere);  }else{    pWhere = 0;  }  if( subqueryIsAgg ){    assert( p->pHaving==0 );    p->pHaving = p->pWhere;    p->pWhere = pWhere;    substExpr(p->pHaving, iParent, pSub->pEList);    if( pSub->pHaving ){      Expr *pHaving = sqliteExprDup(pSub->pHaving);      if( p->pHaving ){        p->pHaving = sqliteExpr(TK_AND, p->pHaving, pHaving, 0);      }else{        p->pHaving = pHaving;      }    }    assert( p->pGroupBy==0 );    p->pGroupBy = sqliteExprListDup(pSub->pGroupBy);  }else if( p->pWhere==0 ){    p->pWhere = pWhere;  }else{    substExpr(p->pWhere, iParent, pSub->pEList);    if( pWhere ){      p->pWhere = sqliteExpr(TK_AND, p->pWhere, pWhere, 0);    }  }  /* The flattened query is distinct if either the inner or the  ** outer query is distinct.   */  p->isDistinct = p->isDistinct || pSub->isDistinct;  /* Transfer the limit expression from the subquery to the outer  ** query.  */  if( pSub->nLimit>=0 ){    if( p->nLimit<0 ){      p->nLimit = pSub->nLimit;    }else if( p->nLimit+p->nOffset > pSub->nLimit+pSub->nOffset ){      p->nLimit = pSub->nLimit + pSub->nOffset - p->nOffset;    }  }  p->nOffset += pSub->nOffset;  /* Finially, delete what is left of the subquery and return  ** success.  */  sqliteSelectDelete(pSub);  return 1;}/*** Analyze the SELECT statement passed in as an argument to see if it** is a simple min() or max() query.  If it is and this query can be** satisfied using a single seek to the beginning or end of an index,** then generate the code for this SELECT and return 1.  If this is not a ** simple min() or max() query, then return 0;**** A simply min() or max() query looks like this:****    SELECT min(a) FROM table;**    SELECT max(a) FROM table;**** The query may have only a single table in its FROM argument.  There** can be no GROUP BY or HAVING or WHERE clauses.  The result set must** be the min() or max() of a single column of the table.  The column** in the min() or max() function must be indexed.**** The parameters to this routine are the same as for sqliteSelect().** See the header comment on that routine for additional information.*/static int simpleMinMaxQuery(Parse *pParse, Select *p, int eDest, int iParm){  Expr *pExpr;  int iCol;  Table *pTab;  Index *pIdx;  int base;  Vdbe *v;  int seekOp;  int cont;  ExprList eList;  struct ExprList_item eListItem;  /* Check to see if this query is a simple min() or max() query.  Return  ** zero if it is  not.  */  if( p->pGroupBy || p->pHaving || p->pWhere ) return 0;  if( p->pSrc->nSrc!=1 ) return 0;  if( p->pEList->nExpr!=1 ) return 0;  pExpr = p->pEList->a[0].pExpr;  if( pExpr->op!=TK_AGG_FUNCTION ) return 0;  if( pExpr->pList==0 || pExpr->pList->nExpr!=1 ) return 0;  if( pExpr->token.n!=3 ) return 0;  if( sqliteStrNICmp(pExpr->token.z,"min",3)==0 ){    seekOp = OP_Rewind;  }else if( sqliteStrNICmp(pExpr->token.z,"max",3)==0 ){    seekOp = OP_Last;  }else{    return 0;  }  pExpr = pExpr->pList->a[0].pExpr;  if( pExpr->op!=TK_COLUMN ) return 0;  iCol = pExpr->iColumn;  pTab = p->pSrc->a[0].pTab;  /* If we get to here, it means the query is of the correct form.  ** Check to make sure we have an index and make pIdx point to the  ** appropriate index.  If the min() or max() is on an INTEGER PRIMARY  ** key column, no index is necessary so set pIdx to NULL.  If no  ** usable index is found, return 0.  */  if( iCol<0 ){    pIdx = 0;  }else{    for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){      assert( pIdx->nColumn>=1 );      if( pIdx->aiColumn[0]==iCol ) break;    }    if( pIdx==0 ) return 0;  }  /* Identify column types if we will be using the callback.  This  ** step is skipped if the output is going to a table or a memory cell.  ** The column names have already been generated in the calling function.  */  v = sqliteGetVdbe(pParse);  if( v==0 ) return 0;  if( eDest==SRT_Callback ){    generateColumnTypes(pParse, p->pSrc, p->pEList);  }  /* If the output is destined for a temporary table, open that table.  */  if( eDest==SRT_TempTable ){    sqliteVdbeAddOp(v, OP_OpenTemp, iParm, 0);  }  /* Generating code to find the min or the max.  Basically all we have  ** to do is find the first or the last entry in the chosen index.  If  ** the min() or max() is on the INTEGER PRIMARY KEY, then find the first  ** or last entry in the main table.  */  sqliteCodeVerifySchema(pParse, pTab->iDb);  base = p->pSrc->a[0].iCursor;  computeLimitRegisters(pParse, p);  sqliteVdbeAddOp(v, OP_Integer, pTab->iDb, 0);  sqliteVdbeOp3(v, OP_OpenRead, base, pTab->tnum, pTab->zName, 0);  cont = sqliteVdbeMakeLabel(v);  if( pIdx==0 ){    sqliteVdbeAddOp(v, seekOp, base, 0);  }else{    sqliteVdbeAddOp(v, OP_Integer, pIdx->iDb, 0);    sqliteVdbeOp3(v, OP_OpenRead, base+1, pIdx->tnum, pIdx->zName, P3_STATIC);    sqliteVdbeAddOp(v, seekOp, base+1, 0);    sqliteVdbeAddOp(v, OP_IdxRecno, base+1, 0);    sqliteVdbeAddOp(v, OP_Close, base+1, 0);    sqliteVdbeAddOp(v, OP_MoveTo, base, 0);  }  eList.nExpr = 1;  memset(&eListItem, 0, sizeof(eListItem));  eList.a = &eListItem;  eList.a[0].pExpr = pExpr;  selectInnerLoop(pParse, p, &eList, 0, 0, 0, -1, eDest, iParm, cont, cont);  sqliteVdbeResolveLabel(v, cont);  sqliteVdbeAddOp(v, OP_Close, base, 0);  return 1;}/*** Generate code for the given SELECT statement.**** The results are distributed in various ways depending on the** value of eDest and iParm.****     eDest Value       Result**     ------------    -------------------------------------------**     SRT_Callback    Invoke the callback for each row of the result.****     SRT_Mem         Store first result in memory cell iParm****     SRT_Set         Store results as keys of a table with cursor iParm****     SRT_Union       Store results as a key in a temporary table iParm****     SRT_Except      Remove results from the temporary table iParm.****     SRT_Table       Store results in temporary table iParm**** The table above is incomplete.  Additional eDist value have be added** since this comment was written.  See the selectInnerLoop() function for** a complete listing of the allowed values of eDest and their meanings.**** This routine returns the number of errors.  If any errors are** encountered, then an appropriate error message is left in** pPars

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品美女久久久久久久网站| 国产综合久久久久久鬼色| 亚洲国产cao| 国产另类ts人妖一区二区| 色先锋资源久久综合| 欧美电视剧免费观看| 一区2区3区在线看| 不卡av免费在线观看| 日韩精品中文字幕在线一区| 亚洲综合久久av| 99麻豆久久久国产精品免费| 欧美v亚洲v综合ⅴ国产v| 亚洲国产成人av网| 91亚洲大成网污www| 中文一区二区在线观看| 韩国理伦片一区二区三区在线播放| 欧美天堂亚洲电影院在线播放| 欧美激情一区二区在线| 国产麻豆日韩欧美久久| 日韩美女主播在线视频一区二区三区| 亚洲欧美自拍偷拍色图| 不卡视频一二三| 国产日韩精品视频一区| 国产精品亚洲第一| 亚洲精品在线免费观看视频| 欧美aaa在线| 欧美一级艳片视频免费观看| 天天影视色香欲综合网老头| 色综合久久综合网| 亚洲综合久久久久| 欧美在线视频全部完| 洋洋成人永久网站入口| 色综合久久六月婷婷中文字幕| 国产精品欧美久久久久无广告| 国产激情一区二区三区四区| 久久天天做天天爱综合色| 韩国午夜理伦三级不卡影院| 久久人人爽人人爽| 国产91精品久久久久久久网曝门| 久久在线免费观看| 成人av小说网| 亚洲一区影音先锋| 欧美日韩不卡一区二区| 麻豆一区二区三| 久久品道一品道久久精品| 东方欧美亚洲色图在线| 亚洲人午夜精品天堂一二香蕉| 成人v精品蜜桃久久一区| 亚洲同性gay激情无套| 在线观看av不卡| 日本亚洲视频在线| 国产亚洲欧美日韩在线一区| 成人av在线一区二区| 亚洲主播在线观看| 精品久久久久香蕉网| 成人免费毛片aaaaa**| 亚洲一区二区美女| 日韩一区二区三区视频| 国产a级毛片一区| 亚洲精品国产视频| 欧美一区二区成人| 成人h动漫精品一区二区| 亚洲成av人片一区二区三区| 精品va天堂亚洲国产| 99久久精品国产毛片| 蜜臀av性久久久久蜜臀aⅴ四虎| 久久精品亚洲麻豆av一区二区| 91啦中文在线观看| 美女视频一区在线观看| 国产精品乱码一区二三区小蝌蚪| 欧美日韩亚洲综合在线| 福利视频网站一区二区三区| 亚洲综合男人的天堂| 亚洲精品一区二区三区99| 91久久精品国产91性色tv | 欧美电视剧在线观看完整版| 国产a久久麻豆| 青青草精品视频| 亚洲柠檬福利资源导航| 久久久久久久电影| 欧美日韩在线观看一区二区| 成人亚洲一区二区一| 亚洲国产视频一区二区| 成人欧美一区二区三区白人 | 欧美伦理视频网站| 成人av在线影院| 韩国女主播一区二区三区| 香蕉av福利精品导航| 亚洲一区二区欧美| 欧美国产成人精品| 日韩精品一区二区三区四区视频| 色成年激情久久综合| 成人免费高清在线| 国内精品在线播放| 男人的天堂亚洲一区| 一区二区三区加勒比av| 亚洲欧洲精品一区二区三区 | 1区2区3区国产精品| 欧美国产视频在线| 日韩精品中文字幕一区 | 中文字幕av一区二区三区| 欧美一区二区精品在线| 欧美体内she精高潮| 色综合av在线| 日本道精品一区二区三区| 91蜜桃免费观看视频| 顶级嫩模精品视频在线看| 国产精品99久久久久久似苏梦涵| 久久福利资源站| 黑人巨大精品欧美一区| 国产精品一区不卡| 国产成人自拍网| 成人开心网精品视频| 成人av在线资源| 99视频国产精品| 色噜噜狠狠成人中文综合| 99riav久久精品riav| 色综合久久天天| 欧美天堂一区二区三区| 91精品欧美综合在线观看最新| 欧美精品丝袜久久久中文字幕| 欧美嫩在线观看| 欧美精品一区二区三区蜜桃视频 | 天天操天天色综合| 亚洲午夜影视影院在线观看| 亚洲成人精品在线观看| 日韩黄色一级片| 久久99精品国产麻豆婷婷洗澡| 精品在线免费视频| 粉嫩av亚洲一区二区图片| 99re在线精品| 91精品婷婷国产综合久久性色| 欧美videofree性高清杂交| 国产亚洲一区二区三区在线观看| 日本一区二区成人| 一区二区激情小说| 精品综合免费视频观看| 欧美精品视频www在线观看| 亚洲一区二区视频| 尤物在线观看一区| 天堂久久一区二区三区| 国产在线国偷精品免费看| 不卡一区在线观看| 69堂国产成人免费视频| 国产欧美日韩三级| 亚洲国产精品影院| 精品一区二区国语对白| 色老汉av一区二区三区| 日韩欧美国产一二三区| 亚洲欧洲另类国产综合| 日日噜噜夜夜狠狠视频欧美人| 国产一区二区免费看| 91在线国产福利| 日韩精品一区二区三区视频在线观看| 国产欧美综合在线| 日韩1区2区日韩1区2区| 99国产精品国产精品毛片| 欧美日韩精品欧美日韩精品一综合| 久久精品一区蜜桃臀影院| 亚洲高清视频中文字幕| 不卡一卡二卡三乱码免费网站| 91精品国产综合久久久久久久久久 | 毛片av一区二区| 色婷婷综合久久久久中文 | 在线综合视频播放| 亚洲精选视频在线| 精品一区二区三区免费播放 | 国产91精品露脸国语对白| 69av一区二区三区| 国产精品久久一卡二卡| 蜜臀精品一区二区三区在线观看| 91在线观看免费视频| 久久看人人爽人人| 日本v片在线高清不卡在线观看| 91在线国产福利| 国产日韩三级在线| 久久99蜜桃精品| 欧美日韩国产大片| 亚洲午夜久久久| 在线亚洲一区二区| 国产精品伦一区| 国产不卡高清在线观看视频| 精品久久人人做人人爽| 日本成人在线视频网站| 欧美男人的天堂一二区| 亚洲一级在线观看| 99在线视频精品| 国产精品色在线观看| 国产mv日韩mv欧美| 国产免费久久精品| 国产精品18久久久| 欧美国产一区视频在线观看| 国产综合色产在线精品| 精品日韩99亚洲| 久久精品国产网站| 日韩精品综合一本久道在线视频| 婷婷综合久久一区二区三区| 欧美精品aⅴ在线视频| 亚洲电影欧美电影有声小说| 欧美丝袜第三区|