Add "autoinc" and "collseq" columns to the table_info() pragma. (CVS 3058)

FossilOrigin-Name: 7940a590abb4262c17922fb2dae1d9688279b2ef
This commit is contained in:
drh 2006-02-06 21:34:27 +00:00
parent 4440597187
commit f7eece6cd9
5 changed files with 28 additions and 22 deletions

View File

@ -1,5 +1,5 @@
C Keep\scorrect\strack\sof\sthe\samount\sof\soutstanding\smemory\seven\swhen\sthe\nsystem\smemory\sallocator\sreturns\sa\sdifferent\snumber\sof\sbytes\sthan\nrequested.\s\sTicket\s#1660.\s(CVS\s3057)
D 2006-02-06T21:22:31
C Add\s"autoinc"\sand\s"collseq"\scolumns\sto\sthe\stable_info()\spragma.\s(CVS\s3058)
D 2006-02-06T21:34:27
F Makefile.in 5d8dff443383918b700e495de42ec65bc1c8865b
F Makefile.linux-gcc 74ba0eadf88748a9ce3fd03d2a3ede2e6715baec
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@ -62,7 +62,7 @@ F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
F src/pager.c b5b380ea7a36f84e50c3adc1a414820a0eb3baa6
F src/pager.h e0acb095b3ad0bca48f2ab00c87346665643f64f
F src/parse.y ce7182bfd47b7e5921bc55dcc399cda5cb879f19
F src/pragma.c 4496cc77dc35824e1c978c3d1413b8a5a4c777d3
F src/pragma.c 0986217308f5607c1e585cab774976bbfa8998b2
F src/prepare.c 40ae23c8aeb641dc7b9bb271eb5e295b815154a7
F src/printf.c c7d6ad9efb71c466305297a448308f467b6e2b6e
F src/random.c d40f8d356cecbd351ccfab6eaedd7ec1b54f5261
@ -210,7 +210,7 @@ F test/pager.test 6ee95e90ee8295e376e39a6c6566ef6df993601a
F test/pager2.test 49c0f57c7da0b060f0486b85fdd074025caa694e
F test/pager3.test 2323bf27fd5bd887b580247e5bce500ceee994b4
F test/pagesize.test 05c74ea49f790734ec1e9ab765d9bf1cce79b8f2
F test/pragma.test 8759b46702f6d8ee4f5dd520216c69dbc9080b60
F test/pragma.test 71bdf78d1b881bf15db3aa42cb3935fc3e4e6eab
F test/printf.test 9e10c74e16bf889f8495ddb3d6f5f891e75ff1b7
F test/progress.test 16496001da445e6534afb94562c286708316d82f x
F test/quick.test 38d1feefe5bfd0a61aa535775448276630ecfb92
@ -237,7 +237,7 @@ F test/subselect.test 2d13fb7f450db3595adcdd24079a0dd1d2d6abc2
F test/sync.test 6c8dc6592cd8dd770c739d9b5a9a9976c7124de6
F test/table.test 6dc0dfa44dd429520e0e5a0c5e55025f730e9403
F test/tableapi.test 6a66d58b37d46dc0f2b3c7d4bd2617d209399bd1
F test/tclsqlite.test 96f5dbba15df0523e889b8d892f152c2f60b8efb
F test/tclsqlite.test 1b9edb34413b857b7d03ede396873816d90ae458
F test/temptable.test c36f3e5a94507abb64f7ba23deeb4e1a8a8c3821
F test/tester.tcl 66a4bfa61a05e08ea523ef077e7ad0eab090c327
F test/thread1.test 776c9e459b75ba905193b351926ac4019b049f35
@ -350,7 +350,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
P 3f0a0ff1973079956506daaba9b21912fc76982b
R 223918435068480aa41a0976a6bec9c9
P 6f5eb74fd93a78ccdc2ddee0936ad4c5b2813720
R 81ff7d292d9391670294f83089b665da
U drh
Z 06a3dbaa3b53376bd535876b78dfb2ea
Z faa80ae5455cd837008f5062ec09fb7d

View File

@ -1 +1 @@
6f5eb74fd93a78ccdc2ddee0936ad4c5b2813720
7940a590abb4262c17922fb2dae1d9688279b2ef

View File

@ -11,7 +11,7 @@
*************************************************************************
** This file contains code used to implement the PRAGMA command.
**
** $Id: pragma.c,v 1.114 2006/01/12 01:56:44 drh Exp $
** $Id: pragma.c,v 1.115 2006/02/06 21:34:27 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
@ -468,23 +468,29 @@ void sqlite3Pragma(
pTab = sqlite3FindTable(db, zRight, zDb);
if( pTab ){
int i;
sqlite3VdbeSetNumCols(v, 6);
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; i<pTab->nCol; i++){
for(i=0, pCol=pTab->aCol; i<pTab->nCol; i++, pCol++){
sqlite3VdbeAddOp(v, OP_Integer, i, 0);
sqlite3VdbeOp3(v, OP_String8, 0, 0, pTab->aCol[i].zName, 0);
sqlite3VdbeOp3(v, OP_String8, 0, 0, pCol->zName, 0);
sqlite3VdbeOp3(v, OP_String8, 0, 0,
pTab->aCol[i].zType ? pTab->aCol[i].zType : "numeric", 0);
sqlite3VdbeAddOp(v, OP_Integer, pTab->aCol[i].notNull, 0);
sqlite3ExprCode(pParse, pTab->aCol[i].pDflt);
sqlite3VdbeAddOp(v, OP_Integer, pTab->aCol[i].isPrimKey, 0);
sqlite3VdbeAddOp(v, OP_Callback, 6, 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

View File

@ -12,7 +12,7 @@
#
# This file implements tests for the PRAGMA command.
#
# $Id: pragma.test,v 1.37 2006/01/03 00:33:50 drh Exp $
# $Id: pragma.test,v 1.38 2006/02/06 21:34:27 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -345,7 +345,7 @@ do_test pragma-6.2 {
execsql {
pragma table_info(t2)
}
} {0 a numeric 0 {} 0 1 b numeric 0 {} 0 2 c numeric 0 {} 0}
} {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 {

View File

@ -15,7 +15,7 @@
# 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.51 2006/01/24 10:58:23 danielk1977 Exp $
# $Id: tclsqlite.test,v 1.52 2006/02/06 21:34:27 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -148,7 +148,7 @@ if {[sqlite3 -tcl-uses-utf]} {
ifcapable schema_pragmas {
do_test tcl-2.2 {
execsql "PRAGMA table_info(t\u0123x)"
} "0 a int 0 {} 0 1 b\u1235 float 0 {} 0"
} "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)"