1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-14 00:22:38 +03:00

Change the table_info pragma so that it returns NULL for the default

value if there is no default value.  Ticket #2078. (CVS 3527)

FossilOrigin-Name: 5f21c3a5f02b4f2c4550f5904e9d0e1e2eafb0f3
This commit is contained in:
drh
2006-11-30 13:06:37 +00:00
parent 741f70633d
commit 736c7d4b2c
4 changed files with 21 additions and 15 deletions

View File

@@ -11,7 +11,7 @@
*************************************************************************
** This file contains code used to implement the PRAGMA command.
**
** $Id: pragma.c,v 1.124 2006/09/25 18:01:57 drh Exp $
** $Id: pragma.c,v 1.125 2006/11/30 13:06:37 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
@@ -483,14 +483,12 @@ void sqlite3Pragma(
sqlite3ViewGetColumnNames(pParse, pTab);
for(i=0, pCol=pTab->aCol; i<pTab->nCol; i++, pCol++){
const Token *pDflt;
static const Token noDflt = { (unsigned char*)"", 0, 0 };
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 : "", 0);
sqlite3VdbeAddOp(v, OP_Integer, pCol->notNull, 0);
pDflt = pCol->pDflt ? &pCol->pDflt->span : &noDflt;
if( pDflt->z ){
if( pCol->pDflt && (pDflt = &pCol->pDflt->span)->z ){
sqlite3VdbeOp3(v, OP_String8, 0, 0, (char*)pDflt->z, pDflt->n);
}else{
sqlite3VdbeAddOp(v, OP_Null, 0, 0);