diff options
Diffstat (limited to 'libraries/sqlite/unix/sqlite-3.5.1/www/different.tcl')
-rw-r--r-- | libraries/sqlite/unix/sqlite-3.5.1/www/different.tcl | 224 |
1 files changed, 224 insertions, 0 deletions
diff --git a/libraries/sqlite/unix/sqlite-3.5.1/www/different.tcl b/libraries/sqlite/unix/sqlite-3.5.1/www/different.tcl new file mode 100644 index 0000000..1858e6f --- /dev/null +++ b/libraries/sqlite/unix/sqlite-3.5.1/www/different.tcl | |||
@@ -0,0 +1,224 @@ | |||
1 | set rcsid {$Id: different.tcl,v 1.8 2006/12/18 14:12:21 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> | ||
10 | } | ||
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" | ||
15 | } | ||
16 | |||
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. | ||
34 | } | ||
35 | |||
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. | ||
63 | } | ||
64 | |||
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. | ||
80 | } | ||
81 | |||
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 | Firebird 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. | ||
96 | } | ||
97 | |||
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.) | ||
110 | <p> | ||
111 | As far as we can tell, the SQL language specification allows the use | ||
112 | of manifest typing. Nevertheless, most other SQL database engines are | ||
113 | statically typed and so some people | ||
114 | feel that the use of manifest typing is a bug in SQLite. But the authors | ||
115 | of SQLite feel very strongly that this is a feature. The use of manifest | ||
116 | typing in SQLite is a deliberate design decision which has proven in practice | ||
117 | to make SQLite more reliable and easier to use, especially when used in | ||
118 | combination with dynamically typed programming languages such as Tcl and | ||
119 | Python. | ||
120 | } | ||
121 | |||
122 | feature flex {Variable-length records} { | ||
123 | Most other SQL database engines allocated a fixed amount of disk space | ||
124 | for each row in most tables. They play special tricks for handling | ||
125 | BLOBs and CLOBs which can be of wildly varying length. But for most | ||
126 | tables, if you declare a column to be a VARCHAR(100) then the database | ||
127 | engine will allocate | ||
128 | 100 bytes of disk space regardless of how much information you actually | ||
129 | store in that column. | ||
130 | <p> | ||
131 | SQLite, in contrast, use only the amount of disk space actually | ||
132 | needed to store the information in a row. If you store a single | ||
133 | character in a VARCHAR(100) column, then only a single byte of disk | ||
134 | space is consumed. (Actually two bytes - there is some overhead at | ||
135 | the beginning of each column to record its datatype and length.) | ||
136 | <p> | ||
137 | The use of variable-length records by SQLite has a number of advantages. | ||
138 | It results in smaller database files, obviously. It also makes the | ||
139 | database run faster, since there is less information to move to and from | ||
140 | disk. And, the use of variable-length records makes it possible for | ||
141 | SQLite to employ manifest typing instead of static typing. | ||
142 | } | ||
143 | |||
144 | feature readable {Readable source code} { | ||
145 | The source code to SQLite is designed to be readable and accessible to | ||
146 | the average programmer. All procedures and data structures and many | ||
147 | automatic variables are carefully commented with useful information about | ||
148 | what they do. Boilerplate commenting is omitted. | ||
149 | } | ||
150 | |||
151 | feature vdbe {SQL statements compile into virtual machine code} { | ||
152 | Every SQL database engine compiles each SQL statement into some kind of | ||
153 | internal data structure which is then used to carry out the work of the | ||
154 | statement. But in most SQL engines that internal data structure is a | ||
155 | complex web of interlinked structures and objects. In SQLite, the compiled | ||
156 | form of statements is a short program in a machine-language like | ||
157 | representation. Users of the database can view this | ||
158 | <a href="opcode.html">virtual machine language</a> | ||
159 | by prepending the <a href="lang_explain.html">EXPLAIN</a> keyword | ||
160 | to a query. | ||
161 | <p> | ||
162 | The use of a virtual machine in SQLite has been a great benefit to | ||
163 | library's development. The virtual machine provides a crisp, well-defined | ||
164 | junction between the front-end of SQLite (the part that parses SQL | ||
165 | statements and generates virtual machine code) and the back-end (the | ||
166 | part that executes the virtual machine code and computes a result.) | ||
167 | The virtual machine allows the developers to see clearly and in an | ||
168 | easily readable form what SQLite is trying to do with each statement | ||
169 | it compiles, which is a tremendous help in debugging. | ||
170 | Depending on how it is compiled, SQLite also has the capability of | ||
171 | tracing the execution of the virtual machine - printing each | ||
172 | virtual machine instruction and its result as it executes. | ||
173 | } | ||
174 | |||
175 | #feature binding {Tight bindings to dynamic languages} { | ||
176 | # Because it is embedded, SQLite can have a much tighter and more natural | ||
177 | # binding to high-level dynamic languages such as Tcl, Perl, Python, | ||
178 | # PHP, and Ruby. | ||
179 | # For example, | ||
180 | #} | ||
181 | |||
182 | feature license {Public domain} { | ||
183 | The source code for SQLite is in the public domain. No claim of copyright | ||
184 | is made on any part of the core source code. (The documentation and test | ||
185 | code is a different matter - some sections of documentation and test logic | ||
186 | are governed by open-sources licenses.) All contributors to the | ||
187 | SQLite core software have signed affidavits specifically disavowing any | ||
188 | copyright interest in the code. This means that anybody is able to legally | ||
189 | do anything they want with the SQLite source code. | ||
190 | <p> | ||
191 | There are other SQL database engines with liberal licenses that allow | ||
192 | the code to be broadly and freely used. But those other engines are | ||
193 | still governed by copyright law. SQLite is different in that copyright | ||
194 | law simply does not apply. | ||
195 | <p> | ||
196 | The source code files for other SQL database engines typically begin | ||
197 | with a comment describing your license rights to view and copy that file. | ||
198 | The SQLite source code contains no license since it is not governed by | ||
199 | copyright. Instead of a license, the SQLite source code offers a blessing: | ||
200 | <blockquote> | ||
201 | <i>May you do good and not evil<br> | ||
202 | May you find forgiveness for yourself and forgive others<br> | ||
203 | May you share freely, never taking more than you give.</i> | ||
204 | </blockquote> | ||
205 | } | ||
206 | |||
207 | feature extensions {SQL language extensions} { | ||
208 | SQLite provides a number of enhancements to the SQL language | ||
209 | not normally found in other database engines. | ||
210 | The EXPLAIN keyword and manifest typing have already been mentioned | ||
211 | above. SQLite also provides statements such as | ||
212 | <a href="lang_replace.html">REPLACE</a> and the | ||
213 | <a href="lang_conflict.html">ON CONFLICT</a> clause that allow for | ||
214 | added control over the resolution of constraint conflicts. | ||
215 | SQLite supports <a href="lang_attach.html">ATTACH</a> and | ||
216 | <a href="lang_detach.html">DETACH</a> commands that allow multiple | ||
217 | independent databases to be used together in the same query. | ||
218 | And SQLite defines APIs that allows the user to add new | ||
219 | <a href="capi3ref.html#sqlite3_create_function">SQL functions</a> | ||
220 | and <a href="capi3ref.html#sqlite3_create_collation">collating sequences</a>. | ||
221 | } | ||
222 | |||
223 | |||
224 | footer $rcsid | ||