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

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

?? select.c

?? sqlite 3.3.8 支持加密的版本
?? C
?? 第 1 頁 / 共 5 頁
字號:
    sqlite3VdbeAddOp(v, OP_Close, pseudoTab, 0);
  }

}

/*
** Return a pointer to a string containing the 'declaration type' of the
** expression pExpr. The string may be treated as static by the caller.
**
** The declaration type is the exact datatype definition extracted from the
** original CREATE TABLE statement if the expression is a column. The
** declaration type for a ROWID field is INTEGER. Exactly when an expression
** is considered a column can be complex in the presence of subqueries. The
** result-set expression in all of the following SELECT statements is 
** considered a column by this function.
**
**   SELECT col FROM tbl;
**   SELECT (SELECT col FROM tbl;
**   SELECT (SELECT col FROM tbl);
**   SELECT abc FROM (SELECT col AS abc FROM tbl);
** 
** The declaration type for any expression other than a column is NULL.
*/
static const char *columnType(
  NameContext *pNC, 
  Expr *pExpr,
  const char **pzOriginDb,
  const char **pzOriginTab,
  const char **pzOriginCol
){
  char const *zType = 0;
  char const *zOriginDb = 0;
  char const *zOriginTab = 0;
  char const *zOriginCol = 0;
  int j;
  if( pExpr==0 || pNC->pSrcList==0 ) return 0;

  /* The TK_AS operator can only occur in ORDER BY, GROUP BY, HAVING,
  ** and LIMIT clauses.  But pExpr originates in the result set of a
  ** SELECT.  So pExpr can never contain an AS operator.
  */
  assert( pExpr->op!=TK_AS );

  switch( pExpr->op ){
    case TK_AGG_COLUMN:
    case TK_COLUMN: {
      /* The expression is a column. Locate the table the column is being
      ** extracted from in NameContext.pSrcList. This table may be real
      ** database table or a subquery.
      */
      Table *pTab = 0;            /* Table structure column is extracted from */
      Select *pS = 0;             /* Select the column is extracted from */
      int iCol = pExpr->iColumn;  /* Index of column in pTab */
      while( pNC && !pTab ){
        SrcList *pTabList = pNC->pSrcList;
        for(j=0;j<pTabList->nSrc && pTabList->a[j].iCursor!=pExpr->iTable;j++);
        if( j<pTabList->nSrc ){
          pTab = pTabList->a[j].pTab;
          pS = pTabList->a[j].pSelect;
        }else{
          pNC = pNC->pNext;
        }
      }

      if( pTab==0 ){
        /* FIX ME:
        ** This can occurs if you have something like "SELECT new.x;" inside
        ** a trigger.  In other words, if you reference the special "new"
        ** table in the result set of a select.  We do not have a good way
        ** to find the actual table type, so call it "TEXT".  This is really
        ** something of a bug, but I do not know how to fix it.
        **
        ** This code does not produce the correct answer - it just prevents
        ** a segfault.  See ticket #1229.
        */
        zType = "TEXT";
        break;
      }

      assert( pTab );
      if( pS ){
        /* The "table" is actually a sub-select or a view in the FROM clause
        ** of the SELECT statement. Return the declaration type and origin
        ** data for the result-set column of the sub-select.
        */
        if( iCol>=0 && iCol<pS->pEList->nExpr ){
          /* If iCol is less than zero, then the expression requests the
          ** rowid of the sub-select or view. This expression is legal (see 
          ** test case misc2.2.2) - it always evaluates to NULL.
          */
          NameContext sNC;
          Expr *p = pS->pEList->a[iCol].pExpr;
          sNC.pSrcList = pS->pSrc;
          sNC.pNext = 0;
          sNC.pParse = pNC->pParse;
          zType = columnType(&sNC, p, &zOriginDb, &zOriginTab, &zOriginCol); 
        }
      }else if( pTab->pSchema ){
        /* A real table */
        assert( !pS );
        if( iCol<0 ) iCol = pTab->iPKey;
        assert( iCol==-1 || (iCol>=0 && iCol<pTab->nCol) );
        if( iCol<0 ){
          zType = "INTEGER";
          zOriginCol = "rowid";
        }else{
          zType = pTab->aCol[iCol].zType;
          zOriginCol = pTab->aCol[iCol].zName;
        }
        zOriginTab = pTab->zName;
        if( pNC->pParse ){
          int iDb = sqlite3SchemaToIndex(pNC->pParse->db, pTab->pSchema);
          zOriginDb = pNC->pParse->db->aDb[iDb].zName;
        }
      }
      break;
    }
#ifndef SQLITE_OMIT_SUBQUERY
    case TK_SELECT: {
      /* The expression is a sub-select. Return the declaration type and
      ** origin info for the single column in the result set of the SELECT
      ** statement.
      */
      NameContext sNC;
      Select *pS = pExpr->pSelect;
      Expr *p = pS->pEList->a[0].pExpr;
      sNC.pSrcList = pS->pSrc;
      sNC.pNext = pNC;
      sNC.pParse = pNC->pParse;
      zType = columnType(&sNC, p, &zOriginDb, &zOriginTab, &zOriginCol); 
      break;
    }
#endif
  }
  
  if( pzOriginDb ){
    assert( pzOriginTab && pzOriginCol );
    *pzOriginDb = zOriginDb;
    *pzOriginTab = zOriginTab;
    *pzOriginCol = zOriginCol;
  }
  return zType;
}

/*
** Generate code that will tell the VDBE the declaration types of columns
** in the result set.
*/
static void generateColumnTypes(
  Parse *pParse,      /* Parser context */
  SrcList *pTabList,  /* List of tables */
  ExprList *pEList    /* Expressions defining the result set */
){
  Vdbe *v = pParse->pVdbe;
  int i;
  NameContext sNC;
  sNC.pSrcList = pTabList;
  sNC.pParse = pParse;
  for(i=0; i<pEList->nExpr; i++){
    Expr *p = pEList->a[i].pExpr;
    const char *zOrigDb = 0;
    const char *zOrigTab = 0;
    const char *zOrigCol = 0;
    const char *zType = columnType(&sNC, p, &zOrigDb, &zOrigTab, &zOrigCol);

    /* The vdbe must make it's own copy of the column-type and other 
    ** column specific strings, in case the schema is reset before this
    ** virtual machine is deleted.
    */
    sqlite3VdbeSetColName(v, i, COLNAME_DECLTYPE, zType, P3_TRANSIENT);
    sqlite3VdbeSetColName(v, i, COLNAME_DATABASE, zOrigDb, P3_TRANSIENT);
    sqlite3VdbeSetColName(v, i, COLNAME_TABLE, zOrigTab, P3_TRANSIENT);
    sqlite3VdbeSetColName(v, i, COLNAME_COLUMN, zOrigCol, P3_TRANSIENT);
  }
}

/*
** Generate code that will tell the VDBE the names of columns
** in the result set.  This information is used to provide the
** azCol[] values in the callback.
*/
static void generateColumnNames(
  Parse *pParse,      /* Parser context */
  SrcList *pTabList,  /* List of tables */
  ExprList *pEList    /* Expressions defining the result set */
){
  Vdbe *v = pParse->pVdbe;
  int i, j;
  sqlite3 *db = pParse->db;
  int fullNames, shortNames;

#ifndef SQLITE_OMIT_EXPLAIN
  /* If this is an EXPLAIN, skip this step */
  if( pParse->explain ){
    return;
  }
#endif

  assert( v!=0 );
  if( pParse->colNamesSet || v==0 || sqlite3MallocFailed() ) return;
  pParse->colNamesSet = 1;
  fullNames = (db->flags & SQLITE_FullColNames)!=0;
  shortNames = (db->flags & SQLITE_ShortColNames)!=0;
  sqlite3VdbeSetNumCols(v, pEList->nExpr);
  for(i=0; i<pEList->nExpr; i++){
    Expr *p;
    p = pEList->a[i].pExpr;
    if( p==0 ) continue;
    if( pEList->a[i].zName ){
      char *zName = pEList->a[i].zName;
      sqlite3VdbeSetColName(v, i, COLNAME_NAME, zName, strlen(zName));
      continue;
    }
    if( p->op==TK_COLUMN && pTabList ){
      Table *pTab;
      char *zCol;
      int iCol = p->iColumn;
      for(j=0; j<pTabList->nSrc && pTabList->a[j].iCursor!=p->iTable; j++){}
      assert( j<pTabList->nSrc );
      pTab = pTabList->a[j].pTab;
      if( iCol<0 ) iCol = pTab->iPKey;
      assert( iCol==-1 || (iCol>=0 && iCol<pTab->nCol) );
      if( iCol<0 ){
        zCol = "rowid";
      }else{
        zCol = pTab->aCol[iCol].zName;
      }
      if( !shortNames && !fullNames && p->span.z && p->span.z[0] ){
        sqlite3VdbeSetColName(v, i, COLNAME_NAME, (char*)p->span.z, p->span.n);
      }else if( fullNames || (!shortNames && pTabList->nSrc>1) ){
        char *zName = 0;
        char *zTab;
 
        zTab = pTabList->a[j].zAlias;
        if( fullNames || zTab==0 ) zTab = pTab->zName;
        sqlite3SetString(&zName, zTab, ".", zCol, (char*)0);
        sqlite3VdbeSetColName(v, i, COLNAME_NAME, zName, P3_DYNAMIC);
      }else{
        sqlite3VdbeSetColName(v, i, COLNAME_NAME, zCol, strlen(zCol));
      }
    }else if( p->span.z && p->span.z[0] ){
      sqlite3VdbeSetColName(v, i, COLNAME_NAME, (char*)p->span.z, p->span.n);
      /* sqlite3VdbeCompressSpace(v, addr); */
    }else{
      char zName[30];
      assert( p->op!=TK_COLUMN || pTabList==0 );
      sprintf(zName, "column%d", i+1);
      sqlite3VdbeSetColName(v, i, COLNAME_NAME, zName, 0);
    }
  }
  generateColumnTypes(pParse, pTabList, pEList);
}

#ifndef SQLITE_OMIT_COMPOUND_SELECT
/*
** Name of the connection operator, used for error messages.
*/
static const char *selectOpName(int id){
  char *z;
  switch( id ){
    case TK_ALL:       z = "UNION ALL";   break;
    case TK_INTERSECT: z = "INTERSECT";   break;
    case TK_EXCEPT:    z = "EXCEPT";      break;
    default:           z = "UNION";       break;
  }
  return z;
}
#endif /* SQLITE_OMIT_COMPOUND_SELECT */

/*
** Forward declaration
*/
static int prepSelectStmt(Parse*, Select*);

/*
** Given a SELECT statement, generate a Table structure that describes
** the result set of that SELECT.
*/
Table *sqlite3ResultSetOfSelect(Parse *pParse, char *zTabName, Select *pSelect){
  Table *pTab;
  int i, j;
  ExprList *pEList;
  Column *aCol, *pCol;

  while( pSelect->pPrior ) pSelect = pSelect->pPrior;
  if( prepSelectStmt(pParse, pSelect) ){
    return 0;
  }
  if( sqlite3SelectResolve(pParse, pSelect, 0) ){
    return 0;
  }
  pTab = sqliteMalloc( sizeof(Table) );
  if( pTab==0 ){
    return 0;
  }
  pTab->nRef = 1;
  pTab->zName = zTabName ? sqliteStrDup(zTabName) : 0;
  pEList = pSelect->pEList;
  pTab->nCol = pEList->nExpr;
  assert( pTab->nCol>0 );
  pTab->aCol = aCol = sqliteMalloc( sizeof(pTab->aCol[0])*pTab->nCol );
  for(i=0, pCol=aCol; i<pTab->nCol; i++, pCol++){
    Expr *p, *pR;
    char *zType;
    char *zName;
    int nName;
    CollSeq *pColl;
    int cnt;
    NameContext sNC;
    
    /* Get an appropriate name for the column
    */
    p = pEList->a[i].pExpr;
    assert( p->pRight==0 || p->pRight->token.z==0 || p->pRight->token.z[0]!=0 );
    if( (zName = pEList->a[i].zName)!=0 ){
      /* If the column contains an "AS <name>" phrase, use <name> as the name */
      zName = sqliteStrDup(zName);
    }else if( p->op==TK_DOT 
              && (pR=p->pRight)!=0 && pR->token.z && pR->token.z[0] ){
      /* For columns of the from A.B use B as the name */
      zName = sqlite3MPrintf("%T", &pR->token);
    }else if( p->span.z && p->span.z[0] ){
      /* Use the original text of the column expression as its name */
      zName = sqlite3MPrintf("%T", &p->span);
    }else{
      /* If all else fails, make up a name */
      zName = sqlite3MPrintf("column%d", i+1);
    }
    sqlite3Dequote(zName);
    if( sqlite3MallocFailed() ){
      sqliteFree(zName);
      sqlite3DeleteTable(0, pTab);
      return 0;
    }

    /* Make sure the column name is unique.  If the name is not unique,
    ** append a integer to the name so that it becomes unique.
    */
    nName = strlen(zName);
    for(j=cnt=0; j<i; j++){
      if( sqlite3StrICmp(aCol[j].zName, zName)==0 ){
        zName[nName] = 0;
        zName = sqlite3MPrintf("%z:%d", zName, ++cnt);
        j = -1;
        if( zName==0 ) break;
      }
    }
    pCol->zName = zName;

    /* Get the typename, type affinity, and collating sequence for the
    ** column.
    */
    memset(&sNC, 0, sizeof(sNC));
    sNC.pSrcList = pSelect->pSrc;
    zType = sqliteStrDup(columnType(&sNC, p, 0, 0, 0));
    pCol->zType = zType;
    pCol->affinity = sqlite3ExprAffinity(p);
    pColl = sqlite3ExprCollSeq(pParse, p);
    if( pColl ){
      pCol->zColl = sqliteStrDup(pColl->zName);
    }
  }
  pTab->iPKey = -1;
  return pTab;
}

/*
** Prepare a SELECT statement for processing by doing the following
** things:
**
**    (1)  Make sure VDBE cursor numbers have been assigned to every
**         element of the FROM clause.
**
**    (2)  Fill in the pTabList->a[].pTab fields in the SrcList that 
**         defines FROM clause.  When views appear in the FROM clause,
**         fill pTabList->a[].pSelect with a copy of the SELECT statement
**         that implements the view.  A copy is made of the view's SELECT
**         statement so that we can freely modify or delete that statement
**         without worrying about messing up the presistent representation
**         of the view.
**
**    (3)  Add terms to the WHERE clause to accomodate the NATURAL keyword
**         on joins and the ON and USING clause of joins.
**

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲一区中文日韩| 国产亚洲精品资源在线26u| 亚洲男人天堂一区| 97久久精品人人澡人人爽| 亚洲色大成网站www久久九九| 91丝袜美腿高跟国产极品老师| 亚洲欧洲日韩女同| 91久久久免费一区二区| 五月婷婷综合网| 欧美电影免费观看高清完整版 | 国产一区二三区| 国产亚洲精久久久久久| av一区二区三区四区| 亚洲欧美日本韩国| 欧美丰满嫩嫩电影| 国产麻豆视频一区| 亚洲伦在线观看| 日韩一区二区免费视频| 国产白丝精品91爽爽久久| 成人免费一区二区三区视频 | 欧美国产在线观看| 在线观看日产精品| 麻豆成人免费电影| 中文字幕在线不卡一区二区三区| 日本精品免费观看高清观看| 蜜乳av一区二区| 国产精品视频第一区| 欧美日韩久久久一区| 久久电影网电视剧免费观看| 国产精品久久久久久久久晋中| 欧美在线综合视频| 另类小说图片综合网| 综合亚洲深深色噜噜狠狠网站| 欧美一区二区三区喷汁尤物| 高清av一区二区| 日韩和的一区二区| 国产精品久久一级| 91精品国产色综合久久| 成人福利视频网站| 日本va欧美va精品| ...xxx性欧美| 精品国产乱码久久久久久1区2区 | 91成人免费网站| 国产精品一区二区久久不卡| 午夜电影一区二区| 亚洲欧洲日韩av| 久久久久久97三级| 日韩一二在线观看| 欧美性色aⅴ视频一区日韩精品| 国产91露脸合集magnet| 日韩黄色免费电影| 亚洲一区二区三区三| 中文字幕不卡在线观看| 日韩美女视频在线| 欧美性大战xxxxx久久久| 成人涩涩免费视频| 国产曰批免费观看久久久| 午夜精品久久久| 亚洲激情图片qvod| 亚洲三级理论片| 国产精品狼人久久影院观看方式| 欧美电影免费观看高清完整版在线| 欧美性一二三区| 在线视频国内自拍亚洲视频| 粉嫩av亚洲一区二区图片| 久久精品国内一区二区三区| 午夜激情久久久| 午夜一区二区三区视频| 一区二区三区在线高清| 亚洲欧洲精品一区二区三区| 欧美激情一区二区三区全黄| 精品国产乱码久久久久久浪潮| 日韩一级大片在线| 欧美成人综合网站| 精品区一区二区| 日韩精品一区二区三区在线| 91精品国产综合久久福利软件| 欧美日韩国产精品成人| 欧美日韩日本视频| 欧美伦理视频网站| 欧美日韩情趣电影| 91精品免费观看| 日韩三级中文字幕| 日韩精品中文字幕在线一区| 亚洲精品在线观看视频| 久久综合狠狠综合久久激情| 久久久久久久国产精品影院| 国产亚洲精品超碰| 一区在线播放视频| 一区二区三区四区在线| 亚洲高清久久久| 天天影视网天天综合色在线播放| 日本不卡一区二区三区高清视频| 美女脱光内衣内裤视频久久网站| 久久99国产精品免费| 国产精品影视在线观看| 国产河南妇女毛片精品久久久| 成人精品视频网站| 在线观看日韩国产| 日韩美女视频在线| 中文一区一区三区高中清不卡| 中文字幕制服丝袜一区二区三区| 一级做a爱片久久| 日产国产欧美视频一区精品| 久久国产人妖系列| 成人av影院在线| 欧美三区在线视频| 精品国产露脸精彩对白| 国产精品传媒入口麻豆| 天天av天天翘天天综合网| 美女高潮久久久| www.日韩精品| 91精品一区二区三区在线观看| 久久亚洲精华国产精华液| 亚洲同性同志一二三专区| 香港成人在线视频| 国产成人丝袜美腿| 91官网在线观看| 欧美mv日韩mv国产网站app| 国产精品九色蝌蚪自拍| 亚洲午夜一二三区视频| 国产在线不卡视频| 欧美亚州韩日在线看免费版国语版| 精品国内片67194| 亚洲欧美日韩在线不卡| 精品一区二区精品| 91九色最新地址| 久久九九久久九九| 亚洲大片免费看| 风间由美一区二区av101| 欧美日韩不卡一区二区| 欧美经典一区二区三区| 日韩精品成人一区二区三区| 99久久精品免费精品国产| 欧美大片在线观看一区| 亚洲一级片在线观看| 波多野结衣的一区二区三区| 欧美不卡视频一区| 亚洲成人av资源| av成人免费在线| 久久综合色播五月| 五月婷婷欧美视频| 在线观看一区二区精品视频| 亚洲国产精品av| 国产在线精品一区二区三区不卡 | 91片在线免费观看| 久久久久久久综合日本| 麻豆精品精品国产自在97香蕉| 欧美又粗又大又爽| 最新日韩在线视频| 国产高清久久久| 欧美精品一区二区三区蜜臀| 男女男精品视频| 欧美日韩国产大片| 一区二区三区在线播| 91麻豆产精品久久久久久| 日本一区二区视频在线| 国产一区二区视频在线| 欧美一二三四在线| 日本不卡高清视频| 欧美一区二区私人影院日本| 亚洲国产人成综合网站| 欧美探花视频资源| 亚洲免费观看高清| 91视频免费看| 亚洲另类在线制服丝袜| 99久久伊人网影院| 国产精品国产自产拍高清av| 福利一区二区在线| 国产精品剧情在线亚洲| av激情综合网| 亚洲天堂a在线| 一本色道**综合亚洲精品蜜桃冫| 国产精品传媒视频| 色欧美乱欧美15图片| 一区二区三区在线视频观看| 欧美综合欧美视频| 亚洲国产aⅴ天堂久久| 欧美日韩美女一区二区| 丝袜亚洲另类欧美| 日韩欧美中文字幕公布| 精品在线观看视频| 久久久天堂av| 在线观看欧美日本| 亚洲愉拍自拍另类高清精品| 欧美三区在线观看| 麻豆精品在线播放| 国产日韩欧美高清| av在线一区二区三区| 亚洲一级二级三级| 日韩欧美在线不卡| 国产乱人伦精品一区二区在线观看 | 欧美一区二区三区小说| 麻豆精品视频在线观看| 国产丝袜在线精品| 在线观看网站黄不卡| 日本视频中文字幕一区二区三区| 日韩免费一区二区| 成人av电影在线网| 午夜亚洲国产au精品一区二区|