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

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

?? analyze.c

?? 新版輕量級嵌入式數據庫
?? C
字號:
/*** 2005 July 8**** 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 file contains code associated with the ANALYZE command.**** @(#) $Id: analyze.c,v 1.16 2006/01/10 17:58:23 danielk1977 Exp $*/#ifndef SQLITE_OMIT_ANALYZE#include "sqliteInt.h"/*** This routine generates code that opens the sqlite_stat1 table on cursor** iStatCur.**** If the sqlite_stat1 tables does not previously exist, it is created.** If it does previously exist, all entires associated with table zWhere** are removed.  If zWhere==0 then all entries are removed.*/static void openStatTable(  Parse *pParse,          /* Parsing context */  int iDb,                /* The database we are looking in */  int iStatCur,           /* Open the sqlite_stat1 table on this cursor */  const char *zWhere      /* Delete entries associated with this table */){  sqlite3 *db = pParse->db;  Db *pDb;  int iRootPage;  Table *pStat;  Vdbe *v = sqlite3GetVdbe(pParse);  pDb = &db->aDb[iDb];  if( (pStat = sqlite3FindTable(db, "sqlite_stat1", pDb->zName))==0 ){    /* The sqlite_stat1 tables does not exist.  Create it.      ** Note that a side-effect of the CREATE TABLE statement is to leave    ** the rootpage of the new table on the top of the stack.  This is    ** important because the OpenWrite opcode below will be needing it. */    sqlite3NestedParse(pParse,      "CREATE TABLE %Q.sqlite_stat1(tbl,idx,stat)",      pDb->zName    );    iRootPage = 0;  /* Cause rootpage to be taken from top of stack */  }else if( zWhere ){    /* The sqlite_stat1 table exists.  Delete all entries associated with    ** the table zWhere. */    sqlite3NestedParse(pParse,       "DELETE FROM %Q.sqlite_stat1 WHERE tbl=%Q",       pDb->zName, zWhere    );    iRootPage = pStat->tnum;  }else{    /* The sqlite_stat1 table already exists.  Delete all rows. */    iRootPage = pStat->tnum;    sqlite3VdbeAddOp(v, OP_Clear, pStat->tnum, iDb);  }  /* Open the sqlite_stat1 table for writing. Unless it was created  ** by this vdbe program, lock it for writing at the shared-cache level.   ** If this vdbe did create the sqlite_stat1 table, then it must have   ** already obtained a schema-lock, making the write-lock redundant.  */  if( iRootPage>0 ){    sqlite3TableLock(pParse, iDb, iRootPage, 1, "sqlite_stat1");  }  sqlite3VdbeAddOp(v, OP_Integer, iDb, 0);  sqlite3VdbeAddOp(v, OP_OpenWrite, iStatCur, iRootPage);  sqlite3VdbeAddOp(v, OP_SetNumColumns, iStatCur, 3);}/*** Generate code to do an analysis of all indices associated with** a single table.*/static void analyzeOneTable(  Parse *pParse,   /* Parser context */  Table *pTab,     /* Table whose indices are to be analyzed */  int iStatCur,    /* Cursor that writes to the sqlite_stat1 table */  int iMem         /* Available memory locations begin here */){  Index *pIdx;     /* An index to being analyzed */  int iIdxCur;     /* Cursor number for index being analyzed */  int nCol;        /* Number of columns in the index */  Vdbe *v;         /* The virtual machine being built up */  int i;           /* Loop counter */  int topOfLoop;   /* The top of the loop */  int endOfLoop;   /* The end of the loop */  int addr;        /* The address of an instruction */  int iDb;         /* Index of database containing pTab */  v = sqlite3GetVdbe(pParse);  if( pTab==0 || pTab->pIndex==0 ){    /* Do no analysis for tables that have no indices */    return;  }  iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);  assert( iDb>=0 );#ifndef SQLITE_OMIT_AUTHORIZATION  if( sqlite3AuthCheck(pParse, SQLITE_ANALYZE, pTab->zName, 0,      pParse->db->aDb[iDb].zName ) ){    return;  }#endif  /* Establish a read-lock on the table at the shared-cache level. */  sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName);  iIdxCur = pParse->nTab;  for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){    KeyInfo *pKey = sqlite3IndexKeyinfo(pParse, pIdx);    /* Open a cursor to the index to be analyzed    */    assert( iDb==sqlite3SchemaToIndex(pParse->db, pIdx->pSchema) );    sqlite3VdbeAddOp(v, OP_Integer, iDb, 0);    VdbeComment((v, "# %s", pIdx->zName));    sqlite3VdbeOp3(v, OP_OpenRead, iIdxCur, pIdx->tnum,        (char *)pKey, P3_KEYINFO_HANDOFF);    nCol = pIdx->nColumn;    if( iMem+nCol*2>=pParse->nMem ){      pParse->nMem = iMem+nCol*2+1;    }    sqlite3VdbeAddOp(v, OP_SetNumColumns, iIdxCur, nCol+1);    /* Memory cells are used as follows:    **    **    mem[iMem]:             The total number of rows in the table.    **    mem[iMem+1]:           Number of distinct values in column 1    **    ...    **    mem[iMem+nCol]:        Number of distinct values in column N    **    mem[iMem+nCol+1]       Last observed value of column 1    **    ...    **    mem[iMem+nCol+nCol]:   Last observed value of column N    **    ** Cells iMem through iMem+nCol are initialized to 0.  The others    ** are initialized to NULL.    */    for(i=0; i<=nCol; i++){      sqlite3VdbeAddOp(v, OP_MemInt, 0, iMem+i);    }    for(i=0; i<nCol; i++){      sqlite3VdbeAddOp(v, OP_MemNull, iMem+nCol+i+1, 0);    }    /* Do the analysis.    */    endOfLoop = sqlite3VdbeMakeLabel(v);    sqlite3VdbeAddOp(v, OP_Rewind, iIdxCur, endOfLoop);    topOfLoop = sqlite3VdbeCurrentAddr(v);    sqlite3VdbeAddOp(v, OP_MemIncr, 1, iMem);    for(i=0; i<nCol; i++){      sqlite3VdbeAddOp(v, OP_Column, iIdxCur, i);      sqlite3VdbeAddOp(v, OP_MemLoad, iMem+nCol+i+1, 0);      sqlite3VdbeAddOp(v, OP_Ne, 0x100, 0);    }    sqlite3VdbeAddOp(v, OP_Goto, 0, endOfLoop);    for(i=0; i<nCol; i++){      addr = sqlite3VdbeAddOp(v, OP_MemIncr, 1, iMem+i+1);      sqlite3VdbeChangeP2(v, topOfLoop + 3*i + 3, addr);      sqlite3VdbeAddOp(v, OP_Column, iIdxCur, i);      sqlite3VdbeAddOp(v, OP_MemStore, iMem+nCol+i+1, 1);    }    sqlite3VdbeResolveLabel(v, endOfLoop);    sqlite3VdbeAddOp(v, OP_Next, iIdxCur, topOfLoop);    sqlite3VdbeAddOp(v, OP_Close, iIdxCur, 0);    /* Store the results.      **    ** The result is a single row of the sqlite_stmt1 table.  The first    ** two columns are the names of the table and index.  The third column    ** is a string composed of a list of integer statistics about the    ** index.  The first integer in the list is the total number of entires    ** in the index.  There is one additional integer in the list for each    ** column of the table.  This additional integer is a guess of how many    ** rows of the table the index will select.  If D is the count of distinct    ** values and K is the total number of rows, then the integer is computed    ** as:    **    **        I = (K+D-1)/D    **    ** If K==0 then no entry is made into the sqlite_stat1 table.      ** If K>0 then it is always the case the D>0 so division by zero    ** is never possible.    */    sqlite3VdbeAddOp(v, OP_MemLoad, iMem, 0);    addr = sqlite3VdbeAddOp(v, OP_IfNot, 0, 0);    sqlite3VdbeAddOp(v, OP_NewRowid, iStatCur, 0);    sqlite3VdbeOp3(v, OP_String8, 0, 0, pTab->zName, 0);    sqlite3VdbeOp3(v, OP_String8, 0, 0, pIdx->zName, 0);    sqlite3VdbeAddOp(v, OP_MemLoad, iMem, 0);    sqlite3VdbeOp3(v, OP_String8, 0, 0, " ", 0);    for(i=0; i<nCol; i++){      sqlite3VdbeAddOp(v, OP_MemLoad, iMem, 0);      sqlite3VdbeAddOp(v, OP_MemLoad, iMem+i+1, 0);      sqlite3VdbeAddOp(v, OP_Add, 0, 0);      sqlite3VdbeAddOp(v, OP_AddImm, -1, 0);      sqlite3VdbeAddOp(v, OP_MemLoad, iMem+i+1, 0);      sqlite3VdbeAddOp(v, OP_Divide, 0, 0);      sqlite3VdbeAddOp(v, OP_ToInt, 0, 0);      if( i==nCol-1 ){        sqlite3VdbeAddOp(v, OP_Concat, nCol*2-1, 0);      }else{        sqlite3VdbeAddOp(v, OP_Dup, 1, 0);      }    }    sqlite3VdbeOp3(v, OP_MakeRecord, 3, 0, "aaa", 0);    sqlite3VdbeAddOp(v, OP_Insert, iStatCur, 0);    sqlite3VdbeJumpHere(v, addr);  }}/*** Generate code that will cause the most recent index analysis to** be laoded into internal hash tables where is can be used.*/static void loadAnalysis(Parse *pParse, int iDb){  Vdbe *v = sqlite3GetVdbe(pParse);  sqlite3VdbeAddOp(v, OP_LoadAnalysis, iDb, 0);}/*** Generate code that will do an analysis of an entire database*/static void analyzeDatabase(Parse *pParse, int iDb){  sqlite3 *db = pParse->db;  Schema *pSchema = db->aDb[iDb].pSchema;    /* Schema of database iDb */  HashElem *k;  int iStatCur;  int iMem;  sqlite3BeginWriteOperation(pParse, 0, iDb);  iStatCur = pParse->nTab++;  openStatTable(pParse, iDb, iStatCur, 0);  iMem = pParse->nMem;  for(k=sqliteHashFirst(&pSchema->tblHash); k; k=sqliteHashNext(k)){    Table *pTab = (Table*)sqliteHashData(k);    analyzeOneTable(pParse, pTab, iStatCur, iMem);  }  loadAnalysis(pParse, iDb);}/*** Generate code that will do an analysis of a single table in** a database.*/static void analyzeTable(Parse *pParse, Table *pTab){  int iDb;  int iStatCur;  assert( pTab!=0 );  iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);  sqlite3BeginWriteOperation(pParse, 0, iDb);  iStatCur = pParse->nTab++;  openStatTable(pParse, iDb, iStatCur, pTab->zName);  analyzeOneTable(pParse, pTab, iStatCur, pParse->nMem);  loadAnalysis(pParse, iDb);}/*** Generate code for the ANALYZE command.  The parser calls this routine** when it recognizes an ANALYZE command.****        ANALYZE                            -- 1**        ANALYZE  <database>                -- 2**        ANALYZE  ?<database>.?<tablename>  -- 3**** Form 1 causes all indices in all attached databases to be analyzed.** Form 2 analyzes all indices the single database named.** Form 3 analyzes all indices associated with the named table.*/void sqlite3Analyze(Parse *pParse, Token *pName1, Token *pName2){  sqlite3 *db = pParse->db;  int iDb;  int i;  char *z, *zDb;  Table *pTab;  Token *pTableName;  /* Read the database schema. If an error occurs, leave an error message  ** and code in pParse and return NULL. */  if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){    return;  }  if( pName1==0 ){    /* Form 1:  Analyze everything */    for(i=0; i<db->nDb; i++){      if( i==1 ) continue;  /* Do not analyze the TEMP database */      analyzeDatabase(pParse, i);    }  }else if( pName2==0 || pName2->n==0 ){    /* Form 2:  Analyze the database or table named */    iDb = sqlite3FindDb(db, pName1);    if( iDb>=0 ){      analyzeDatabase(pParse, iDb);    }else{      z = sqlite3NameFromToken(pName1);      pTab = sqlite3LocateTable(pParse, z, 0);      sqliteFree(z);      if( pTab ){        analyzeTable(pParse, pTab);      }    }  }else{    /* Form 3: Analyze the fully qualified table name */    iDb = sqlite3TwoPartName(pParse, pName1, pName2, &pTableName);    if( iDb>=0 ){      zDb = db->aDb[iDb].zName;      z = sqlite3NameFromToken(pTableName);      pTab = sqlite3LocateTable(pParse, z, zDb);      sqliteFree(z);      if( pTab ){        analyzeTable(pParse, pTab);      }    }     }}/*** Used to pass information from the analyzer reader through to the** callback routine.*/typedef struct analysisInfo analysisInfo;struct analysisInfo {  sqlite3 *db;  const char *zDatabase;};/*** This callback is invoked once for each index when reading the** sqlite_stat1 table.  ****     argv[0] = name of the index**     argv[1] = results of analysis - on integer for each column*/static int analysisLoader(void *pData, int argc, char **argv, char **azNotUsed){  analysisInfo *pInfo = (analysisInfo*)pData;  Index *pIndex;  int i, c;  unsigned int v;  const char *z;  assert( argc==2 );  if( argv==0 || argv[0]==0 || argv[1]==0 ){    return 0;  }  pIndex = sqlite3FindIndex(pInfo->db, argv[0], pInfo->zDatabase);  if( pIndex==0 ){    return 0;  }  z = argv[1];  for(i=0; *z && i<=pIndex->nColumn; i++){    v = 0;    while( (c=z[0])>='0' && c<='9' ){      v = v*10 + c - '0';      z++;    }    pIndex->aiRowEst[i] = v;    if( *z==' ' ) z++;  }  return 0;}/*** Load the content of the sqlite_stat1 table into the index hash tables.*/void sqlite3AnalysisLoad(sqlite3 *db, int iDb){  analysisInfo sInfo;  HashElem *i;  char *zSql;  /* Clear any prior statistics */  for(i=sqliteHashFirst(&db->aDb[iDb].pSchema->idxHash);i;i=sqliteHashNext(i)){    Index *pIdx = sqliteHashData(i);    sqlite3DefaultRowEst(pIdx);  }  /* Check to make sure the sqlite_stat1 table existss */  sInfo.db = db;  sInfo.zDatabase = db->aDb[iDb].zName;  if( sqlite3FindTable(db, "sqlite_stat1", sInfo.zDatabase)==0 ){     return;  }  /* Load new statistics out of the sqlite_stat1 table */  zSql = sqlite3MPrintf("SELECT idx, stat FROM %Q.sqlite_stat1",                        sInfo.zDatabase);  sqlite3SafetyOff(db);  sqlite3_exec(db, zSql, analysisLoader, &sInfo, 0);  sqlite3SafetyOn(db);  sqliteFree(zSql);}#endif /* SQLITE_OMIT_ANALYZE */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91农村精品一区二区在线| 国产精品免费视频一区| 97se亚洲国产综合自在线观| 国产一区二区不卡| 免费亚洲电影在线| 麻豆一区二区三区| 免播放器亚洲一区| 久久不见久久见免费视频1| 日本视频中文字幕一区二区三区| 激情久久五月天| 日本丰满少妇一区二区三区| 91麻豆蜜桃一区二区三区| 99视频一区二区| 99国内精品久久| 在线视频国内一区二区| 91论坛在线播放| 欧美一a一片一级一片| 6080日韩午夜伦伦午夜伦| 欧美高清视频一二三区| 精品日本一线二线三线不卡| 久久久精品国产免大香伊| 国产精品毛片无遮挡高清| 一区二区三区成人在线视频| 亚洲国产精品久久人人爱| 日韩黄色一级片| 国产宾馆实践打屁股91| 色综合久久88色综合天天免费| 欧美日韩一区成人| 久久久影院官网| 亚洲欧美日韩一区二区 | 成a人片国产精品| 91在线码无精品| 日韩一区二区影院| 国产欧美精品一区二区三区四区| 亚洲人亚洲人成电影网站色| 午夜私人影院久久久久| 久久国产精品露脸对白| 91丨九色丨蝌蚪丨老版| 欧美一区二区精品| 国产精品超碰97尤物18| 日韩高清不卡一区| 9色porny自拍视频一区二区| 91麻豆精品国产91久久久久久久久 | 成人丝袜高跟foot| 欧美日韩国产综合视频在线观看| ww久久中文字幕| 亚洲一区二区三区免费视频| 国产综合成人久久大片91| 欧洲精品在线观看| 国产亚洲精久久久久久| 日本sm残虐另类| 91看片淫黄大片一级| 久久久久久久综合色一本| 性久久久久久久久| 99久久综合精品| 2欧美一区二区三区在线观看视频| 成人免费小视频| 国产精品538一区二区在线| 欧美乱妇一区二区三区不卡视频| 亚洲欧洲色图综合| 国产69精品久久久久毛片| 精品噜噜噜噜久久久久久久久试看| 亚洲美女屁股眼交3| 国产aⅴ综合色| 2023国产精品自拍| 另类调教123区| 91精品国产一区二区三区蜜臀 | 日韩一区二区在线观看视频播放| 亚洲欧美在线视频| 国产91色综合久久免费分享| 日韩精品专区在线影院观看| 天天色天天操综合| 欧美日韩免费高清一区色橹橹| 亚洲色图一区二区| av一二三不卡影片| 中文字幕永久在线不卡| av网站免费线看精品| 国产精品天美传媒| av色综合久久天堂av综合| 中文字幕亚洲在| 99国产精品久久久久久久久久久| 国产精品女主播在线观看| 国产99久久久精品| 一区二区中文字幕在线| 91网站最新地址| 一区二区高清在线| 8x8x8国产精品| 久久福利视频一区二区| 中文字幕巨乱亚洲| 91亚洲国产成人精品一区二区三 | 视频一区二区三区入口| 91精品国产综合久久福利软件| 久久草av在线| 中文字幕中文在线不卡住| 在线精品国精品国产尤物884a| 亚洲小说欧美激情另类| 在线成人高清不卡| 久久97超碰国产精品超碰| 久久久99精品免费观看不卡| 成人性生交大片免费看中文 | 日本黄色一区二区| 丝袜诱惑亚洲看片| 久久综合色婷婷| 不卡av在线网| 视频在线观看一区二区三区| 欧美sm极限捆绑bd| 91同城在线观看| 三级久久三级久久久| 国产欧美中文在线| 欧美日韩在线精品一区二区三区激情| 免费高清视频精品| 国产精品久久一级| 欧美一区二区成人| 99国产欧美久久久精品| 免费久久99精品国产| 国产精品免费人成网站| 这里只有精品免费| 91网站视频在线观看| 九色综合国产一区二区三区| 国产精品五月天| 日韩欧美色综合| 欧美体内she精高潮| 国产精品伊人色| 亚洲国产cao| 国产精品美女久久久久久2018| 这里只有精品视频在线观看| 国产精品美女久久久久久久网站| 一区二区三区在线看| 欧美老肥妇做.爰bbww视频| 一区二区在线电影| 色狠狠色噜噜噜综合网| 国产亚洲欧美中文| 高清久久久久久| 欧美手机在线视频| 国产三级精品在线| 免费久久99精品国产| 日日夜夜一区二区| 国产婷婷精品av在线| 欧美日韩精品一区二区三区蜜桃 | 日本怡春院一区二区| 久久在线免费观看| 激情五月激情综合网| 这里只有精品免费| 看电视剧不卡顿的网站| 7777精品伊人久久久大香线蕉最新版| 日韩一区精品字幕| 在线播放91灌醉迷j高跟美女 | 欧美mv日韩mv| 成人性视频免费网站| 国产精品18久久久| 久久99日本精品| 亚洲激情第一区| 亚洲免费av在线| 亚洲美女在线国产| 欧美va天堂va视频va在线| 韩国精品免费视频| 韩国成人在线视频| 国产美女在线观看一区| 免费久久精品视频| 国产美女久久久久| 麻豆免费看一区二区三区| 日韩精品国产欧美| 日韩二区三区四区| 亚洲五月六月丁香激情| 国产日韩欧美a| 国产精品第五页| 成人欧美一区二区三区1314 | 亚洲精品日韩一| 日韩视频免费观看高清在线视频| 精品亚洲成av人在线观看| 亚洲h动漫在线| 蜜臀久久99精品久久久久久9| 亚洲同性同志一二三专区| 日韩欧美第一区| 久久久不卡网国产精品二区 | 日本不卡的三区四区五区| 国产成人精品aa毛片| 91视频观看视频| 国产亚洲人成网站| 亚洲国产乱码最新视频| 国产精品18久久久久| 国产一区啦啦啦在线观看| 福利一区二区在线观看| 欧美午夜精品免费| 中国av一区二区三区| 亚洲欧洲精品一区二区精品久久久 | 欧美日韩大陆一区二区| 精品美女在线播放| 日韩一区精品视频| 中文文精品字幕一区二区| 自拍偷拍欧美精品| 亚洲成人免费电影| 国产综合色视频| 色综合色狠狠天天综合色| 欧美人与禽zozo性伦| 欧美激情综合五月色丁香小说| 亚洲国产精品久久不卡毛片 | 一区二区中文视频| 久久国产精品第一页| 欧美亚洲综合在线|