1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

Update comments. No changes to code. (CVS 841)

FossilOrigin-Name: f6a8706872c43cee3003b48bb427c7b74b1f89e7
This commit is contained in:
drh
2003-01-19 03:59:45 +00:00
parent 79104c9d2a
commit e78e8284ad
7 changed files with 103 additions and 38 deletions

View File

@ -1,5 +1,5 @@
C Update\sthe\sspeed\scomparison\spage.\s(CVS\s840) C Update\scomments.\s\sNo\schanges\sto\scode.\s(CVS\s841)
D 2003-01-18T22:01:07 D 2003-01-19T03:59:46
F Makefile.in 6606854b1512f185b8e8c779b8d7fc2750463d64 F Makefile.in 6606854b1512f185b8e8c779b8d7fc2750463d64
F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906 F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
@ -23,22 +23,22 @@ F src/btree.c 131b5903f66e148f0f9af0cedd1c6654932c4e04
F src/btree.h 17710339f7a8f46e3c7d6d0d4648ef19c584ffda F src/btree.h 17710339f7a8f46e3c7d6d0d4648ef19c584ffda
F src/build.c 0454fd02e163865c82106dd52dec4a4caf908ebf F src/build.c 0454fd02e163865c82106dd52dec4a4caf908ebf
F src/delete.c cbd499f3f9297504c42e328af89bef1a2113d04c F src/delete.c cbd499f3f9297504c42e328af89bef1a2113d04c
F src/encode.c 09d1fe8a2e97ff94cce496e2909e2ebc8947960b F src/encode.c faf03741efe921755ec371cf4a6984536de00042
F src/expr.c 382839b92cb66a34cfa71cf1d2bc8fb818226c90 F src/expr.c 382839b92cb66a34cfa71cf1d2bc8fb818226c90
F src/func.c 90c583f0b91220f7cd411a2407deaf9327245d63 F src/func.c 90c583f0b91220f7cd411a2407deaf9327245d63
F src/hash.c 4fc39feb7b7711f6495ee9f2159559bedb043e1f F src/hash.c 4fc39feb7b7711f6495ee9f2159559bedb043e1f
F src/hash.h cd0433998bc1a3759d244e1637fe5a3c13b53bf8 F src/hash.h cd0433998bc1a3759d244e1637fe5a3c13b53bf8
F src/insert.c db954e955970795819145a3649fd2ad116a58890 F src/insert.c db954e955970795819145a3649fd2ad116a58890
F src/main.c a05db522f8182f47e0cc6902327a7c205735d808 F src/main.c ad3193c56da5acd31bc6cd48aa50dae1962d7c78
F src/md5.c fe4f9c9c6f71dfc26af8da63e4d04489b1430565 F src/md5.c fe4f9c9c6f71dfc26af8da63e4d04489b1430565
F src/os.c 3a652608c296cf639ce63bd31d255db862e45685 F src/os.c 3a652608c296cf639ce63bd31d255db862e45685
F src/os.h afa3e096213bad86845f8bdca81a9e917505e401 F src/os.h afa3e096213bad86845f8bdca81a9e917505e401
F src/pager.c 081155624cff7bec54590133b69906a23f9b3659 F src/pager.c 081155624cff7bec54590133b69906a23f9b3659
F src/pager.h 540833e8cb826b80ce2e39aa917deee5e12db626 F src/pager.h 540833e8cb826b80ce2e39aa917deee5e12db626
F src/parse.y a4fbfbe3c4254c96dae8c33264fb54af755a3770 F src/parse.y a4fbfbe3c4254c96dae8c33264fb54af755a3770
F src/printf.c 5c50fc1da75c8f5bf432b1ad17d91d6653acd167 F src/printf.c e8e9a0605602cb1a3a2dc754e0978fa9064ecee7
F src/random.c 19e8e00fe0df32a742f115773f57651be327cabe F src/random.c 19e8e00fe0df32a742f115773f57651be327cabe
F src/select.c 65373244633151884ea83daffb34ef98382ac3b3 F src/select.c c3c0b8263587d290592dca8b4371b5c1162ca684
F src/shell.c cbb29252f0bd7b144d1e3126e64e17e5a314f2fd F src/shell.c cbb29252f0bd7b144d1e3126e64e17e5a314f2fd
F src/shell.tcl 27ecbd63dd88396ad16d81ab44f73e6c0ea9d20e F src/shell.tcl 27ecbd63dd88396ad16d81ab44f73e6c0ea9d20e
F src/sqlite.h.in 90657185cff387069d17c5b876a87a6a7a3b6f10 F src/sqlite.h.in 90657185cff387069d17c5b876a87a6a7a3b6f10
@ -53,7 +53,7 @@ F src/tokenize.c 7ac1c33e0149647c9eb5959c48992df6906d4809
F src/trigger.c da142decd2808bc39e801f3bb1f161dbc2bd4005 F src/trigger.c da142decd2808bc39e801f3bb1f161dbc2bd4005
F src/update.c f06afa9bf1f777d17702e0f6e33cf44c44bc4f75 F src/update.c f06afa9bf1f777d17702e0f6e33cf44c44bc4f75
F src/util.c e23f8ffc654923e18f8db2d8e0de97c166fca20f F src/util.c e23f8ffc654923e18f8db2d8e0de97c166fca20f
F src/vdbe.c dc0a9c1b815c95b14ffe62765cfd528d974c6c1b F src/vdbe.c 7796485aa510c89aa378a11d3fbeb6fcf3893433
F src/vdbe.h 754eba497cfe0c3e352b9c101ab2f811f10d0a55 F src/vdbe.h 754eba497cfe0c3e352b9c101ab2f811f10d0a55
F src/where.c 5bf7f1e1d756ab3d25a18b24bb42106cb8e14d18 F src/where.c 5bf7f1e1d756ab3d25a18b24bb42106cb8e14d18
F test/all.test 873d30e25a41b3aa48fec5633a7ec1816e107029 F test/all.test 873d30e25a41b3aa48fec5633a7ec1816e107029
@ -154,7 +154,7 @@ F www/speed.tcl 52759968401d81760fc01f9d3ab6242f6d2a7066
F www/sqlite.tcl ae3dcfb077e53833b59d4fcc94d8a12c50a44098 F www/sqlite.tcl ae3dcfb077e53833b59d4fcc94d8a12c50a44098
F www/tclsqlite.tcl 1db15abeb446aad0caf0b95b8b9579720e4ea331 F www/tclsqlite.tcl 1db15abeb446aad0caf0b95b8b9579720e4ea331
F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218 F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218
P 71cc292dce59cf8224b205d1cdbff59ad12f1043 P 424cb2edb0c51b911791422ce7a9f5284a57f9ce
R 843340c3fef7e6ee0ac6b3187554a951 R c412fddde0211bcedc2c913718bf3cae
U drh U drh
Z 66212ef777c3998af30d067a457e17bb Z 08ec0c344754362c114e2ab7933a5823

View File

@ -1 +1 @@
424cb2edb0c51b911791422ce7a9f5284a57f9ce f6a8706872c43cee3003b48bb427c7b74b1f89e7

View File

@ -12,10 +12,10 @@
** This file contains helper routines used to translate binary data into ** This file contains helper routines used to translate binary data into
** a null-terminated string (suitable for use in SQLite) and back again. ** a null-terminated string (suitable for use in SQLite) and back again.
** These are convenience routines for use by people who want to store binary ** These are convenience routines for use by people who want to store binary
** data in an SQLite database. The code in this file is used by any other ** data in an SQLite database. The code in this file is not used by any other
** part of the SQLite library. ** part of the SQLite library.
** **
** $Id: encode.c,v 1.4 2003/01/11 14:25:40 drh Exp $ ** $Id: encode.c,v 1.5 2003/01/19 03:59:46 drh Exp $
*/ */
#include <string.h> #include <string.h>

View File

@ -14,7 +14,7 @@
** other files are for internal use by SQLite and should not be ** other files are for internal use by SQLite and should not be
** accessed by users of the library. ** accessed by users of the library.
** **
** $Id: main.c,v 1.108 2003/01/18 17:04:09 drh Exp $ ** $Id: main.c,v 1.109 2003/01/19 03:59:47 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include "os.h" #include "os.h"
@ -39,7 +39,7 @@ typedef struct {
** argv[0] = "file-format" or "schema-cookie" or "table" or "index" ** argv[0] = "file-format" or "schema-cookie" or "table" or "index"
** argv[1] = table or index name or meta statement type. ** argv[1] = table or index name or meta statement type.
** argv[2] = root page number for table or index. NULL for meta. ** argv[2] = root page number for table or index. NULL for meta.
** argv[3] = SQL create statement for the table or index ** argv[3] = SQL text for a CREATE TABLE or CREATE INDEX statement.
** argv[4] = "1" for temporary files, "0" for main database ** argv[4] = "1" for temporary files, "0" for main database
** **
*/ */
@ -391,7 +391,7 @@ sqlite *sqlite_open(const char *zFilename, int mode, char **pzErrMsg){
/* If the database is in formats 1 or 2, then upgrade it to /* If the database is in formats 1 or 2, then upgrade it to
** version 3. This will reconstruct all indices. If the ** version 3. This will reconstruct all indices. If the
** upgrade fails for any reason (ex: out of disk space, database ** upgrade fails for any reason (ex: out of disk space, database
** is read only, interrupt receive, etc.) then refuse to open. ** is read only, interrupt received, etc.) then refuse to open.
*/ */
if( rc==SQLITE_OK && db->file_format<3 ){ if( rc==SQLITE_OK && db->file_format<3 ){
char *zErr = 0; char *zErr = 0;
@ -786,7 +786,8 @@ void sqlite_freemem(void *p){ free(p); }
/* /*
** Windows systems need functions to call to return the sqlite_version ** Windows systems need functions to call to return the sqlite_version
** and sqlite_encoding strings. ** and sqlite_encoding strings since they are unable to access constants
** within DLLs.
*/ */
const char *sqlite_libversion(void){ return sqlite_version; } const char *sqlite_libversion(void){ return sqlite_version; }
const char *sqlite_libencoding(void){ return sqlite_encoding; } const char *sqlite_libencoding(void){ return sqlite_encoding; }

View File

@ -3,8 +3,8 @@
** the public domain. The original comments are included here for ** the public domain. The original comments are included here for
** completeness. They are slightly out-of-date. ** completeness. They are slightly out-of-date.
** **
** The following modules is an enhanced replacement for the "printf" programs ** The following modules is an enhanced replacement for the "printf" subroutines
** found in the standard library. The following enhancements are ** found in the standard C library. The following enhancements are
** supported: ** supported:
** **
** + Additional functions. The standard set of "printf" functions ** + Additional functions. The standard set of "printf" functions

View File

@ -12,7 +12,7 @@
** This file contains C code routines that are called by the parser ** This file contains C code routines that are called by the parser
** to handle SELECT statements in SQLite. ** to handle SELECT statements in SQLite.
** **
** $Id: select.c,v 1.122 2003/01/18 20:11:07 drh Exp $ ** $Id: select.c,v 1.123 2003/01/19 03:59:47 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
@ -180,7 +180,7 @@ static void addWhereTerm(
/* /*
** Set the EP_FromJoin property on all terms of the given expression. ** Set the EP_FromJoin property on all terms of the given expression.
** **
** The EP_FromJoin property is used at on terms of an expression to tell ** The EP_FromJoin property is used on terms of an expression to tell
** the LEFT OUTER JOIN processing logic that this term is part of the ** the LEFT OUTER JOIN processing logic that this term is part of the
** join restriction specified in the ON or USING clause and not a part ** join restriction specified in the ON or USING clause and not a part
** of the more general WHERE clause. These terms are moved over to the ** of the more general WHERE clause. These terms are moved over to the
@ -677,6 +677,17 @@ static void generateSortTail(
/* /*
** Generate code that will tell the VDBE the datatypes of ** Generate code that will tell the VDBE the datatypes of
** columns in the result set. ** columns in the result set.
**
** This routine only generates code if the "PRAGMA show_datatypes=on"
** has been executed. The datatypes are reported out in the azCol
** parameter to the callback function. The first N azCol[] entries
** are the names of the columns, and the second N entries are the
** datatypes for the columns.
**
** The "datatype" for a result that is a column of a type is the
** datatype definition extracted from the CREATE TABLE statement.
** The datatype for an expression is either TEXT or NUMERIC. The
** datatype for a ROWID field is INTEGER.
*/ */
static void generateColumnTypes( static void generateColumnTypes(
Parse *pParse, /* Parser context */ Parse *pParse, /* Parser context */
@ -1187,7 +1198,19 @@ Vdbe *sqliteGetVdbe(Parse *pParse){
** **
** Examples: ** Examples:
** **
** SELECT a,b ** CREATE TABLE one(a INTEGER, b TEXT);
** CREATE TABLE two(c VARCHAR(5), d FLOAT);
**
** SELECT b, b FROM one UNION SELECT d, c FROM two ORDER BY 1, 2;
**
** The primary sort key will use SQLITE_SO_NUM because the "d" in
** the second SELECT is numeric. The 1st column of the first SELECT
** is text but that does not matter because a numeric always overrides
** a text.
**
** The secondary key will use the SQLITE_SO_TEXT sort order because
** both the (second) "b" in the first SELECT and the "c" in the second
** SELECT have a datatype of text.
*/ */
static void multiSelectSortOrder(Select *p, ExprList *pOrderBy){ static void multiSelectSortOrder(Select *p, ExprList *pOrderBy){
int i; int i;
@ -1215,8 +1238,31 @@ static void multiSelectSortOrder(Select *p, ExprList *pOrderBy){
** This routine is called to process a query that is really the union ** This routine is called to process a query that is really the union
** or intersection of two or more separate queries. ** or intersection of two or more separate queries.
** **
** "p" points to the right-most of the two queries. The results should ** "p" points to the right-most of the two queries. the query on the
** be stored in eDest with parameter iParm. ** left is p->pPrior. The left query could also be a compound query
** in which case this routine will be called recursively.
**
** The results of the total query are to be written into a destination
** of type eDest with parameter iParm.
**
** Example 1: Consider a three-way compound SQL statement.
**
** SELECT a FROM t1 UNION SELECT b FROM t2 UNION SELECT c FROM t3
**
** This statement is parsed up as follows:
**
** SELECT c FROM t3
** |
** `-----> SELECT b FROM t2
** |
** `------> SELECT c FROM t1
**
** The arrows in the diagram above represent the Select.pPrior pointer.
** So if this routine is called with p equal to the t3 query, then
** pPrior will be the t2 query. p->op will be TK_UNION in this case.
**
** Notice that because of the way SQLite parses compound SELECTs, the
** individual selects always group from left to right.
*/ */
static int multiSelect(Parse *pParse, Select *p, int eDest, int iParm){ static int multiSelect(Parse *pParse, Select *p, int eDest, int iParm){
int rc; /* Success code from a subroutine */ int rc; /* Success code from a subroutine */
@ -1695,7 +1741,7 @@ static int flattenSubquery(
** Analyze the SELECT statement passed in as an argument to see if it ** Analyze the SELECT statement passed in as an argument to see if it
** is a simple min() or max() query. If it is and this query can be ** is a simple min() or max() query. If it is and this query can be
** satisfied using a single seek to the beginning or end of an index, ** satisfied using a single seek to the beginning or end of an index,
** then generate the code for this SELECT return 1. If this is not a ** then generate the code for this SELECT and return 1. If this is not a
** simple min() or max() query, then return 0; ** simple min() or max() query, then return 0;
** **
** A simply min() or max() query looks like this: ** A simply min() or max() query looks like this:
@ -1826,6 +1872,10 @@ static int simpleMinMaxQuery(Parse *pParse, Select *p, int eDest, int iParm){
** **
** SRT_Table Store results in temporary table iParm ** SRT_Table Store results in temporary table iParm
** **
** The table above is incomplete. Additional eDist value have be added
** since this comment was written. See the selectInnerLoop() function for
** a complete listing of the allowed values of eDest and their meanings.
**
** This routine returns the number of errors. If any errors are ** This routine returns the number of errors. If any errors are
** encountered, then an appropriate error message is left in ** encountered, then an appropriate error message is left in
** pParse->zErrMsg. ** pParse->zErrMsg.
@ -1839,12 +1889,26 @@ static int simpleMinMaxQuery(Parse *pParse, Select *p, int eDest, int iParm){
** change the parent query from a non-aggregate to an aggregate query. ** change the parent query from a non-aggregate to an aggregate query.
** For that reason, the pParentAgg flag is passed as a pointer, so it ** For that reason, the pParentAgg flag is passed as a pointer, so it
** can be changed. ** can be changed.
**
** Example 1: The meaning of the pParent parameter.
**
** SELECT * FROM t1 JOIN (SELECT x, count(*) FROM t2) JOIN t3;
** \ \_______ subquery _______/ /
** \ /
** \____________________ outer query ___________________/
**
** This routine is called for the outer query first. For that call,
** pParent will be NULL. During the processing of the outer query, this
** routine is called recursively to handle the subquery. For the recursive
** call, pParent will point to the outer query. Because the subquery is
** the second element in a three-way join, the parentTab parameter will
** be 1 (the 2nd value of a 0-indexed array.)
*/ */
int sqliteSelect( int sqliteSelect(
Parse *pParse, /* The parser context */ Parse *pParse, /* The parser context */
Select *p, /* The SELECT statement being coded. */ Select *p, /* The SELECT statement being coded. */
int eDest, /* One of: SRT_Callback Mem Set Union Except */ int eDest, /* How to dispose of the results */
int iParm, /* Save result in this memory location, if >=0 */ int iParm, /* A parameter used by the eDest disposal method */
Select *pParent, /* Another SELECT for which this is a sub-query */ Select *pParent, /* Another SELECT for which this is a sub-query */
int parentTab, /* Index in pParent->pSrc of this query */ int parentTab, /* Index in pParent->pSrc of this query */
int *pParentAgg /* True if pParent uses aggregate functions */ int *pParentAgg /* True if pParent uses aggregate functions */
@ -1895,9 +1959,9 @@ int sqliteSelect(
*/ */
if( pParse->nErr>0 ) goto select_end; if( pParse->nErr>0 ) goto select_end;
/* Look up every table in the table list and create an appropriate /* Expand any "*" terms in the result set. (For example the "*" in
** columnlist in pEList if there isn't one already. (The parser leaves ** "SELECT * FROM t1") The fillInColumnlist() routine also does some
** a NULL in the p->pEList if the SQL said "SELECT * FROM ...") ** other housekeeping - see the header comment for details.
*/ */
if( fillInColumnList(pParse, p) ){ if( fillInColumnList(pParse, p) ){
goto select_end; goto select_end;
@ -2024,8 +2088,8 @@ int sqliteSelect(
v = sqliteGetVdbe(pParse); v = sqliteGetVdbe(pParse);
if( v==0 ) goto select_end; if( v==0 ) goto select_end;
/* Identify column names if we will be using in the callback. This /* Identify column names if we will be using them in a callback. This
** step is skipped if the output is going to a table or a memory cell. ** step is skipped if the output is going to some other destination.
*/ */
if( eDest==SRT_Callback ){ if( eDest==SRT_Callback ){
generateColumnNames(pParse, p->base, pTabList, pEList); generateColumnNames(pParse, p->base, pTabList, pEList);
@ -2076,8 +2140,9 @@ int sqliteSelect(
return rc; return rc;
} }
/* Identify column types if we will be using in the callback. This /* Identify column types if we will be using a callback. This
** step is skipped if the output is going to a table or a memory cell. ** step is skipped if the output is going to a destination other
** than a callback.
*/ */
if( eDest==SRT_Callback ){ if( eDest==SRT_Callback ){
generateColumnTypes(pParse, p->base, pTabList, pEList); generateColumnTypes(pParse, p->base, pTabList, pEList);
@ -2254,7 +2319,6 @@ int sqliteSelect(
** successful coding of the SELECT. ** successful coding of the SELECT.
*/ */
select_end: select_end:
/* pParse->nTab = base; */
sqliteAggregateInfoReset(pParse); sqliteAggregateInfoReset(pParse);
return rc; return rc;
} }

View File

@ -36,7 +36,7 @@
** in this file for details. If in doubt, do not deviate from existing ** in this file for details. If in doubt, do not deviate from existing
** commenting and indentation practices when changing or adding code. ** commenting and indentation practices when changing or adding code.
** **
** $Id: vdbe.c,v 1.198 2003/01/16 13:42:43 drh Exp $ ** $Id: vdbe.c,v 1.199 2003/01/19 03:59:47 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include <ctype.h> #include <ctype.h>
@ -1759,8 +1759,8 @@ case OP_Callback: {
** **
** Invoke the callback function once with the 2nd argument (the ** Invoke the callback function once with the 2nd argument (the
** number of columns) equal to P1 and with the 4th argument (the ** number of columns) equal to P1 and with the 4th argument (the
** names of the columns) set according to prior OP_ColumnName and ** names of the columns) set according to prior OP_ColumnName
** OP_ColumnCount instructions. This is all like the regular ** instructions. This is all like the regular
** OP_Callback or OP_SortCallback opcodes. But the 3rd argument ** OP_Callback or OP_SortCallback opcodes. But the 3rd argument
** which normally contains a pointer to an array of pointers to ** which normally contains a pointer to an array of pointers to
** data is NULL. ** data is NULL.