File: x137.html

package info (click to toggle)
libdbi-drivers 0.9.0-13
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 7,160 kB
  • sloc: ansic: 19,030; sh: 10,963; xml: 2,759; makefile: 584
file content (327 lines) | stat: -rw-r--r-- 7,645 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>SQLite3 (mis)features</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REL="HOME"
TITLE="sqlite3 driver manual"
HREF="index.html"><LINK
REL="UP"
TITLE="Peculiarities you should know about"
HREF="c134.html"><LINK
REL="PREVIOUS"
TITLE="Peculiarities you should know about"
HREF="c134.html"><LINK
REL="NEXT"
TITLE="sqlite driver misfeatures"
HREF="x209.html"></HEAD
><BODY
CLASS="SECT1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>sqlite3 driver manual: A libdbi driver using the SQLite3 embedded database engine</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="c134.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 4. Peculiarities you should know about</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="x209.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="AEN137"
>4.1. SQLite3 (mis)features</A
></H1
><P
>As the SQLite3 package is constantly being improved, you should refer to the original documentation about the SQL features it <A
HREF="http://www.sqlite.org/lang.html"
TARGET="_top"
>supports</A
> and about the SQL features it <A
HREF="http://www.sqlite.org/omitted.html"
TARGET="_top"
>doesn't support</A
>.</P
><P
>One noticeable difference between SQLite3 and other SQL database engines is that the former uses something called "manifest typing". The practical difference to the typeless nature of SQLite 2.x is negligible as it still does not support the rich typing used by most other SQL database engines. In order to satisfy the needs of the strongly typed retrieval functions of libdbi, the only way out is to declare the column types in a <B
CLASS="COMMAND"
>CREATE TABLE</B
> statement just as you would with any other SQL database engine. As an example, the following statement is perfectly fine with SQLite3, but not with the sqlite3 driver:</P
><TABLE
BORDER="0"
BGCOLOR="#000000"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#32CD32"
><PRE
CLASS="SCREEN"
><KBD
CLASS="USERINPUT"
>CREATE TABLE foo (a,b,c)</KBD
></PRE
></FONT
></TD
></TR
></TABLE
><P
>However, the following statement is fine with SQLite3, the sqlite3 driver, and just about any other SQL database engine out there:</P
><TABLE
BORDER="0"
BGCOLOR="#000000"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#32CD32"
><PRE
CLASS="SCREEN"
><KBD
CLASS="USERINPUT"
>CREATE TABLE foo (a INTEGER,b TEXT,c VARCHAR(64))</KBD
></PRE
></FONT
></TD
></TR
></TABLE
><P
>The following table lists the column types which are positively recognized by the sqlite driver. Essentially all column types supported by MySQL and PostgreSQL are supported by this driver as well, making it reasonably easy to write portable SQL code. All other column types are treated as strings.</P
><DIV
CLASS="TABLE"
><A
NAME="AEN150"
></A
><P
><B
>Table 4-1. SQL column types supported by the sqlite driver</B
></P
><TABLE
BORDER="1"
CLASS="CALSTABLE"
><COL><COL><THEAD
><TR
><TH
>type</TH
><TH
>description</TH
></TR
></THEAD
><TBODY
><TR
><TD
>TINYBLOB, BLOB, MEDIUMBLOB, LONGBLOB, BYTEA</TD
><TD
>String types of unlimited length. Binary data must be safely encoded, see text.</TD
></TR
><TR
><TD
>CHAR(), VARCHAR(), TINYTEXT, TEXT, MEDIUMTEXT, LONGTEXT</TD
><TD
>String types of unlimited length. There is no chopping or padding performed by the database engine.</TD
></TR
><TR
><TD
>ENUM</TD
><TD
>String type of unlimited length. In contrast to MySQL, choosing ENUM over VARCHAR does not save any storage space.</TD
></TR
><TR
><TD
>SET</TD
><TD
>String type of unlimited length. In contrast to MySQL, the input is not checked against the list of allowed values.</TD
></TR
><TR
><TD
>YEAR</TD
><TD
>String type of unlimited length. MySQL stores 2 or 4 digit years as a 1 byte value, whereas the SQLite drivers stores the string as provided.</TD
></TR
><TR
><TD
>TINYINT, INT1, CHAR</TD
><TD
>A 1 byte type used to store one character, a signed integer between -128 and 127, or an unsigned integer between 0 and 255.</TD
></TR
><TR
><TD
>SMALLINT, INT2</TD
><TD
>2 byte (short) integer type used to store a signed integer between -32768 and 32767 or an unsigned integer between 0 and 65535.</TD
></TR
><TR
><TD
>MEDIUMINT</TD
><TD
>3 byte integer type used to store a signed integer between -8388608 and 8388607 or an unsigned integer between 0 and 16777215.</TD
></TR
><TR
><TD
>INT, INTEGER, INT4</TD
><TD
>4 byte (long) integer type used to store a signed integer between -2147483648 and 2147483647 or an unsigned integer between 0 and 4294967295.</TD
></TR
><TR
><TD
>BIGINT, INT8, INTEGER PRIMARY KEY</TD
><TD
>8 byte (long long) integer type used to store a signed integer between -9223372036854775808 and 9223372036854775807 or an unsigned integer between 0 and 18446744073709551615. See below for a discussion of INTEGER PRIMARY KEY.</TD
></TR
><TR
><TD
>DECIMAL, NUMERIC</TD
><TD
>A string type of unlimited length used to store floating-point numbers of arbitrary precision.</TD
></TR
><TR
><TD
>TIMESTAMP, DATETIME</TD
><TD
>A string type of unlimited length used to store date/time combinations. The required format is 'YYYY-MM-DD HH:MM:SS', anything following this pattern is ignored.</TD
></TR
><TR
><TD
>DATE</TD
><TD
>A string type of unlimited length used to store a date. The required format is 'YYYY-MM-DD', anything following this pattern is ignored.</TD
></TR
><TR
><TD
>TIME</TD
><TD
>A string type of unlimited length used to store a time. The required format is 'HH:MM:SS', anything following this pattern is ignored.</TD
></TR
><TR
><TD
>FLOAT, FLOAT4, REAL</TD
><TD
>A 4 byte floating-point number. The range is -3.402823466E+38 to -1.175494351E-38, 0, and 1.175494351E-38 to 3.402823466E+38. Please note that MySQL treats REAL as an 8 byte instead of a 4 byte float like PostgreSQL.</TD
></TR
><TR
><TD
>DOUBLE, DOUBLE PRECISION, FLOAT8</TD
><TD
>An 8 byte floating-point number. The range is -1.7976931348623157E+308 to -2.2250738585072014E-308, 0, and 2.2250738585072014E-308 to 1.7976931348623157E+308.</TD
></TR
></TBODY
></TABLE
></DIV
><P
>Another difference is the lack of access control on the database engine level. Most SQL database servers implement some mechanisms to restrict who is allowed to fiddle with the databases and who is not. As SQLite3 uses regular files to store its databases, all available access control is on the filesystem level. There is no SQL interface to this kind of access control, but <B
CLASS="COMMAND"
>chmod</B
> and <B
CLASS="COMMAND"
>chown</B
> are your friends.</P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="c134.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="x209.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Peculiarities you should know about</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="c134.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>sqlite driver misfeatures</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>