Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add "autoinc" and "collseq" columns to the table_info() pragma. (CVS 3058) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
7940a590abb4262c17922fb2dae1d968 |
User & Date: | drh 2006-02-06 21:34:27.000 |
Context
2006-02-09
| ||
02:41 | Use 64-bit integers in sqlite3_analyzer. Ticket #1666. (CVS 3059) (check-in: 8b3068aca7 user: drh tags: trunk) | |
2006-02-06
| ||
21:34 | Add "autoinc" and "collseq" columns to the table_info() pragma. (CVS 3058) (check-in: 7940a590ab user: drh tags: trunk) | |
21:22 | Keep correct track of the amount of outstanding memory even when the system memory allocator returns a different number of bytes than requested. Ticket #1660. (CVS 3057) (check-in: 6f5eb74fd9 user: drh tags: trunk) | |
Changes
Changes to src/pragma.c.
1 2 3 4 5 6 7 8 9 10 11 12 13 | /* ** 2003 April 6 ** ** 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 code used to implement the PRAGMA command. ** | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | /* ** 2003 April 6 ** ** 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 code used to implement the PRAGMA command. ** ** $Id: pragma.c,v 1.115 2006/02/06 21:34:27 drh Exp $ */ #include "sqliteInt.h" #include "os.h" #include <ctype.h> /* Ignore this whole file if pragmas are disabled */ |
︙ | ︙ | |||
464 465 466 467 468 469 470 | */ if( sqlite3StrICmp(zLeft, "table_info")==0 && zRight ){ Table *pTab; if( sqlite3ReadSchema(pParse) ) goto pragma_out; pTab = sqlite3FindTable(db, zRight, zDb); if( pTab ){ int i; | > | > > | | | | | | > > > | | 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 | */ if( sqlite3StrICmp(zLeft, "table_info")==0 && zRight ){ Table *pTab; if( sqlite3ReadSchema(pParse) ) goto pragma_out; pTab = sqlite3FindTable(db, zRight, zDb); if( pTab ){ int i; Column *pCol; sqlite3VdbeSetNumCols(v, 8); sqlite3VdbeSetColName(v, 0, "cid", P3_STATIC); sqlite3VdbeSetColName(v, 1, "name", P3_STATIC); sqlite3VdbeSetColName(v, 2, "type", P3_STATIC); sqlite3VdbeSetColName(v, 3, "notnull", P3_STATIC); sqlite3VdbeSetColName(v, 4, "dflt_value", P3_STATIC); sqlite3VdbeSetColName(v, 5, "pk", P3_STATIC); sqlite3VdbeSetColName(v, 6, "autoinc", P3_STATIC); sqlite3VdbeSetColName(v, 7, "collseq", P3_STATIC); sqlite3ViewGetColumnNames(pParse, pTab); for(i=0, pCol=pTab->aCol; i<pTab->nCol; i++, pCol++){ sqlite3VdbeAddOp(v, OP_Integer, i, 0); sqlite3VdbeOp3(v, OP_String8, 0, 0, pCol->zName, 0); sqlite3VdbeOp3(v, OP_String8, 0, 0, pCol->zType ? pCol->zType : "numeric", 0); sqlite3VdbeAddOp(v, OP_Integer, pCol->notNull, 0); sqlite3ExprCode(pParse, pCol->pDflt); sqlite3VdbeAddOp(v, OP_Integer, pCol->isPrimKey, 0); sqlite3VdbeAddOp(v, OP_Integer, pCol->isPrimKey && pTab->autoInc, 0); sqlite3VdbeOp3(v, OP_String8, 0, 0, pCol->zColl ? pCol->zColl : "binary", 0); sqlite3VdbeAddOp(v, OP_Callback, 8, 0); } } }else if( sqlite3StrICmp(zLeft, "index_info")==0 && zRight ){ Index *pIdx; Table *pTab; |
︙ | ︙ |
Changes to test/pragma.test.
︙ | ︙ | |||
8 9 10 11 12 13 14 | # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests for the PRAGMA command. # | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests for the PRAGMA command. # # $Id: pragma.test,v 1.38 2006/02/06 21:34:27 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Test organization: # # pragma-1.*: Test cache_size, default_cache_size and synchronous on main db. |
︙ | ︙ | |||
341 342 343 344 345 346 347 | set res } {0 main 1 temp 2 aux} } do_test pragma-6.2 { execsql { pragma table_info(t2) } | | | 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 | set res } {0 main 1 temp 2 aux} } do_test pragma-6.2 { execsql { pragma table_info(t2) } } {0 a numeric 0 {} 0 0 binary 1 b numeric 0 {} 0 0 binary 2 c numeric 0 {} 0 0 binary} ifcapable {foreignkey} { do_test pragma-6.3 { execsql { CREATE TABLE t3(a int references t2(b), b UNIQUE); pragma foreign_key_list(t3); } } {0 0 t2 a b} |
︙ | ︙ |
Changes to test/tclsqlite.test.
︙ | ︙ | |||
11 12 13 14 15 16 17 | # This file implements regression tests for TCL interface to the # SQLite library. # # Actually, all tests are based on the TCL interface, so the main # interface is pretty well tested. This file contains some addition # tests for fringe issues that the main test suite does not cover. # | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # This file implements regression tests for TCL interface to the # SQLite library. # # Actually, all tests are based on the TCL interface, so the main # interface is pretty well tested. This file contains some addition # tests for fringe issues that the main test suite does not cover. # # $Id: tclsqlite.test,v 1.52 2006/02/06 21:34:27 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Check the error messages generated by tclsqlite # if {[sqlite3 -has-codec]} { |
︙ | ︙ | |||
144 145 146 147 148 149 150 | catch {unset ::result} do_test tcl-2.1 { execsql "CREATE TABLE t\u0123x(a int, b\u1235 float)" } {} ifcapable schema_pragmas { do_test tcl-2.2 { execsql "PRAGMA table_info(t\u0123x)" | | | 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | catch {unset ::result} do_test tcl-2.1 { execsql "CREATE TABLE t\u0123x(a int, b\u1235 float)" } {} ifcapable schema_pragmas { do_test tcl-2.2 { execsql "PRAGMA table_info(t\u0123x)" } "0 a int 0 {} 0 0 binary 1 b\u1235 float 0 {} 0 0 binary" } do_test tcl-2.3 { execsql "INSERT INTO t\u0123x VALUES(1,2.3)" db eval "SELECT * FROM t\u0123x" result break set result(*) } "a b\u1235" } |
︙ | ︙ |