亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
宅男在线国产精品| 日精品一区二区| 日韩黄色免费网站| 黄色成人免费在线| 91免费版在线看| 久久综合九色综合97婷婷| 午夜激情综合网| 91亚洲精品久久久蜜桃网站| 久久久www成人免费毛片麻豆 | 91免费在线看| 精品久久人人做人人爱| 亚洲成av人综合在线观看| av中文字幕不卡| 国产欧美日韩另类视频免费观看| 日韩av一区二区三区四区| 日本道精品一区二区三区| 日本一区免费视频| 国产精品综合在线视频| 精品国产一区久久| 免费高清在线视频一区·| 欧美女孩性生活视频| 亚洲一区二区在线观看视频| 粉嫩欧美一区二区三区高清影视| 精品电影一区二区| 麻豆精品蜜桃视频网站| 91精品欧美综合在线观看最新| 亚洲自拍偷拍九九九| 欧美在线播放高清精品| 一区二区三区欧美| 欧美色网站导航| 亚洲久本草在线中文字幕| 99久久久久久| 樱花草国产18久久久久| 欧美性做爰猛烈叫床潮| 亚洲国产精品综合小说图片区| 日本国产一区二区| 午夜精品成人在线视频| 欧美一区二区三区免费大片| 青青草原综合久久大伊人精品优势| 91精品国产综合久久福利| 日本欧美一区二区在线观看| 精品毛片乱码1区2区3区| 国内精品自线一区二区三区视频| 精品国产一区a| 国产精品一区二区男女羞羞无遮挡| 久久这里只有精品6| 国产成人自拍网| 国产精品久久久久久妇女6080| 波多野结衣中文字幕一区二区三区 | 日本女优在线视频一区二区| 欧美一区二区三区喷汁尤物| 激情六月婷婷综合| 欧美经典三级视频一区二区三区| 成人福利在线看| 亚洲国产另类av| 精品久久久久久综合日本欧美| 国产伦理精品不卡| 亚洲色图色小说| 欧美一级夜夜爽| 成人h精品动漫一区二区三区| 亚洲精品第1页| 欧美肥胖老妇做爰| 懂色av噜噜一区二区三区av| 亚洲国产日韩av| 精品日韩欧美一区二区| 粉嫩蜜臀av国产精品网站| 亚洲综合自拍偷拍| 精品福利一二区| 色先锋资源久久综合| 日韩成人免费看| 国产精品萝li| 日韩一区二区免费视频| 成人免费视频一区| 麻豆传媒一区二区三区| 国产精品久久久久久户外露出| 91精品在线免费| 色综合天天狠狠| 精品一区精品二区高清| 亚洲美女视频在线观看| 26uuu久久综合| 欧美日韩电影一区| 成人黄色综合网站| 国精品**一区二区三区在线蜜桃 | 2020国产精品自拍| 在线观看91精品国产入口| 国产一区二区在线影院| 亚洲国产中文字幕在线视频综合| 国产亚洲欧美激情| 欧美一区二区三区小说| 欧美在线一区二区| 91日韩在线专区| 成人国产精品免费网站| 国产精品一区二区果冻传媒| 麻豆精品一二三| 亚洲电影激情视频网站| 亚洲女同女同女同女同女同69| 国产亚洲精品久| 26uuu色噜噜精品一区| 欧美一区二区三区免费视频| 欧美日本乱大交xxxxx| 在线精品视频免费观看| 色域天天综合网| 91免费国产在线| 97久久超碰国产精品| 成人久久久精品乱码一区二区三区| 韩国午夜理伦三级不卡影院| 奇米色777欧美一区二区| 婷婷久久综合九色综合绿巨人 | 国产欧美精品一区| 26uuu精品一区二区三区四区在线 26uuu精品一区二区在线观看 | 国产欧美视频在线观看| 久久久噜噜噜久噜久久综合| 精品精品欲导航| 欧美一区二区成人| 8x福利精品第一导航| 欧美日韩一区二区欧美激情| 日本二三区不卡| 欧美日韩国产欧美日美国产精品| 欧美亚洲国产一区二区三区va| 欧美中文字幕一区二区三区| 成人sese在线| 欧美在线不卡视频| 51午夜精品国产| 日韩精品影音先锋| 国产香蕉久久精品综合网| 国产精品网站一区| 一区二区三区成人| 亚洲123区在线观看| 免费欧美高清视频| 国产白丝网站精品污在线入口| 大胆欧美人体老妇| 色综合久久久网| 欧美剧在线免费观看网站| 精品免费日韩av| 国产精品你懂的| 天天爽夜夜爽夜夜爽精品视频| 老司机午夜精品99久久| 国产91丝袜在线观看| 91国产福利在线| 精品国产电影一区二区| 国产香蕉久久精品综合网| 亚洲男人都懂的| 老鸭窝一区二区久久精品| 成人丝袜视频网| 欧美日韩一区成人| 日韩一区二区在线观看视频播放| 久久久国产综合精品女国产盗摄| 亚洲欧洲在线观看av| 天堂资源在线中文精品| 国产伦精品一区二区三区在线观看| 99麻豆久久久国产精品免费 | 久久久久一区二区三区四区| 亚洲人成7777| 黄页网站大全一区二区| 色国产综合视频| 久久久www成人免费无遮挡大片| 亚洲尤物视频在线| 国产精品一区二区无线| 欧美日韩高清一区二区三区| 国产精品丝袜91| 美女视频网站久久| 欧美午夜电影一区| 欧美国产国产综合| 久草这里只有精品视频| 在线视频一区二区免费| 国产日韩精品视频一区| 日韩国产欧美一区二区三区| 99国产精品久久久久久久久久久| 日韩你懂的在线播放| 亚洲一区在线视频观看| 成人午夜精品在线| 26uuu久久综合| 免费成人在线视频观看| 91福利国产成人精品照片| 国产精品久久久久一区二区三区| 麻豆国产欧美一区二区三区| 欧美色精品在线视频| 亚洲男同性恋视频| 91浏览器在线视频| 中文字幕久久午夜不卡| 日产精品久久久久久久性色| 色婷婷综合久久久久中文一区二区| 久久久噜噜噜久噜久久综合| 秋霞午夜av一区二区三区| 欧美日韩综合一区| 一区二区三区中文字幕精品精品| 成人午夜免费av| 中文字幕av一区 二区| 国产精品乡下勾搭老头1| 精品久久久久久久久久久久久久久 | 成人自拍视频在线| www国产成人| 国产麻豆精品一区二区| 亚洲精品一区二区三区香蕉| 日韩av不卡在线观看| 制服丝袜亚洲播放| 日韩专区中文字幕一区二区| 欧美区一区二区三区| 日韩电影网1区2区| 欧美mv和日韩mv国产网站|