Same fix as r45172 for classes/iconimage:
[AROS-Contrib.git] / sqlite3 / www / different.tcl
blobb4529076bf4bc4c0ac8b4ca2d4bcd06aa449f7c6
1 set rcsid {$Id: different.tcl,v 1.5 2005/04/01 16:29:12 drh Exp $}
2 source common.tcl
3 header {Distinctive Features Of SQLite}
4 puts {
5 <p>
6 This page highlights some of the characteristics of SQLite that are
7 unusual and which make SQLite different from many other SQL
8 database engines.
9 </p>
11 proc feature {tag name text} {
12 puts "<a name=\"$tag\" />"
13 puts "<p><b>$name</b></p>\n"
14 puts "<blockquote>$text</blockquote>\n"
17 feature zeroconfig {Zero-Configuration} {
18 SQLite does not need to be "installed" before it is used.
19 There is no "setup" procedure. There is no
20 server process that needs to be started, stopped, or configured.
21 There is
22 no need for an administrator to create a new database instance or assign
23 access permissions to users.
24 SQLite uses no configuration files.
25 Nothing needs to be done to tell the system that SQLite is running.
26 No actions are required to recover after a system crash or power failure.
27 There is nothing to troubleshoot.
28 <p>
29 SQLite just works.
30 <p>
31 Other more familiar database engines run great once you get them going.
32 But doing the initial installation and configuration can be
33 intimidatingly complex.
36 feature serverless {Serverless} {
37 Most SQL database engines are implemented as a separate server
38 process. Programs that want to access the database communicate
39 with the server using some kind of interprocess communcation
40 (typically TCP/IP) to send requests to the server and to receive
41 back results. SQLite does not work this way. With SQLite, the
42 process that wants to access the database reads and writes
43 directly from the database files on disk. There is no intermediary
44 server process.
45 <p>
46 There are advantages and disadvantages to being serverless. The
47 main advantage is that there is no separate server process
48 to install, setup, configure, initialize, manage, and troubleshoot.
49 This is one reason why SQLite is a "zero-configuration" database
50 engine. Programs that use SQLite require no administrative support
51 for setting up the database engine before they are run. Any program
52 that is able to access the disk is able to use an SQLite database.
53 <p>
54 On the other hand, a database engine that uses a server can provide
55 better protection from bugs in the client application - stray pointers
56 in a client cannot corrupt memory on the server. And because a server
57 is a single persistent process, it is able control database access with
58 more precision, allowing for finer grain locking and better concurrancy.
59 <p>
60 Most SQL database engines are client/server based. Of those that are
61 serverless, SQLite is the only one that this author knows of that
62 allows multiple applications to access the same database at the same time.
65 feature onefile {Single Database File} {
66 An SQLite database is a single ordinary disk file that can be located
67 anywhere in the directory hierarchy. If SQLite can read
68 the disk file then it can read anything in the database. If the disk
69 file and its directory are writable, then SQLite can change anything
70 in the database. Database files can easily be copied onto a USB
71 memory stick or emailed for sharing.
72 <p>
73 Other SQL database engines tend to store data as a large collection of
74 files. Often these files are in a standard location that only the
75 database engine itself can access. This makes the data more secure,
76 but also makes it harder to access. Some SQL database engines provide
77 the option of writing directly to disk and bypassing the filesystem
78 all together. This provides added performance, but at the cost of
79 considerable setup and maintenance complexity.
82 feature small {Compact} {
83 When optimized for size, the whole SQLite library with everything enabled
84 is less than 225KiB in size (as measured on an ix86 using the "size"
85 utility from the GNU compiler suite.) Unneeded features can be disabled
86 at compile-time to further reduce the size of the library to under
87 170KiB if desired.
88 <p>
89 Most other SQL database engines are much larger than this. IBM boasts
90 that it's recently released CloudScape database engine is "only" a 2MiB
91 jar file - 10 times larger than SQLite even after it is compressed!
92 Firefox boasts that it's client-side library is only 350KiB. That's
93 50% larger than SQLite and does not even contain the database engine.
94 The Berkeley DB library from Sleepycat is 450KiB and it omits SQL
95 support, providing the programmer with only simple key/value pairs.
98 feature typing {Manifest typing} {
99 Most SQL database engines use static typing. A datatype is associated
100 with each column in a table and only values of that particular datatype
101 are allowed to be stored in that column. SQLite relaxes this restriction
102 by using manifest typing.
103 In manifest typing, the datatype is a property of the value itself, not
104 of the column in which the value is stored.
105 SQLite thus allows the user to store
106 any value of any datatype into any column regardless of the declared type
107 of that column. (There are some exceptions to this rule: An INTEGER
108 PRIMARY KEY column may only store integers. And SQLite attempts to coerce
109 values into the declared datatype of the column when it can.)
111 The SQL language specification calls for static typing. So some people
112 feel that the use of manifest typing is a bug in SQLite. But the authors
113 of SQLite feel very strongly that this is a feature. The authors argue
114 that static typing is a bug in the SQL specification that SQLite has fixed
115 in a backwards compatible way.
118 feature flex {Variable-length records} {
119 Most other SQL database engines allocated a fixed amount of disk space
120 for each row in most tables. They play special tricks for handling
121 BLOBs and CLOBs which can be of wildly varying length. But for most
122 tables, if you declare a column to be a VARCHAR(100) then the database
123 engine will allocate
124 100 bytes of disk space regardless of how much information you actually
125 store in that column.
127 SQLite, in contrast, use only the amount of disk space actually
128 needed to store the information in a row. If you store a single
129 character in a VARCHAR(100) column, then only a single byte of disk
130 space is consumed. (Actually two bytes - there is some overhead at
131 the beginning of each column to record its datatype and length.)
133 The use of variable-length records by SQLite has a number of advantages.
134 It results in smaller database files, obviously. It also makes the
135 database run faster, since there is less information to move to and from
136 disk. And, the use of variable-length records makes it possible for
137 SQLite to employ manifest typing instead of static typing.
140 feature readable {Readable source code} {
141 The source code to SQLite is designed to be readable and accessible to
142 the average programmer. All procedures and data structures and many
143 automatic variables are carefully commented with useful information about
144 what they do. Boilerplate commenting is omitted.
147 feature vdbe {SQL statements compile into virtual machine code} {
148 Every SQL database engine compiles each SQL statement into some kind of
149 internal data structure which is then used to carry out the work of the
150 statement. But in most SQL engines that internal data structure is a
151 complex web of interlinked structures and objects. In SQLite, the compiled
152 form of statements is a short program in a machine-language like
153 representation. Users of the database can view this
154 <a href="opcode.html">virtual machine language</a>
155 by prepending the <a href="lang_explain.html">EXPLAIN</a> keyword
156 to a query.
158 The use of a virtual machine in SQLite has been a great benefit to
159 library's development. The virtual machine provides a crisp, well-defined
160 junction between the front-end of SQLite (the part that parses SQL
161 statements and generates virtual machine code) and the back-end (the
162 part that executes the virtual machine code and computes a result.)
163 The virtual machine allows the developers to see clearly and in an
164 easily readable form what SQLite is trying to do with each statement
165 it compiles, which is a tremendous help in debugging.
166 Depending on how it is compiled, SQLite also has the capability of
167 tracing the execution of the virtual machine - printing each
168 virtual machine instruction and its result as it executes.
171 #feature binding {Tight bindings to dynamic languages} {
172 # Because it is embedded, SQLite can have a much tighter and more natural
173 # binding to high-level dynamic languages such as Tcl, Perl, Python,
174 # PHP, and Ruby.
175 # For example,
178 feature license {Public domain} {
179 The source code for SQLite is in the public domain. No claim of copyright
180 is made on any part of the core source code. (The documentation and test
181 code is a different matter - some sections of documentation and test logic
182 are governed by open-sources licenses.) All contributors to the
183 SQLite core software have signed affidavits specifically disavowing any
184 copyright interest in the code. This means that anybody is able to legally
185 do anything they want with the SQLite source code.
187 There are other SQL database engines with liberal licenses that allow
188 the code to be broadly and freely used. But those other engines are
189 still governed by copyright law. SQLite is different in that copyright
190 law simply does not apply.
192 The source code files for other SQL database engines typically begin
193 with a comment describing your license rights to view and copy that file.
194 The SQLite source code contains no license since it is not governed by
195 copyright. Instead of a license, the SQLite source code offers a blessing:
196 <blockquote>
197 <i>May you do good and not evil<br>
198 May you find forgiveness for yourself and forgive others<br>
199 May you share freely, never taking more than you give.</i>
200 </blockquote>
203 feature extensions {SQL language extensions} {
204 SQLite provides a number of enhancements to the SQL language
205 not normally found in other database engines.
206 The EXPLAIN keyword and manifest typing have already been mentioned
207 above. SQLite also provides statements such as
208 <a href="lang_replace.html">REPLACE</a> and the
209 <a href="lang_conflict.html">ON CONFLICT</a> clause that allow for
210 added control over the resolution of constraint conflicts.
211 SQLite supports <a href="lang_attach.html">ATTACH</a> and
212 <a href="lang_detach.html">DETACH</a> commands that allow multiple
213 independent databases to be used together in the same query.
214 And SQLite defines APIs that allows the user to add new
215 <a href="capi3ref.html#sqlite3_create_function>SQL functions</a>
216 and <a href="capi3ref.html#sqlite3_create_collation>collating sequences</a>.
220 footer $rcsid