/ Check-in [97339efd]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Comment changes only (CVS 165)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:97339efdf3f3b02a6a4fe57d2cb01d19cec3c749
User & Date: drh 2000-11-28 20:46:39
Context
2000-11-28
20:47
Comment changes only (CVS 166) check-in: 5518e012 user: drh tags: trunk
20:46
Comment changes only (CVS 165) check-in: 97339efd user: drh tags: trunk
2000-10-23
13:20
Version 1.0.15 (CVS 488) check-in: d2ad3d2b user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to www/c_interface.tcl.

     1      1   #
     2      2   # Run this Tcl script to generate the sqlite.html file.
     3      3   #
     4         -set rcsid {$Id: c_interface.tcl,v 1.12 2000/10/23 13:16:33 drh Exp $}
            4  +set rcsid {$Id: c_interface.tcl,v 1.13 2000/11/28 20:46:39 drh Exp $}
     5      5   
     6      6   puts {<html>
     7      7   <head>
     8      8     <title>The C language interface to the SQLite library</title>
     9      9   </head>
    10     10   <body bgcolor=white>
    11     11   <h1 align=center>
................................................................................
   454    454   it into the result.  But %q translates the inserted string by
   455    455   making two copies of every single-quote (') character in the
   456    456   substituted string.  This has the effect of escaping the end-of-string
   457    457   meaning of single-quote within a string literal.
   458    458   </p>
   459    459   
   460    460   <p>Consider an example.  Suppose you are trying to insert a string
   461         -values into a database table where the string value was obtained from
          461  +value into a database table where the string value was obtained from
   462    462   user input.  Suppose the string to be inserted is stored in a variable
   463    463   named zString.  The code to do the insertion might look like this:</p>
   464    464   
   465    465   <blockquote><pre>
   466    466   sqlite_exec_printf(db,
   467    467     "INSERT INTO table1 VALUES('%s')",
   468    468     0, 0, 0, zString);

Changes to www/vdbe.tcl.

     1      1   #
     2      2   # Run this Tcl script to generate the vdbe.html file.
     3      3   #
     4         -set rcsid {$Id: vdbe.tcl,v 1.5 2000/07/30 20:04:43 drh Exp $}
            4  +set rcsid {$Id: vdbe.tcl,v 1.6 2000/11/28 20:46:41 drh Exp $}
     5      5   
     6      6   puts {<html>
     7      7   <head>
     8      8     <title>The Virtual Database Engine of SQLite</title>
     9      9   </head>
    10     10   <body bgcolor=white>
    11     11   <h1 align=center>
................................................................................
   216    216   <a name="trace">
   217    217   <h2>Tracing VDBE Program Execution</h2>
   218    218   
   219    219   <p>If the SQLite library is compiled without the NDEBUG 
   220    220   preprocessor macro, then
   221    221   there is a special SQL comment that will cause the 
   222    222   the VDBE to traces the execution of programs.
   223         -Though this features was originally intended for testing
          223  +Though this feature was originally intended for testing
   224    224   and debugging, it might also be useful in learning about
   225    225   how the VDBE operates.
   226    226   Use the "<tt>--vdbe-trace-on--</tt>" comment to
   227    227   turn tracing on and "<tt>--vdbe-trace-off--</tt>" to turn tracing
   228    228   back off.  Like this:</p>
   229    229   }
   230    230   
................................................................................
   302    302   
   303    303   <blockquote><pre>
   304    304   int Callback(void *pUserData, int nColumn, char *azData[], char *azColumnName[]);
   305    305   </pre></blockquote>
   306    306   
   307    307   <p>The SQLite library supplies the VDBE with a pointer to the callback function
   308    308   and the <b>pUserData</b> pointer.  (Both the callback and the user data were
   309         -originally passed in as argument to the <b>sqlite_exec()</b> API function.)
          309  +originally passed in as arguments to the <b>sqlite_exec()</b> API function.)
   310    310   The job of the VDBE is to
   311    311   come up with values for <b>nColumn</b>, <b>azData[]</b>, 
   312    312   and <b>azColumnName[]</b>.
   313    313   <b>nColumn</b> is the number of columns in the results, of course.
   314    314   <b>azColumnName[]</b> is an array of strings where each string is the name
   315    315   of one of the result column.  <b>azData[]</b> is an array of strings holding
   316    316   the actual data.</p>
................................................................................
   765    765   
   766    766   <p>In the example queries above, every row of the table being
   767    767   queried must be loaded off of the disk and examined, even if only
   768    768   a small percentage of the rows end up in the result.  This can
   769    769   take a long time on a big table.  To speed things up, SQLite
   770    770   can use an index.</p>
   771    771   
   772         -<p>An GDBM file associates a key with some data.  For a SQLite
          772  +<p>A GDBM file associates a key with some data.  For a SQLite
   773    773   table, the GDBM file is set up so that the key is a integer
   774    774   and the data is the information for one row of the table.
   775    775   Indices in SQLite reverse this arrangement.  The GDBM key
   776    776   is (some of) the information being stored and the GDBM data 
   777    777   is an integer.
   778    778   To access a table row that has some particular
   779    779   content, we first look up the content in the GDBM index file to find
................................................................................
  1168   1168   The data structure is an unordered set of buckets, where each bucket
  1169   1169   has a key and one or more memory locations.  Within the query
  1170   1170   loop, the GROUP BY clause is used to construct a key and the bucket
  1171   1171   with that key is brought into focus.  A new bucket is created with
  1172   1172   the key if one did not previously exist.  Once the bucket is in
  1173   1173   focus, the memory locations of the bucket are used to accumulate
  1174   1174   the values of the various aggregate functions.  After the query
  1175         -loop terminates, the each bucket is visited once to generate a
         1175  +loop terminates, each bucket is visited once to generate a
  1176   1176   single row of the results.</p>
  1177   1177   
  1178   1178   <p>An example will help to clarify this concept.  Consider the
  1179   1179   following query:</p>
  1180   1180   
  1181   1181   <blockquote><pre>
  1182   1182   SELECT three, min(three+four)+avg(four) 
................................................................................
  1472   1472   table will be automatically deleted from the disk when the
  1473   1473   VDBE halts.</p>
  1474   1474   
  1475   1475   <p>The inner SELECT statement is implemented by instructions 1 through 7.
  1476   1476   All this code does is make an entry in the temporary table for each
  1477   1477   row of the examp2 table.  The key for each temporary table entry
  1478   1478   is the "three" column of examp2 and the data 
  1479         -entries is an empty string since it is never used.</p>
         1479  +is an empty string since it is never used.</p>
  1480   1480   
  1481   1481   <p>The outer SELECT is implemented by instructions 8 through 19.  In
  1482   1482   particular, the WHERE clause containing the IN operator is implemented
  1483   1483   by two instructions at 13 and 14.  Instruction 13 pushes the value of
  1484   1484   the "two" column for the current row onto the stack and instruction 14
  1485   1485   tests to see if top of the stack matches any key in the temporary table.
  1486   1486   All the rest of the code is the same as what has been shown before.</p>