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

? 歡迎來(lái)到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? trigger.c

?? 新版輕量級(jí)嵌入式數(shù)據(jù)庫(kù)
?? C
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
/***** 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.*****************************************************************************/#include "sqliteInt.h"#ifndef SQLITE_OMIT_TRIGGER/*** Delete a linked list of TriggerStep structures.*/void sqlite3DeleteTriggerStep(TriggerStep *pTriggerStep){  while( pTriggerStep ){    TriggerStep * pTmp = pTriggerStep;    pTriggerStep = pTriggerStep->pNext;    if( pTmp->target.dyn ) sqliteFree((char*)pTmp->target.z);    sqlite3ExprDelete(pTmp->pWhere);    sqlite3ExprListDelete(pTmp->pExprList);    sqlite3SelectDelete(pTmp->pSelect);    sqlite3IdListDelete(pTmp->pIdList);    sqliteFree(pTmp);  }}/*** This is called by the parser when it sees a CREATE TRIGGER statement** up to the point of the BEGIN before the trigger actions.  A Trigger** structure is generated based on the information available and stored** in pParse->pNewTrigger.  After the trigger actions have been parsed, the** sqlite3FinishTrigger() function is called to complete the trigger** construction process.*/void sqlite3BeginTrigger(  Parse *pParse,      /* The parse context of the CREATE TRIGGER statement */  Token *pName1,      /* The name of the trigger */  Token *pName2,      /* The name of the trigger */  int tr_tm,          /* One of TK_BEFORE, TK_AFTER, TK_INSTEAD */  int op,             /* One of TK_INSERT, TK_UPDATE, TK_DELETE */  IdList *pColumns,   /* column list if this is an UPDATE OF trigger */  SrcList *pTableName,/* The name of the table/view the trigger applies to */  int foreach,        /* One of TK_ROW or TK_STATEMENT */  Expr *pWhen,        /* WHEN clause */  int isTemp          /* True if the TEMPORARY keyword is present */){  Trigger *pTrigger = 0;  Table *pTab;  char *zName = 0;        /* Name of the trigger */  sqlite3 *db = pParse->db;  int iDb;                /* The database to store the trigger in */  Token *pName;           /* The unqualified db name */  DbFixer sFix;  int iTabDb;  assert( pName1!=0 );   /* pName1->z might be NULL, but not pName1 itself */  assert( pName2!=0 );  if( isTemp ){    /* If TEMP was specified, then the trigger name may not be qualified. */    if( pName2->n>0 ){      sqlite3ErrorMsg(pParse, "temporary trigger may not have qualified name");      goto trigger_cleanup;    }    iDb = 1;    pName = pName1;  }else{    /* Figure out the db that the the trigger will be created in */    iDb = sqlite3TwoPartName(pParse, pName1, pName2, &pName);    if( iDb<0 ){      goto trigger_cleanup;    }  }  /* If the trigger name was unqualified, and the table is a temp table,  ** then set iDb to 1 to create the trigger in the temporary database.  ** If sqlite3SrcListLookup() returns 0, indicating the table does not  ** exist, the error is caught by the block below.  */  if( !pTableName || sqlite3MallocFailed() ){    goto trigger_cleanup;  }  pTab = sqlite3SrcListLookup(pParse, pTableName);  if( pName2->n==0 && pTab && pTab->pSchema==db->aDb[1].pSchema ){    iDb = 1;  }  /* Ensure the table name matches database name and that the table exists */  if( sqlite3MallocFailed() ) goto trigger_cleanup;  assert( pTableName->nSrc==1 );  if( sqlite3FixInit(&sFix, pParse, iDb, "trigger", pName) &&       sqlite3FixSrcList(&sFix, pTableName) ){    goto trigger_cleanup;  }  pTab = sqlite3SrcListLookup(pParse, pTableName);  if( !pTab ){    /* The table does not exist. */    goto trigger_cleanup;  }  /* Check that the trigger name is not reserved and that no trigger of the  ** specified name exists */  zName = sqlite3NameFromToken(pName);  if( !zName || SQLITE_OK!=sqlite3CheckObjectName(pParse, zName) ){    goto trigger_cleanup;  }  if( sqlite3HashFind(&(db->aDb[iDb].pSchema->trigHash), zName,strlen(zName)) ){    sqlite3ErrorMsg(pParse, "trigger %T already exists", pName);    goto trigger_cleanup;  }  /* Do not create a trigger on a system table */  if( sqlite3StrNICmp(pTab->zName, "sqlite_", 7)==0 ){    sqlite3ErrorMsg(pParse, "cannot create trigger on system table");    pParse->nErr++;    goto trigger_cleanup;  }  /* INSTEAD of triggers are only for views and views only support INSTEAD  ** of triggers.  */  if( pTab->pSelect && tr_tm!=TK_INSTEAD ){    sqlite3ErrorMsg(pParse, "cannot create %s trigger on view: %S",         (tr_tm == TK_BEFORE)?"BEFORE":"AFTER", pTableName, 0);    goto trigger_cleanup;  }  if( !pTab->pSelect && tr_tm==TK_INSTEAD ){    sqlite3ErrorMsg(pParse, "cannot create INSTEAD OF"        " trigger on table: %S", pTableName, 0);    goto trigger_cleanup;  }  iTabDb = sqlite3SchemaToIndex(db, pTab->pSchema);#ifndef SQLITE_OMIT_AUTHORIZATION  {    int code = SQLITE_CREATE_TRIGGER;    const char *zDb = db->aDb[iTabDb].zName;    const char *zDbTrig = isTemp ? db->aDb[1].zName : zDb;    if( iTabDb==1 || isTemp ) code = SQLITE_CREATE_TEMP_TRIGGER;    if( sqlite3AuthCheck(pParse, code, zName, pTab->zName, zDbTrig) ){      goto trigger_cleanup;    }    if( sqlite3AuthCheck(pParse, SQLITE_INSERT, SCHEMA_TABLE(iTabDb),0,zDb)){      goto trigger_cleanup;    }  }#endif  /* INSTEAD OF triggers can only appear on views and BEFORE triggers  ** cannot appear on views.  So we might as well translate every  ** INSTEAD OF trigger into a BEFORE trigger.  It simplifies code  ** elsewhere.  */  if (tr_tm == TK_INSTEAD){    tr_tm = TK_BEFORE;  }  /* Build the Trigger object */  pTrigger = (Trigger*)sqliteMalloc(sizeof(Trigger));  if( pTrigger==0 ) goto trigger_cleanup;  pTrigger->name = zName;  zName = 0;  pTrigger->table = sqliteStrDup(pTableName->a[0].zName);  pTrigger->pSchema = db->aDb[iDb].pSchema;  pTrigger->pTabSchema = pTab->pSchema;  pTrigger->op = op;  pTrigger->tr_tm = tr_tm==TK_BEFORE ? TRIGGER_BEFORE : TRIGGER_AFTER;  pTrigger->pWhen = sqlite3ExprDup(pWhen);  pTrigger->pColumns = sqlite3IdListDup(pColumns);  pTrigger->foreach = foreach;  sqlite3TokenCopy(&pTrigger->nameToken,pName);  assert( pParse->pNewTrigger==0 );  pParse->pNewTrigger = pTrigger;trigger_cleanup:  sqliteFree(zName);  sqlite3SrcListDelete(pTableName);  sqlite3IdListDelete(pColumns);  sqlite3ExprDelete(pWhen);  if( !pParse->pNewTrigger ){    sqlite3DeleteTrigger(pTrigger);  }else{    assert( pParse->pNewTrigger==pTrigger );  }}/*** This routine is called after all of the trigger actions have been parsed** in order to complete the process of building the trigger.*/void sqlite3FinishTrigger(  Parse *pParse,          /* Parser context */  TriggerStep *pStepList, /* The triggered program */  Token *pAll             /* Token that describes the complete CREATE TRIGGER */){  Trigger *pTrig = 0;     /* The trigger whose construction is finishing up */  sqlite3 *db = pParse->db;  /* The database */  DbFixer sFix;  int iDb;                   /* Database containing the trigger */  pTrig = pParse->pNewTrigger;  pParse->pNewTrigger = 0;  if( pParse->nErr || !pTrig ) goto triggerfinish_cleanup;  iDb = sqlite3SchemaToIndex(pParse->db, pTrig->pSchema);  pTrig->step_list = pStepList;  while( pStepList ){    pStepList->pTrig = pTrig;    pStepList = pStepList->pNext;  }  if( sqlite3FixInit(&sFix, pParse, iDb, "trigger", &pTrig->nameToken)           && sqlite3FixTriggerStep(&sFix, pTrig->step_list) ){    goto triggerfinish_cleanup;  }  /* if we are not initializing, and this trigger is not on a TEMP table,   ** build the sqlite_master entry  */  if( !db->init.busy ){    static const VdbeOpList insertTrig[] = {      { OP_NewRowid,   0, 0,  0          },      { OP_String8,    0, 0,  "trigger"  },      { OP_String8,    0, 0,  0          },  /* 2: trigger name */      { OP_String8,    0, 0,  0          },  /* 3: table name */      { OP_Integer,    0, 0,  0          },      { OP_String8,    0, 0,  "CREATE TRIGGER "},      { OP_String8,    0, 0,  0          },  /* 6: SQL */      { OP_Concat,     0, 0,  0          },       { OP_MakeRecord, 5, 0,  "aaada"    },      { OP_Insert,     0, 0,  0          },    };    int addr;    Vdbe *v;    /* Make an entry in the sqlite_master table */    v = sqlite3GetVdbe(pParse);    if( v==0 ) goto triggerfinish_cleanup;    sqlite3BeginWriteOperation(pParse, 0, iDb);    sqlite3OpenMasterTable(pParse, iDb);    addr = sqlite3VdbeAddOpList(v, ArraySize(insertTrig), insertTrig);    sqlite3VdbeChangeP3(v, addr+2, pTrig->name, 0);     sqlite3VdbeChangeP3(v, addr+3, pTrig->table, 0);     sqlite3VdbeChangeP3(v, addr+6, (char*)pAll->z, pAll->n);    sqlite3ChangeCookie(db, v, iDb);    sqlite3VdbeAddOp(v, OP_Close, 0, 0);    sqlite3VdbeOp3(v, OP_ParseSchema, iDb, 0,        sqlite3MPrintf("type='trigger' AND name='%q'", pTrig->name), P3_DYNAMIC);  }  if( db->init.busy ){    int n;    Table *pTab;    Trigger *pDel;    pDel = sqlite3HashInsert(&db->aDb[iDb].pSchema->trigHash,                      pTrig->name, strlen(pTrig->name), pTrig);    if( pDel ){      assert( sqlite3MallocFailed() && pDel==pTrig );      goto triggerfinish_cleanup;    }    n = strlen(pTrig->table) + 1;    pTab = sqlite3HashFind(&pTrig->pTabSchema->tblHash, pTrig->table, n);    assert( pTab!=0 );    pTrig->pNext = pTab->pTrigger;    pTab->pTrigger = pTrig;    pTrig = 0;  }triggerfinish_cleanup:  sqlite3DeleteTrigger(pTrig);  assert( !pParse->pNewTrigger );  sqlite3DeleteTriggerStep(pStepList);}/*** Make a copy of all components of the given trigger step.  This has** the effect of copying all Expr.token.z values into memory obtained** from sqliteMalloc().  As initially created, the Expr.token.z values** all point to the input string that was fed to the parser.  But that** string is ephemeral - it will go away as soon as the sqlite3_exec()** call that started the parser exits.  This routine makes a persistent** copy of all the Expr.token.z strings so that the TriggerStep structure** will be valid even after the sqlite3_exec() call returns.*/static void sqlitePersistTriggerStep(TriggerStep *p){  if( p->target.z ){    p->target.z = (u8*)sqliteStrNDup((char*)p->target.z, p->target.n);    p->target.dyn = 1;  }  if( p->pSelect ){    Select *pNew = sqlite3SelectDup(p->pSelect);    sqlite3SelectDelete(p->pSelect);    p->pSelect = pNew;  }  if( p->pWhere ){    Expr *pNew = sqlite3ExprDup(p->pWhere);    sqlite3ExprDelete(p->pWhere);    p->pWhere = pNew;  }  if( p->pExprList ){    ExprList *pNew = sqlite3ExprListDup(p->pExprList);    sqlite3ExprListDelete(p->pExprList);    p->pExprList = pNew;  }  if( p->pIdList ){    IdList *pNew = sqlite3IdListDup(p->pIdList);    sqlite3IdListDelete(p->pIdList);    p->pIdList = pNew;  }}/*** Turn a SELECT statement (that the pSelect parameter points to) into** a trigger step.  Return a pointer to a TriggerStep structure.**** The parser calls this routine when it finds a SELECT statement in** body of a TRIGGER.  */TriggerStep *sqlite3TriggerSelectStep(Select *pSelect){  TriggerStep *pTriggerStep = sqliteMalloc(sizeof(TriggerStep));  if( pTriggerStep==0 ) {    sqlite3SelectDelete(pSelect);    return 0;  }  pTriggerStep->op = TK_SELECT;  pTriggerStep->pSelect = pSelect;  pTriggerStep->orconf = OE_Default;  sqlitePersistTriggerStep(pTriggerStep);  return pTriggerStep;}/*** Build a trigger step out of an INSERT statement.  Return a pointer** to the new trigger step.**** The parser calls this routine when it sees an INSERT inside the** body of a trigger.*/TriggerStep *sqlite3TriggerInsertStep(  Token *pTableName,  /* Name of the table into which we insert */  IdList *pColumn,    /* List of columns in pTableName to insert into */  ExprList *pEList,   /* The VALUE clause: a list of values to be inserted */  Select *pSelect,    /* A SELECT statement that supplies values */  int orconf          /* The conflict algorithm (OE_Abort, OE_Replace, etc.) */){  TriggerStep *pTriggerStep = sqliteMalloc(sizeof(TriggerStep));  assert(pEList == 0 || pSelect == 0);  assert(pEList != 0 || pSelect != 0);  if( pTriggerStep ){    pTriggerStep->op = TK_INSERT;    pTriggerStep->pSelect = pSelect;    pTriggerStep->target  = *pTableName;    pTriggerStep->pIdList = pColumn;    pTriggerStep->pExprList = pEList;    pTriggerStep->orconf = orconf;    sqlitePersistTriggerStep(pTriggerStep);  }else{    sqlite3IdListDelete(pColumn);    sqlite3ExprListDelete(pEList);    sqlite3SelectDup(pSelect);  }  return pTriggerStep;}/*** Construct a trigger step that implements an UPDATE statement and return** a pointer to that trigger step.  The parser calls this routine when it** sees an UPDATE statement inside the body of a CREATE TRIGGER.*/TriggerStep *sqlite3TriggerUpdateStep(  Token *pTableName,   /* Name of the table to be updated */  ExprList *pEList,    /* The SET clause: list of column and new values */  Expr *pWhere,        /* The WHERE clause */  int orconf           /* The conflict algorithm. (OE_Abort, OE_Ignore, etc) */){  TriggerStep *pTriggerStep = sqliteMalloc(sizeof(TriggerStep));  if( pTriggerStep==0 ) return 0;  pTriggerStep->op = TK_UPDATE;  pTriggerStep->target  = *pTableName;  pTriggerStep->pExprList = pEList;  pTriggerStep->pWhere = pWhere;  pTriggerStep->orconf = orconf;  sqlitePersistTriggerStep(pTriggerStep);  return pTriggerStep;}/*** Construct a trigger step that implements a DELETE statement and return** a pointer to that trigger step.  The parser calls this routine when it** sees a DELETE statement inside the body of a CREATE TRIGGER.*/TriggerStep *sqlite3TriggerDeleteStep(Token *pTableName, Expr *pWhere){  TriggerStep *pTriggerStep = sqliteMalloc(sizeof(TriggerStep));  if( pTriggerStep==0 ) return 0;  pTriggerStep->op = TK_DELETE;

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩视频不卡中文| 精品对白一区国产伦| 精彩视频一区二区三区| 亚洲成精国产精品女| 亚洲一区二区三区在线播放| 国产精品丝袜在线| 久久精品欧美一区二区三区麻豆 | 色综合久久久久网| 国产米奇在线777精品观看| 另类小说综合欧美亚洲| 五月天欧美精品| 欧美激情在线一区二区| 欧美国产激情二区三区| 国产欧美视频一区二区| 国产精品你懂的在线欣赏| 久久日一线二线三线suv| 日韩欧美一区中文| 欧美mv日韩mv国产网站| 日韩一区二区高清| 3atv在线一区二区三区| 欧洲视频一区二区| 欧美亚洲一区二区在线观看| 日本久久电影网| 欧美日本在线观看| 欧美日韩激情在线| 欧美一区二区三区成人| 日韩一区二区高清| 51精品国自产在线| 26uuu亚洲| 国产欧美一区二区精品仙草咪| 国产精品久久久久久久午夜片| 一区二区三区中文在线| 日韩电影在线一区二区| 欧美aⅴ一区二区三区视频| 国产成人免费网站| fc2成人免费人成在线观看播放| 成人免费毛片a| 在线观看视频一区二区| 在线不卡一区二区| 久久久久久久国产精品影院| 国产精品久久久久一区| 最新国产の精品合集bt伙计| 天天爽夜夜爽夜夜爽精品视频| 日韩国产精品久久久| 国产成人av影院| 99r精品视频| 亚洲最大色网站| 亚洲第一电影网| 国产河南妇女毛片精品久久久 | 成人aaaa免费全部观看| 欧美亚洲一区三区| 久久先锋影音av| 国产精品第四页| 一区二区三区精密机械公司| 激情五月婷婷综合网| 国产成人免费av在线| 色欧美日韩亚洲| 亚洲h精品动漫在线观看| 五月婷婷激情综合| 视频一区欧美精品| 蜜桃在线一区二区三区| 国产成人免费在线观看不卡| 欧美日韩亚洲丝袜制服| 久久青草国产手机看片福利盒子 | 一区二区高清在线| 久久精品久久综合| 日本乱人伦aⅴ精品| 欧美电视剧在线看免费| 日韩伦理av电影| 日本视频一区二区| 成人毛片视频在线观看| 日韩一区二区三区av| 国产精品白丝在线| 国产伦精品一区二区三区视频青涩| jvid福利写真一区二区三区| 国产伦精品一区二区三区免费迷| 在线亚洲免费视频| 国产亚洲午夜高清国产拍精品 | 国产91对白在线观看九色| 91精品国产色综合久久久蜜香臀| 中文av一区特黄| 久久99精品一区二区三区| 欧美私模裸体表演在线观看| 国产精品无人区| 韩国一区二区视频| 欧美日韩一区三区四区| 国产精品久久午夜| 精品一区二区三区在线观看国产| 在线观看视频一区二区欧美日韩| 国产精品久久免费看| 国产一区福利在线| 精品国产伦一区二区三区观看体验| 亚洲精品一二三区| 色综合一个色综合亚洲| 26uuu精品一区二区三区四区在线| 亚洲国产精品视频| 色呦呦国产精品| 国产蜜臀97一区二区三区| 黄色日韩网站视频| 91精品国产综合久久国产大片| 一区二区不卡在线视频 午夜欧美不卡在| 国产凹凸在线观看一区二区| 欧美一区二区三区不卡| 日本va欧美va欧美va精品| 欧美影院精品一区| 亚洲不卡一区二区三区| 一本大道综合伊人精品热热| 91麻豆精品国产无毒不卡在线观看| 亚洲国产综合人成综合网站| 色婷婷综合中文久久一本| 一区二区三区在线免费播放| thepron国产精品| 天天色天天操综合| 日韩欧美一级在线播放| 狠狠色丁香婷婷综合| 久久综合久久综合久久综合| 狂野欧美性猛交blacked| 成人午夜私人影院| 亚洲欧美日韩成人高清在线一区| 成人免费视频视频在线观看免费| 中文字幕色av一区二区三区| 国产成人久久精品77777最新版本| 国产日韩精品久久久| 国产一区二区三区| 欧美mv日韩mv国产网站app| 国产一区二区三区在线观看免费视频| 日韩丝袜美女视频| 国产综合色产在线精品| 亚洲精品一区二区三区四区高清 | 欧美主播一区二区三区| 亚洲最大的成人av| 日韩视频国产视频| 伦理电影国产精品| 欧美电影免费观看高清完整版在| 激情文学综合网| 中文字幕精品综合| 99久久婷婷国产| 天堂成人免费av电影一区| 91精品国产入口| 国产aⅴ综合色| 中文字幕一区二区三区在线观看| 99精品国产一区二区三区不卡| 亚洲精品综合在线| 日韩一区二区三区电影 | 99久久久国产精品| 亚洲福利国产精品| 日韩欧美二区三区| 99久久综合99久久综合网站| 一区二区三区在线视频观看58 | 亚洲精品一区二区三区影院| 波多野洁衣一区| 亚洲综合清纯丝袜自拍| 精品免费国产一区二区三区四区| 国产麻豆成人传媒免费观看| 一个色在线综合| 精品久久久久av影院| 国产剧情一区在线| 亚洲国产日产av| 精品久久久久久亚洲综合网| 91麻豆自制传媒国产之光| 天天综合色天天综合色h| 久久久精品综合| 欧美在线观看一区| 夜夜嗨av一区二区三区四季av| 日韩欧美aaaaaa| 黄网站免费久久| 亚洲成人免费看| 国产欧美中文在线| 欧美一级艳片视频免费观看| 国内精品国产成人国产三级粉色| 亚洲欧美一区二区三区久本道91| 9191成人精品久久| 99精品久久久久久| 美女精品自拍一二三四| 亚洲激情男女视频| 久久免费美女视频| 欧美一区二区三区系列电影| 成人激情开心网| 国产资源在线一区| 香蕉成人啪国产精品视频综合网| 欧美激情一区二区三区蜜桃视频| 欧美精品vⅰdeose4hd| 一本一道综合狠狠老| 国产精品综合一区二区三区| 国产精品动漫网站| 26uuu国产电影一区二区| 日本va欧美va瓶| 色婷婷国产精品久久包臀| 日本一不卡视频| 亚洲成年人网站在线观看| 国产精品久久看| 久久精品视频免费观看| 91麻豆精品国产91| 欧美视频一区二区在线观看| av在线综合网| 99这里都是精品| 成人深夜福利app| 粉嫩嫩av羞羞动漫久久久 | 日韩成人伦理电影在线观看| 亚洲精品第一国产综合野|