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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? delete.c

?? sqlite庫
?? C
字號:
/*** 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 file contains C code routines that are called by the parser** in order to generate code for DELETE FROM statements.**** $Id: delete.c,v 1.122 2006/02/24 02:53:50 drh Exp $*/#include "sqliteInt.h"/*** Look up every table that is named in pSrc.  If any table is not found,** add an error message to pParse->zErrMsg and return NULL.  If all tables** are found, return a pointer to the last table.*/Table *sqlite3SrcListLookup(Parse *pParse, SrcList *pSrc){  Table *pTab = 0;  int i;  struct SrcList_item *pItem;  for(i=0, pItem=pSrc->a; i<pSrc->nSrc; i++, pItem++){    pTab = sqlite3LocateTable(pParse, pItem->zName, pItem->zDatabase);    sqlite3DeleteTable(pParse->db, pItem->pTab);    pItem->pTab = pTab;    if( pTab ){      pTab->nRef++;    }  }  return pTab;}/*** Check to make sure the given table is writable.  If it is not** writable, generate an error message and return 1.  If it is** writable return 0;*/int sqlite3IsReadOnly(Parse *pParse, Table *pTab, int viewOk){  if( pTab->readOnly && (pParse->db->flags & SQLITE_WriteSchema)==0        && pParse->nested==0 ){    sqlite3ErrorMsg(pParse, "table %s may not be modified", pTab->zName);    return 1;  }#ifndef SQLITE_OMIT_VIEW  if( !viewOk && pTab->pSelect ){    sqlite3ErrorMsg(pParse,"cannot modify %s because it is a view",pTab->zName);    return 1;  }#endif  return 0;}/*** Generate code that will open a table for reading.*/void sqlite3OpenTable(  Parse *p,       /* Generate code into this VDBE */  int iCur,       /* The cursor number of the table */  int iDb,        /* The database index in sqlite3.aDb[] */  Table *pTab,    /* The table to be opened */  int opcode      /* OP_OpenRead or OP_OpenWrite */){  Vdbe *v = sqlite3GetVdbe(p);  assert( opcode==OP_OpenWrite || opcode==OP_OpenRead );  sqlite3TableLock(p, iDb, pTab->tnum, (opcode==OP_OpenWrite), pTab->zName);  sqlite3VdbeAddOp(v, OP_Integer, iDb, 0);  VdbeComment((v, "# %s", pTab->zName));  sqlite3VdbeAddOp(v, opcode, iCur, pTab->tnum);  sqlite3VdbeAddOp(v, OP_SetNumColumns, iCur, pTab->nCol);}/*** Generate code for a DELETE FROM statement.****     DELETE FROM table_wxyz WHERE a<5 AND b NOT NULL;**                 \________/       \________________/**                  pTabList              pWhere*/void sqlite3DeleteFrom(  Parse *pParse,         /* The parser context */  SrcList *pTabList,     /* The table from which we should delete things */  Expr *pWhere           /* The WHERE clause.  May be null */){  Vdbe *v;               /* The virtual database engine */  Table *pTab;           /* The table from which records will be deleted */  const char *zDb;       /* Name of database holding pTab */  int end, addr = 0;     /* A couple addresses of generated code */  int i;                 /* Loop counter */  WhereInfo *pWInfo;     /* Information about the WHERE clause */  Index *pIdx;           /* For looping over indices of the table */  int iCur;              /* VDBE Cursor number for pTab */  sqlite3 *db;           /* Main database structure */  AuthContext sContext;  /* Authorization context */  int oldIdx = -1;       /* Cursor for the OLD table of AFTER triggers */  NameContext sNC;       /* Name context to resolve expressions in */  int iDb;#ifndef SQLITE_OMIT_TRIGGER  int isView;                  /* True if attempting to delete from a view */  int triggers_exist = 0;      /* True if any triggers exist */#endif  sContext.pParse = 0;  if( pParse->nErr || sqlite3MallocFailed() ){    goto delete_from_cleanup;  }  db = pParse->db;  assert( pTabList->nSrc==1 );  /* Locate the table which we want to delete.  This table has to be  ** put in an SrcList structure because some of the subroutines we  ** will be calling are designed to work with multiple tables and expect  ** an SrcList* parameter instead of just a Table* parameter.  */  pTab = sqlite3SrcListLookup(pParse, pTabList);  if( pTab==0 )  goto delete_from_cleanup;  /* Figure out if we have any triggers and if the table being  ** deleted from is a view  */#ifndef SQLITE_OMIT_TRIGGER  triggers_exist = sqlite3TriggersExist(pParse, pTab, TK_DELETE, 0);  isView = pTab->pSelect!=0;#else# define triggers_exist 0# define isView 0#endif#ifdef SQLITE_OMIT_VIEW# undef isView# define isView 0#endif  if( sqlite3IsReadOnly(pParse, pTab, triggers_exist) ){    goto delete_from_cleanup;  }  iDb = sqlite3SchemaToIndex(db, pTab->pSchema);  assert( iDb<db->nDb );  zDb = db->aDb[iDb].zName;  if( sqlite3AuthCheck(pParse, SQLITE_DELETE, pTab->zName, 0, zDb) ){    goto delete_from_cleanup;  }  /* If pTab is really a view, make sure it has been initialized.  */  if( isView && sqlite3ViewGetColumnNames(pParse, pTab) ){    goto delete_from_cleanup;  }  /* Allocate a cursor used to store the old.* data for a trigger.  */  if( triggers_exist ){     oldIdx = pParse->nTab++;  }  /* Resolve the column names in the WHERE clause.  */  assert( pTabList->nSrc==1 );  iCur = pTabList->a[0].iCursor = pParse->nTab++;  memset(&sNC, 0, sizeof(sNC));  sNC.pParse = pParse;  sNC.pSrcList = pTabList;  if( sqlite3ExprResolveNames(&sNC, pWhere) ){    goto delete_from_cleanup;  }  /* Start the view context  */  if( isView ){    sqlite3AuthContextPush(pParse, &sContext, pTab->zName);  }  /* Begin generating code.  */  v = sqlite3GetVdbe(pParse);  if( v==0 ){    goto delete_from_cleanup;  }  if( pParse->nested==0 ) sqlite3VdbeCountChanges(v);  sqlite3BeginWriteOperation(pParse, triggers_exist, iDb);  /* If we are trying to delete from a view, realize that view into  ** a ephemeral table.  */  if( isView ){    Select *pView = sqlite3SelectDup(pTab->pSelect);    sqlite3Select(pParse, pView, SRT_VirtualTab, iCur, 0, 0, 0, 0);    sqlite3SelectDelete(pView);  }  /* Initialize the counter of the number of rows deleted, if  ** we are counting rows.  */  if( db->flags & SQLITE_CountRows ){    sqlite3VdbeAddOp(v, OP_Integer, 0, 0);  }  /* Special case: A DELETE without a WHERE clause deletes everything.  ** It is easier just to erase the whole table.  Note, however, that  ** this means that the row change count will be incorrect.  */  if( pWhere==0 && !triggers_exist ){    if( db->flags & SQLITE_CountRows ){      /* If counting rows deleted, just count the total number of      ** entries in the table. */      int endOfLoop = sqlite3VdbeMakeLabel(v);      int addr2;      if( !isView ){        sqlite3OpenTable(pParse, iCur, iDb, pTab, OP_OpenRead);      }      sqlite3VdbeAddOp(v, OP_Rewind, iCur, sqlite3VdbeCurrentAddr(v)+2);      addr2 = sqlite3VdbeAddOp(v, OP_AddImm, 1, 0);      sqlite3VdbeAddOp(v, OP_Next, iCur, addr2);      sqlite3VdbeResolveLabel(v, endOfLoop);      sqlite3VdbeAddOp(v, OP_Close, iCur, 0);    }    if( !isView ){      sqlite3VdbeAddOp(v, OP_Clear, pTab->tnum, iDb);      if( !pParse->nested ){        sqlite3VdbeChangeP3(v, -1, pTab->zName, P3_STATIC);      }      for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){        assert( pIdx->pSchema==pTab->pSchema );        sqlite3VdbeAddOp(v, OP_Clear, pIdx->tnum, iDb);      }    }  }  /* The usual case: There is a WHERE clause so we have to scan through  ** the table and pick which records to delete.  */  else{    /* Begin the database scan    */    pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, 0);    if( pWInfo==0 ) goto delete_from_cleanup;    /* Remember the rowid of every item to be deleted.    */    sqlite3VdbeAddOp(v, OP_Rowid, iCur, 0);    sqlite3VdbeAddOp(v, OP_FifoWrite, 0, 0);    if( db->flags & SQLITE_CountRows ){      sqlite3VdbeAddOp(v, OP_AddImm, 1, 0);    }    /* End the database scan loop.    */    sqlite3WhereEnd(pWInfo);    /* Open the pseudo-table used to store OLD if there are triggers.    */    if( triggers_exist ){      sqlite3VdbeAddOp(v, OP_OpenPseudo, oldIdx, 0);      sqlite3VdbeAddOp(v, OP_SetNumColumns, oldIdx, pTab->nCol);    }    /* Delete every item whose key was written to the list during the    ** database scan.  We have to delete items after the scan is complete    ** because deleting an item can change the scan order.    */    end = sqlite3VdbeMakeLabel(v);    /* This is the beginning of the delete loop when there are    ** row triggers.    */    if( triggers_exist ){      addr = sqlite3VdbeAddOp(v, OP_FifoRead, 0, end);      if( !isView ){        sqlite3VdbeAddOp(v, OP_Dup, 0, 0);        sqlite3OpenTable(pParse, iCur, iDb, pTab, OP_OpenRead);      }      sqlite3VdbeAddOp(v, OP_MoveGe, iCur, 0);      sqlite3VdbeAddOp(v, OP_Rowid, iCur, 0);      sqlite3VdbeAddOp(v, OP_RowData, iCur, 0);      sqlite3VdbeAddOp(v, OP_Insert, oldIdx, 0);      if( !isView ){        sqlite3VdbeAddOp(v, OP_Close, iCur, 0);      }      (void)sqlite3CodeRowTrigger(pParse, TK_DELETE, 0, TRIGGER_BEFORE, pTab,          -1, oldIdx, (pParse->trigStack)?pParse->trigStack->orconf:OE_Default,          addr);    }    if( !isView ){      /* Open cursors for the table we are deleting from and all its      ** indices.  If there are row triggers, this happens inside the      ** OP_FifoRead loop because the cursor have to all be closed      ** before the trigger fires.  If there are no row triggers, the      ** cursors are opened only once on the outside the loop.      */      sqlite3OpenTableAndIndices(pParse, pTab, iCur, OP_OpenWrite);      /* This is the beginning of the delete loop when there are no      ** row triggers */      if( !triggers_exist ){         addr = sqlite3VdbeAddOp(v, OP_FifoRead, 0, end);      }      /* Delete the row */      sqlite3GenerateRowDelete(db, v, pTab, iCur, pParse->nested==0);    }    /* If there are row triggers, close all cursors then invoke    ** the AFTER triggers    */    if( triggers_exist ){      if( !isView ){        for(i=1, pIdx=pTab->pIndex; pIdx; i++, pIdx=pIdx->pNext){          sqlite3VdbeAddOp(v, OP_Close, iCur + i, pIdx->tnum);        }        sqlite3VdbeAddOp(v, OP_Close, iCur, 0);      }      (void)sqlite3CodeRowTrigger(pParse, TK_DELETE, 0, TRIGGER_AFTER, pTab, -1,          oldIdx, (pParse->trigStack)?pParse->trigStack->orconf:OE_Default,          addr);    }    /* End of the delete loop */    sqlite3VdbeAddOp(v, OP_Goto, 0, addr);    sqlite3VdbeResolveLabel(v, end);    /* Close the cursors after the loop if there are no row triggers */    if( !triggers_exist ){      for(i=1, pIdx=pTab->pIndex; pIdx; i++, pIdx=pIdx->pNext){        sqlite3VdbeAddOp(v, OP_Close, iCur + i, pIdx->tnum);      }      sqlite3VdbeAddOp(v, OP_Close, iCur, 0);    }  }  /*  ** Return the number of rows that were deleted. If this routine is   ** generating code because of a call to sqlite3NestedParse(), do not  ** invoke the callback function.  */  if( db->flags & SQLITE_CountRows && pParse->nested==0 && !pParse->trigStack ){    sqlite3VdbeAddOp(v, OP_Callback, 1, 0);    sqlite3VdbeSetNumCols(v, 1);    sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "rows deleted", P3_STATIC);  }delete_from_cleanup:  sqlite3AuthContextPop(&sContext);  sqlite3SrcListDelete(pTabList);  sqlite3ExprDelete(pWhere);  return;}/*** This routine generates VDBE code that causes a single row of a** single table to be deleted.**** The VDBE must be in a particular state when this routine is called.** These are the requirements:****   1.  A read/write cursor pointing to pTab, the table containing the row**       to be deleted, must be opened as cursor number "base".****   2.  Read/write cursors for all indices of pTab must be open as**       cursor number base+i for the i-th index.****   3.  The record number of the row to be deleted must be on the top**       of the stack.**** This routine pops the top of the stack to remove the record number** and then generates code to remove both the table record and all index** entries that point to that record.*/void sqlite3GenerateRowDelete(  sqlite3 *db,       /* The database containing the index */  Vdbe *v,           /* Generate code into this VDBE */  Table *pTab,       /* Table containing the row to be deleted */  int iCur,          /* Cursor number for the table */  int count          /* Increment the row change counter */){  int addr;  addr = sqlite3VdbeAddOp(v, OP_NotExists, iCur, 0);  sqlite3GenerateRowIndexDelete(v, pTab, iCur, 0);  sqlite3VdbeAddOp(v, OP_Delete, iCur, (count?OPFLAG_NCHANGE:0));  if( count ){    sqlite3VdbeChangeP3(v, -1, pTab->zName, P3_STATIC);  }  sqlite3VdbeJumpHere(v, addr);}/*** This routine generates VDBE code that causes the deletion of all** index entries associated with a single row of a single table.**** The VDBE must be in a particular state when this routine is called.** These are the requirements:****   1.  A read/write cursor pointing to pTab, the table containing the row**       to be deleted, must be opened as cursor number "iCur".****   2.  Read/write cursors for all indices of pTab must be open as**       cursor number iCur+i for the i-th index.****   3.  The "iCur" cursor must be pointing to the row that is to be**       deleted.*/void sqlite3GenerateRowIndexDelete(  Vdbe *v,           /* Generate code into this VDBE */  Table *pTab,       /* Table containing the row to be deleted */  int iCur,          /* Cursor number for the table */  char *aIdxUsed     /* Only delete if aIdxUsed!=0 && aIdxUsed[i]!=0 */){  int i;  Index *pIdx;  for(i=1, pIdx=pTab->pIndex; pIdx; i++, pIdx=pIdx->pNext){    if( aIdxUsed!=0 && aIdxUsed[i-1]==0 ) continue;    sqlite3GenerateIndexKey(v, pIdx, iCur);    sqlite3VdbeAddOp(v, OP_IdxDelete, iCur+i, 0);  }}/*** Generate code that will assemble an index key and put it on the top** of the tack.  The key with be for index pIdx which is an index on pTab.** iCur is the index of a cursor open on the pTab table and pointing to** the entry that needs indexing.*/void sqlite3GenerateIndexKey(  Vdbe *v,           /* Generate code into this VDBE */  Index *pIdx,       /* The index for which to generate a key */  int iCur           /* Cursor number for the pIdx->pTable table */){  int j;  Table *pTab = pIdx->pTable;  sqlite3VdbeAddOp(v, OP_Rowid, iCur, 0);  for(j=0; j<pIdx->nColumn; j++){    int idx = pIdx->aiColumn[j];    if( idx==pTab->iPKey ){      sqlite3VdbeAddOp(v, OP_Dup, j, 0);    }else{      sqlite3VdbeAddOp(v, OP_Column, iCur, idx);      sqlite3ColumnDefault(v, pTab, idx);    }  }  sqlite3VdbeAddOp(v, OP_MakeIdxRec, pIdx->nColumn, 0);  sqlite3IndexAffinityStr(v, pIdx);}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
色欧美片视频在线观看在线视频| 欧美日韩另类国产亚洲欧美一级| 欧美日韩日日夜夜| 国产欧美精品一区| 一区二区高清视频在线观看| 久久成人av少妇免费| 99视频一区二区| 日韩欧美国产三级电影视频| 亚洲精品国产品国语在线app| 精品一区二区三区日韩| 欧美性感一区二区三区| 国产精品欧美一级免费| 久久精品国产亚洲aⅴ| 欧美蜜桃一区二区三区| 亚洲精品国产第一综合99久久 | 成人激情小说乱人伦| 在线不卡a资源高清| 国产精品欧美久久久久无广告 | 日韩一区二区三区在线| 日韩久久一区二区| 大白屁股一区二区视频| 精品第一国产综合精品aⅴ| 日韩和欧美一区二区三区| 色婷婷av一区二区三区之一色屋| 国产欧美在线观看一区| 国产精品自在在线| 久久免费看少妇高潮| 精品一二线国产| 日韩精品一区二区三区四区| 日韩精品高清不卡| 欧美一区二区在线播放| 青青草91视频| 日韩欧美久久久| 久久99精品久久久久久久久久久久| 亚洲国产精品天堂| 亚洲国产aⅴ成人精品无吗| 亚洲免费观看高清完整版在线| 国产成人高清在线| 国产日韩精品久久久| 国内精品嫩模私拍在线| 2023国产精品自拍| 国产一区999| 国产欧美1区2区3区| 成人激情小说网站| 亚洲欧美一区二区三区久本道91| 91丨porny丨首页| 亚洲最新在线观看| 91麻豆精品国产自产在线| 麻豆精品在线看| 国产亚洲1区2区3区| av在线不卡免费看| 亚洲大片在线观看| 欧美一级淫片007| 岛国av在线一区| 一区二区三区成人| 日韩午夜激情电影| 粉嫩久久99精品久久久久久夜| 国产精品黄色在线观看| 欧美日韩视频第一区| 麻豆成人在线观看| 国产精品家庭影院| 欧美一区二区久久| 国产999精品久久| 亚洲一二三四久久| 日韩欧美高清一区| 成人av电影免费观看| 亚洲成人自拍偷拍| 国产日韩精品一区二区浪潮av| 色婷婷精品大在线视频| 国产一区二区在线免费观看| 亚洲欧洲日本在线| 7777精品伊人久久久大香线蕉的 | 中文天堂在线一区| 在线免费不卡电影| 国产原创一区二区三区| 亚洲永久精品大片| 久久美女高清视频| 欧美日韩在线综合| 成人性生交大片免费看中文 | 亚洲欧美日韩国产综合| 日韩一区二区视频在线观看| 成人精品视频网站| 狂野欧美性猛交blacked| 亚洲男人天堂一区| 国产日韩欧美综合在线| 日韩一二三区不卡| 在线观看91精品国产入口| 国产成人精品三级麻豆| 人妖欧美一区二区| 亚洲乱码国产乱码精品精的特点| 欧美tickling网站挠脚心| 欧美伊人久久久久久午夜久久久久| 国产精品影视天天线| 日本在线不卡一区| 亚洲一区二区三区三| 日韩美女久久久| 国产精品美女久久久久高潮| 久久综合九色综合97_久久久| 69堂亚洲精品首页| 91成人在线免费观看| 91麻豆文化传媒在线观看| 国产成人av福利| 国产精品资源在线观看| 美洲天堂一区二卡三卡四卡视频| 午夜影院久久久| 午夜伦欧美伦电影理论片| 亚洲一区二区四区蜜桃| 一区二区三区产品免费精品久久75| 成人免费在线播放视频| 中文字幕一区二区三区四区不卡| 国产婷婷色一区二区三区在线| 久久久亚洲综合| 欧美国产精品v| 国产精品蜜臀av| 国产精品传媒入口麻豆| 中文字幕中文在线不卡住| 综合在线观看色| 亚洲资源在线观看| 无吗不卡中文字幕| 久88久久88久久久| 国产剧情一区二区三区| 国产成人av一区二区三区在线观看| 风间由美一区二区av101| 成人免费视频免费观看| 成人免费视频国产在线观看| 99在线视频精品| 欧美中文字幕一二三区视频| 欧美色综合网站| 日韩天堂在线观看| 久久久久久免费网| ㊣最新国产の精品bt伙计久久| 欧美激情中文字幕一区二区| 一区二区三区四区在线播放| 亚洲一区免费在线观看| 偷拍与自拍一区| 国产盗摄精品一区二区三区在线 | fc2成人免费人成在线观看播放| av影院午夜一区| 欧美日韩一区二区三区在线看 | 三级亚洲高清视频| 奇米精品一区二区三区在线观看| 国产在线日韩欧美| 99视频热这里只有精品免费| 欧美日精品一区视频| 精品人伦一区二区色婷婷| 国产精品免费免费| 三级欧美在线一区| 成人三级伦理片| 欧美日韩国产电影| 国产欧美日韩综合| 亚洲国产精品一区二区久久恐怖片| 久草精品在线观看| 一本色道综合亚洲| 久久综合九色综合97_久久久| 亚洲免费电影在线| 狠狠色狠狠色综合| 91麻豆免费看片| 久久一日本道色综合| 亚洲高清不卡在线观看| 国产成人av电影在线观看| 这里是久久伊人| 亚洲视频在线观看一区| 国产自产v一区二区三区c| 色老头久久综合| 国产午夜精品一区二区三区视频| 亚洲国产一区二区三区青草影视| 国产精品一区二区男女羞羞无遮挡 | 日韩主播视频在线| 国产成人一区在线| 日韩一区二区三免费高清| 亚洲男人都懂的| 不卡高清视频专区| 精品欧美一区二区三区精品久久| 亚洲国产精品久久久男人的天堂| 国产.欧美.日韩| 久久免费美女视频| 免费黄网站欧美| 欧美揉bbbbb揉bbbbb| 亚洲精品日韩专区silk| 成人av电影在线观看| 国产午夜精品一区二区三区嫩草 | 一区二区三区影院| 99精品视频在线免费观看| 精品国产不卡一区二区三区| 日韩avvvv在线播放| 欧美日韩一区二区三区视频| 亚洲精品视频观看| 色偷偷久久人人79超碰人人澡| 国产亚洲欧美色| 国产成人自拍在线| 久久综合狠狠综合久久综合88| 青青草精品视频| 日韩欧美一级在线播放| 蜜臀a∨国产成人精品| 欧美日韩成人一区| 午夜视黄欧洲亚洲| 日韩视频免费观看高清完整版| 欧美aa在线视频| 日韩免费高清视频| 国产一区二区调教|