~ubuntu-branches/ubuntu/precise/libdbi-drivers/precise

« back to all changes in this revision

Viewing changes to drivers/sqlite3/dbd_sqlite3/x203.html

  • Committer: Stefano Rivera
  • Date: 2010-08-07 14:06:29 UTC
  • mfrom: (5.1.1 libdbi-drivers)
  • Revision ID: stefanor@ubuntu.com-20100807140629-dshfwn5j6v34pqrd
Tags: 0.8.3-1-0ubuntu1
New upstream release. -- Fixes ABORT problems with sqlite3+rrdtool

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 
2
<HTML
 
3
><HEAD
 
4
><TITLE
 
5
>sqlite driver misfeatures</TITLE
 
6
><META
 
7
NAME="GENERATOR"
 
8
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
 
9
REL="HOME"
 
10
TITLE="sqlite3 driver manual"
 
11
HREF="index.html"><LINK
 
12
REL="UP"
 
13
TITLE="Peculiarities you should know about"
 
14
HREF="c128.html"><LINK
 
15
REL="PREVIOUS"
 
16
TITLE="SQLite3 (mis)features"
 
17
HREF="x131.html"><LINK
 
18
REL="NEXT"
 
19
TITLE="GNU Free Documentation License"
 
20
HREF="copying-fdl.html"></HEAD
 
21
><BODY
 
22
CLASS="SECT1"
 
23
BGCOLOR="#FFFFFF"
 
24
TEXT="#000000"
 
25
LINK="#0000FF"
 
26
VLINK="#840084"
 
27
ALINK="#0000FF"
 
28
><DIV
 
29
CLASS="NAVHEADER"
 
30
><TABLE
 
31
SUMMARY="Header navigation table"
 
32
WIDTH="100%"
 
33
BORDER="0"
 
34
CELLPADDING="0"
 
35
CELLSPACING="0"
 
36
><TR
 
37
><TH
 
38
COLSPAN="3"
 
39
ALIGN="center"
 
40
>sqlite3 driver manual: A libdbi driver using the SQLite3 embedded database engine</TH
 
41
></TR
 
42
><TR
 
43
><TD
 
44
WIDTH="10%"
 
45
ALIGN="left"
 
46
VALIGN="bottom"
 
47
><A
 
48
HREF="x131.html"
 
49
ACCESSKEY="P"
 
50
>Prev</A
 
51
></TD
 
52
><TD
 
53
WIDTH="80%"
 
54
ALIGN="center"
 
55
VALIGN="bottom"
 
56
>Chapter 4. Peculiarities you should know about</TD
 
57
><TD
 
58
WIDTH="10%"
 
59
ALIGN="right"
 
60
VALIGN="bottom"
 
61
><A
 
62
HREF="copying-fdl.html"
 
63
ACCESSKEY="N"
 
64
>Next</A
 
65
></TD
 
66
></TR
 
67
></TABLE
 
68
><HR
 
69
ALIGN="LEFT"
 
70
WIDTH="100%"></DIV
 
71
><DIV
 
72
CLASS="SECT1"
 
73
><H1
 
74
CLASS="SECT1"
 
75
><A
 
76
NAME="AEN203"
 
77
>4.2. sqlite driver misfeatures</A
 
78
></H1
 
79
><P
 
80
>And now we have to discuss how successful the sqlite driver is in squeezing the SQLite idea of a database engine into the libdbi framework which was shaped after MySQL and PostgreSQL. Keep in mind that the limitations mentioned here are not intrinsic (except maybe the first one which is beyond our control), that is a sufficient amount of coding might fix these problems eventually.</P
 
81
><P
 
82
></P
 
83
><UL
 
84
><LI
 
85
><P
 
86
>SQLite3 handles auto-increment columns in a fairly non-intuitive way. Only the type INTEGER PRIMARY KEY auto-increments. As a user of other database engine you might expect the row IDs to be 4-byte integers (they were in 2.x), but nope: they are in fact 8-byte integers, and therefore equivalent to INT8 or BIGINT of other engines. This leaves us with the odd "feature" of the sqlite3 driver that INTEGER is a 4-byte integer, whereas INTEGER PRIMARY KEY is a 8-bit integer type. If this were not the case, auto-incrementing columns would be artificially limited to the range of 4-byte integers. On the other hand this means that you cannot declare a real 4-byte integer auto-incrementing column.</P
 
87
><DIV
 
88
CLASS="WARNING"
 
89
><P
 
90
></P
 
91
><TABLE
 
92
CLASS="WARNING"
 
93
BORDER="1"
 
94
WIDTH="90%"
 
95
><TR
 
96
><TD
 
97
ALIGN="CENTER"
 
98
><B
 
99
>Warning</B
 
100
></TD
 
101
></TR
 
102
><TR
 
103
><TD
 
104
ALIGN="LEFT"
 
105
><P
 
106
>Do not forget to use <CODE
 
107
CLASS="FUNCTION"
 
108
>dbi_result_get_longlong()</CODE
 
109
> or <CODE
 
110
CLASS="FUNCTION"
 
111
>dbi_result_get_ulonglong</CODE
 
112
> to retrieve values from columns declared as INTEGER PRIMARY KEY.</P
 
113
></TD
 
114
></TR
 
115
></TABLE
 
116
></DIV
 
117
></LI
 
118
><LI
 
119
><P
 
120
>The (essentially) typeless nature of SQLite has some nasty consequences. The sqlite driver takes great care to reconstruct the type of a field that you request in a query, but this isn't always successful. Some of the functions that SQLite supports work both on numeric and text data. The sqlite driver currently cannot deduce the field type correctly as it would have to check all arguments of each function. Instead the sqlite driver makes a few assumptions that may be right or wrong in a given case. The affected functions are <CODE
 
121
CLASS="FUNCTION"
 
122
>coalesce(X,Y,...)</CODE
 
123
>, <CODE
 
124
CLASS="FUNCTION"
 
125
>max(X)</CODE
 
126
>, <CODE
 
127
CLASS="FUNCTION"
 
128
>min(X)</CODE
 
129
>, and <CODE
 
130
CLASS="FUNCTION"
 
131
>count(X)</CODE
 
132
>.</P
 
133
></LI
 
134
><LI
 
135
><P
 
136
>The sqlite driver currently assumes that the directory separator of your filesystem is a slash (/). This may be wrong on your particular system. It is not a problem for Windows systems as long as the sqlite driver is built with the Cygwin tools (see <TT
 
137
CLASS="FILENAME"
 
138
>README.win32</TT
 
139
>).</P
 
140
></LI
 
141
><LI
 
142
><P
 
143
>Listing tables with the <CODE
 
144
CLASS="FUNCTION"
 
145
>dbi_conn_get_table_list()</CODE
 
146
> libdbi function currently returns only permanent tables. Temporary tables are ignored.</P
 
147
></LI
 
148
><LI
 
149
><P
 
150
>The sqlite driver assumes that table and field names do not exceed 128 characters in length, including the trailing \0. I don't know whether SQLite internally has such a limit or not (both MySQL and PostgreSQL have a lower limit). The limit can be increased by changing a single #define in the <TT
 
151
CLASS="FILENAME"
 
152
>dbd_sqlite.h</TT
 
153
> header file.</P
 
154
></LI
 
155
><LI
 
156
><P
 
157
>In a few cases, the sqlite driver expects you to type SQL keywords in all lowercase or all uppercase, but not mixed. This holds true for the 'from' in a SELECT statement. Type it either as 'from' or as 'FROM', but refrain from using 'fRoM' or other funny mixtures of uppercase and lowercase. Most other database engines treat the keywords as case-insensitive and would accept all variants.</P
 
158
></LI
 
159
></UL
 
160
></DIV
 
161
><DIV
 
162
CLASS="NAVFOOTER"
 
163
><HR
 
164
ALIGN="LEFT"
 
165
WIDTH="100%"><TABLE
 
166
SUMMARY="Footer navigation table"
 
167
WIDTH="100%"
 
168
BORDER="0"
 
169
CELLPADDING="0"
 
170
CELLSPACING="0"
 
171
><TR
 
172
><TD
 
173
WIDTH="33%"
 
174
ALIGN="left"
 
175
VALIGN="top"
 
176
><A
 
177
HREF="x131.html"
 
178
ACCESSKEY="P"
 
179
>Prev</A
 
180
></TD
 
181
><TD
 
182
WIDTH="34%"
 
183
ALIGN="center"
 
184
VALIGN="top"
 
185
><A
 
186
HREF="index.html"
 
187
ACCESSKEY="H"
 
188
>Home</A
 
189
></TD
 
190
><TD
 
191
WIDTH="33%"
 
192
ALIGN="right"
 
193
VALIGN="top"
 
194
><A
 
195
HREF="copying-fdl.html"
 
196
ACCESSKEY="N"
 
197
>Next</A
 
198
></TD
 
199
></TR
 
200
><TR
 
201
><TD
 
202
WIDTH="33%"
 
203
ALIGN="left"
 
204
VALIGN="top"
 
205
>SQLite3 (mis)features</TD
 
206
><TD
 
207
WIDTH="34%"
 
208
ALIGN="center"
 
209
VALIGN="top"
 
210
><A
 
211
HREF="c128.html"
 
212
ACCESSKEY="U"
 
213
>Up</A
 
214
></TD
 
215
><TD
 
216
WIDTH="33%"
 
217
ALIGN="right"
 
218
VALIGN="top"
 
219
>GNU Free Documentation License</TD
 
220
></TR
 
221
></TABLE
 
222
></DIV
 
223
></BODY
 
224
></HTML
 
225
>
 
 
b'\\ No newline at end of file'