diff options
author | drh <drh@noemail.net> | 2002-07-11 12:18:16 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2002-07-11 12:18:16 +0000 |
commit | 5080aaa7ab8da17be7cec13d0708c29d24d92455 (patch) | |
tree | 68318fdcfd0bde96ceb1765178d7342241782d65 /src/tclsqlite.c | |
parent | fa173a764a713e8ac9f9a6733c4612edfc904f28 (diff) | |
download | sqlite-5080aaa7ab8da17be7cec13d0708c29d24d92455.tar.gz sqlite-5080aaa7ab8da17be7cec13d0708c29d24d92455.zip |
Turn of the reporting of datatypes in the 4th callback argument unless the
SHOW_DATATYPES pragma is ON. Eliminate the NULL pointer that used to separate
the beginning of datatypes from the end of column names so that the callback
can test to see whether or not datatypes are provided. This is an
incompatible changes, but since the prior behavior was never documented, we
will let it in. (CVS 670)
FossilOrigin-Name: b98727246d5fcc1b097b577be498a77e954c5dc4
Diffstat (limited to 'src/tclsqlite.c')
-rw-r--r-- | src/tclsqlite.c | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/src/tclsqlite.c b/src/tclsqlite.c index b8e2a5ee3..93cf71846 100644 --- a/src/tclsqlite.c +++ b/src/tclsqlite.c @@ -11,7 +11,7 @@ ************************************************************************* ** A TCL Interface to SQLite ** -** $Id: tclsqlite.c,v 1.37 2002/07/10 21:26:01 drh Exp $ +** $Id: tclsqlite.c,v 1.38 2002/07/11 12:18:17 drh Exp $ */ #ifndef NO_TCL /* Omit this whole file if TCL is unavailable */ @@ -93,18 +93,20 @@ static int DbEvalCallback( return 1; } if( cbData->zArray[0] ){ - Tcl_DString dType; - Tcl_DStringInit(&dType); Tcl_SetVar2(cbData->interp, cbData->zArray, "*", Tcl_DStringValue(&dCol), TCL_LIST_ELEMENT|TCL_APPEND_VALUE); - Tcl_DStringAppend(&dType, "typeof:", -1); - Tcl_DStringAppend(&dType, Tcl_DStringValue(&dCol), -1); - Tcl_DStringFree(&dCol); - Tcl_ExternalToUtfDString(NULL, azN[i+argc+1], -1, &dCol); - Tcl_SetVar2(cbData->interp, cbData->zArray, - Tcl_DStringValue(&dType), Tcl_DStringValue(&dCol), - TCL_LIST_ELEMENT|TCL_APPEND_VALUE); - Tcl_DStringFree(&dType); + if( azN[nCol]!=0 } { + Tcl_DString dType; + Tcl_DStringInit(&dType); + Tcl_DStringAppend(&dType, "typeof:", -1); + Tcl_DStringAppend(&dType, Tcl_DStringValue(&dCol), -1); + Tcl_DStringFree(&dCol); + Tcl_ExternalToUtfDString(NULL, azN[i+nCol], -1, &dCol); + Tcl_SetVar2(cbData->interp, cbData->zArray, + Tcl_DStringValue(&dType), Tcl_DStringValue(&dCol), + TCL_LIST_ELEMENT|TCL_APPEND_VALUE); + Tcl_DStringFree(&dType); + } } Tcl_DStringFree(&dCol); @@ -163,13 +165,14 @@ static int DbEvalCallback( if( azCol==0 || (cbData->once && cbData->zArray[0]) ){ Tcl_SetVar2(cbData->interp, cbData->zArray, "*", "", 0); for(i=0; i<nCol; i++){ - char *z; Tcl_SetVar2(cbData->interp, cbData->zArray, "*", azN[i], TCL_LIST_ELEMENT|TCL_APPEND_VALUE); - z = sqlite_mprintf("typeof:%s", azN[i]); - Tcl_SetVar2(cbData->interp, cbData->zArray, z, azN[i+nCol+1], - TCL_LIST_ELEMENT|TCL_APPEND_VALUE); - sqlite_freemem(z); + if( azN[nCol] ){ + char *z = sqlite_mprintf("typeof:%s", azN[i]); + Tcl_SetVar2(cbData->interp, cbData->zArray, z, azN[i+nCol], + TCL_LIST_ELEMENT|TCL_APPEND_VALUE); + sqlite_freemem(z); + } } cbData->once = 0; } |