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

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

?? alter.c

?? sqlite 3.3.8 支持加密的版本
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*
** 2005 February 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 used to generate VDBE code
** that implements the ALTER TABLE command.
**
** $Id: alter.c,v 1.24 2006/10/12 21:34:20 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>

/*
** The code in this file only exists if we are not omitting the
** ALTER TABLE logic from the build.
*/
#ifndef SQLITE_OMIT_ALTERTABLE


/*
** This function is used by SQL generated to implement the 
** ALTER TABLE command. The first argument is the text of a CREATE TABLE or
** CREATE INDEX command. The second is a table name. The table name in 
** the CREATE TABLE or CREATE INDEX statement is replaced with the third
** argument and the result returned. Examples:
**
** sqlite_rename_table('CREATE TABLE abc(a, b, c)', 'def')
**     -> 'CREATE TABLE def(a, b, c)'
**
** sqlite_rename_table('CREATE INDEX i ON abc(a)', 'def')
**     -> 'CREATE INDEX i ON def(a, b, c)'
*/
static void renameTableFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  unsigned char const *zSql = sqlite3_value_text(argv[0]);
  unsigned char const *zTableName = sqlite3_value_text(argv[1]);

  int token;
  Token tname;
  unsigned char const *zCsr = zSql;
  int len = 0;
  char *zRet;

  /* The principle used to locate the table name in the CREATE TABLE 
  ** statement is that the table name is the first token that is immediatedly
  ** followed by a left parenthesis - TK_LP.
  */
  if( zSql ){
    do {
      /* Store the token that zCsr points to in tname. */
      tname.z = zCsr;
      tname.n = len;

      /* Advance zCsr to the next token. Store that token type in 'token',
      ** and it's length in 'len' (to be used next iteration of this loop).
      */
      do {
        zCsr += len;
        len = sqlite3GetToken(zCsr, &token);
      } while( token==TK_SPACE );
      assert( len>0 );
    } while( token!=TK_LP );

    zRet = sqlite3MPrintf("%.*s%Q%s", tname.z - zSql, zSql, 
       zTableName, tname.z+tname.n);
    sqlite3_result_text(context, zRet, -1, sqlite3FreeX);
  }
}

#ifndef SQLITE_OMIT_TRIGGER
/* This function is used by SQL generated to implement the
** ALTER TABLE command. The first argument is the text of a CREATE TRIGGER 
** statement. The second is a table name. The table name in the CREATE 
** TRIGGER statement is replaced with the third argument and the result 
** returned. This is analagous to renameTableFunc() above, except for CREATE
** TRIGGER, not CREATE INDEX and CREATE TABLE.
*/
static void renameTriggerFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  unsigned char const *zSql = sqlite3_value_text(argv[0]);
  unsigned char const *zTableName = sqlite3_value_text(argv[1]);

  int token;
  Token tname;
  int dist = 3;
  unsigned char const *zCsr = zSql;
  int len = 0;
  char *zRet;

  /* The principle used to locate the table name in the CREATE TRIGGER 
  ** statement is that the table name is the first token that is immediatedly
  ** preceded by either TK_ON or TK_DOT and immediatedly followed by one
  ** of TK_WHEN, TK_BEGIN or TK_FOR.
  */
  if( zSql ){
    do {
      /* Store the token that zCsr points to in tname. */
      tname.z = zCsr;
      tname.n = len;

      /* Advance zCsr to the next token. Store that token type in 'token',
      ** and it's length in 'len' (to be used next iteration of this loop).
      */
      do {
        zCsr += len;
        len = sqlite3GetToken(zCsr, &token);
      }while( token==TK_SPACE );
      assert( len>0 );

      /* Variable 'dist' stores the number of tokens read since the most
      ** recent TK_DOT or TK_ON. This means that when a WHEN, FOR or BEGIN 
      ** token is read and 'dist' equals 2, the condition stated above
      ** to be met.
      **
      ** Note that ON cannot be a database, table or column name, so
      ** there is no need to worry about syntax like 
      ** "CREATE TRIGGER ... ON ON.ON BEGIN ..." etc.
      */
      dist++;
      if( token==TK_DOT || token==TK_ON ){
        dist = 0;
      }
    } while( dist!=2 || (token!=TK_WHEN && token!=TK_FOR && token!=TK_BEGIN) );

    /* Variable tname now contains the token that is the old table-name
    ** in the CREATE TRIGGER statement.
    */
    zRet = sqlite3MPrintf("%.*s%Q%s", tname.z - zSql, zSql, 
       zTableName, tname.z+tname.n);
    sqlite3_result_text(context, zRet, -1, sqlite3FreeX);
  }
}
#endif   /* !SQLITE_OMIT_TRIGGER */

/*
** Register built-in functions used to help implement ALTER TABLE
*/
void sqlite3AlterFunctions(sqlite3 *db){
  static const struct {
     char *zName;
     signed char nArg;
     void (*xFunc)(sqlite3_context*,int,sqlite3_value **);
  } aFuncs[] = {
    { "sqlite_rename_table",    2, renameTableFunc},
#ifndef SQLITE_OMIT_TRIGGER
    { "sqlite_rename_trigger",  2, renameTriggerFunc},
#endif
  };
  int i;

  for(i=0; i<sizeof(aFuncs)/sizeof(aFuncs[0]); i++){
    sqlite3CreateFunc(db, aFuncs[i].zName, aFuncs[i].nArg,
        SQLITE_UTF8, 0, aFuncs[i].xFunc, 0, 0);
  }
}

/*
** Generate the text of a WHERE expression which can be used to select all
** temporary triggers on table pTab from the sqlite_temp_master table. If
** table pTab has no temporary triggers, or is itself stored in the 
** temporary database, NULL is returned.
*/
static char *whereTempTriggers(Parse *pParse, Table *pTab){
  Trigger *pTrig;
  char *zWhere = 0;
  char *tmp = 0;
  const Schema *pTempSchema = pParse->db->aDb[1].pSchema; /* Temp db schema */

  /* If the table is not located in the temp-db (in which case NULL is 
  ** returned, loop through the tables list of triggers. For each trigger
  ** that is not part of the temp-db schema, add a clause to the WHERE 
  ** expression being built up in zWhere.
  */
  if( pTab->pSchema!=pTempSchema ){
    for( pTrig=pTab->pTrigger; pTrig; pTrig=pTrig->pNext ){
      if( pTrig->pSchema==pTempSchema ){
        if( !zWhere ){
          zWhere = sqlite3MPrintf("name=%Q", pTrig->name);
        }else{
          tmp = zWhere;
          zWhere = sqlite3MPrintf("%s OR name=%Q", zWhere, pTrig->name);
          sqliteFree(tmp);
        }
      }
    }
  }
  return zWhere;
}

/*
** Generate code to drop and reload the internal representation of table
** pTab from the database, including triggers and temporary triggers.
** Argument zName is the name of the table in the database schema at
** the time the generated code is executed. This can be different from
** pTab->zName if this function is being called to code part of an 
** "ALTER TABLE RENAME TO" statement.
*/
static void reloadTableSchema(Parse *pParse, Table *pTab, const char *zName){
  Vdbe *v;
  char *zWhere;
  int iDb;                   /* Index of database containing pTab */
#ifndef SQLITE_OMIT_TRIGGER
  Trigger *pTrig;
#endif

  v = sqlite3GetVdbe(pParse);
  if( !v ) return;
  iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
  assert( iDb>=0 );

#ifndef SQLITE_OMIT_TRIGGER
  /* Drop any table triggers from the internal schema. */
  for(pTrig=pTab->pTrigger; pTrig; pTrig=pTrig->pNext){
    int iTrigDb = sqlite3SchemaToIndex(pParse->db, pTrig->pSchema);
    assert( iTrigDb==iDb || iTrigDb==1 );
    sqlite3VdbeOp3(v, OP_DropTrigger, iTrigDb, 0, pTrig->name, 0);
  }
#endif

  /* Drop the table and index from the internal schema */
  sqlite3VdbeOp3(v, OP_DropTable, iDb, 0, pTab->zName, 0);

  /* Reload the table, index and permanent trigger schemas. */
  zWhere = sqlite3MPrintf("tbl_name=%Q", zName);
  if( !zWhere ) return;
  sqlite3VdbeOp3(v, OP_ParseSchema, iDb, 0, zWhere, P3_DYNAMIC);

#ifndef SQLITE_OMIT_TRIGGER
  /* Now, if the table is not stored in the temp database, reload any temp 
  ** triggers. Don't use IN(...) in case SQLITE_OMIT_SUBQUERY is defined. 
  */
  if( (zWhere=whereTempTriggers(pParse, pTab))!=0 ){
    sqlite3VdbeOp3(v, OP_ParseSchema, 1, 0, zWhere, P3_DYNAMIC);
  }
#endif
}

/*
** Generate code to implement the "ALTER TABLE xxx RENAME TO yyy" 
** command. 
*/
void sqlite3AlterRenameTable(
  Parse *pParse,            /* Parser context. */
  SrcList *pSrc,            /* The table to rename. */
  Token *pName              /* The new table name. */
){
  int iDb;                  /* Database that contains the table */
  char *zDb;                /* Name of database iDb */
  Table *pTab;              /* Table being renamed */
  char *zName = 0;          /* NULL-terminated version of pName */ 
  sqlite3 *db = pParse->db; /* Database connection */
  Vdbe *v;
#ifndef SQLITE_OMIT_TRIGGER
  char *zWhere = 0;         /* Where clause to locate temp triggers */
#endif
  
  if( sqlite3MallocFailed() ) goto exit_rename_table;
  assert( pSrc->nSrc==1 );

  pTab = sqlite3LocateTable(pParse, pSrc->a[0].zName, pSrc->a[0].zDatabase);
  if( !pTab ) goto exit_rename_table;
#ifndef SQLITE_OMIT_VIRTUALTABLE
  if( IsVirtual(pTab) ){
    sqlite3ErrorMsg(pParse, "virtual tables may not be altered");
    goto exit_rename_table;
  }
#endif
  iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
  zDb = db->aDb[iDb].zName;

  /* Get a NULL terminated version of the new table name. */
  zName = sqlite3NameFromToken(pName);
  if( !zName ) goto exit_rename_table;

  /* Check that a table or index named 'zName' does not already exist

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91免费精品国自产拍在线不卡| 欧美日韩一区二区三区免费看| 99国内精品久久| 欧美美女视频在线观看| 欧美一个色资源| 亚洲日本va午夜在线影院| 日韩欧美一区二区久久婷婷| 国产毛片精品视频| 一区二区三区在线观看国产| 欧美美女喷水视频| 午夜久久久影院| 在线视频欧美精品| 亚洲欧洲www| 91精品国产综合久久精品性色| 亚洲一级二级在线| 18成人在线视频| 日韩和欧美的一区| 99视频有精品| 国产网红主播福利一区二区| 蜜桃久久av一区| 欧美人与z0zoxxxx视频| 亚洲精品国久久99热| 不卡的av中国片| 国产精品色呦呦| 国产大陆精品国产| 国产日韩欧美在线一区| 国产一区二区三区电影在线观看 | 99久久精品国产麻豆演员表| 久久日韩粉嫩一区二区三区 | 91丨porny丨最新| 欧美—级在线免费片| 国产成人午夜99999| 久久精子c满五个校花| 国产成人在线免费观看| 国产欧美精品在线观看| 粉嫩aⅴ一区二区三区四区五区| 久久久久国产精品麻豆ai换脸 | 久久久亚洲综合| 精品在线亚洲视频| 久久精品日产第一区二区三区高清版| 国产在线播精品第三| 精品成人一区二区三区四区| 国产麻豆精品久久一二三| 国产三级精品三级| 99re成人精品视频| 欧美成人精品福利| 91玉足脚交白嫩脚丫在线播放| 欧美精品123区| 日韩欧美一二三| 欧美一区日本一区韩国一区| 欧美电视剧免费观看| 日韩精品最新网址| 国产精品卡一卡二卡三| 亚洲成人一区在线| 蜜桃精品在线观看| 久久久电影一区二区三区| 日韩一本二本av| 国产99精品在线观看| 亚洲三级久久久| 日韩欧美精品三级| 成人av免费在线播放| 亚洲午夜久久久久久久久久久| 欧美精品第1页| 国产福利一区在线| 亚洲综合在线第一页| 精品久久久久久久一区二区蜜臀| 国产成人av电影在线观看| 亚洲综合色婷婷| 久久看人人爽人人| 91精品福利视频| 激情五月婷婷综合网| 亚洲另类在线制服丝袜| 日韩免费在线观看| 色综合咪咪久久| 国产在线精品一区二区夜色| 亚洲免费av观看| 国产丝袜欧美中文另类| 精品视频在线视频| 99久久精品一区二区| 久久国内精品视频| 亚洲一区二区在线免费观看视频| 久久久美女毛片| 91精品国产一区二区人妖| av午夜精品一区二区三区| 日韩精品一二三四| 亚洲国产成人精品视频| 日本一区二区视频在线观看| 欧美一区二视频| 欧美天堂一区二区三区| 不卡的av网站| 国产一区在线视频| 欧美日本在线视频| 美腿丝袜亚洲一区| 午夜不卡在线视频| 日韩欧美中文一区| 日本免费新一区视频| 欧美大片一区二区三区| 美国三级日本三级久久99| 在线播放国产精品二区一二区四区| 一区二区三区高清不卡| 欧美日韩精品一区二区| 天天综合色天天综合色h| 成人欧美一区二区三区1314 | 91精选在线观看| 一本一道久久a久久精品| 国产黄色精品网站| 黑人巨大精品欧美一区| 老色鬼精品视频在线观看播放| 亚洲国产aⅴ成人精品无吗| 亚洲精品免费在线| 亚洲美女精品一区| 亚洲品质自拍视频| 日韩美女啊v在线免费观看| 18欧美乱大交hd1984| 国产精品毛片久久久久久| 中文字幕电影一区| 国产亚洲欧美日韩俺去了| 久久新电视剧免费观看| 国产日产欧产精品推荐色| 国产亚洲精品免费| 国产精品第五页| 亚洲区小说区图片区qvod| 一区二区三区av电影| 亚洲国产人成综合网站| 日韩中文字幕亚洲一区二区va在线| 91视频你懂的| 麻豆久久久久久久| 国产黑丝在线一区二区三区| 成人深夜视频在线观看| jizz一区二区| 在线视频国内自拍亚洲视频| 欧美日韩的一区二区| 欧美一区二区视频免费观看| 精品久久一区二区三区| 日本一区二区三区电影| 夜色激情一区二区| 日本视频一区二区三区| 国产一区二区三区四区在线观看| 国产成人精品亚洲777人妖| 成人午夜av在线| 欧美亚洲动漫制服丝袜| 欧美丰满少妇xxxxx高潮对白| 精品剧情在线观看| 国产精品国产三级国产| 午夜视频在线观看一区| 美女脱光内衣内裤视频久久网站| 国产成人在线观看| 91视频xxxx| 欧美一区二区三区视频免费播放| 国产三级精品在线| 亚洲18影院在线观看| 国产精品538一区二区在线| 91在线无精精品入口| 91精品欧美久久久久久动漫 | 亚洲一区影音先锋| 麻豆91精品视频| av在线不卡网| 欧美一区二区精品| 国产精品高潮呻吟久久| 免费成人在线观看视频| 99精品一区二区三区| 日韩欧美专区在线| 亚洲欧美日韩在线不卡| 国产一区二区精品久久| 在线观看不卡视频| 五月天国产精品| 成人免费高清视频在线观看| 91精品国产综合久久久久久漫画| 国产精品嫩草影院com| 蜜臀av一级做a爰片久久| 色偷偷久久人人79超碰人人澡| 亚洲精品一区二区三区影院| 亚洲综合一区二区| 成人av电影观看| 精品国产凹凸成av人网站| 香蕉影视欧美成人| 99久久精品国产一区| 日本一区二区免费在线观看视频 | 亚洲成a人片在线不卡一二三区 | 3atv在线一区二区三区| 亚洲一区中文日韩| 99国产麻豆精品| 国产女同互慰高潮91漫画| 麻豆成人综合网| 欧美疯狂做受xxxx富婆| 亚洲精品国产精华液| av在线不卡免费看| 久久精品水蜜桃av综合天堂| 免费在线观看不卡| 欧美日韩亚洲另类| 亚洲综合久久av| 在线观看日韩高清av| 亚洲三级在线免费| www.性欧美| 国产精品久久久久久福利一牛影视 | 狠狠狠色丁香婷婷综合激情| 日韩一区二区三区在线视频| 日韩黄色一级片| 欧美一区二区三区四区视频| 青椒成人免费视频|