Documentation Source Text

Check-in [4ab90dc6cf]
Login

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

Overview
Comment:Typos in the opcodes.html document.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 4ab90dc6cf987031968ef7d49a79fe6cca0a0007
User & Date: drh 2016-08-29 16:16:41.246
Context
2016-08-29
18:38
Merge "experimental" with this branch. Adds more links to the front page, fts5 search, show/hide links for tables of contents and some other things. (check-in: e4c2e46a8c user: dan tags: trunk)
16:16
Typos in the opcodes.html document. (check-in: 4ab90dc6cf user: drh tags: trunk)
16:07
Improvements to the opcode.html page. Minor tweaks to legacy c_interface.html and queryplanner-ng.html (check-in: 5baf5a5191 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to pages/opcode.in.
87
88
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

<h1>Introduction</h1>

<p>SQLite operates by translating each SQL statement into bytecode.
A [prepared statement] in SQLite is mostly just the bytecode needed to
implement the corresponding SQL.  The [sqlite3_prepare_v2()] interface
is a compiler that translates SQL into bytecode.
The [sqlite3_step()] interface passes that bytecode to a virtual machine,
which evaluates the bytecode and thereby does the work specified by the
original SQL statement.  The bytecode engine is the heart of SQLite
and so a good understanding of the bytecode engine is essential to
understanding how SQLite operations internally.


<p>Historically, the bytecode engine in SQLite is called the
"Virtual DataBase Engine" or "VDBE".  This article uses the terms
"bytecode engine" and "VDBE" and "virtual machine" interchangeably.

<p>
This article also uses the terms "bytecode program" and
"prepared statement" interchangeably, as they mean the same thing.

<h2>VDBE Source Code</h2>

<p>The source code to the bytecode engine is in the 
[http://www.sqlite.org/src/finfo?name=src/vdbe.c | vdbe.c] source
file.  All of the [opcode definitions] in this document are
contained in comments in the source file.  In fact, the opcode table







|
|
|
|
|
>







|







87
88
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

<h1>Introduction</h1>

<p>SQLite operates by translating each SQL statement into bytecode.
A [prepared statement] in SQLite is mostly just the bytecode needed to
implement the corresponding SQL.  The [sqlite3_prepare_v2()] interface
is a compiler that translates SQL into bytecode.
The [sqlite3_step()] interface passes that bytecode to a virtual machine.
The virtual machine evaluates the bytecode and thereby does the work
specified by the original SQL statement.
The virtual machine is the heart of SQLite.
Programmers who want to understand how SQLite operates internally
must be familiar with the bytecode engine.

<p>Historically, the bytecode engine in SQLite is called the
"Virtual DataBase Engine" or "VDBE".  This article uses the terms
"bytecode engine" and "VDBE" and "virtual machine" interchangeably.

<p>
This article also uses the terms "bytecode program" and
"prepared statement" interchangeably, as theyalso mean the same thing.

<h2>VDBE Source Code</h2>

<p>The source code to the bytecode engine is in the 
[http://www.sqlite.org/src/finfo?name=src/vdbe.c | vdbe.c] source
file.  All of the [opcode definitions] in this document are
contained in comments in the source file.  In fact, the opcode table
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
13    TableLock      0     2     1     tbl1           00  iDb=0 root=2 write=1
14    Integer        20    3     0                    00  r[3]=20      
15    Goto           0     1     0                    00               
}
</tcl>

<p>Any application can run an [EXPLAIN] query to get output similar to 
what is shown above.
However, indentation to show the loop structure is not generated
by the SQLite core.  The [command-line shell] contains extra logic
for indenting loops.
Also, the "comment" column in the [EXPLAIN] output
is only provided if SQLite is compiled with the
[-DSQLITE_ENABLE_EXPLAIN_COMMENTS] options.








|







265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
13    TableLock      0     2     1     tbl1           00  iDb=0 root=2 write=1
14    Integer        20    3     0                    00  r[3]=20      
15    Goto           0     1     0                    00               
}
</tcl>

<p>Any application can run an [EXPLAIN] query to get output similar to 
the above.
However, indentation to show the loop structure is not generated
by the SQLite core.  The [command-line shell] contains extra logic
for indenting loops.
Also, the "comment" column in the [EXPLAIN] output
is only provided if SQLite is compiled with the
[-DSQLITE_ENABLE_EXPLAIN_COMMENTS] options.