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

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

?? where.c

?? 新版輕量級嵌入式數據庫
?? C
?? 第 1 頁 / 共 5 頁
字號:
/*** 2001 September 15**** The author disclaims copyright to this source code.  In place of** a legal notice, here is a blessing:****    May you do good and not evil.**    May you find forgiveness for yourself and forgive others.**    May you share freely, never taking more than you give.***************************************************************************** This module contains C code that generates VDBE code used to process** the WHERE clause of SQL statements.  This module is reponsible for** generating the code that loops through a table looking for applicable** rows.  Indices are selected and used to speed the search when doing** so is applicable.  Because this module is responsible for selecting** indices, you might also think of this module as the "query optimizer".**** $Id: where.c,v 1.206 2006/03/28 23:55:58 drh Exp $*/#include "sqliteInt.h"/*** The number of bits in a Bitmask.  "BMS" means "BitMask Size".*/#define BMS  (sizeof(Bitmask)*8)/*** Determine the number of elements in an array.*/#define ARRAYSIZE(X)  (sizeof(X)/sizeof(X[0]))/*** Trace output macros*/#if defined(SQLITE_TEST) || defined(SQLITE_DEBUG)int sqlite3_where_trace = 0;# define TRACE(X)  if(sqlite3_where_trace) sqlite3DebugPrintf X#else# define TRACE(X)#endif/* Forward reference*/typedef struct WhereClause WhereClause;/*** The query generator uses an array of instances of this structure to** help it analyze the subexpressions of the WHERE clause.  Each WHERE** clause subexpression is separated from the others by an AND operator.**** All WhereTerms are collected into a single WhereClause structure.  ** The following identity holds:****        WhereTerm.pWC->a[WhereTerm.idx] == WhereTerm**** When a term is of the form:****              X <op> <expr>**** where X is a column name and <op> is one of certain operators,** then WhereTerm.leftCursor and WhereTerm.leftColumn record the** cursor number and column number for X.  WhereTerm.operator records** the <op> using a bitmask encoding defined by WO_xxx below.  The** use of a bitmask encoding for the operator allows us to search** quickly for terms that match any of several different operators.**** prereqRight and prereqAll record sets of cursor numbers,** but they do so indirectly.  A single ExprMaskSet structure translates** cursor number into bits and the translated bit is stored in the prereq** fields.  The translation is used in order to maximize the number of** bits that will fit in a Bitmask.  The VDBE cursor numbers might be** spread out over the non-negative integers.  For example, the cursor** numbers might be 3, 8, 9, 10, 20, 23, 41, and 45.  The ExprMaskSet** translates these sparse cursor numbers into consecutive integers** beginning with 0 in order to make the best possible use of the available** bits in the Bitmask.  So, in the example above, the cursor numbers** would be mapped into integers 0 through 7.*/typedef struct WhereTerm WhereTerm;struct WhereTerm {  Expr *pExpr;            /* Pointer to the subexpression */  i16 iParent;            /* Disable pWC->a[iParent] when this term disabled */  i16 leftCursor;         /* Cursor number of X in "X <op> <expr>" */  i16 leftColumn;         /* Column number of X in "X <op> <expr>" */  u16 eOperator;          /* A WO_xx value describing <op> */  u8 flags;               /* Bit flags.  See below */  u8 nChild;              /* Number of children that must disable us */  WhereClause *pWC;       /* The clause this term is part of */  Bitmask prereqRight;    /* Bitmask of tables used by pRight */  Bitmask prereqAll;      /* Bitmask of tables referenced by p */};/*** Allowed values of WhereTerm.flags*/#define TERM_DYNAMIC    0x01   /* Need to call sqlite3ExprDelete(pExpr) */#define TERM_VIRTUAL    0x02   /* Added by the optimizer.  Do not code */#define TERM_CODED      0x04   /* This term is already coded */#define TERM_COPIED     0x08   /* Has a child */#define TERM_OR_OK      0x10   /* Used during OR-clause processing *//*** An instance of the following structure holds all information about a** WHERE clause.  Mostly this is a container for one or more WhereTerms.*/struct WhereClause {  Parse *pParse;           /* The parser context */  int nTerm;               /* Number of terms */  int nSlot;               /* Number of entries in a[] */  WhereTerm *a;            /* Each a[] describes a term of the WHERE cluase */  WhereTerm aStatic[10];   /* Initial static space for a[] */};/*** An instance of the following structure keeps track of a mapping** between VDBE cursor numbers and bits of the bitmasks in WhereTerm.**** The VDBE cursor numbers are small integers contained in ** SrcList_item.iCursor and Expr.iTable fields.  For any given WHERE ** clause, the cursor numbers might not begin with 0 and they might** contain gaps in the numbering sequence.  But we want to make maximum** use of the bits in our bitmasks.  This structure provides a mapping** from the sparse cursor numbers into consecutive integers beginning** with 0.**** If ExprMaskSet.ix[A]==B it means that The A-th bit of a Bitmask** corresponds VDBE cursor number B.  The A-th bit of a bitmask is 1<<A.**** For example, if the WHERE clause expression used these VDBE** cursors:  4, 5, 8, 29, 57, 73.  Then the  ExprMaskSet structure** would map those cursor numbers into bits 0 through 5.**** Note that the mapping is not necessarily ordered.  In the example** above, the mapping might go like this:  4->3, 5->1, 8->2, 29->0,** 57->5, 73->4.  Or one of 719 other combinations might be used. It** does not really matter.  What is important is that sparse cursor** numbers all get mapped into bit numbers that begin with 0 and contain** no gaps.*/typedef struct ExprMaskSet ExprMaskSet;struct ExprMaskSet {  int n;                        /* Number of assigned cursor values */  int ix[sizeof(Bitmask)*8];    /* Cursor assigned to each bit */};/*** Bitmasks for the operators that indices are able to exploit.  An** OR-ed combination of these values can be used when searching for** terms in the where clause.*/#define WO_IN     1#define WO_EQ     2#define WO_LT     (WO_EQ<<(TK_LT-TK_EQ))#define WO_LE     (WO_EQ<<(TK_LE-TK_EQ))#define WO_GT     (WO_EQ<<(TK_GT-TK_EQ))#define WO_GE     (WO_EQ<<(TK_GE-TK_EQ))/*** Value for flags returned by bestIndex()*/#define WHERE_ROWID_EQ       0x0001   /* rowid=EXPR or rowid IN (...) */#define WHERE_ROWID_RANGE    0x0002   /* rowid<EXPR and/or rowid>EXPR */#define WHERE_COLUMN_EQ      0x0010   /* x=EXPR or x IN (...) */#define WHERE_COLUMN_RANGE   0x0020   /* x<EXPR and/or x>EXPR */#define WHERE_COLUMN_IN      0x0040   /* x IN (...) */#define WHERE_TOP_LIMIT      0x0100   /* x<EXPR or x<=EXPR constraint */#define WHERE_BTM_LIMIT      0x0200   /* x>EXPR or x>=EXPR constraint */#define WHERE_IDX_ONLY       0x0800   /* Use index only - omit table */#define WHERE_ORDERBY        0x1000   /* Output will appear in correct order */#define WHERE_REVERSE        0x2000   /* Scan in reverse order */#define WHERE_UNIQUE         0x4000   /* Selects no more than one row *//*** Initialize a preallocated WhereClause structure.*/static void whereClauseInit(WhereClause *pWC, Parse *pParse){  pWC->pParse = pParse;  pWC->nTerm = 0;  pWC->nSlot = ARRAYSIZE(pWC->aStatic);  pWC->a = pWC->aStatic;}/*** Deallocate a WhereClause structure.  The WhereClause structure** itself is not freed.  This routine is the inverse of whereClauseInit().*/static void whereClauseClear(WhereClause *pWC){  int i;  WhereTerm *a;  for(i=pWC->nTerm-1, a=pWC->a; i>=0; i--, a++){    if( a->flags & TERM_DYNAMIC ){      sqlite3ExprDelete(a->pExpr);    }  }  if( pWC->a!=pWC->aStatic ){    sqliteFree(pWC->a);  }}/*** Add a new entries to the WhereClause structure.  Increase the allocated** space as necessary.**** WARNING:  This routine might reallocate the space used to store** WhereTerms.  All pointers to WhereTerms should be invalided after** calling this routine.  Such pointers may be reinitialized by referencing** the pWC->a[] array.*/static int whereClauseInsert(WhereClause *pWC, Expr *p, int flags){  WhereTerm *pTerm;  int idx;  if( pWC->nTerm>=pWC->nSlot ){    WhereTerm *pOld = pWC->a;    pWC->a = sqliteMalloc( sizeof(pWC->a[0])*pWC->nSlot*2 );    if( pWC->a==0 ) return 0;    memcpy(pWC->a, pOld, sizeof(pWC->a[0])*pWC->nTerm);    if( pOld!=pWC->aStatic ){      sqliteFree(pOld);    }    pWC->nSlot *= 2;  }  pTerm = &pWC->a[idx = pWC->nTerm];  pWC->nTerm++;  pTerm->pExpr = p;  pTerm->flags = flags;  pTerm->pWC = pWC;  pTerm->iParent = -1;  return idx;}/*** This routine identifies subexpressions in the WHERE clause where** each subexpression is separated by the AND operator or some other** operator specified in the op parameter.  The WhereClause structure** is filled with pointers to subexpressions.  For example:****    WHERE  a=='hello' AND coalesce(b,11)<10 AND (c+12!=d OR c==22)**           \________/     \_______________/     \________________/**            slot[0]            slot[1]               slot[2]**** The original WHERE clause in pExpr is unaltered.  All this routine** does is make slot[] entries point to substructure within pExpr.**** In the previous sentence and in the diagram, "slot[]" refers to** the WhereClause.a[] array.  This array grows as needed to contain** all terms of the WHERE clause.*/static void whereSplit(WhereClause *pWC, Expr *pExpr, int op){  if( pExpr==0 ) return;  if( pExpr->op!=op ){    whereClauseInsert(pWC, pExpr, 0);  }else{    whereSplit(pWC, pExpr->pLeft, op);    whereSplit(pWC, pExpr->pRight, op);  }}/*** Initialize an expression mask set*/#define initMaskSet(P)  memset(P, 0, sizeof(*P))/*** Return the bitmask for the given cursor number.  Return 0 if** iCursor is not in the set.*/static Bitmask getMask(ExprMaskSet *pMaskSet, int iCursor){  int i;  for(i=0; i<pMaskSet->n; i++){    if( pMaskSet->ix[i]==iCursor ){      return ((Bitmask)1)<<i;    }  }  return 0;}/*** Create a new mask for cursor iCursor.**** There is one cursor per table in the FROM clause.  The number of** tables in the FROM clause is limited by a test early in the** sqlite3WhereBegin() routine.  So we know that the pMaskSet->ix[]** array will never overflow.*/static void createMask(ExprMaskSet *pMaskSet, int iCursor){  assert( pMaskSet->n < ARRAYSIZE(pMaskSet->ix) );  pMaskSet->ix[pMaskSet->n++] = iCursor;}/*** This routine walks (recursively) an expression tree and generates** a bitmask indicating which tables are used in that expression** tree.**** In order for this routine to work, the calling function must have** previously invoked sqlite3ExprResolveNames() on the expression.  See** the header comment on that routine for additional information.** The sqlite3ExprResolveNames() routines looks for column names and** sets their opcodes to TK_COLUMN and their Expr.iTable fields to** the VDBE cursor number of the table.  This routine just has to** translate the cursor numbers into bitmask values and OR all** the bitmasks together.*/static Bitmask exprListTableUsage(ExprMaskSet*, ExprList*);static Bitmask exprSelectTableUsage(ExprMaskSet*, Select*);static Bitmask exprTableUsage(ExprMaskSet *pMaskSet, Expr *p){  Bitmask mask = 0;  if( p==0 ) return 0;  if( p->op==TK_COLUMN ){    mask = getMask(pMaskSet, p->iTable);    return mask;  }  mask = exprTableUsage(pMaskSet, p->pRight);  mask |= exprTableUsage(pMaskSet, p->pLeft);  mask |= exprListTableUsage(pMaskSet, p->pList);  mask |= exprSelectTableUsage(pMaskSet, p->pSelect);  return mask;}static Bitmask exprListTableUsage(ExprMaskSet *pMaskSet, ExprList *pList){  int i;  Bitmask mask = 0;  if( pList ){    for(i=0; i<pList->nExpr; i++){      mask |= exprTableUsage(pMaskSet, pList->a[i].pExpr);    }  }  return mask;}static Bitmask exprSelectTableUsage(ExprMaskSet *pMaskSet, Select *pS){  Bitmask mask;  if( pS==0 ){    mask = 0;  }else{    mask = exprListTableUsage(pMaskSet, pS->pEList);    mask |= exprListTableUsage(pMaskSet, pS->pGroupBy);    mask |= exprListTableUsage(pMaskSet, pS->pOrderBy);    mask |= exprTableUsage(pMaskSet, pS->pWhere);    mask |= exprTableUsage(pMaskSet, pS->pHaving);  }  return mask;}/*** Return TRUE if the given operator is one of the operators that is** allowed for an indexable WHERE clause term.  The allowed operators are** "=", "<", ">", "<=", ">=", and "IN".*/static int allowedOp(int op){  assert( TK_GT>TK_EQ && TK_GT<TK_GE );  assert( TK_LT>TK_EQ && TK_LT<TK_GE );  assert( TK_LE>TK_EQ && TK_LE<TK_GE );  assert( TK_GE==TK_EQ+4 );  return op==TK_IN || (op>=TK_EQ && op<=TK_GE);}/*** Swap two objects of type T.*/#define SWAP(TYPE,A,B) {TYPE t=A; A=B; B=t;}/*** Commute a comparision operator.  Expressions of the form "X op Y"** are converted into "Y op X".*/static void exprCommute(Expr *pExpr){  assert( allowedOp(pExpr->op) && pExpr->op!=TK_IN );

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
极品少妇xxxx精品少妇| 国产美女av一区二区三区| 久久综合色婷婷| 欧美日韩在线不卡| 风间由美性色一区二区三区| 丝袜美腿亚洲一区二区图片| 一区在线观看免费| 精品福利二区三区| 欧美色中文字幕| a美女胸又www黄视频久久| 久久国产精品色婷婷| 亚洲大片免费看| 国产精品的网站| 久久精品欧美一区二区三区不卡 | 国产成人鲁色资源国产91色综| 午夜精品国产更新| 尤物在线观看一区| 国产精品久久久久久久第一福利| 精品欧美一区二区在线观看| 欧美性猛交xxxx乱大交退制版| 国产98色在线|日韩| 久草中文综合在线| 日韩高清在线电影| 亚洲一级二级在线| 一区二区三区日韩欧美精品| 国产精品乱码妇女bbbb| 国产人久久人人人人爽| 精品国产一区二区三区忘忧草 | 久久久亚洲精华液精华液精华液| 欧美一区二区在线观看| 欧美三级视频在线| 欧美吞精做爰啪啪高潮| 91麻豆精品一区二区三区| 成人三级在线视频| 成人精品视频一区| 成人精品gif动图一区| 成人国产亚洲欧美成人综合网| 久久爱www久久做| 国模冰冰炮一区二区| 国模冰冰炮一区二区| 国产一区二三区| 国产福利一区二区三区视频 | 国产午夜精品在线观看| 国产日韩成人精品| 中文字幕在线观看不卡| 亚洲欧洲一区二区在线播放| 国产精品女同互慰在线看| 国产精品色婷婷久久58| 亚洲欧美怡红院| 亚洲精品视频一区| 一区二区在线观看av| 亚洲线精品一区二区三区八戒| 亚洲成人激情自拍| 久国产精品韩国三级视频| 狠狠色综合日日| 国产成人av影院| 91麻豆国产香蕉久久精品| 欧美日韩一区 二区 三区 久久精品| 欧美日韩色一区| 精品国产乱码久久久久久浪潮 | 视频在线在亚洲| 久久综合综合久久综合| 国产精品羞羞答答xxdd| 91视频国产观看| 欧美日韩免费在线视频| 日韩欧美一二三区| 国产精品拍天天在线| 一区二区三区四区高清精品免费观看 | 欧美色综合网站| 日韩欧美综合在线| 国产精品欧美综合在线| 香蕉成人啪国产精品视频综合网| 精品一二线国产| 91片在线免费观看| 日韩美女视频在线| 国产精品传媒在线| 日韩高清不卡在线| 成人一级片网址| 欧美日韩在线不卡| 国产欧美一区二区精品久导航 | 99re8在线精品视频免费播放| 欧美日韩三级在线| 国产视频亚洲色图| 午夜久久福利影院| 成人网在线播放| 在线电影院国产精品| 国产精品欧美经典| 久久精品国产77777蜜臀| 99在线精品免费| 欧美变态口味重另类| 亚洲特黄一级片| 蜜臀久久久久久久| 91久久久免费一区二区| 国产亚洲视频系列| 蜜臀av一区二区三区| 色综合天天做天天爱| 久久亚洲精品小早川怜子| 亚洲国产裸拍裸体视频在线观看乱了| 国产精品一区2区| 欧美精品一卡二卡| 亚洲欧洲精品一区二区精品久久久| 蜜臂av日日欢夜夜爽一区| 在线影视一区二区三区| 国产亚洲一本大道中文在线| 丝袜美腿亚洲综合| 色视频欧美一区二区三区| 国产香蕉久久精品综合网| 日本特黄久久久高潮| 在线观看日韩精品| 日韩美女久久久| 国产91清纯白嫩初高中在线观看| 日韩欧美视频一区| 首页综合国产亚洲丝袜| 在线亚洲+欧美+日本专区| 国产精品网站在线观看| 国产一区二区三区蝌蚪| 欧美一区二区三级| 天天综合色天天综合色h| 91成人在线精品| 亚洲色欲色欲www在线观看| 高清免费成人av| 久久综合色天天久久综合图片| 男人的天堂亚洲一区| 在线91免费看| 午夜av一区二区三区| 欧美日韩综合在线免费观看| 一区二区三区四区在线| 色偷偷久久一区二区三区| 日韩久久一区二区| av一区二区三区四区| 中文字幕免费在线观看视频一区| 国产精品综合久久| 久久网站最新地址| 国产福利精品一区二区| 久久久久久综合| 国产91丝袜在线18| 国产欧美一区二区精品久导航| 国产精品1024| 国产精品美女久久福利网站| www.综合网.com| 亚洲免费在线电影| 欧美性大战久久久| 午夜精品久久久久影视| 91精品国产欧美日韩| 久久99国内精品| 久久久噜噜噜久久中文字幕色伊伊 | 国产精品久久久久婷婷二区次| 丁香天五香天堂综合| 国产精品久久久久影院老司 | 国内精品嫩模私拍在线| 久久久久国产精品免费免费搜索| 国产成人精品在线看| |精品福利一区二区三区| 在线中文字幕一区二区| 日韩精品一级中文字幕精品视频免费观看 | 精品奇米国产一区二区三区| 国产精品一区二区在线观看网站| 国产精品伦一区二区三级视频| 99久久精品国产一区二区三区| 一区二区三区日韩精品| 欧美一区二区在线播放| 国产在线麻豆精品观看| 亚洲视频在线观看一区| 欧美日韩一区久久| 国产在线麻豆精品观看| 自拍偷拍国产亚洲| 日韩一区二区在线看| 国产成人av一区二区三区在线| 亚洲人成小说网站色在线| 91精品婷婷国产综合久久性色 | 国产一区二区导航在线播放| 中文字幕在线观看不卡| 欧美日韩久久一区| 高清国产一区二区三区| 亚洲综合激情另类小说区| 26uuu亚洲综合色| 色综合天天视频在线观看| 喷水一区二区三区| 中文字幕va一区二区三区| 欧美日韩国产中文| 成人黄色在线看| 美女尤物国产一区| 亚洲天堂av老司机| 欧美岛国在线观看| 色视频一区二区| 国产一区91精品张津瑜| 一二三四区精品视频| 久久免费视频色| 欧美精品国产精品| 91亚洲精华国产精华精华液| 美女视频网站黄色亚洲| 一区二区三区日韩欧美| 国产亚洲精品精华液| 欧美精品久久久久久久多人混战 | 成人av在线播放网址| 日本aⅴ免费视频一区二区三区| 中文字幕一区二区三区在线不卡| 欧美一区二区三区日韩| 色妞www精品视频| 懂色av中文一区二区三区 |