]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Update comments. No changes to code. (CVS 841)
authordrh <drh@noemail.net>
Sun, 19 Jan 2003 03:59:45 +0000 (03:59 +0000)
committerdrh <drh@noemail.net>
Sun, 19 Jan 2003 03:59:45 +0000 (03:59 +0000)
FossilOrigin-Name: f6a8706872c43cee3003b48bb427c7b74b1f89e7

manifest
manifest.uuid
src/encode.c
src/main.c
src/printf.c
src/select.c
src/vdbe.c

index a52e81abd058b5c8d6a14b6d1c943ddc94942f24..902e36a4b718c1ecc79a2ec8b9be917d435e28f4 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Update\sthe\sspeed\scomparison\spage.\s(CVS\s840)
-D 2003-01-18T22:01:07
+C Update\scomments.\s\sNo\schanges\sto\scode.\s(CVS\s841)
+D 2003-01-19T03:59:46
 F Makefile.in 6606854b1512f185b8e8c779b8d7fc2750463d64
 F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
 F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
@@ -23,22 +23,22 @@ F src/btree.c 131b5903f66e148f0f9af0cedd1c6654932c4e04
 F src/btree.h 17710339f7a8f46e3c7d6d0d4648ef19c584ffda
 F src/build.c 0454fd02e163865c82106dd52dec4a4caf908ebf
 F src/delete.c cbd499f3f9297504c42e328af89bef1a2113d04c
-F src/encode.c 09d1fe8a2e97ff94cce496e2909e2ebc8947960b
+F src/encode.c faf03741efe921755ec371cf4a6984536de00042
 F src/expr.c 382839b92cb66a34cfa71cf1d2bc8fb818226c90
 F src/func.c 90c583f0b91220f7cd411a2407deaf9327245d63
 F src/hash.c 4fc39feb7b7711f6495ee9f2159559bedb043e1f
 F src/hash.h cd0433998bc1a3759d244e1637fe5a3c13b53bf8
 F src/insert.c db954e955970795819145a3649fd2ad116a58890
-F src/main.c a05db522f8182f47e0cc6902327a7c205735d808
+F src/main.c ad3193c56da5acd31bc6cd48aa50dae1962d7c78
 F src/md5.c fe4f9c9c6f71dfc26af8da63e4d04489b1430565
 F src/os.c 3a652608c296cf639ce63bd31d255db862e45685
 F src/os.h afa3e096213bad86845f8bdca81a9e917505e401
 F src/pager.c 081155624cff7bec54590133b69906a23f9b3659
 F src/pager.h 540833e8cb826b80ce2e39aa917deee5e12db626
 F src/parse.y a4fbfbe3c4254c96dae8c33264fb54af755a3770
-F src/printf.c 5c50fc1da75c8f5bf432b1ad17d91d6653acd167
+F src/printf.c e8e9a0605602cb1a3a2dc754e0978fa9064ecee7
 F src/random.c 19e8e00fe0df32a742f115773f57651be327cabe
-F src/select.c 65373244633151884ea83daffb34ef98382ac3b3
+F src/select.c c3c0b8263587d290592dca8b4371b5c1162ca684
 F src/shell.c cbb29252f0bd7b144d1e3126e64e17e5a314f2fd
 F src/shell.tcl 27ecbd63dd88396ad16d81ab44f73e6c0ea9d20e
 F src/sqlite.h.in 90657185cff387069d17c5b876a87a6a7a3b6f10
@@ -53,7 +53,7 @@ F src/tokenize.c 7ac1c33e0149647c9eb5959c48992df6906d4809
 F src/trigger.c da142decd2808bc39e801f3bb1f161dbc2bd4005
 F src/update.c f06afa9bf1f777d17702e0f6e33cf44c44bc4f75
 F src/util.c e23f8ffc654923e18f8db2d8e0de97c166fca20f
-F src/vdbe.c dc0a9c1b815c95b14ffe62765cfd528d974c6c1b
+F src/vdbe.c 7796485aa510c89aa378a11d3fbeb6fcf3893433
 F src/vdbe.h 754eba497cfe0c3e352b9c101ab2f811f10d0a55
 F src/where.c 5bf7f1e1d756ab3d25a18b24bb42106cb8e14d18
 F test/all.test 873d30e25a41b3aa48fec5633a7ec1816e107029
@@ -154,7 +154,7 @@ F www/speed.tcl 52759968401d81760fc01f9d3ab6242f6d2a7066
 F www/sqlite.tcl ae3dcfb077e53833b59d4fcc94d8a12c50a44098
 F www/tclsqlite.tcl 1db15abeb446aad0caf0b95b8b9579720e4ea331
 F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218
-P 71cc292dce59cf8224b205d1cdbff59ad12f1043
-R 843340c3fef7e6ee0ac6b3187554a951
+P 424cb2edb0c51b911791422ce7a9f5284a57f9ce
+R c412fddde0211bcedc2c913718bf3cae
 U drh
-Z 66212ef777c3998af30d067a457e17bb
+Z 08ec0c344754362c114e2ab7933a5823
index 49b0a5ce5176133282e60c627b05ad526f24e574..e9928020382b4a55190cbcd1d1eae61581630f22 100644 (file)
@@ -1 +1 @@
-424cb2edb0c51b911791422ce7a9f5284a57f9ce
\ No newline at end of file
+f6a8706872c43cee3003b48bb427c7b74b1f89e7
\ No newline at end of file
index 523a4db11bc7ab8e19b6a5efebcb9b08cf589277..a4bea5574c58fe28de5c4034f5fe18686bed8439 100644 (file)
 ** This file contains helper routines used to translate binary data into
 ** 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
-** 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.
 **
-** $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>
 
index 48956db7a4c075e98611afa20614056f27e65f1f..23efd5546622eb6a934ba0b4ec9488fa5dcd6693 100644 (file)
@@ -14,7 +14,7 @@
 ** other files are for internal use by SQLite and should not be
 ** 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 "os.h"
@@ -39,7 +39,7 @@ typedef struct {
 **     argv[0] = "file-format" or "schema-cookie" or "table" or "index"
 **     argv[1] = table or index name or meta statement type.
 **     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
 **
 */
@@ -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
   ** version 3.  This will reconstruct all indices.  If the
   ** 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 ){
     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
-** 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_libencoding(void){ return sqlite_encoding; }
index af703f3f995ab1b5274ed23347c110fbd6b332b7..1ef6f42ce9948349847c5601dcbfee2e870f17fd 100644 (file)
@@ -3,8 +3,8 @@
 ** the public domain.  The original comments are included here for
 ** completeness.  They are slightly out-of-date.
 **
-** The following modules is an enhanced replacement for the "printf" programs
-** found in the standard library.  The following enhancements are
+** The following modules is an enhanced replacement for the "printf" subroutines
+** found in the standard library.  The following enhancements are
 ** supported:
 **
 **      +  Additional functions.  The standard set of "printf" functions
index 5a72a1a44b8bb8479ab925159b37a7abee9bb7e3..29b1f9e3a647516c2488d90db489e05d4622a9d0 100644 (file)
@@ -12,7 +12,7 @@
 ** This file contains C code routines that are called by the parser
 ** 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"
 
@@ -180,7 +180,7 @@ static void addWhereTerm(
 /*
 ** 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
 ** 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
@@ -677,6 +677,17 @@ static void generateSortTail(
 /*
 ** Generate code that will tell the VDBE the datatypes of
 ** 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(
   Parse *pParse,      /* Parser context */
@@ -1187,7 +1198,19 @@ Vdbe *sqliteGetVdbe(Parse *pParse){
 **
 ** 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){
   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
 ** or intersection of two or more separate queries.
 **
-** "p" points to the right-most of the two queries.  The results should
-** be stored in eDest with parameter iParm.
+** "p" points to the right-most of the two queries.  the query on the
+** 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){
   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
 ** 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,
-** 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;
 **
 ** 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
 **
+** 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
 ** encountered, then an appropriate error message is left in
 ** 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.
 ** For that reason, the pParentAgg flag is passed as a pointer, so it
 ** 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(
   Parse *pParse,         /* The parser context */
   Select *p,             /* The SELECT statement being coded. */
-  int eDest,             /* One of: SRT_Callback Mem Set Union Except */
-  int iParm,             /* Save result in this memory location, if >=0 */
+  int eDest,             /* How to dispose of the results */
+  int iParm,             /* A parameter used by the eDest disposal method */
   Select *pParent,       /* Another SELECT for which this is a sub-query */
   int parentTab,         /* Index in pParent->pSrc of this query */
   int *pParentAgg        /* True if pParent uses aggregate functions */
@@ -1895,9 +1959,9 @@ int sqliteSelect(
   */
   if( pParse->nErr>0 ) goto select_end;
 
-  /* Look up every table in the table list and create an appropriate
-  ** columnlist in pEList if there isn't one already.  (The parser leaves
-  ** a NULL in the p->pEList if the SQL said "SELECT * FROM ...")
+  /* Expand any "*" terms in the result set.  (For example the "*" in
+  ** "SELECT * FROM t1")  The fillInColumnlist() routine also does some
+  ** other housekeeping - see the header comment for details.
   */
   if( fillInColumnList(pParse, p) ){
     goto select_end;
@@ -2024,8 +2088,8 @@ int sqliteSelect(
   v = sqliteGetVdbe(pParse);
   if( v==0 ) goto select_end;
 
-  /* Identify column names if we will be using in the callback.  This
-  ** step is skipped if the output is going to a table or a memory cell.
+  /* Identify column names if we will be using them in a callback.  This
+  ** step is skipped if the output is going to some other destination.
   */
   if( eDest==SRT_Callback ){
     generateColumnNames(pParse, p->base, pTabList, pEList);
@@ -2076,8 +2140,9 @@ int sqliteSelect(
     return rc;
   }
 
-  /* Identify column types if we will be using in the callback.  This
-  ** step is skipped if the output is going to a table or a memory cell.
+  /* Identify column types if we will be using a callback.  This
+  ** step is skipped if the output is going to a destination other
+  ** than a callback.
   */
   if( eDest==SRT_Callback ){
     generateColumnTypes(pParse, p->base, pTabList, pEList);
@@ -2254,7 +2319,6 @@ int sqliteSelect(
   ** successful coding of the SELECT.
   */
 select_end:
-  /* pParse->nTab = base; */
   sqliteAggregateInfoReset(pParse);
   return rc;
 }
index ba3fcca82606b12620a3ede17802068eb1a58764..ac92fa0447b759193a4b29f9651423598e53881b 100644 (file)
@@ -36,7 +36,7 @@
 ** in this file for details.  If in doubt, do not deviate from existing
 ** 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 <ctype.h>
@@ -1759,8 +1759,8 @@ case OP_Callback: {
 **
 ** Invoke the callback function once with the 2nd 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
-** OP_ColumnCount instructions.  This is all like the regular
+** names of the columns) set according to prior OP_ColumnName
+** instructions.  This is all like the regular
 ** OP_Callback or OP_SortCallback opcodes.  But the 3rd argument
 ** which normally contains a pointer to an array of pointers to
 ** data is NULL.