亚洲欧美第一页_禁久久精品乱码_粉嫩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.164 2006/03/15 16:26:10 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**  ------------------------------**  'a'            TEXT**  'b'            NONE**  'c'            NUMERIC**  'd'            INTEGER**  'e'            REAL*/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**  ------------------------------**  'a'            TEXT**  'b'            NONE**  'c'            NUMERIC**  'd'            INTEGER**  'e'            REAL*/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, Schema *pSchema, 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, pSchema, iTab) ) return 1;    }else{      if( pItem->pTab->pSchema==pSchema && 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 */  int iDb;#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 = 0;  /* Memory cell holding rowid of autoinc counter */#endif  if( pParse->nErr || sqlite3MallocFailed() ){    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;  }  iDb = sqlite3SchemaToIndex(db, pTab->pSchema);  assert( iDb<db->nDb );  pDb = &db->aDb[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;  }  assert( pTab!=0 );  /* If pTab is really a view, make sure it has been initialized.  */  if( isView && sqlite3ViewGetColumnNames(pParse, pTab) ){    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, 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 addr = sqlite3VdbeCurrentAddr(v);    counterRowid = pParse->nMem++;    counterMem = pParse->nMem++;    sqlite3OpenTable(pParse, iCur, iDb, pDb->pSchema->pSeqTab, OP_OpenRead);    sqlite3VdbeAddOp(v, OP_Rewind, iCur, addr+13);    sqlite3VdbeAddOp(v, OP_Column, iCur, 0);    sqlite3VdbeOp3(v, OP_String8, 0, 0, pTab->zName, 0);    sqlite3VdbeAddOp(v, OP_Ne, 0x100, addr+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, addr+13);    sqlite3VdbeAddOp(v, OP_Next, iCur, addr+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 || sqlite3MallocFailed() ){      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->pSchema,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);      sqlite3VdbeAddOp(v, OP_NewRowid, srcTab, 0);      sqlite3VdbeAddOp(v, OP_Pull, 1, 0);      sqlite3VdbeAddOp(v, OP_Insert, srcTab, 0);      sqlite3VdbeAddOp(v, OP_Return, 0, 0);      /* The following code runs first because the GOTO at the very top      ** of the program jumps to it.  Create the temporary table, then jump      ** back up and execute the SELECT code above.      */      sqlite3VdbeJumpHere(v, iInitCode);      sqlite3VdbeAddOp(v, OP_OpenVirtual, srcTab, 0);      sqlite3VdbeAddOp(v, OP_SetNumColumns, srcTab, nColumn);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲视频香蕉人妖| 日韩免费高清av| 国产精品一区二区你懂的| 全国精品久久少妇| 蜜臀久久久久久久| 激情久久五月天| 国产一区二区三区在线观看精品 | 亚洲天天做日日做天天谢日日欢 | 国产香蕉久久精品综合网| 欧美精品一区二区在线播放| 日韩欧美一二三区| 日韩三级av在线播放| 91精品国产乱码久久蜜臀| 91精品蜜臀在线一区尤物| 91精品国产黑色紧身裤美女| 欧美一区三区二区| 精品久久国产老人久久综合| 国产欧美一区二区精品性| 中文字幕一区二区日韩精品绯色| 亚洲免费av在线| 日韩电影在线观看电影| 麻豆国产欧美一区二区三区| 激情深爱一区二区| 9l国产精品久久久久麻豆| 在线精品视频免费观看| 日韩午夜在线影院| 中文字幕成人av| 亚洲bdsm女犯bdsm网站| 国产制服丝袜一区| 欧美亚一区二区| 精品对白一区国产伦| 一区二区三区中文字幕| 激情欧美日韩一区二区| 欧美亚洲国产一区二区三区| 精品国产乱码久久久久久蜜臀| 国产精品成人网| 另类人妖一区二区av| 色偷偷一区二区三区| 欧美变态tickling挠脚心| 亚洲欧洲中文日韩久久av乱码| 免费看精品久久片| av一区二区三区| 精品福利av导航| 亚洲一区欧美一区| 国产成人99久久亚洲综合精品| 欧美亚洲日本一区| 国产精品乱人伦中文| 日韩av一区二区三区四区| 成人国产精品免费观看| 日韩一区二区三区电影| 亚洲成人av福利| 91在线国产观看| 国产午夜精品久久| 蜜臀久久久99精品久久久久久| 91影视在线播放| 国产亚洲一区二区在线观看| 日韩黄色免费网站| 91色在线porny| 国产欧美一区视频| 免费美女久久99| 在线不卡中文字幕| 亚洲视频一区在线| 成人h版在线观看| 亚洲精品一区二区三区影院| 日韩高清一区在线| 欧美日韩精品久久久| 亚洲四区在线观看| 成人av电影观看| 久久久久99精品国产片| 国产一区二区三区在线观看精品 | 国产一区二区网址| 精品国产三级电影在线观看| 蜜桃久久久久久| 欧美日韩小视频| 亚洲一区二区欧美日韩| 欧美性猛片aaaaaaa做受| 亚洲精品免费播放| 在线观看不卡视频| 亚洲mv在线观看| 日韩欧美国产精品| 国内精品视频666| 欧美www视频| 久久国产人妖系列| 欧美va亚洲va在线观看蝴蝶网| 久久99久久精品欧美| 精品免费视频一区二区| 黑人精品欧美一区二区蜜桃 | 中文字幕一区二区三区视频| www.一区二区| 亚洲韩国精品一区| 日韩欧美自拍偷拍| 国产一区 二区| 亚洲欧美自拍偷拍| 9191久久久久久久久久久| 蜜臀久久久久久久| 中文字幕中文字幕一区| 欧美在线一二三| 青青草97国产精品免费观看 | 欧美精品一区二区久久婷婷| 国产精品资源在线观看| 亚洲免费在线电影| 精品少妇一区二区三区日产乱码| 国产成人久久精品77777最新版本 国产成人鲁色资源国产91色综 | 欧美色精品在线视频| 免费观看成人av| 国产精品理伦片| 欧美一区日韩一区| 国产99久久久国产精品潘金| 亚洲一区二区欧美| 国产精品青草综合久久久久99| 欧美视频在线观看一区| 韩国一区二区三区| 亚洲伊人伊色伊影伊综合网| 久久在线观看免费| 欧美男同性恋视频网站| 丰满白嫩尤物一区二区| 美女网站在线免费欧美精品| 亚洲欧美日韩成人高清在线一区| 欧美一区二区三区在线视频| 色呦呦一区二区三区| 国产美女一区二区| 日韩电影在线观看电影| 一区二区三区毛片| 欧美国产激情一区二区三区蜜月 | 国产乱国产乱300精品| 亚洲一区成人在线| 亚洲欧洲av在线| 国产拍揄自揄精品视频麻豆| 日韩欧美久久一区| 在线视频国内一区二区| 国产91精品一区二区麻豆网站| 日本在线不卡一区| 亚洲成人av一区二区三区| 亚洲欧美经典视频| 国产精品蜜臀av| 国产农村妇女毛片精品久久麻豆| 91精品国产手机| 欧美日韩精品一区二区三区 | 欧美日韩国产高清一区| 99久久精品费精品国产一区二区| 国产在线视频一区二区| 老色鬼精品视频在线观看播放| 夜夜操天天操亚洲| 亚洲永久精品国产| 亚洲精品成a人| 亚洲人亚洲人成电影网站色| 日本一区二区电影| 国产精品久久久久毛片软件| 中文字幕一区免费在线观看 | 欧美色成人综合| 欧美色图在线观看| 欧美在线影院一区二区| 欧美影院精品一区| 欧美日韩在线电影| 欧美裸体bbwbbwbbw| 欧美性大战久久久| 欧美日韩成人在线| 69堂亚洲精品首页| 日韩视频在线永久播放| 精品欧美一区二区久久| 国产日韩精品一区| 成人欧美一区二区三区黑人麻豆| 中文字幕一区三区| 亚洲一二三区在线观看| 天堂蜜桃91精品| 国产在线视视频有精品| 99久久精品国产一区| 日本丰满少妇一区二区三区| 欧美美女黄视频| 久久久精品国产99久久精品芒果| 国产精品久久久久久久久免费桃花| 亚洲欧美日韩久久精品| 亚洲成av人片在线观看无码| 久久精品久久精品| av激情成人网| 51精品视频一区二区三区| 久久影院午夜论| 亚洲一区二区三区三| 精品一区二区三区久久久| 波多野结衣中文字幕一区二区三区 | 奇米色777欧美一区二区| 国产一区视频在线看| 一本色道亚洲精品aⅴ| 欧美日韩在线综合| 国产日韩在线不卡| 亚洲国产成人va在线观看天堂| 久久精品噜噜噜成人88aⅴ| 91在线精品一区二区三区| 日韩一区二区电影网| 最新久久zyz资源站| 日韩成人免费在线| 99久久久精品免费观看国产蜜| 欧美一区二区三区视频| 国产精品理伦片| 九色综合狠狠综合久久| 日本乱码高清不卡字幕| 国产午夜精品在线观看| 蜜桃视频在线一区| 欧美午夜寂寞影院| 国产精品国产三级国产a|