Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | 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) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
b98727246d5fcc1b097b577be498a77e |
User & Date: | drh 2002-07-11 12:18:16.000 |
Context
2002-07-13
| ||
03:11 | Fix for ticket #95: Do not allow automatically created indices (associated with UNIQUE or PRIMARY KEY constraints) to be dropped. (CVS 671) (check-in: 0603eb74e6 user: drh tags: trunk) | |
2002-07-11
| ||
12:18 | 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) (check-in: b98727246d user: drh tags: trunk) | |
2002-07-10
| ||
21:26 | When reporting back the datatype of columns, use the text of the datatype as it appears in the CREATE TABLE statement, if available. Also: removed the ".reindex" command from the shell. (CVS 669) (check-in: ff8b6f4ee8 user: drh tags: trunk) | |
Changes
Changes to src/build.c.
︙ | ︙ | |||
21 22 23 24 25 26 27 | ** COPY ** VACUUM ** BEGIN TRANSACTION ** COMMIT ** ROLLBACK ** PRAGMA ** | | | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | ** COPY ** VACUUM ** BEGIN TRANSACTION ** COMMIT ** ROLLBACK ** PRAGMA ** ** $Id: build.c,v 1.103 2002/07/11 12:18:16 drh Exp $ */ #include "sqliteInt.h" #include <ctype.h> /* ** This routine is called when a new SQL statement is beginning to ** be parsed. Check to see if the schema for the database needs |
︙ | ︙ | |||
2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 | if( sqliteStrICmp(zLeft, "full_column_names")==0 ){ if( getBoolean(zRight) ){ db->flags |= SQLITE_FullColNames; }else{ db->flags &= ~SQLITE_FullColNames; } }else if( sqliteStrICmp(zLeft, "result_set_details")==0 ){ if( getBoolean(zRight) ){ db->flags |= SQLITE_ResultDetails; }else{ db->flags &= ~SQLITE_ResultDetails; } | > > > > > > > > | 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 | if( sqliteStrICmp(zLeft, "full_column_names")==0 ){ if( getBoolean(zRight) ){ db->flags |= SQLITE_FullColNames; }else{ db->flags &= ~SQLITE_FullColNames; } }else if( sqliteStrICmp(zLeft, "show_datatypes")==0 ){ if( getBoolean(zRight) ){ db->flags |= SQLITE_ReportTypes; }else{ db->flags &= ~SQLITE_ReportTypes; } }else if( sqliteStrICmp(zLeft, "result_set_details")==0 ){ if( getBoolean(zRight) ){ db->flags |= SQLITE_ResultDetails; }else{ db->flags &= ~SQLITE_ResultDetails; } |
︙ | ︙ |
Changes to src/select.c.
︙ | ︙ | |||
8 9 10 11 12 13 14 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains C code routines that are called by the parser ** to handle SELECT statements in SQLite. ** | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains C code routines that are called by the parser ** to handle SELECT statements in SQLite. ** ** $Id: select.c,v 1.105 2002/07/11 12:18:17 drh Exp $ */ #include "sqliteInt.h" /* ** Allocate a new Select structure and return a pointer to that ** structure. */ |
︙ | ︙ | |||
608 609 610 611 612 613 614 | SrcList *pTabList, /* List of tables */ ExprList *pEList /* Expressions defining the result set */ ){ Vdbe *v = pParse->pVdbe; int i; if( pParse->colNamesSet || v==0 || sqlite_malloc_failed ) return; pParse->colNamesSet = 1; | > | > > > | 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 | SrcList *pTabList, /* List of tables */ ExprList *pEList /* Expressions defining the result set */ ){ Vdbe *v = pParse->pVdbe; int i; if( pParse->colNamesSet || v==0 || sqlite_malloc_failed ) return; pParse->colNamesSet = 1; if( pParse->db->flags & SQLITE_ReportTypes ){ sqliteVdbeAddOp(v, OP_ColumnCount, pEList->nExpr*2, 0); }else{ sqliteVdbeAddOp(v, OP_ColumnCount, pEList->nExpr, 0); } for(i=0; i<pEList->nExpr; i++){ Expr *p; char *zType = 0; int showFullNames; if( pEList->a[i].zName ){ char *zName = pEList->a[i].zName; sqliteVdbeAddOp(v, OP_ColumnName, i, 0); |
︙ | ︙ | |||
668 669 670 671 672 673 674 | }else{ char zName[30]; assert( p->op!=TK_COLUMN || pTabList==0 ); sprintf(zName, "column%d", i+1); sqliteVdbeAddOp(v, OP_ColumnName, i, 0); sqliteVdbeChangeP3(v, -1, zName, strlen(zName)); } | > | | | | | | | | | > | 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 | }else{ char zName[30]; assert( p->op!=TK_COLUMN || pTabList==0 ); sprintf(zName, "column%d", i+1); sqliteVdbeAddOp(v, OP_ColumnName, i, 0); sqliteVdbeChangeP3(v, -1, zName, strlen(zName)); } if( pParse->db->flags & SQLITE_ReportTypes ){ if( zType==0 ){ if( sqliteExprType(p)==SQLITE_SO_TEXT ){ zType = "TEXT"; }else{ zType = "NUMERIC"; } } sqliteVdbeAddOp(v, OP_ColumnName, i + pEList->nExpr, 0); sqliteVdbeChangeP3(v, -1, zType, P3_STATIC); } } } /* ** Name of the connection operator, used for error messages. */ static const char *selectOpName(int id){ |
︙ | ︙ |
Changes to src/sqliteInt.h.
1 2 3 4 5 6 7 8 9 10 11 12 13 | /* ** 2001 September 15 ** ** 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. ** ************************************************************************* ** Internal interface definitions for SQLite. ** | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | /* ** 2001 September 15 ** ** 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. ** ************************************************************************* ** Internal interface definitions for SQLite. ** ** @(#) $Id: sqliteInt.h,v 1.136 2002/07/11 12:18:17 drh Exp $ */ #include "sqlite.h" #include "hash.h" #include "vdbe.h" #include "parse.h" #include "btree.h" #include <stdio.h> |
︙ | ︙ | |||
226 227 228 229 230 231 232 233 234 235 236 237 238 239 | /* DELETE, or UPDATE and return */ /* the count using a callback. */ #define SQLITE_NullCallback 0x00000080 /* Invoke the callback once if the */ /* result set is empty */ #define SQLITE_ResultDetails 0x00000100 /* Details added to result set */ #define SQLITE_UnresetViews 0x00000200 /* True if one or more views have */ /* defined column names */ /* ** Possible values for the sqlite.magic field. ** The numbers are obtained at random and have no special meaning, other ** than being distinct from one another. */ #define SQLITE_MAGIC_OPEN 0xa029a697 /* Database is open */ | > > | 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | /* DELETE, or UPDATE and return */ /* the count using a callback. */ #define SQLITE_NullCallback 0x00000080 /* Invoke the callback once if the */ /* result set is empty */ #define SQLITE_ResultDetails 0x00000100 /* Details added to result set */ #define SQLITE_UnresetViews 0x00000200 /* True if one or more views have */ /* defined column names */ #define SQLITE_ReportTypes 0x00000400 /* Include information on datatypes */ /* in 4th argument of callback */ /* ** Possible values for the sqlite.magic field. ** The numbers are obtained at random and have no special meaning, other ** than being distinct from one another. */ #define SQLITE_MAGIC_OPEN 0xa029a697 /* Database is open */ |
︙ | ︙ |
Changes to src/tclsqlite.c.
1 2 3 4 5 6 7 8 9 10 11 12 13 | /* ** 2001 September 15 ** ** 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. ** ************************************************************************* ** A TCL Interface to SQLite ** | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | /* ** 2001 September 15 ** ** 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. ** ************************************************************************* ** A TCL Interface to SQLite ** ** $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 */ #include "sqliteInt.h" #include "tcl.h" #include <stdlib.h> #include <string.h> |
︙ | ︙ | |||
89 90 91 92 93 94 95 | cbData->azColName[i] = malloc( Tcl_DStringLength(&dCol) + 1 ); if( cbData->azColName[i] ){ strcpy(cbData->azColName[i], Tcl_DStringValue(&dCol)); }else{ return 1; } if( cbData->zArray[0] ){ | < < > > > | | | | | | | | > | 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | cbData->azColName[i] = malloc( Tcl_DStringLength(&dCol) + 1 ); if( cbData->azColName[i] ){ strcpy(cbData->azColName[i], Tcl_DStringValue(&dCol)); }else{ return 1; } if( cbData->zArray[0] ){ Tcl_SetVar2(cbData->interp, cbData->zArray, "*", Tcl_DStringValue(&dCol), TCL_LIST_ELEMENT|TCL_APPEND_VALUE); 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); } } if( azCol!=0 ){ if( cbData->zArray[0] ){ |
︙ | ︙ | |||
159 160 161 162 163 164 165 | char ** azN /* Name for each column */ ){ CallbackData *cbData = (CallbackData*)clientData; int i, rc; if( azCol==0 || (cbData->once && cbData->zArray[0]) ){ Tcl_SetVar2(cbData->interp, cbData->zArray, "*", "", 0); for(i=0; i<nCol; i++){ | < > | | | | > | 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | char ** azN /* Name for each column */ ){ CallbackData *cbData = (CallbackData*)clientData; int i, rc; if( azCol==0 || (cbData->once && cbData->zArray[0]) ){ Tcl_SetVar2(cbData->interp, cbData->zArray, "*", "", 0); for(i=0; i<nCol; i++){ Tcl_SetVar2(cbData->interp, cbData->zArray, "*", azN[i], TCL_LIST_ELEMENT|TCL_APPEND_VALUE); 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; } if( azCol!=0 ){ if( cbData->zArray[0] ){ for(i=0; i<nCol; i++){ char *z = azCol[i]; |
︙ | ︙ |