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

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

?? 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.111 2005/09/20 17:42:23 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 sqlite3OpenTableForReading(  Vdbe *v,        /* Generate code into this VDBE */  int iCur,       /* The cursor number of the table */  Table *pTab     /* The table to be opened */){  sqlite3VdbeAddOp(v, OP_Integer, pTab->iDb, 0);  VdbeComment((v, "# %s", pTab->zName));  sqlite3VdbeAddOp(v, OP_OpenRead, 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 */#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 || sqlite3_malloc_failed ){    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;  }  assert( pTab->iDb<db->nDb );  zDb = db->aDb[pTab->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, pTab->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 addr;      if( !isView ){        sqlite3OpenTableForReading(v, iCur, pTab);      }      sqlite3VdbeAddOp(v, OP_Rewind, iCur, sqlite3VdbeCurrentAddr(v)+2);      addr = sqlite3VdbeAddOp(v, OP_AddImm, 1, 0);      sqlite3VdbeAddOp(v, OP_Next, iCur, addr);      sqlite3VdbeResolveLabel(v, endOfLoop);      sqlite3VdbeAddOp(v, OP_Close, iCur, 0);    }    if( !isView ){      sqlite3VdbeAddOp(v, OP_Clear, pTab->tnum, pTab->iDb);      for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){        sqlite3VdbeAddOp(v, OP_Clear, pIdx->tnum, pIdx->iDb);      }    }  }  /* The usual case: There is a WHERE clause so we have to scan through  ** the table and pick which records to delete.  */  else{    /* Ensure all required collation sequences are available. */    for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){      if( sqlite3CheckIndexCollSeq(pParse, pIdx) ){        goto delete_from_cleanup;      }    }    /* 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);        sqlite3OpenTableForReading(v, iCur, pTab);      }      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, "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(db, v, pTab, iCur, 0);  sqlite3VdbeAddOp(v, OP_Delete, iCur, (count?OPFLAG_NCHANGE:0));  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(  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 */  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);}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品视频色一区| 欧美tickling网站挠脚心| 欧美日韩日日骚| 久久精品免费在线观看| 怡红院av一区二区三区| 国产麻豆视频精品| 欧美日韩日日夜夜| 尤物在线观看一区| 成人一级视频在线观看| 欧美一区二区三区免费在线看| 一区二区中文字幕在线| 精品一区精品二区高清| 欧美性猛交xxxxxx富婆| 国产精品美女久久久久久久久久久 | 91国产福利在线| 国产欧美日韩在线视频| 久久成人免费网站| 欧美高清dvd| 亚洲一区二区成人在线观看| 99re6这里只有精品视频在线观看| 久久女同互慰一区二区三区| 麻豆精品国产传媒mv男同 | 亚洲免费视频中文字幕| 国产91在线看| 国产嫩草影院久久久久| 国产精品综合网| 久久麻豆一区二区| 精品一区二区三区日韩| 日韩精品一区国产麻豆| 秋霞国产午夜精品免费视频| 欧美一三区三区四区免费在线看| 亚洲国产va精品久久久不卡综合| 在线观看日韩毛片| 亚洲永久精品国产| 欧美私人免费视频| 亚洲va天堂va国产va久| 在线电影一区二区三区| 日本视频免费一区| 日韩精品中文字幕一区| 国产乱子伦视频一区二区三区| www一区二区| 国产**成人网毛片九色| 国产精品久久久久四虎| 97aⅴ精品视频一二三区| 亚洲免费资源在线播放| 欧美午夜精品久久久| 丝袜诱惑制服诱惑色一区在线观看 | 欧美一区二区三区播放老司机| 午夜精品福利久久久| 7777精品伊人久久久大香线蕉 | 精品在线你懂的| 久久精品人人做人人综合| 成人晚上爱看视频| 中文字幕亚洲成人| 欧美午夜精品一区二区蜜桃| 久久97超碰国产精品超碰| 久久婷婷成人综合色| 成人av午夜电影| 亚洲一区二区三区四区的 | 色噜噜狠狠色综合欧洲selulu| 一区二区三区四区在线免费观看 | 丝瓜av网站精品一区二区| 欧美一二三区精品| 风间由美性色一区二区三区| 亚洲精品国产品国语在线app| 欧美猛男gaygay网站| 精东粉嫩av免费一区二区三区| 亚洲国产经典视频| 欧美群妇大交群中文字幕| 激情综合色丁香一区二区| 亚洲欧洲无码一区二区三区| 3atv在线一区二区三区| 国产麻豆精品久久一二三| 一区二区三区影院| 久久久久久久久伊人| 日本精品一级二级| 韩国av一区二区三区四区| 日韩一区有码在线| 日韩欧美亚洲一区二区| 日本韩国欧美三级| 国产激情视频一区二区三区欧美| 一区二区三区色| 久久精品人人做| 欧美高清视频一二三区 | 国产精品99久久久久久久vr| 亚洲午夜av在线| 中文字幕巨乱亚洲| 欧美一区二区三区免费视频 | a4yy欧美一区二区三区| 男男视频亚洲欧美| 亚洲资源在线观看| 国产精品久久综合| 欧美精品一区二区三区蜜桃视频| 欧美性猛交xxxxxx富婆| 成人黄色综合网站| 国内精品伊人久久久久av一坑| 午夜视频一区二区| 亚洲女性喷水在线观看一区| 国产免费成人在线视频| 欧美一区二区三区在线视频 | 91麻豆蜜桃一区二区三区| 国产一区不卡精品| 免费在线看一区| 日韩和欧美一区二区三区| 亚洲精品视频在线看| 国产精品伦理在线| 国产欧美视频一区二区| 国产网站一区二区三区| 欧美精品一区二区高清在线观看 | 在线电影院国产精品| 在线观看视频91| 欧美性猛片xxxx免费看久爱| 欧美亚洲禁片免费| 欧美网站一区二区| 欧美日韩亚州综合| 欧美久久高跟鞋激| 91精品国产综合久久久蜜臀粉嫩 | 国产河南妇女毛片精品久久久| 久久精品国产精品青草| 蜜桃av一区二区| 九九久久精品视频| 国产一区二区中文字幕| 国产一区二区三区日韩| 国产精品一区二区在线播放 | 一区二区三区在线播放| 亚洲一区二区三区视频在线 | 日韩av在线免费观看不卡| 午夜精品久久久久久久| 日韩av中文在线观看| 久久国产精品99久久久久久老狼| 精品一区二区在线观看| 国产一区二区在线影院| 成人av动漫网站| 在线观看成人免费视频| 欧美色涩在线第一页| 欧美一级二级在线观看| 国产午夜精品一区二区三区视频 | 免费观看在线综合| 激情综合网天天干| 成人爱爱电影网址| 91福利在线免费观看| 777久久久精品| 欧美国产精品一区| 亚洲精品中文字幕乱码三区| 蜜桃一区二区三区在线| 国产精品一级片| 在线视频国内自拍亚洲视频| 欧美一三区三区四区免费在线看 | 久久不见久久见免费视频1| 国产一区二区在线视频| 色欲综合视频天天天| 欧美一区2区视频在线观看| 久久网站最新地址| 亚洲综合视频网| 国产成人一区在线| 欧美亚州韩日在线看免费版国语版| 欧美一级黄色片| 亚洲精品成人在线| 国产最新精品免费| 欧美三级日韩在线| 国产精品免费丝袜| 五月婷婷久久丁香| 99在线精品观看| 久久久不卡影院| 免费欧美日韩国产三级电影| 99re成人在线| 国产三级精品视频| 亚洲国产欧美另类丝袜| 粉嫩aⅴ一区二区三区四区五区| 51午夜精品国产| 亚洲男人的天堂在线观看| 精品无码三级在线观看视频| 欧美日韩国产区一| 中文字幕一区在线观看| 狠狠色狠狠色综合日日91app| 欧美亚男人的天堂| 国产精品福利一区二区三区| 国产在线不卡视频| 日韩三级精品电影久久久| 一区二区三区不卡视频 | 666欧美在线视频| 亚洲最大色网站| 99久久99久久精品国产片果冻| 欧美精品一区二区三区一线天视频| 三级不卡在线观看| 欧美午夜电影网| 一区二区不卡在线视频 午夜欧美不卡在| 国产激情一区二区三区| 欧美成人精精品一区二区频| 免费观看91视频大全| 欧美精品乱码久久久久久| 亚洲自拍偷拍综合| 色婷婷激情一区二区三区| 中文字幕视频一区| 99精品热视频| 亚洲免费观看高清完整| av亚洲精华国产精华精华| 国产欧美精品一区| 国产成人在线观看免费网站| 欧美激情一区二区三区蜜桃视频|