/ Check-in [0415af32]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Use the database name supplied to table_info() and related pragmas. (CVS 2001)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:0415af325739fd4e0bd4761c889719355a1ec4ff
User & Date: drh 2004-10-05 15:42:53
Context
2004-10-05
17:37
Rearrange memory allocation in sqlite3VdbeMakeReady to try to work around some byte-alignment problems on Sparc. (CVS 2002) check-in: f623d6e7 user: drh tags: trunk
15:42
Use the database name supplied to table_info() and related pragmas. (CVS 2001) check-in: 0415af32 user: drh tags: trunk
02:41
Add support for DEFERRED, IMMEDIATE, and EXCLUSIVE transactions. (CVS 2000) check-in: 81ff8107 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Show Whitespace Changes Patch

Changes to src/pragma.c.

     7      7   **    May you do good and not evil.
     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** This file contains code used to implement the PRAGMA command.
    13     13   **
    14         -** $Id: pragma.c,v 1.68 2004/10/05 02:41:43 drh Exp $
           14  +** $Id: pragma.c,v 1.69 2004/10/05 15:42:53 drh Exp $
    15     15   */
    16     16   #include "sqliteInt.h"
    17     17   #include <ctype.h>
    18     18   
    19     19   #if defined(SQLITE_DEBUG) || defined(SQLITE_TEST)
    20     20   # include "pager.h"
    21     21   # include "btree.h"
................................................................................
   380    380     ** type:       Column declaration type.
   381    381     ** notnull:    True if 'NOT NULL' is part of column declaration
   382    382     ** dflt_value: The default value for the column, if any.
   383    383     */
   384    384     if( sqlite3StrICmp(zLeft, "table_info")==0 && zRight ){
   385    385       Table *pTab;
   386    386       if( sqlite3ReadSchema(pParse) ) goto pragma_out;
   387         -    pTab = sqlite3FindTable(db, zRight, 0);
          387  +    pTab = sqlite3FindTable(db, zRight, zDb);
   388    388       if( pTab ){
   389    389         int i;
   390    390         sqlite3VdbeSetNumCols(v, 6);
   391    391         sqlite3VdbeSetColName(v, 0, "cid", P3_STATIC);
   392    392         sqlite3VdbeSetColName(v, 1, "name", P3_STATIC);
   393    393         sqlite3VdbeSetColName(v, 2, "type", P3_STATIC);
   394    394         sqlite3VdbeSetColName(v, 3, "notnull", P3_STATIC);
................................................................................
   409    409       }
   410    410     }else
   411    411   
   412    412     if( sqlite3StrICmp(zLeft, "index_info")==0 && zRight ){
   413    413       Index *pIdx;
   414    414       Table *pTab;
   415    415       if( sqlite3ReadSchema(pParse) ) goto pragma_out;
   416         -    pIdx = sqlite3FindIndex(db, zRight, 0);
          416  +    pIdx = sqlite3FindIndex(db, zRight, zDb);
   417    417       if( pIdx ){
   418    418         int i;
   419    419         pTab = pIdx->pTable;
   420    420         sqlite3VdbeSetNumCols(v, 3);
   421    421         sqlite3VdbeSetColName(v, 0, "seqno", P3_STATIC);
   422    422         sqlite3VdbeSetColName(v, 1, "cid", P3_STATIC);
   423    423         sqlite3VdbeSetColName(v, 2, "name", P3_STATIC);
................................................................................
   432    432       }
   433    433     }else
   434    434   
   435    435     if( sqlite3StrICmp(zLeft, "index_list")==0 && zRight ){
   436    436       Index *pIdx;
   437    437       Table *pTab;
   438    438       if( sqlite3ReadSchema(pParse) ) goto pragma_out;
   439         -    pTab = sqlite3FindTable(db, zRight, 0);
          439  +    pTab = sqlite3FindTable(db, zRight, zDb);
   440    440       if( pTab ){
   441    441         v = sqlite3GetVdbe(pParse);
   442    442         pIdx = pTab->pIndex;
   443    443         if( pIdx ){
   444    444           int i = 0; 
   445    445           sqlite3VdbeSetNumCols(v, 3);
   446    446           sqlite3VdbeSetColName(v, 0, "seq", P3_STATIC);
................................................................................
   458    458       }
   459    459     }else
   460    460   
   461    461     if( sqlite3StrICmp(zLeft, "foreign_key_list")==0 && zRight ){
   462    462       FKey *pFK;
   463    463       Table *pTab;
   464    464       if( sqlite3ReadSchema(pParse) ) goto pragma_out;
   465         -    pTab = sqlite3FindTable(db, zRight, 0);
          465  +    pTab = sqlite3FindTable(db, zRight, zDb);
   466    466       if( pTab ){
   467    467         v = sqlite3GetVdbe(pParse);
   468    468         pFK = pTab->pFKey;
   469    469         if( pFK ){
   470    470           int i = 0; 
   471    471           sqlite3VdbeSetNumCols(v, 5);
   472    472           sqlite3VdbeSetColName(v, 0, "id", P3_STATIC);