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

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

?? insert.c

?? 調用sqlite開源數據的小程序
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*** 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 INSERT statements in SQLite.**** $Id: insert.c,v 1.143 2005/09/20 17:42:23 drh Exp $*/#include "sqliteInt.h"/*** Set P3 of the most recently inserted opcode to a column affinity** string for index pIdx. A column affinity string has one character** for each column in the table, according to the affinity of the column:****  Character      Column affinity**  ------------------------------**  'n'            NUMERIC**  'i'            INTEGER**  't'            TEXT**  'o'            NONE*/void sqlite3IndexAffinityStr(Vdbe *v, Index *pIdx){  if( !pIdx->zColAff ){    /* The first time a column affinity string for a particular index is    ** required, it is allocated and populated here. It is then stored as    ** a member of the Index structure for subsequent use.    **    ** The column affinity string will eventually be deleted by    ** sqliteDeleteIndex() when the Index structure itself is cleaned    ** up.    */    int n;    Table *pTab = pIdx->pTable;    pIdx->zColAff = (char *)sqliteMalloc(pIdx->nColumn+1);    if( !pIdx->zColAff ){      return;    }    for(n=0; n<pIdx->nColumn; n++){      pIdx->zColAff[n] = pTab->aCol[pIdx->aiColumn[n]].affinity;    }    pIdx->zColAff[pIdx->nColumn] = '\0';  }   sqlite3VdbeChangeP3(v, -1, pIdx->zColAff, 0);}/*** Set P3 of the most recently inserted opcode to a column affinity** string for table pTab. A column affinity string has one character** for each column indexed by the index, according to the affinity of the** column:****  Character      Column affinity**  ------------------------------**  'n'            NUMERIC**  'i'            INTEGER**  't'            TEXT**  'o'            NONE*/void sqlite3TableAffinityStr(Vdbe *v, Table *pTab){  /* The first time a column affinity string for a particular table  ** is required, it is allocated and populated here. It is then   ** stored as a member of the Table structure for subsequent use.  **  ** The column affinity string will eventually be deleted by  ** sqlite3DeleteTable() when the Table structure itself is cleaned up.  */  if( !pTab->zColAff ){    char *zColAff;    int i;    zColAff = (char *)sqliteMalloc(pTab->nCol+1);    if( !zColAff ){      return;    }    for(i=0; i<pTab->nCol; i++){      zColAff[i] = pTab->aCol[i].affinity;    }    zColAff[pTab->nCol] = '\0';    pTab->zColAff = zColAff;  }  sqlite3VdbeChangeP3(v, -1, pTab->zColAff, 0);}/*** Return non-zero if SELECT statement p opens the table with rootpage** iTab in database iDb.  This is used to see if a statement of the form ** "INSERT INTO <iDb, iTab> SELECT ..." can run without using temporary** table for the results of the SELECT. **** No checking is done for sub-selects that are part of expressions.*/static int selectReadsTable(Select *p, int iDb, int iTab){  int i;  struct SrcList_item *pItem;  if( p->pSrc==0 ) return 0;  for(i=0, pItem=p->pSrc->a; i<p->pSrc->nSrc; i++, pItem++){    if( pItem->pSelect ){      if( selectReadsTable(pItem->pSelect, iDb, iTab) ) return 1;    }else{      if( pItem->pTab->iDb==iDb && pItem->pTab->tnum==iTab ) return 1;    }  }  return 0;}/*** This routine is call to handle SQL of the following forms:****    insert into TABLE (IDLIST) values(EXPRLIST)**    insert into TABLE (IDLIST) select**** The IDLIST following the table name is always optional.  If omitted,** then a list of all columns for the table is substituted.  The IDLIST** appears in the pColumn parameter.  pColumn is NULL if IDLIST is omitted.**** The pList parameter holds EXPRLIST in the first form of the INSERT** statement above, and pSelect is NULL.  For the second form, pList is** NULL and pSelect is a pointer to the select statement used to generate** data for the insert.**** The code generated follows one of three templates.  For a simple** select with data coming from a VALUES clause, the code executes** once straight down through.  The template looks like this:****         open write cursor to <table> and its indices**         puts VALUES clause expressions onto the stack**         write the resulting record into <table>**         cleanup**** If the statement is of the form****   INSERT INTO <table> SELECT ...**** And the SELECT clause does not read from <table> at any time, then** the generated code follows this template:****         goto B**      A: setup for the SELECT**         loop over the tables in the SELECT**           gosub C**         end loop**         cleanup after the SELECT**         goto D**      B: open write cursor to <table> and its indices**         goto A**      C: insert the select result into <table>**         return**      D: cleanup**** The third template is used if the insert statement takes its** values from a SELECT but the data is being inserted into a table** that is also read as part of the SELECT.  In the third form,** we have to use a intermediate table to store the results of** the select.  The template is like this:****         goto B**      A: setup for the SELECT**         loop over the tables in the SELECT**           gosub C**         end loop**         cleanup after the SELECT**         goto D**      C: insert the select result into the intermediate table**         return**      B: open a cursor to an intermediate table**         goto A**      D: open write cursor to <table> and its indices**         loop over the intermediate table**           transfer values form intermediate table into <table>**         end the loop**         cleanup*/void sqlite3Insert(  Parse *pParse,        /* Parser context */  SrcList *pTabList,    /* Name of table into which we are inserting */  ExprList *pList,      /* List of values to be inserted */  Select *pSelect,      /* A SELECT statement to use as the data source */  IdList *pColumn,      /* Column names corresponding to IDLIST. */  int onError           /* How to handle constraint errors */){  Table *pTab;          /* The table to insert into */  char *zTab;           /* Name of the table into which we are inserting */  const char *zDb;      /* Name of the database holding this table */  int i, j, idx;        /* Loop counters */  Vdbe *v;              /* Generate code into this virtual machine */  Index *pIdx;          /* For looping over indices of the table */  int nColumn;          /* Number of columns in the data */  int base = 0;         /* VDBE Cursor number for pTab */  int iCont=0,iBreak=0; /* Beginning and end of the loop over srcTab */  sqlite3 *db;          /* The main database structure */  int keyColumn = -1;   /* Column that is the INTEGER PRIMARY KEY */  int endOfLoop;        /* Label for the end of the insertion loop */  int useTempTable = 0; /* Store SELECT results in intermediate table */  int srcTab = 0;       /* Data comes from this temporary cursor if >=0 */  int iSelectLoop = 0;  /* Address of code that implements the SELECT */  int iCleanup = 0;     /* Address of the cleanup code */  int iInsertBlock = 0; /* Address of the subroutine used to insert data */  int iCntMem = 0;      /* Memory cell used for the row counter */  int newIdx = -1;      /* Cursor for the NEW table */  Db *pDb;              /* The database containing table being inserted into */  int counterMem = 0;   /* Memory cell holding AUTOINCREMENT counter */#ifndef SQLITE_OMIT_TRIGGER  int isView;                 /* True if attempting to insert into a view */  int triggers_exist = 0;     /* True if there are FOR EACH ROW triggers */#endif#ifndef SQLITE_OMIT_AUTOINCREMENT  int counterRowid;     /* Memory cell holding rowid of autoinc counter */#endif  if( pParse->nErr || sqlite3_malloc_failed ) goto insert_cleanup;  db = pParse->db;  /* Locate the table into which we will be inserting new information.  */  assert( pTabList->nSrc==1 );  zTab = pTabList->a[0].zName;  if( zTab==0 ) goto insert_cleanup;  pTab = sqlite3SrcListLookup(pParse, pTabList);  if( pTab==0 ){    goto insert_cleanup;  }  assert( pTab->iDb<db->nDb );  pDb = &db->aDb[pTab->iDb];  zDb = pDb->zName;  if( sqlite3AuthCheck(pParse, SQLITE_INSERT, pTab->zName, 0, zDb) ){    goto insert_cleanup;  }  /* Figure out if we have any triggers and if the table being  ** inserted into is a view  */#ifndef SQLITE_OMIT_TRIGGER  triggers_exist = sqlite3TriggersExist(pParse, pTab, TK_INSERT, 0);  isView = pTab->pSelect!=0;#else# define triggers_exist 0# define isView 0#endif#ifdef SQLITE_OMIT_VIEW# undef isView# define isView 0#endif  /* Ensure that:  *  (a) the table is not read-only,   *  (b) that if it is a view then ON INSERT triggers exist  */  if( sqlite3IsReadOnly(pParse, pTab, triggers_exist) ){    goto insert_cleanup;  }  if( pTab==0 ) goto insert_cleanup;  /* If pTab is really a view, make sure it has been initialized.  */  if( isView && sqlite3ViewGetColumnNames(pParse, pTab) ){    goto insert_cleanup;  }  /* Ensure all required collation sequences are available. */  for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){    if( sqlite3CheckIndexCollSeq(pParse, pIdx) ){      goto insert_cleanup;    }  }  /* Allocate a VDBE  */  v = sqlite3GetVdbe(pParse);  if( v==0 ) goto insert_cleanup;  if( pParse->nested==0 ) sqlite3VdbeCountChanges(v);  sqlite3BeginWriteOperation(pParse, pSelect || triggers_exist, pTab->iDb);  /* if there are row triggers, allocate a temp table for new.* references. */  if( triggers_exist ){    newIdx = pParse->nTab++;  }#ifndef SQLITE_OMIT_AUTOINCREMENT  /* If this is an AUTOINCREMENT table, look up the sequence number in the  ** sqlite_sequence table and store it in memory cell counterMem.  Also  ** remember the rowid of the sqlite_sequence table entry in memory cell  ** counterRowid.  */  if( pTab->autoInc ){    int iCur = pParse->nTab;    int base = sqlite3VdbeCurrentAddr(v);    counterRowid = pParse->nMem++;    counterMem = pParse->nMem++;    sqlite3VdbeAddOp(v, OP_Integer, pTab->iDb, 0);    sqlite3VdbeAddOp(v, OP_OpenRead, iCur, pDb->pSeqTab->tnum);    sqlite3VdbeAddOp(v, OP_SetNumColumns, iCur, 2);    sqlite3VdbeAddOp(v, OP_Rewind, iCur, base+13);    sqlite3VdbeAddOp(v, OP_Column, iCur, 0);    sqlite3VdbeOp3(v, OP_String8, 0, 0, pTab->zName, 0);    sqlite3VdbeAddOp(v, OP_Ne, 28417, base+12);    sqlite3VdbeAddOp(v, OP_Rowid, iCur, 0);    sqlite3VdbeAddOp(v, OP_MemStore, counterRowid, 1);    sqlite3VdbeAddOp(v, OP_Column, iCur, 1);    sqlite3VdbeAddOp(v, OP_MemStore, counterMem, 1);    sqlite3VdbeAddOp(v, OP_Goto, 0, base+13);    sqlite3VdbeAddOp(v, OP_Next, iCur, base+4);    sqlite3VdbeAddOp(v, OP_Close, iCur, 0);  }#endif /* SQLITE_OMIT_AUTOINCREMENT */  /* Figure out how many columns of data are supplied.  If the data  ** is coming from a SELECT statement, then this step also generates  ** all the code to implement the SELECT statement and invoke a subroutine  ** to process each row of the result. (Template 2.) If the SELECT  ** statement uses the the table that is being inserted into, then the  ** subroutine is also coded here.  That subroutine stores the SELECT  ** results in a temporary table. (Template 3.)  */  if( pSelect ){    /* Data is coming from a SELECT.  Generate code to implement that SELECT    */    int rc, iInitCode;    iInitCode = sqlite3VdbeAddOp(v, OP_Goto, 0, 0);    iSelectLoop = sqlite3VdbeCurrentAddr(v);    iInsertBlock = sqlite3VdbeMakeLabel(v);    /* Resolve the expressions in the SELECT statement and execute it. */    rc = sqlite3Select(pParse, pSelect, SRT_Subroutine, iInsertBlock,0,0,0,0);    if( rc || pParse->nErr || sqlite3_malloc_failed ) goto insert_cleanup;    iCleanup = sqlite3VdbeMakeLabel(v);    sqlite3VdbeAddOp(v, OP_Goto, 0, iCleanup);    assert( pSelect->pEList );    nColumn = pSelect->pEList->nExpr;    /* Set useTempTable to TRUE if the result of the SELECT statement    ** should be written into a temporary table.  Set to FALSE if each    ** row of the SELECT can be written directly into the result table.    **    ** A temp table must be used if the table being updated is also one    ** of the tables being read by the SELECT statement.  Also use a     ** temp table in the case of row triggers.    */    if( triggers_exist || selectReadsTable(pSelect, pTab->iDb, pTab->tnum) ){      useTempTable = 1;    }    if( useTempTable ){      /* Generate the subroutine that SELECT calls to process each row of      ** the result.  Store the result in a temporary table      */      srcTab = pParse->nTab++;      sqlite3VdbeResolveLabel(v, iInsertBlock);      sqlite3VdbeAddOp(v, OP_MakeRecord, nColumn, 0);      sqlite3TableAffinityStr(v, pTab);      sqlite3VdbeAddOp(v, OP_NewRowid, srcTab, 0);      sqlite3VdbeAddOp(v, OP_Pull, 1, 0);      sqlite3VdbeAddOp(v, OP_Insert, srcTab, 0);      sqlite3VdbeAddOp(v, OP_Return, 0, 0);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
中日韩av电影| 久久69国产一区二区蜜臀| 亚洲高清在线精品| 国产专区欧美精品| 欧美性欧美巨大黑白大战| 精品久久久久香蕉网| 亚洲自拍偷拍综合| 波波电影院一区二区三区| 日韩欧美成人午夜| 午夜久久电影网| 色94色欧美sute亚洲线路一ni| 久久久久久亚洲综合| 日韩精品一卡二卡三卡四卡无卡| 91小视频免费看| 国产精品区一区二区三区| 国内精品第一页| 6080国产精品一区二区| 亚洲国产综合色| 色噜噜夜夜夜综合网| 国产精品久久夜| 成人精品电影在线观看| 国产日韩精品一区| 国产精品自在在线| 久久免费看少妇高潮| 国产一区欧美日韩| 久久亚区不卡日本| 激情偷乱视频一区二区三区| 7777精品伊人久久久大香线蕉的 | 欧美国产乱子伦| 狠狠色2019综合网| 欧美成人一区二区三区片免费| 亚洲成av人片www| 在线不卡一区二区| 美女视频黄频大全不卡视频在线播放| 欧美日韩视频专区在线播放| 亚洲国产精品久久久男人的天堂| 欧美日韩激情在线| 人禽交欧美网站| 欧美精品一区二区三区蜜臀| 国产精品综合二区| 亚洲视频在线一区观看| 91福利在线观看| 首页综合国产亚洲丝袜| 日韩欧美国产综合| 国产一区二区三区不卡在线观看| 久久精品视频在线免费观看| 丁香婷婷综合色啪| 亚洲黄色在线视频| 91精品国产综合久久精品app| 青青草国产成人99久久| 久久亚洲二区三区| 91丝袜高跟美女视频| 午夜欧美一区二区三区在线播放| 欧美一区二区观看视频| 国产成都精品91一区二区三| 亚洲欧洲中文日韩久久av乱码| 91激情在线视频| 久久国产视频网| 国产精品久久久久影院| 欧美日本国产一区| 国产成人夜色高潮福利影视| 一区二区视频在线| 欧美精品一区二区在线播放| 日本韩国欧美一区| 久久激五月天综合精品| 亚洲欧美日韩中文字幕一区二区三区 | 久久伊人中文字幕| 色综合久久综合网97色综合| 日韩黄色免费网站| 欧美国产日本韩| 欧美一级日韩免费不卡| 成人精品视频一区二区三区| 亚洲va在线va天堂| 国产午夜精品久久久久久免费视| 一本色道久久综合亚洲精品按摩| 久久国产三级精品| 亚洲综合色在线| 久久影院午夜论| 8x8x8国产精品| 99久久久久免费精品国产| 青青草91视频| 一区二区三区四区在线播放| 亚洲精品在线三区| 欧美精品色一区二区三区| 成人成人成人在线视频| 国产一区二区精品久久91| 午夜免费欧美电影| 亚洲主播在线播放| 国产精品久久久久婷婷| 久久美女艺术照精彩视频福利播放| 在线亚洲免费视频| 99久久精品国产观看| 国产乱码精品一品二品| 秋霞成人午夜伦在线观看| 亚洲电影你懂得| 亚洲欧美另类在线| 中文乱码免费一区二区| 久久久久免费观看| 久久色视频免费观看| 精品久久久久久久久久久久久久久 | 日韩电影在线免费看| 亚洲精品视频自拍| 亚洲三级小视频| 中文字幕视频一区二区三区久| 久久久久国产精品厨房| 26uuu精品一区二区在线观看| 制服丝袜激情欧洲亚洲| 欧美福利视频导航| 6080午夜不卡| 欧美大片日本大片免费观看| 日韩精品专区在线影院观看 | 欧美系列在线观看| 欧美最新大片在线看| 欧美三区在线观看| 欧美日韩在线亚洲一区蜜芽| 在线观看中文字幕不卡| 欧美性受xxxx黑人xyx| 欧美色图片你懂的| 欧美高清视频一二三区| 欧美一区二区免费视频| 欧美成人女星排名| 中文av一区特黄| 一级日本不卡的影视| 亚洲一区二区三区小说| 日韩精品电影一区亚洲| 国产一区在线看| 色综合天天综合网天天看片| 欧美在线一区二区| 日韩精品一区二| 国产欧美一区二区精品性色超碰| 中文字幕的久久| 亚洲一区视频在线| 另类小说综合欧美亚洲| 国产精品亚洲人在线观看| 99综合影院在线| 欧美日韩国产影片| 2020日本不卡一区二区视频| 欧美国产一区二区| 亚洲一区二区三区三| 韩国v欧美v亚洲v日本v| 成人黄色片在线观看| 欧美日韩国产高清一区二区| 精品国产91乱码一区二区三区 | 在线观看视频91| 91精品国产综合久久久蜜臀粉嫩| 久久久久97国产精华液好用吗| 中文字幕一区二区三区四区 | 久久一二三国产| 亚洲人吸女人奶水| 精品影视av免费| 色8久久人人97超碰香蕉987| 日韩欧美不卡在线观看视频| 亚洲三级电影网站| 精品一区二区综合| 在线看日本不卡| 久久久久久久久99精品| 亚洲午夜私人影院| 岛国av在线一区| 91精品国产综合久久福利| 亚洲欧洲精品一区二区三区 | 色婷婷精品久久二区二区蜜臀av | 91精品国产欧美日韩| 国产精品对白交换视频| 免费av网站大全久久| 日本道精品一区二区三区| 久久综合九色综合欧美就去吻| 亚洲综合在线视频| av亚洲产国偷v产偷v自拍| 欧美v亚洲v综合ⅴ国产v| 天涯成人国产亚洲精品一区av| 不卡视频在线看| 国产拍欧美日韩视频二区| 日韩国产一区二| 欧美日韩一区视频| 亚洲欧美国产高清| 成人国产在线观看| 久久综合中文字幕| 久久福利资源站| 欧美精品v国产精品v日韩精品| 综合久久一区二区三区| 成人一区二区三区| 久久美女高清视频| 久久成人免费电影| 欧美电视剧免费全集观看| 日韩二区在线观看| 91精品国产欧美一区二区成人| 亚洲一区在线免费观看| 欧美综合一区二区| 亚洲综合清纯丝袜自拍| 91香蕉视频污| 亚洲男人电影天堂| 91美女精品福利| 亚洲免费观看高清完整版在线观看| 国产a区久久久| 中文字幕av不卡| 不卡av电影在线播放| 日韩一区欧美小说| 日本高清视频一区二区| 亚洲自拍偷拍麻豆| 欧美一区二区三区白人|