亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
欧美日韩精品专区| 一区二区三区四区高清精品免费观看| 日韩欧美国产高清| 911精品国产一区二区在线| 在线看国产一区二区| 日本韩国欧美在线| 色吧成人激情小说| 在线观看三级视频欧美| 精品视频在线免费观看| 欧美日韩免费不卡视频一区二区三区| 96av麻豆蜜桃一区二区| 91久久精品一区二区| 欧美日韩一区中文字幕| 欧美日韩国产大片| 制服丝袜中文字幕亚洲| 欧美一区二区啪啪| 精品久久国产字幕高潮| 久久精品亚洲精品国产欧美| 国产日韩欧美a| 国产精品私人自拍| 亚洲综合男人的天堂| 日韩国产欧美在线视频| 久久精品国产第一区二区三区| 国产伦精品一区二区三区在线观看| 国产综合色在线| 国产69精品久久99不卡| 99在线精品视频| 欧美在线观看视频一区二区三区| 欧美视频一区在线| 日韩欧美在线网站| 国产三级精品三级| 亚洲日本va午夜在线电影| 一区二区三区四区国产精品| 青青草国产成人av片免费| 国产一区二区三区免费看| av不卡在线播放| 欧美情侣在线播放| 久久青草国产手机看片福利盒子 | 亚洲视频在线观看三级| 亚洲精品免费在线| 蜜臀av一区二区在线观看| 国产精品一区二区无线| 95精品视频在线| 日韩一区二区三区视频在线观看| 国产农村妇女毛片精品久久麻豆| 亚洲一区二区三区视频在线播放| 捆绑调教一区二区三区| 国产91精品在线观看| 在线日韩av片| 国产欧美一区二区精品性| 亚洲国产cao| 国产呦萝稀缺另类资源| 欧美主播一区二区三区美女| 欧美精品一区二区高清在线观看| 自拍视频在线观看一区二区| 美女视频免费一区| 97久久精品人人做人人爽50路| 欧美一区二区在线观看| 自拍偷拍国产精品| 国产精品自拍毛片| 91精品国产91热久久久做人人| 国产日韩欧美麻豆| 久久精品国产一区二区三| 91麻豆福利精品推荐| 精品少妇一区二区三区日产乱码| 亚洲主播在线观看| 国产高清精品久久久久| 91精品国产一区二区三区蜜臀 | 国产亚洲欧美激情| 亚洲动漫第一页| 成人手机电影网| 欧美精品一区视频| 免费人成精品欧美精品| 色综合天天性综合| 国产亚洲一区二区三区四区| 日本视频免费一区| 在线观看视频一区二区| 国产精品久久久久久久久免费丝袜 | 一区二区三区视频在线看| 国产精品77777| 91精品国产91久久久久久最新毛片| 亚洲美女电影在线| 成人免费三级在线| 久久久精品免费网站| 午夜精品一区在线观看| 色婷婷激情综合| ...中文天堂在线一区| 国产成人综合网站| 精品对白一区国产伦| 蜜臀91精品一区二区三区| 欧美日韩一级黄| 一区二区三区高清在线| 91亚洲资源网| 1000精品久久久久久久久| 成人精品一区二区三区四区| 国产色91在线| 岛国一区二区在线观看| 国产亚洲综合在线| 高清不卡一二三区| 国产喷白浆一区二区三区| 激情都市一区二区| 精品久久久久久无| 国产综合色在线| 久久噜噜亚洲综合| 国产精品538一区二区在线| 久久久综合网站| 大尺度一区二区| 国产农村妇女精品| 99国产精品99久久久久久| 亚洲三级电影网站| 欧美影院一区二区| 亚洲线精品一区二区三区八戒| 欧美三级日韩三级国产三级| 亚洲电影第三页| 欧美疯狂做受xxxx富婆| 奇米综合一区二区三区精品视频 | 亚洲美女视频在线观看| 91视频你懂的| 亚洲国产裸拍裸体视频在线观看乱了 | 激情五月激情综合网| 精品处破学生在线二十三| 国产一区 二区| 最近中文字幕一区二区三区| 91黄视频在线| 五月综合激情婷婷六月色窝| 日韩免费看的电影| 国产suv精品一区二区6| 综合自拍亚洲综合图不卡区| 欧美午夜电影在线播放| 日本欧美加勒比视频| 欧美不卡一二三| 成人综合在线视频| 亚洲欧美一区二区久久| 欧美高清视频在线高清观看mv色露露十八 | 欧美色区777第一页| 日本不卡高清视频| 久久久亚洲午夜电影| 99麻豆久久久国产精品免费优播| 亚洲成a人片在线观看中文| 91精品国产91久久综合桃花| 国产电影精品久久禁18| 一区二区在线观看视频在线观看| 制服丝袜一区二区三区| 国产成人在线影院| 亚洲国产精品久久人人爱蜜臀| 欧美sm美女调教| 99精品视频一区二区| 日韩激情一二三区| 欧美激情自拍偷拍| 欧美精品自拍偷拍| 国产一区二区网址| 一区二区三区 在线观看视频| 精品人在线二区三区| 99久久久国产精品| 久久国产人妖系列| 亚洲欧美视频在线观看视频| 日韩一区二区三区av| 一本大道久久a久久精品综合| 免费高清在线视频一区·| 国产精品久久精品日日| 欧美xfplay| 欧美亚洲国产bt| 顶级嫩模精品视频在线看| 婷婷成人综合网| 中文字幕字幕中文在线中不卡视频| 欧美一区国产二区| 99久久精品免费看国产免费软件| 久久精品国产亚洲高清剧情介绍 | 婷婷夜色潮精品综合在线| 国产亚洲女人久久久久毛片| 精品视频在线免费看| 成人免费毛片片v| 久久国产欧美日韩精品| 亚洲第一综合色| 亚洲视频一区二区在线| 国产日韩欧美一区二区三区综合| 这里只有精品免费| 欧美伊人久久大香线蕉综合69| 成人三级在线视频| 国产自产高清不卡| 午夜日韩在线观看| 亚洲欧美激情插| 欧美国产一区在线| 亚洲精品一线二线三线无人区| 欧美日韩精品一二三区| 色狠狠色狠狠综合| 成人app网站| 国产激情一区二区三区| 美女视频黄 久久| 日韩影院精彩在线| 亚洲国产综合视频在线观看| 亚洲欧美经典视频| 中文字幕一区二区三区不卡在线| 久久亚洲私人国产精品va媚药| 欧美一区二区三区视频在线| 欧美午夜片在线看| 欧美性生活久久| 欧美色图第一页| 欧美日韩国产综合一区二区| 欧美综合亚洲图片综合区|