/ Check-in [0c4dd9ff]
Login

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

Overview
Comment:Changes to the new initial row of PRAGMA index_list results.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | indexList
Files: files | file ages | folders
SHA1:0c4dd9fff0c78c3519bfd5b59100183b97fd1863
User & Date: mistachkin 2013-10-12 09:32:05
Context
2013-10-12
09:32
Changes to the new initial row of PRAGMA index_list results. Closed-Leaf check-in: 0c4dd9ff user: mistachkin tags: indexList
02:33
Fix harmless compiler warning. check-in: 4b130f88 user: mistachkin tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/pragma.c.

1461
1462
1463
1464
1465
1466
1467
1468


1469
1470
1471
1472
1473
1474
1475
1476
      pParse->nMem = 4;
      sqlite3CodeVerifySchema(pParse, iDb);
      sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "seq", SQLITE_STATIC);
      sqlite3VdbeSetColName(v, 1, COLNAME_NAME, "name", SQLITE_STATIC);
      sqlite3VdbeSetColName(v, 2, COLNAME_NAME, "unique", SQLITE_STATIC);
      sqlite3VdbeSetColName(v, 3, COLNAME_NAME, "avgrowsize", SQLITE_STATIC);
      sqlite3VdbeAddOp2(v, OP_Integer, 0, 1);
      sqlite3VdbeAddOp2(v, OP_Null, 0, 2);


      sqlite3VdbeAddOp2(v, OP_Integer, 1, 3);
      sqlite3VdbeAddOp2(v, OP_Integer,
                           (int)sqlite3LogEstToInt(pTab->szTabRow), 4);
      sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 4);
      for(pIdx=pTab->pIndex, i=1; pIdx; pIdx=pIdx->pNext, i++){
        sqlite3VdbeAddOp2(v, OP_Integer, i, 1);
        sqlite3VdbeAddOp4(v, OP_String8, 0, 2, 0, pIdx->zName, 0);
        sqlite3VdbeAddOp2(v, OP_Integer, pIdx->onError!=OE_None, 3);







|
>
>
|







1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
      pParse->nMem = 4;
      sqlite3CodeVerifySchema(pParse, iDb);
      sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "seq", SQLITE_STATIC);
      sqlite3VdbeSetColName(v, 1, COLNAME_NAME, "name", SQLITE_STATIC);
      sqlite3VdbeSetColName(v, 2, COLNAME_NAME, "unique", SQLITE_STATIC);
      sqlite3VdbeSetColName(v, 3, COLNAME_NAME, "avgrowsize", SQLITE_STATIC);
      sqlite3VdbeAddOp2(v, OP_Integer, 0, 1);
      sqlite3VdbeAddOp4(v, OP_String8, 0, 2, 0,
         sqlite3MPrintf(db, "sqlite_pseudoindex_%s", pTab->zName),
         P4_DYNAMIC);
      sqlite3VdbeAddOp2(v, OP_Integer, 0, 3);
      sqlite3VdbeAddOp2(v, OP_Integer,
                           (int)sqlite3LogEstToInt(pTab->szTabRow), 4);
      sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 4);
      for(pIdx=pTab->pIndex, i=1; pIdx; pIdx=pIdx->pNext, i++){
        sqlite3VdbeAddOp2(v, OP_Integer, i, 1);
        sqlite3VdbeAddOp4(v, OP_String8, 0, 2, 0, pIdx->zName, 0);
        sqlite3VdbeAddOp2(v, OP_Integer, pIdx->onError!=OE_None, 3);

Changes to test/pragma.test.

570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
...
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
....
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
      pragma foreign_key_list(t5);
    }
  } {}
  do_test pragma-6.4 {
    execsql {
      pragma index_list(t3);
    }
  } {/0 {} 1 \d+ 1 sqlite_autoindex_t3_1 1 \d+/}
}
ifcapable {!foreignkey} {
  execsql {CREATE TABLE t3(a,b UNIQUE)}
}
do_test pragma-6.5.1 {
  execsql {
    CREATE INDEX t3i1 ON t3(a,b);
................................................................................
do_test pragma-7.1.1 {
  # Make sure a pragma knows to read the schema if it needs to
  db close
  sqlite3 db test.db
  execsql {
    pragma index_list(t3);
  }
} {/0 {} 1 \d+ 1 t3i1 0 \d+ 2 sqlite_autoindex_t3_1 1 \d+/}
do_test pragma-7.1.2 {
  execsql {
    pragma index_list(t3_bogus);
  }
} {}
} ;# ifcapable schema_pragmas
ifcapable {utf16} {
................................................................................
  db2 eval {PRAGMA index_info(i2)}
} {0 2 c 1 3 d 2 1 b}
do_test 23.3 {
  db eval {
    CREATE INDEX i3 ON t1(d,b,c);
  }
  db2 eval {PRAGMA index_list(t1)}
} {/0 {} 1 \d+ 1 i3 0 \d+ 2 i2 0 \d+ 3 i1 0 \d+/}
do_test 23.4 {
  db eval {
    ALTER TABLE t1 ADD COLUMN e;
  }
  db2 eval {
    PRAGMA table_info(t1);
  }







|







 







|







 







|







570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
...
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
....
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
      pragma foreign_key_list(t5);
    }
  } {}
  do_test pragma-6.4 {
    execsql {
      pragma index_list(t3);
    }
  } {/0 sqlite_pseudoindex_t3 0 \d+ 1 sqlite_autoindex_t3_1 1 \d+/}
}
ifcapable {!foreignkey} {
  execsql {CREATE TABLE t3(a,b UNIQUE)}
}
do_test pragma-6.5.1 {
  execsql {
    CREATE INDEX t3i1 ON t3(a,b);
................................................................................
do_test pragma-7.1.1 {
  # Make sure a pragma knows to read the schema if it needs to
  db close
  sqlite3 db test.db
  execsql {
    pragma index_list(t3);
  }
} {/0 sqlite_pseudoindex_t3 0 \d+ 1 t3i1 0 \d+ 2 sqlite_autoindex_t3_1 1 \d+/}
do_test pragma-7.1.2 {
  execsql {
    pragma index_list(t3_bogus);
  }
} {}
} ;# ifcapable schema_pragmas
ifcapable {utf16} {
................................................................................
  db2 eval {PRAGMA index_info(i2)}
} {0 2 c 1 3 d 2 1 b}
do_test 23.3 {
  db eval {
    CREATE INDEX i3 ON t1(d,b,c);
  }
  db2 eval {PRAGMA index_list(t1)}
} {/0 sqlite_pseudoindex_t1 0 \d+ 1 i3 0 \d+ 2 i2 0 \d+ 3 i1 0 \d+/}
do_test 23.4 {
  db eval {
    ALTER TABLE t1 ADD COLUMN e;
  }
  db2 eval {
    PRAGMA table_info(t1);
  }