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

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

?? update.c

?? sqlite 3.3.8 支持加密的版本
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*
** 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
** to handle UPDATE statements.
**
** $Id: update.c,v 1.24 2006/10/12 21:34:22 rmsimpson Exp $
*/
#include "sqliteInt.h"

#ifndef SQLITE_OMIT_VIRTUALTABLE
/* Forward declaration */
static void updateVirtualTable(
  Parse *pParse,       /* The parsing context */
  SrcList *pSrc,       /* The virtual table to be modified */
  Table *pTab,         /* The virtual table */
  ExprList *pChanges,  /* The columns to change in the UPDATE statement */
  Expr *pRowidExpr,    /* Expression used to recompute the rowid */
  int *aXRef,          /* Mapping from columns of pTab to entries in pChanges */
  Expr *pWhere         /* WHERE clause of the UPDATE statement */
);
#endif /* SQLITE_OMIT_VIRTUALTABLE */

/*
** The most recently coded instruction was an OP_Column to retrieve the
** i-th column of table pTab. This routine sets the P3 parameter of the 
** OP_Column to the default value, if any.
**
** The default value of a column is specified by a DEFAULT clause in the 
** column definition. This was either supplied by the user when the table
** was created, or added later to the table definition by an ALTER TABLE
** command. If the latter, then the row-records in the table btree on disk
** may not contain a value for the column and the default value, taken
** from the P3 parameter of the OP_Column instruction, is returned instead.
** If the former, then all row-records are guaranteed to include a value
** for the column and the P3 value is not required.
**
** Column definitions created by an ALTER TABLE command may only have 
** literal default values specified: a number, null or a string. (If a more
** complicated default expression value was provided, it is evaluated 
** when the ALTER TABLE is executed and one of the literal values written
** into the sqlite_master table.)
**
** Therefore, the P3 parameter is only required if the default value for
** the column is a literal number, string or null. The sqlite3ValueFromExpr()
** function is capable of transforming these types of expressions into
** sqlite3_value objects.
*/
void sqlite3ColumnDefault(Vdbe *v, Table *pTab, int i){
  if( pTab && !pTab->pSelect ){
    sqlite3_value *pValue;
    u8 enc = ENC(sqlite3VdbeDb(v));
    Column *pCol = &pTab->aCol[i];
    sqlite3ValueFromExpr(pCol->pDflt, enc, pCol->affinity, &pValue);
    if( pValue ){
      sqlite3VdbeChangeP3(v, -1, (const char *)pValue, P3_MEM);
    }else{
      VdbeComment((v, "# %s.%s", pTab->zName, pCol->zName));
    }
  }
}

/*
** Process an UPDATE statement.
**
**   UPDATE OR IGNORE table_wxyz SET a=b, c=d WHERE e<5 AND f NOT NULL;
**          \_______/ \________/     \______/       \________________/
*            onError   pTabList      pChanges             pWhere
*/
void sqlite3Update(
  Parse *pParse,         /* The parser context */
  SrcList *pTabList,     /* The table in which we should change things */
  ExprList *pChanges,    /* Things to be changed */
  Expr *pWhere,          /* The WHERE clause.  May be null */
  int onError            /* How to handle constraint errors */
){
  int i, j;              /* Loop counters */
  Table *pTab;           /* The table to be updated */
  int addr = 0;          /* VDBE instruction address of the start of the loop */
  WhereInfo *pWInfo;     /* Information about the WHERE clause */
  Vdbe *v;               /* The virtual database engine */
  Index *pIdx;           /* For looping over indices */
  int nIdx;              /* Number of indices that need updating */
  int nIdxTotal;         /* Total number of indices */
  int iCur;              /* VDBE Cursor number of pTab */
  sqlite3 *db;           /* The database structure */
  Index **apIdx = 0;     /* An array of indices that need updating too */
  char *aIdxUsed = 0;    /* aIdxUsed[i]==1 if the i-th index is used */
  int *aXRef = 0;        /* aXRef[i] is the index in pChanges->a[] of the
                         ** an expression for the i-th column of the table.
                         ** aXRef[i]==-1 if the i-th column is not changed. */
  int chngRowid;         /* True if the record number is being changed */
  Expr *pRowidExpr = 0;  /* Expression defining the new record number */
  int openAll = 0;       /* True if all indices need to be opened */
  AuthContext sContext;  /* The authorization context */
  NameContext sNC;       /* The name-context to resolve expressions in */
  int iDb;               /* Database containing the table being updated */

#ifndef SQLITE_OMIT_TRIGGER
  int isView;                  /* Trying to update a view */
  int triggers_exist = 0;      /* True if any row triggers exist */
#endif

  int newIdx      = -1;  /* index of trigger "new" temp table       */
  int oldIdx      = -1;  /* index of trigger "old" temp table       */

  sContext.pParse = 0;
  if( pParse->nErr || sqlite3MallocFailed() ){
    goto update_cleanup;
  }
  db = pParse->db;
  assert( pTabList->nSrc==1 );

  /* Locate the table which we want to update. 
  */
  pTab = sqlite3SrcListLookup(pParse, pTabList);
  if( pTab==0 ) goto update_cleanup;
  iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);

  /* Figure out if we have any triggers and if the table being
  ** updated is a view
  */
#ifndef SQLITE_OMIT_TRIGGER
  triggers_exist = sqlite3TriggersExist(pParse, pTab, TK_UPDATE, pChanges);
  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 update_cleanup;
  }
  if( sqlite3ViewGetColumnNames(pParse, pTab) ){
    goto update_cleanup;
  }
  aXRef = sqliteMallocRaw( sizeof(int) * pTab->nCol );
  if( aXRef==0 ) goto update_cleanup;
  for(i=0; i<pTab->nCol; i++) aXRef[i] = -1;

  /* If there are FOR EACH ROW triggers, allocate cursors for the
  ** special OLD and NEW tables
  */
  if( triggers_exist ){
    newIdx = pParse->nTab++;
    oldIdx = pParse->nTab++;
  }

  /* Allocate a cursors for the main database table and for all indices.
  ** The index cursors might not be used, but if they are used they
  ** need to occur right after the database cursor.  So go ahead and
  ** allocate enough space, just in case.
  */
  pTabList->a[0].iCursor = iCur = pParse->nTab++;
  for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
    pParse->nTab++;
  }

  /* Initialize the name-context */
  memset(&sNC, 0, sizeof(sNC));
  sNC.pParse = pParse;
  sNC.pSrcList = pTabList;

  /* Resolve the column names in all the expressions of the
  ** of the UPDATE statement.  Also find the column index
  ** for each column to be updated in the pChanges array.  For each
  ** column to be updated, make sure we have authorization to change
  ** that column.
  */
  chngRowid = 0;
  for(i=0; i<pChanges->nExpr; i++){
    if( sqlite3ExprResolveNames(&sNC, pChanges->a[i].pExpr) ){
      goto update_cleanup;
    }
    for(j=0; j<pTab->nCol; j++){
      if( sqlite3StrICmp(pTab->aCol[j].zName, pChanges->a[i].zName)==0 ){
        if( j==pTab->iPKey ){
          chngRowid = 1;
          pRowidExpr = pChanges->a[i].pExpr;
        }
        aXRef[j] = i;
        break;
      }
    }
    if( j>=pTab->nCol ){
      if( sqlite3IsRowid(pChanges->a[i].zName) ){
        chngRowid = 1;
        pRowidExpr = pChanges->a[i].pExpr;
      }else{
        sqlite3ErrorMsg(pParse, "no such column: %s", pChanges->a[i].zName);
        goto update_cleanup;
      }
    }
#ifndef SQLITE_OMIT_AUTHORIZATION
    {
      int rc;
      rc = sqlite3AuthCheck(pParse, SQLITE_UPDATE, pTab->zName,
                           pTab->aCol[j].zName, db->aDb[iDb].zName);
      if( rc==SQLITE_DENY ){
        goto update_cleanup;
      }else if( rc==SQLITE_IGNORE ){
        aXRef[j] = -1;
      }
    }
#endif
  }

  /* Allocate memory for the array apIdx[] and fill it with pointers to every
  ** index that needs to be updated.  Indices only need updating if their
  ** key includes one of the columns named in pChanges or if the record
  ** number of the original table entry is changing.
  */
  for(nIdx=nIdxTotal=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, nIdxTotal++){
    if( chngRowid ){
      i = 0;
    }else {
      for(i=0; i<pIdx->nColumn; i++){
        if( aXRef[pIdx->aiColumn[i]]>=0 ) break;
      }
    }
    if( i<pIdx->nColumn ) nIdx++;
  }
  if( nIdxTotal>0 ){
    apIdx = sqliteMallocRaw( sizeof(Index*) * nIdx + nIdxTotal );
    if( apIdx==0 ) goto update_cleanup;
    aIdxUsed = (char*)&apIdx[nIdx];
  }
  for(nIdx=j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
    if( chngRowid ){
      i = 0;
    }else{
      for(i=0; i<pIdx->nColumn; i++){
        if( aXRef[pIdx->aiColumn[i]]>=0 ) break;
      }
    }
    if( i<pIdx->nColumn ){
      apIdx[nIdx++] = pIdx;
      aIdxUsed[j] = 1;
    }else{
      aIdxUsed[j] = 0;
    }
  }

  /* Begin generating code.
  */
  v = sqlite3GetVdbe(pParse);
  if( v==0 ) goto update_cleanup;
  if( pParse->nested==0 ) sqlite3VdbeCountChanges(v);
  sqlite3BeginWriteOperation(pParse, 1, iDb);

#ifndef SQLITE_OMIT_VIRTUALTABLE
  /* Virtual tables must be handled separately */
  if( IsVirtual(pTab) ){
    updateVirtualTable(pParse, pTabList, pTab, pChanges, pRowidExpr, aXRef,
                       pWhere);
    pWhere = 0;
    pTabList = 0;
    goto update_cleanup;
  }
#endif

  /* Resolve the column names in all the expressions in the
  ** WHERE clause.
  */
  if( sqlite3ExprResolveNames(&sNC, pWhere) ){
    goto update_cleanup;
  }

  /* Start the view context
  */
  if( isView ){
    sqlite3AuthContextPush(pParse, &sContext, pTab->zName);
  }

  /* If we are trying to update a view, realize that view into
  ** a ephemeral table.
  */
  if( isView ){
    Select *pView;
    pView = sqlite3SelectDup(pTab->pSelect);
    sqlite3Select(pParse, pView, SRT_EphemTab, iCur, 0, 0, 0, 0);
    sqlite3SelectDelete(pView);
  }

  /* Begin the database scan
  */
  pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, 0);
  if( pWInfo==0 ) goto update_cleanup;

  /* Remember the rowid of every item to be updated.
  */
  sqlite3VdbeAddOp(v, IsVirtual(pTab) ? OP_VRowid : OP_Rowid, iCur, 0);
  sqlite3VdbeAddOp(v, OP_FifoWrite, 0, 0);

  /* End the database scan loop.
  */
  sqlite3WhereEnd(pWInfo);

  /* Initialize the count of updated rows
  */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
香蕉成人啪国产精品视频综合网| 99国产精品国产精品毛片| 亚洲国产你懂的| 亚洲视频一区在线| 亚洲日韩欧美一区二区在线| 国产精品久久久一区麻豆最新章节| 久久嫩草精品久久久久| 久久综合网色—综合色88| 精品噜噜噜噜久久久久久久久试看 | 在线视频欧美区| 91尤物视频在线观看| 色综合天天综合| 色综合视频在线观看| 91麻豆蜜桃一区二区三区| 在线日韩国产精品| 欧美性生交片4| 欧美猛男男办公室激情| 6080yy午夜一二三区久久| 欧美一二三四区在线| 日韩免费高清视频| 久久久久久久久蜜桃| 国产视频一区在线播放| 中文字幕视频一区| 一区二区三区中文字幕| 亚洲成人自拍偷拍| 免费视频一区二区| 国产91精品在线观看| 不卡的电影网站| 91在线云播放| 91精品国产综合久久香蕉麻豆 | 国产精品女主播av| 一区二区三区在线视频免费| 亚洲高清一区二区三区| 麻豆精品蜜桃视频网站| 国产伦精品一区二区三区视频青涩| 国产精品一区免费在线观看| 99久久精品99国产精品| 欧美区一区二区三区| 日韩免费成人网| 国产精品久久久一本精品| 亚洲香蕉伊在人在线观| 激情综合五月婷婷| 91网站在线播放| 91精品国产综合久久久蜜臀粉嫩| 精品久久久久久久久久久久久久久| 国产精品日韩精品欧美在线 | 成人国产电影网| 欧美中文一区二区三区| 精品国产一区二区三区忘忧草 | 国产精品资源在线| 91官网在线观看| 精品国产免费久久| 国产精品女上位| 日本aⅴ亚洲精品中文乱码| 国产激情视频一区二区在线观看 | 久久精品人人做人人综合 | 日韩亚洲电影在线| 亚洲欧洲日韩一区二区三区| 午夜久久福利影院| 国产91清纯白嫩初高中在线观看| 欧美午夜理伦三级在线观看| 久久夜色精品国产噜噜av| 亚洲夂夂婷婷色拍ww47| 国产一区在线观看麻豆| 欧美亚洲一区二区在线| 国产调教视频一区| 视频一区二区国产| 99re这里只有精品6| 精品国产电影一区二区| 亚洲高清久久久| av在线播放不卡| 久久综合狠狠综合| 日韩精品成人一区二区在线| 国产成人精品免费看| 国产乱码精品一区二区三区av| 懂色av一区二区三区免费观看 | 日本一区二区高清| 青青草国产精品97视觉盛宴| 色网综合在线观看| 国产精品美女久久久久久久| 人人精品人人爱| 在线观看一区二区视频| 国产日韩欧美麻豆| 麻豆久久久久久久| 欧美日韩国产三级| 亚洲欧美二区三区| 成人av网站在线| 国产农村妇女毛片精品久久麻豆| 日韩福利视频导航| 欧美性猛交一区二区三区精品| 中文字幕欧美区| 国产精品亚洲成人| 欧美精品一区二区三区蜜臀| 美女一区二区三区| 欧美福利电影网| 天天影视色香欲综合网老头| 色婷婷国产精品| 亚洲三级久久久| 色综合久久久久综合体| 中文文精品字幕一区二区| 国产精品538一区二区在线| 日韩免费看的电影| 蜜臂av日日欢夜夜爽一区| 8v天堂国产在线一区二区| 日韩影院免费视频| 欧美日韩大陆在线| 日韩高清国产一区在线| 在线观看91精品国产麻豆| 日韩电影在线看| 91精品国产综合久久婷婷香蕉| 日韩在线一二三区| 日韩精品一区在线| 国内精品免费**视频| 欧美精品一区二区三区视频| 国产在线视频一区二区三区| 久久久久久久久蜜桃| 丁香亚洲综合激情啪啪综合| 中文字幕一区二区三区四区| 色婷婷激情久久| 丝袜脚交一区二区| 日韩欧美在线影院| 国产一区二区三区蝌蚪| 久久久影视传媒| va亚洲va日韩不卡在线观看| 国产精品动漫网站| 欧美优质美女网站| 三级久久三级久久久| 精品动漫一区二区三区在线观看| 国产成人日日夜夜| 亚洲欧洲日韩一区二区三区| 欧洲国产伦久久久久久久| 日韩专区欧美专区| 久久久久久日产精品| 波多野结衣精品在线| 亚洲国产欧美在线| 欧美xfplay| av一区二区三区四区| 午夜精品国产更新| 国产亚洲欧洲997久久综合| a亚洲天堂av| 日日噜噜夜夜狠狠视频欧美人 | 中文字幕国产精品一区二区| 色综合天天做天天爱| 欧美aa在线视频| 国产精品青草综合久久久久99| 色偷偷久久一区二区三区| 午夜精品成人在线| 国产视频在线观看一区二区三区 | 欧美三级资源在线| 激情综合五月天| 亚洲乱码中文字幕综合| 91精品国产综合久久蜜臀| 国产成人在线视频网址| 亚洲综合小说图片| 久久综合国产精品| 欧洲中文字幕精品| 国产高清成人在线| 婷婷开心激情综合| 国产精品视频在线看| 欧美乱妇15p| 不卡视频一二三| 青青国产91久久久久久| 中文字幕在线一区二区三区| 欧美一区二区性放荡片| heyzo一本久久综合| 欧美96一区二区免费视频| 国产精品久久久久久久久久免费看| 在线播放中文字幕一区| 成人99免费视频| 老司机午夜精品| 亚洲国产精品久久久男人的天堂| 国产日产精品一区| 欧美一区二区三区的| 91色在线porny| 粉嫩av一区二区三区在线播放| 天堂一区二区在线免费观看| 国产精品妹子av| 精品国产乱码久久久久久图片 | 欧美日韩激情一区二区三区| 国产成人在线电影| 日韩电影免费一区| 夜夜嗨av一区二区三区| 日本一区二区三区四区在线视频| 日韩一区二区视频| 欧美日韩一区在线观看| 成人福利视频网站| 国产主播一区二区| 人人精品人人爱| 午夜精品久久久久久久久久| 亚洲精品久久嫩草网站秘色| 欧美经典一区二区| 精品国产精品网麻豆系列| 日韩一区二区三区在线| 欧美日韩一区高清| 欧日韩精品视频| 色香蕉成人二区免费| 99国产精品视频免费观看| 岛国一区二区三区| 国产精品一二三四区| 国产乱人伦偷精品视频不卡|