Documentation Source Text

Check-in [e5ea14f1ff]
Login

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

Overview
Comment:First complete draft of the "rescode.html" document.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: e5ea14f1ff7a7fbd1c0be7ced2afb22f2584aa0f
User & Date: drh 2014-08-08 17:05:50.537
Context
2014-08-08
21:27
Fix documentation errors and typos. (check-in: 066b35fad5 user: drh tags: trunk)
17:05
First complete draft of the "rescode.html" document. (check-in: e5ea14f1ff user: drh tags: trunk)
12:50
Work-in-progress: refactoring the documentation on integer result codes. (check-in: b22f668cca user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to pages/docs.in.
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
doc {How To Compile SQLite} {howtocompile.html} {
  Instructions and hints for compiling SQLite C code and integrating
  that code with your own application.
}
doc {C/C++ API Reference} {c3ref/intro.html} {
  This document describes each API function separately.
}
doc {Result Codes} {errors.html} {
  A description of the meanings of the numeric result codes
  returned by various C/C++ interfaces.
}
doc {Tcl API} {tclsqlite.html} {
  A description of the TCL interface bindings for SQLite.
}
doc {SQL Syntax} {lang.html} {







|







83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
doc {How To Compile SQLite} {howtocompile.html} {
  Instructions and hints for compiling SQLite C code and integrating
  that code with your own application.
}
doc {C/C++ API Reference} {c3ref/intro.html} {
  This document describes each API function separately.
}
doc {Result Codes} {rescode.html} {
  A description of the meanings of the numeric result codes
  returned by various C/C++ interfaces.
}
doc {Tcl API} {tclsqlite.html} {
  A description of the TCL interface bindings for SQLite.
}
doc {SQL Syntax} {lang.html} {
Changes to pages/lang.in.
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
if an another thread or process has a [shared lock] on the database
that prevented the database from being updated.  ^When COMMIT fails in this
way, the transaction remains active and the COMMIT can be retried later
after the reader has had a chance to clear.
</p>

<p>
^The ROLLBACK will fail with an error code [SQLITE_BUSY] if there
are any pending queries.  ^Both read-only and read/write queries will
cause a ROLLBACK to fail.  A ROLLBACK must fail if there are pending
read operations (unlike COMMIT which can succeed) because bad things
will happen if the in-memory image of the database is changed out from under
an active query.
</p>

<p>
If [PRAGMA journal_mode] is set to OFF (thus disabling the rollback journal
file) then the behavior of the ROLLBACK command is undefined.
</p>








|
|
|
|
|
<







532
533
534
535
536
537
538
539
540
541
542
543

544
545
546
547
548
549
550
if an another thread or process has a [shared lock] on the database
that prevented the database from being updated.  ^When COMMIT fails in this
way, the transaction remains active and the COMMIT can be retried later
after the reader has had a chance to clear.
</p>

<p>
In older versions of SQLite the ROLLBACK will fail with an error code 
[SQLITE_BUSY] if there are any pending queries.  ^In more recent
versions of SQLite (since version 3.7.11 circa 2012-03-20) the ROLLBACK
will proceed and pending statements will be aborted with an
[SQLITE_ABORT] or [SQLITE_ABORT_ROLLBACK] error.

</p>

<p>
If [PRAGMA journal_mode] is set to OFF (thus disabling the rollback journal
file) then the behavior of the ROLLBACK command is undefined.
</p>

969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
  case in SQLite. ^Unless the column is an [INTEGER PRIMARY KEY] or
  the table is a [WITHOUT ROWID] table or the column is declared NOT NULL,
  SQLite allows NULL values in a PRIMARY KEY column.  SQLite could be fixed to
  conform to the standard, but doing so might break legacy applications.
  Hence, it has been decided to merely document the fact that SQLite
  allowing NULLs in most PRIMARY KEY columns.

<tcl>hd_fragment uniqueconst {UNIQUE} {unique constraint}</tcl>
<p>^A <b>UNIQUE</b> constraint is similar to a PRIMARY KEY constraint, except
  that a single table may have any number of UNIQUE constraints. ^For each
  UNIQUE constraint on the table, each row must contain a unique combination
  of values in the columns identified by the UNIQUE constraint. 
  ^For the purposes of UNIQUE constraints, NULL values
  are considered distinct from all other values, including other NULLs.








|







968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
  case in SQLite. ^Unless the column is an [INTEGER PRIMARY KEY] or
  the table is a [WITHOUT ROWID] table or the column is declared NOT NULL,
  SQLite allows NULL values in a PRIMARY KEY column.  SQLite could be fixed to
  conform to the standard, but doing so might break legacy applications.
  Hence, it has been decided to merely document the fact that SQLite
  allowing NULLs in most PRIMARY KEY columns.

<tcl>hd_fragment uniqueconst {UNIQUE} {unique constraint} {UNIQUE constraint}</tcl>
<p>^A <b>UNIQUE</b> constraint is similar to a PRIMARY KEY constraint, except
  that a single table may have any number of UNIQUE constraints. ^For each
  UNIQUE constraint on the table, each row must contain a unique combination
  of values in the columns identified by the UNIQUE constraint. 
  ^For the purposes of UNIQUE constraints, NULL values
  are considered distinct from all other values, including other NULLs.

1294
1295
1296
1297
1298
1299
1300

1301
1302
1303
1304
1305
1306
1307

<p>The value of NEW.rowid is undefined in a BEFORE INSERT trigger in which
the rowid is not explicitly set to an integer.</p>

<p>Because of the behaviors described above, programmers are encouraged to
prefer AFTER triggers over BEFORE triggers.</p>


<h3>The RAISE() function</h3>

<p>^(A special SQL function RAISE() may be used within a trigger-program,)^
with the following syntax</p> 

<tcl>BubbleDiagram raise-function</tcl>








>







1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307

<p>The value of NEW.rowid is undefined in a BEFORE INSERT trigger in which
the rowid is not explicitly set to an integer.</p>

<p>Because of the behaviors described above, programmers are encouraged to
prefer AFTER triggers over BEFORE triggers.</p>

<tcl>hd_fragment raise {RAISE function}</tcl>
<h3>The RAISE() function</h3>

<p>^(A special SQL function RAISE() may be used within a trigger-program,)^
with the following syntax</p> 

<tcl>BubbleDiagram raise-function</tcl>

Changes to pages/rescode.in.
13
14
15
16
17
18
19
20

21
22
23
24
25
26
27

<p>
"Error codes" are a subset of "result codes" that indicate that
something has gone wrong.  There are only a few non-error result
codes:  [SQLITE_OK], [SQLITE_ROW], and [SQLITE_DONE].  The term
"error code" means any result code other than these three.

<tcl>hd_fragment pve {primary versus extended result codes}</tcl>

<h2>Primary Result Codes versus Extended Result Codes</h2>

<p>
Result codes are signed 32-bit integers.
The least significant 8 bits of the result code define a broad category
and are called the "primary result code".  More significant bits provide
more detailed information about the error and are called the







|
>







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

<p>
"Error codes" are a subset of "result codes" that indicate that
something has gone wrong.  There are only a few non-error result
codes:  [SQLITE_OK], [SQLITE_ROW], and [SQLITE_DONE].  The term
"error code" means any result code other than these three.

<tcl>hd_fragment pve {primary versus extended result codes} \
                     {*ext-v-prim} </tcl>
<h2>Primary Result Codes versus Extended Result Codes</h2>

<p>
Result codes are signed 32-bit integers.
The least significant 8 bits of the result code define a broad category
and are called the "primary result code".  More significant bits provide
more detailed information about the error and are called the
98
99
100
101
102
103
104
105
106
107




108
109
110
111
112
































113
114















115
116
117
118
119
120
121
  The SQLITE_PERM result code indicates a file-system permissions problem.
  Currently, on the unix VFS generates this result code.
}
RESCODE SQLITE_ABORT        4  {
  The SQLITE_ABORT result code indicates that an operation was aborted
  prior to completion, usually be application request.
  <p>
  If the callback function to [sqlite3_exec()] returns non-zero, then
  sqlite3_exec() will return SQLITE_ABORT.
  <p>




  In addition to being a result code,
  the SQLITE_ABORT value is also used as a [conflict resolution mode]
  returned from the [sqlite3_vtab_on_conflict()] interface.
}
RESCODE SQLITE_BUSY         5  {
































}
RESCODE SQLITE_LOCKED       6  {}















RESCODE SQLITE_NOMEM        7   {
  The SQLITE_NOMEM result code indicates that SQLite was unable to allocate
  all the memory it needed to complete the operation.  In other words, an
  internal call to [sqlite3_malloc()] or [sqlite3_realloc()] has failed in
  a case where the memory being allocated was required in order to continue
  the operation.
}







|


>
>
>
>
|




>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







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
  The SQLITE_PERM result code indicates a file-system permissions problem.
  Currently, on the unix VFS generates this result code.
}
RESCODE SQLITE_ABORT        4  {
  The SQLITE_ABORT result code indicates that an operation was aborted
  prior to completion, usually be application request.
  <p>
  ^If the callback function to [sqlite3_exec()] returns non-zero, then
  sqlite3_exec() will return SQLITE_ABORT.
  <p>
  ^If a [ROLLBACK] operation occurs on the same [database connection] as
  a pending read or write, then the pending read or write may fail with
  an SQLITE_ABORT or [SQLITE_ABORT_ROLLBACK] error.
  <p>
  ^In addition to being a result code,
  the SQLITE_ABORT value is also used as a [conflict resolution mode]
  returned from the [sqlite3_vtab_on_conflict()] interface.
}
RESCODE SQLITE_BUSY         5  {
  The SQLITE_BUSY result code indicates that the database file could not
  be written (or in some cases read) because of concurrent activity by 
  some other [database connection], usually a database connection in a
  separate process.
  <p>
  For example, if process A is in the middle of a large write transaction
  and at the same time process B attempts to start a new write transaction,
  process B will get back an SQLITE_BUSY result because SQLite only supports
  one writer at a time.  Process B will need to wait for process A to finish
  its transaction before starting a new transaction.  The
  [sqlite3_busy_timeout()] and [sqlite3_busy_handler()] interfaces and
  the [busy_timeout pragma] are available to process B to help it deal
  with SQLITE_BUSY errors.
  <p>
  An SQLITE_BUSY error can occur at any point in a transaction: when the
  transaction is first started, during any write or update operations, or
  when the transaction commits.
  To avoid encountering SQLITE_BUSY errors in the middle of a transaction,
  the application can use [BEGIN IMMEDIATE] instead of just [BEGIN] to
  start a transaction.  The [BEGIN IMMEDIATE] command might itself return
  SQLITE_BUSY, but if it succeeds, then SQLite guarantees that no 
  subsequent operations on the same database through the next [COMMIT] 
  will return SQLITE_BUSY.
  <p>
  See also:  [SQLITE_BUSY_RECOVERY] and [SQLITE_BUSY_SNAPSHOT].
  <p>
  The SQLITE_BUSY result code differs from [SQLITE_LOCKED] in that
  SQLITE_BUSY indicates a conflict with a
  separate [database connection], probably in a separate process,
  whereas [SQLITE_LOCKED] 
  indicates a conflict within the same [database connection] (or sometimes
  a database connection with a [shared cache]).
}
RESCODE SQLITE_LOCKED       6  {
  The SQLITE_LOCKED result code indicates that a write operation could not
  proceed because of a conflict within the same [database connection] or
  a conflict with a different database connection that uses a [shared cache].
  <p>
  For example, a [DROP TABLE] statement cannot be run while another thread
  is reading from that table on the same [database connection] because 
  dropping the table would delete the table out from under the concurrent
  reader.
  <p>
  The SQLITE_LOCKED result code differs from [SQLITE_BUSY] in that
  SQLITE_LOCKED indicates a conflict on the same [database connection]
  (or on a connection with a [shared cache]) whereas [SQLITE_BUSY] indicates
  a conflict with a different database connection, probably in a different
  process.
}
RESCODE SQLITE_NOMEM        7   {
  The SQLITE_NOMEM result code indicates that SQLite was unable to allocate
  all the memory it needed to complete the operation.  In other words, an
  internal call to [sqlite3_malloc()] or [sqlite3_realloc()] has failed in
  a case where the memory being allocated was required in order to continue
  the operation.
}
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
  identify the specific I/O operation that failed.
}
RESCODE SQLITE_CORRUPT     11   {
  The SQLITE_CORRUPT result code indicates that the database file has
  been corrupted.  See the [How To Corrupt Your Database Files] for
  further discussion on how corruption can occur.
}
RESCODE SQLITE_NOTFOUND    12   {}











RESCODE SQLITE_FULL        13   {
  The SQLITE_FULL result code indicates that a write could not complete
  because the disk is full.  Note that this error can occur when trying
  to write information into the main database file, or into a temporary 


  file.  Sometimes users encounter this error when they are using large

  temporary files (for example to do large sorts) but have very little
  space available in the partition used by temporary files.
}
RESCODE SQLITE_CANTOPEN    14   {}




RESCODE SQLITE_PROTOCOL    15   {}












RESCODE SQLITE_EMPTY       16   {}




RESCODE SQLITE_SCHEMA      17   {
  The SQLITE_SCHEMA result code indicates that the database schema
  has changed.  This result code can be returned from [sqlite3_step()] for
  a [prepared statement] that was generated using [sqlite3_prepare()] or
  [sqlite3_prepare16()].  If the database schema was changed by some other
  process in between the time that the statement was prepared and the time
  the statement was run, this error can result.
  <p>
  If a [prepared statement] is generated from [sqlite3_prepare_v2()] then
  the statement is automatically re-prepared if the schema changes, up to
  [SQLITE_MAX_SCHEMA_RETRY] times (default: 50).  The [sqlite3_step()]
  interface will only return SQLITE_SCHEMA back to the application if 
  the failure persists after these many retries.
}
RESCODE SQLITE_TOOBIG      18   {}















RESCODE SQLITE_CONSTRAINT  19   {}






RESCODE SQLITE_MISMATCH    20   {}














RESCODE SQLITE_MISUSE      21   {
  The SQLITE_MISUSE return code might be returned if the application uses
  any SQLite interface in a way that is undefined or unsupported.  For
  example, using a [prepared statement] after that prepared statement has
  been [sqlite3_finalize|finalized] might result in an SQLITE_MISUSE error.
  <p>
  SQLite tries to detect misuse and report the misuse using this result code.
  However, there is no guarantee that the detection of misuse will be
  successful.  The misuse detection is probablistic.  Applications should
  never depend on an SQLITE_MISUSE return value.
  <p>
  If SQLite ever returns SQLITE_MISUSE from any interface, that means that
  the application is incorrectly coded and needs to be fixed.


}
RESCODE SQLITE_NOLFS       22   {
  The SQLITE_NOLFS error can be returned on systems that do not support
  large files when the database grows to be larger than what the filesystem
  can handle.  "NOLFS" stands for "NO Large File Support".
}
RESCODE SQLITE_AUTH        23   {}




RESCODE SQLITE_FORMAT      24   {}


RESCODE SQLITE_RANGE       25   {}




RESCODE SQLITE_NOTADB      26   {}



RESCODE SQLITE_NOTICE      27   {}





RESCODE SQLITE_WARNING     28   {}






RESCODE SQLITE_ROW         100  {}



RESCODE SQLITE_DONE        101  {}











RESCODE SQLITE_IOERR_READ              {SQLITE_IOERR | (1<<8)} {}

RESCODE SQLITE_IOERR_SHORT_READ        {SQLITE_IOERR | (2<<8)} {}





RESCODE SQLITE_IOERR_WRITE             {SQLITE_IOERR | (3<<8)} {}







RESCODE SQLITE_IOERR_FSYNC             {SQLITE_IOERR | (4<<8)} {}







RESCODE SQLITE_IOERR_DIR_FSYNC         {SQLITE_IOERR | (5<<8)} {}








RESCODE SQLITE_IOERR_TRUNCATE          {SQLITE_IOERR | (6<<8)} {}




RESCODE SQLITE_IOERR_FSTAT             {SQLITE_IOERR | (7<<8)} {}





RESCODE SQLITE_IOERR_UNLOCK            {SQLITE_IOERR | (8<<8)} {}




RESCODE SQLITE_IOERR_RDLOCK            {SQLITE_IOERR | (9<<8)} {}





RESCODE SQLITE_IOERR_DELETE            {SQLITE_IOERR | (10<<8)} {}




RESCODE SQLITE_IOERR_BLOCKED           {SQLITE_IOERR | (11<<8)} {}


RESCODE SQLITE_IOERR_NOMEM             {SQLITE_IOERR | (12<<8)} {}






RESCODE SQLITE_IOERR_ACCESS            {SQLITE_IOERR | (13<<8)} {}




RESCODE SQLITE_IOERR_CHECKRESERVEDLOCK {SQLITE_IOERR | (14<<8)} {}





RESCODE SQLITE_IOERR_LOCK              {SQLITE_IOERR | (15<<8)} {}







RESCODE SQLITE_IOERR_CLOSE             {SQLITE_IOERR | (16<<8)} {}




RESCODE SQLITE_IOERR_DIR_CLOSE         {SQLITE_IOERR | (17<<8)} {}


RESCODE SQLITE_IOERR_SHMOPEN           {SQLITE_IOERR | (18<<8)} {}





RESCODE SQLITE_IOERR_SHMSIZE           {SQLITE_IOERR | (19<<8)} {}





RESCODE SQLITE_IOERR_SHMLOCK           {SQLITE_IOERR | (20<<8)} {}


RESCODE SQLITE_IOERR_SHMMAP            {SQLITE_IOERR | (21<<8)} {}





RESCODE SQLITE_IOERR_SEEK              {SQLITE_IOERR | (22<<8)} {}






RESCODE SQLITE_IOERR_DELETE_NOENT      {SQLITE_IOERR | (23<<8)} {}






RESCODE SQLITE_IOERR_MMAP              {SQLITE_IOERR | (24<<8)} {}






RESCODE SQLITE_IOERR_GETTEMPPATH       {SQLITE_IOERR | (25<<8)} {}




RESCODE SQLITE_IOERR_CONVPATH          {SQLITE_IOERR | (26<<8)} {}





RESCODE SQLITE_LOCKED_SHAREDCACHE      {SQLITE_LOCKED |  (1<<8)} {}



















RESCODE SQLITE_BUSY_RECOVERY           {SQLITE_BUSY   |  (1<<8)} {}






RESCODE SQLITE_BUSY_SNAPSHOT           {SQLITE_BUSY   |  (2<<8)} {}



















RESCODE SQLITE_CANTOPEN_NOTEMPDIR      {SQLITE_CANTOPEN | (1<<8)} {}


RESCODE SQLITE_CANTOPEN_ISDIR          {SQLITE_CANTOPEN | (2<<8)} {}




RESCODE SQLITE_CANTOPEN_FULLPATH       {SQLITE_CANTOPEN | (3<<8)} {}




RESCODE SQLITE_CANTOPEN_CONVPATH       {SQLITE_CANTOPEN | (4<<8)} {}





RESCODE SQLITE_CORRUPT_VTAB            {SQLITE_CORRUPT | (1<<8)} {}





RESCODE SQLITE_READONLY_RECOVERY       {SQLITE_READONLY | (1<<8)} {}








RESCODE SQLITE_READONLY_CANTLOCK       {SQLITE_READONLY | (2<<8)} {}



RESCODE SQLITE_READONLY_ROLLBACK       {SQLITE_READONLY | (3<<8)} {}





RESCODE SQLITE_READONLY_DBMOVED        {SQLITE_READONLY | (4<<8)} {}







RESCODE SQLITE_ABORT_ROLLBACK          {SQLITE_ABORT | (2<<8)} {}





RESCODE SQLITE_CONSTRAINT_CHECK        {SQLITE_CONSTRAINT | (1<<8)} {}



RESCODE SQLITE_CONSTRAINT_COMMITHOOK   {SQLITE_CONSTRAINT | (2<<8)} {}






RESCODE SQLITE_CONSTRAINT_FOREIGNKEY   {SQLITE_CONSTRAINT | (3<<8)} {}




RESCODE SQLITE_CONSTRAINT_FUNCTION     {SQLITE_CONSTRAINT | (4<<8)} {}





RESCODE SQLITE_CONSTRAINT_NOTNULL      {SQLITE_CONSTRAINT | (5<<8)} {}



RESCODE SQLITE_CONSTRAINT_PRIMARYKEY   {SQLITE_CONSTRAINT | (6<<8)} {}




RESCODE SQLITE_CONSTRAINT_TRIGGER      {SQLITE_CONSTRAINT | (7<<8)} {}





RESCODE SQLITE_CONSTRAINT_UNIQUE       {SQLITE_CONSTRAINT | (8<<8)} {}




RESCODE SQLITE_CONSTRAINT_VTAB         {SQLITE_CONSTRAINT | (9<<8)} {}




RESCODE SQLITE_CONSTRAINT_ROWID        {SQLITE_CONSTRAINT |(10<<8)} {}




RESCODE SQLITE_NOTICE_RECOVER_WAL      {SQLITE_NOTICE | (1<<8)} {}




RESCODE SQLITE_NOTICE_RECOVER_ROLLBACK {SQLITE_NOTICE | (2<<8)} {}




RESCODE SQLITE_WARNING_AUTOINDEX       {SQLITE_WARNING | (1<<8)} {}







#############################################################################
# Code to process the RESCODE values
#
# Convert formula RESCODE values into numerics
set nResCode 0
set nPrimCode 0







|
>
>
>
>
>
>
>
>
>
>
>



|
>
>
|
>
|
|

|
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>














|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>








|



|
>
>






|
>
>
>
>
|
>
>
|
>
>
>
>
|
>
>
>
|
>
>
>
>
>
|
>
>
>
>
>
>
|
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
|
>
|
>
>
>
>
>
|
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
|
>
>
>
>
|
>
>
>
>
>
|
>
>
>
>
|
>
>
>
>
>
|
>
>
>
>
|
>
>
|
>
>
>
>
>
>
|
>
>
>
>
|
>
>
>
>
>
|
>
>
>
>
>
>
>
|
>
>
>
>
|
>
>
|
>
>
>
>
>
|
>
>
>
>
>
|
>
>
|
>
>
>
>
>
|
>
>
>
>
>
>
|
>
>
>
>
>
>
|
>
>
>
>
>
>
|
>
>
>
>
|
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
|
>
>
>
>
|
>
>
>
>
|
>
>
>
>
>
|
>
>
>
>
>
|
>
>
>
>
>
>
>
>
|
>
>
>
|
>
>
>
>
>
|
>
>
>
>
>
>
>
|
>
>
>
>
>
|
>
>
>
|
>
>
>
>
>
>
|
>
>
>
>
|
>
>
>
>
>
|
>
>
>
|
>
>
>
>
|
>
>
>
>
>
|
>
>
>
>
|
>
>
>
>
|
>
>
>
>
|
>
>
>
>
|
>
>
>
>
|
>
>
>
>
>
>







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
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
  identify the specific I/O operation that failed.
}
RESCODE SQLITE_CORRUPT     11   {
  The SQLITE_CORRUPT result code indicates that the database file has
  been corrupted.  See the [How To Corrupt Your Database Files] for
  further discussion on how corruption can occur.
}
RESCODE SQLITE_NOTFOUND    12   {
  The SQLITE_NOTFOUND result code is used in two contexts.
  SQLITE_NOTFOUND can be returned by the [sqlite3_file_control()] interface
  to indicate that the [file control opcode] passed as the third argument
  was not recognized by the underlying [VFS].
  SQLITE_NOTFOUND can also be returned by the xSetSystemCall() method of
  an [sqlite3_vfs] object.
  <p>
  The SQLITE_NOTFOUND result code is also used
  internally by the SQLite implementation, but those internal uses are
  not exposed to the application.
}
RESCODE SQLITE_FULL        13   {
  The SQLITE_FULL result code indicates that a write could not complete
  because the disk is full.  Note that this error can occur when trying
  to write information into the main database file, or it can also
  occur when writing into [temporary disk files].
  <p>
  Sometimes applications encounter this error even though there is an
  abundance of primary disk space because the error occurs when writing
  into [temporary disk files] on a system where temporary files are stored
  on a separate partition with much less space that the primary disk.
}
RESCODE SQLITE_CANTOPEN    14   {
  The SQLITE_CANTOPEN result code indicates that SQLite was unable to
  open a file.  The file in question might be a primary database file
  or on of several [temporary disk files].
}
RESCODE SQLITE_PROTOCOL    15   {
  The SQLITE_PROTOCOL result code indicates a problem with the file locking
  protocol used by SQLite.  The SQLITE_PROTOCOL error is currently only
  returned when using [WAL mode] and attempting to start a new transaction.
  There is a race condition that can occur when two separate 
  [database connections] both try to start a transaction at the same time
  in [WAL mode].  The loser of the race backs off and tries again, after
  a brief delay.  If the same connection loses the locking race dozens
  of times over a span of multiple seconds, it will eventually give up and
  return SQLITE_PROTOCOL.  The SQLITE_PROTOCOL error should appear in practice
  very, very rarely, and only when there are many separate processes all
  competing intensely to write to the same database.
}
RESCODE SQLITE_EMPTY       16   {
  The SQLITE_EMPTY result code originally meant that a database file was
  empty and held no content.  This result code is no longer used, but might
  be reused in some future release of SQLite.
}
RESCODE SQLITE_SCHEMA      17   {
  The SQLITE_SCHEMA result code indicates that the database schema
  has changed.  This result code can be returned from [sqlite3_step()] for
  a [prepared statement] that was generated using [sqlite3_prepare()] or
  [sqlite3_prepare16()].  If the database schema was changed by some other
  process in between the time that the statement was prepared and the time
  the statement was run, this error can result.
  <p>
  If a [prepared statement] is generated from [sqlite3_prepare_v2()] then
  the statement is automatically re-prepared if the schema changes, up to
  [SQLITE_MAX_SCHEMA_RETRY] times (default: 50).  The [sqlite3_step()]
  interface will only return SQLITE_SCHEMA back to the application if 
  the failure persists after these many retries.
}
RESCODE SQLITE_TOOBIG      18   {
  The SQLITE_TOOBIG error code indicates that a string or BLOB was
  too large.  The default maximum length of a string or BLOB in SQLite is
  1,000,000,000 bytes.  This maximum length can be changed at compile-time
  using the [SQLITE_MAX_LENGTH] compile-time option, or at run-time using
  the [sqlite3_limit](db,[SQLITE_LIMIT_LENGTH],...) interface.  The
  SQLITE_TOOBIG error results when SQLite encounters a string or BLOB
  that exceeds the compile-time or run-time limit.
  <p>
  The SQLITE_TOOBIG error code can also result when an oversized SQL
  statement is passed into one of the [sqlite3_prepare_v2()] interfaces.
  The maximum length of an SQL statement defaults to a much smaller
  value of 1,000,000 bytes.  The maximum SQL statement length can be
  set at compile-time using [SQLITE_MAX_SQL_LENGTH] or at run-time
  using [sqlite3_limit](db,[SQLITE_LIMIT_SQL_LENGTH],...).
}
RESCODE SQLITE_CONSTRAINT  19   {
  The SQLITE_CONSTRAINT error code means that an SQL constraint violation
  occurred while trying to process an SQL statement.  Additional information
  about the failed constraint can be found by consulting the
  accompanying error message (returned via [sqlite3_errmsg()] or
  [sqlite3_errmsg16()]) or by looking at the [extended error code].
}
RESCODE SQLITE_MISMATCH    20   {
  The SQLITE_MISMATCH error code indicates a datatype mismatch.
  <p>
  SQLite is normally very forgiving about mismatches between the type of
  a value and the declared type of the container in which that value is
  to be stored.  For example, SQLite allows the application to store
  a large BLOB in a column with a declared type of BOOLEAN.  But in a few
  cases, SQLite is strict about types.  The SQLITE_MISMATCH error is
  returned in those few cases when the types do not match.
  <p>
  The [rowid] of a table must be an integer.  Attempt to set the [rowid]
  to anything other than an integer (or a NULL which will be automatically
  converted into the next available integer rowid) results in an
  SQLITE_MISMATCH error.
}
RESCODE SQLITE_MISUSE      21   {
  The SQLITE_MISUSE return code might be returned if the application uses
  any SQLite interface in a way that is undefined or unsupported.  For
  example, using a [prepared statement] after that prepared statement has
  been [sqlite3_finalize|finalized] might result in an SQLITE_MISUSE error.
  <p>
  SQLite tries to detect misuse and report the misuse using this result code.
  However, there is no guarantee that the detection of misuse will be
  successful.  Misuse detection is probablistic.  Applications should
  never depend on an SQLITE_MISUSE return value.
  <p>
  If SQLite ever returns SQLITE_MISUSE from any interface, that means that
  the application is incorrectly coded and needs to be fixed.  Do not ship
  an application that sometimes returns SQLITE_MISUSE from a standard
  SQLite interface because that application contains potentially serious bugs.
}
RESCODE SQLITE_NOLFS       22   {
  The SQLITE_NOLFS error can be returned on systems that do not support
  large files when the database grows to be larger than what the filesystem
  can handle.  "NOLFS" stands for "NO Large File Support".
}
RESCODE SQLITE_AUTH        23   {
  The SQLITE_AUTH error is returned when the
  [sqlite3_set_authorizer | authorizer callback] indicates that an
  SQL statement being prepared is not authorized.
}
RESCODE SQLITE_FORMAT      24   {
  The SQLITE_FORMAT error code is not currently used by SQLite.
}
RESCODE SQLITE_RANGE       25   {
  The SQLITE_RANGE error indices that the parameter number argument
  to one of the [sqlite3_bind_blob|sqlite3_bind] routines is out of
  range.
}
RESCODE SQLITE_NOTADB      26   {
  When attempting to open a file, the SQLITE_NOTADB error indicates that
  the file being opened does not appear to be an SQLite database file.
}
RESCODE SQLITE_NOTICE      27   {
  The SQLITE_NOTICE result code is not returned by any C/C++ interface.
  However, SQLITE_NOTICE (or rather one of its [extended error codes])
  is sometimes used as the first argument in an [sqlite3_log()] callback
  to indicate that an unusual operation is taking place.
}
RESCODE SQLITE_WARNING     28   {
  The SQLITE_WARNING result code is not returned by any C/C++ interface.
  However, SQLITE_WARNING (or rather one of its [extended error codes])
  is sometimes used as the first argument in an [sqlite3_log()] callback
  to indicate that an unusual and possibly ill-advised operation is
  taking place.
}
RESCODE SQLITE_ROW         100  {
  The SQLITE_ROW result code returned by
  [sqlite3_step()] indicates that another row of output is available.
}
RESCODE SQLITE_DONE        101  {
  The SQLITE_DONE result code indicates that an operation has completed.
  The SQLITE_DONE result code is most commonly seen as a return value
  from [sqlite3_step()] indicating that the SQL statement has run to
  completion.  But SQLITE_DONE can also be returned by other multi-step
  interfaces such as [sqlite3_backup_step()].
}
RESCODE SQLITE_IOERR_READ              {SQLITE_IOERR | (1<<8)} {
  The SQLITE_IOERR_READ error code is an [ext-v-prim|extended error code]
  for [SQLITE_IOERR] indicating an I/O error in the [VFS] layer
  while trying to read from a file on disk.  This error might result
  from a hardware malfunction or because a filesystem came unmounted
  while the file was open.
}
RESCODE SQLITE_IOERR_SHORT_READ        {SQLITE_IOERR | (2<<8)} {
  The SQLITE_IOERR_SHORT_READ error code is an [ext-v-prim|extended error code]
  for [SQLITE_IOERR] indicating that a read attempt in the [VFS] layer
  was unable to obtain as many bytes as was requested.  This might be
  due to a truncated file.
}
RESCODE SQLITE_IOERR_WRITE             {SQLITE_IOERR | (3<<8)} {
  The SQLITE_IOERR_WRITE error code is an [ext-v-prim|extended error code]
  for [SQLITE_IOERR] indicating an I/O error in the [VFS] layer
  while trying to write into a file on disk.  This error might result
  from a hardware malfunction or because a filesystem came unmounted
  while the file was open.  This error should not occur if the filesystem
  is full as there is a separate error code (SQLITE_FULL) for that purpose.
}
RESCODE SQLITE_IOERR_FSYNC             {SQLITE_IOERR | (4<<8)} {
  The SQLITE_IOERR_FSYNC error code is an [ext-v-prim|extended error code]
  for [SQLITE_IOERR] indicating an I/O error in the [VFS] layer
  while trying to flush previously written content out of OS and/or
  disk-control buffers and into persistent storage.  In other words,
  this code indicates a problem with the fsync() system call in unix
  or the FlushFileBuffers() system call in windows.
}
RESCODE SQLITE_IOERR_DIR_FSYNC         {SQLITE_IOERR | (5<<8)} {
  The SQLITE_IOERR_DIR_FSYNC error code is an [ext-v-prim|extended error code]
  for [SQLITE_IOERR] indicating an I/O error in the [VFS] layer
  while trying to invoke fsync() on a directory.  The unix [VFS] attempts
  to fsync() directories after creating or deleting certain files to
  ensure that those files will still appear in the filesystem following
  a power loss or system crash.  This error code indicates a problem
  attempting to perform that fsync().
}
RESCODE SQLITE_IOERR_TRUNCATE          {SQLITE_IOERR | (6<<8)} {
  The SQLITE_IOERR_TRUNCATE error code is an [ext-v-prim|extended error code]
  for [SQLITE_IOERR] indicating an I/O error in the [VFS] layer
  while trying to truncate a file to a smaller size.
}
RESCODE SQLITE_IOERR_FSTAT             {SQLITE_IOERR | (7<<8)} {
  The SQLITE_IOERR_FSTAT error code is an [ext-v-prim|extended error code]
  for [SQLITE_IOERR] indicating an I/O error in the [VFS] layer
  while trying to invoke fstat() (or the equivalent) on a file in order
  to determine information such as the file size or access permissions.
}
RESCODE SQLITE_IOERR_UNLOCK            {SQLITE_IOERR | (8<<8)} {
  The SQLITE_IOERR_UNLOCK error code is an [ext-v-prim|extended error code]
  for [SQLITE_IOERR] indicating an I/O error
  within xUnlock method on the [sqlite3_io_methods] object.
}
RESCODE SQLITE_IOERR_RDLOCK            {SQLITE_IOERR | (9<<8)} {
  The SQLITE_IOERR_UNLOCK error code is an [ext-v-prim|extended error code]
  for [SQLITE_IOERR] indicating an I/O error
  within xLock method on the [sqlite3_io_methods] object while trying
  to obtain a read lock.
}
RESCODE SQLITE_IOERR_DELETE            {SQLITE_IOERR | (10<<8)} {
  The SQLITE_IOERR_UNLOCK error code is an [ext-v-prim|extended error code]
  for [SQLITE_IOERR] indicating an I/O error
  within xDelete method on the [sqlite3_vfs] object.
}
RESCODE SQLITE_IOERR_BLOCKED           {SQLITE_IOERR | (11<<8)} {
  The SQLITE_IOERR_BLOCKED error code is no longer used.
}
RESCODE SQLITE_IOERR_NOMEM             {SQLITE_IOERR | (12<<8)} {
  The SQLITE_IOERR_NOMEM error code is sometimes returned by the [VFS]
  layer to indicate that an operation could not be completed due to the
  inability to allocate sufficient memory.  This error code is normally
  converted into [SQLITE_NOMEM] by the higher layers of SQLite before
  being returned to the application.
}
RESCODE SQLITE_IOERR_ACCESS            {SQLITE_IOERR | (13<<8)} {
  The SQLITE_IOERR_ACCESS error code is an [ext-v-prim|extended error code]
  for [SQLITE_IOERR] indicating an I/O error
  within the xAccess method on the [sqlite3_vfs] object.
}
RESCODE SQLITE_IOERR_CHECKRESERVEDLOCK {SQLITE_IOERR | (14<<8)} {
  The SQLITE_IOERR_CHECKRESERVEDLOCK error code is
  an [ext-v-prim|extended error code]
  for [SQLITE_IOERR] indicating an I/O error
  within the xCheckReservedLock method on the [sqlite3_io_methods] object.
}
RESCODE SQLITE_IOERR_LOCK              {SQLITE_IOERR | (15<<8)} {
  The SQLITE_IOERR_LOCK error code is an [ext-v-prim|extended error code]
  for [SQLITE_IOERR] indicating an I/O error in the 
  advisory file locking logic.
  Usually an SQLITE_IOERR_LOCK error indicates a problem obtaining
  a [PENDING lock].  However it can also indicate miscellaneous
  locking errors on some of the specialized [VFSes] used on Macs.
}
RESCODE SQLITE_IOERR_CLOSE             {SQLITE_IOERR | (16<<8)} {
  The SQLITE_IOERR_ACCESS error code is an [ext-v-prim|extended error code]
  for [SQLITE_IOERR] indicating an I/O error
  within the xClose method on the [sqlite3_io_methods] object.
}
RESCODE SQLITE_IOERR_DIR_CLOSE         {SQLITE_IOERR | (17<<8)} {
  The SQLITE_IOERR_DIR_CLOSE error code is no longer used.
}
RESCODE SQLITE_IOERR_SHMOPEN           {SQLITE_IOERR | (18<<8)} {
  The SQLITE_IOERR_SHMOPEN error code is an [ext-v-prim|extended error code]
  for [SQLITE_IOERR] indicating an I/O error
  within the xShmMap method on the [sqlite3_io_methods] object
  while trying to open a new shared memory segment.
}
RESCODE SQLITE_IOERR_SHMSIZE           {SQLITE_IOERR | (19<<8)} {
  The SQLITE_IOERR_SHMSIZE error code is an [ext-v-prim|extended error code]
  for [SQLITE_IOERR] indicating an I/O error
  within the xShmMap method on the [sqlite3_io_methods] object
  while trying to resize an existing shared memory segment.
}
RESCODE SQLITE_IOERR_SHMLOCK           {SQLITE_IOERR | (20<<8)} {
  The SQLITE_IOERR_SHMLOCK error code is no longer used.
}
RESCODE SQLITE_IOERR_SHMMAP            {SQLITE_IOERR | (21<<8)} {
  The SQLITE_IOERR_SHMMAP error code is an [ext-v-prim|extended error code]
  for [SQLITE_IOERR] indicating an I/O error
  within the xShmMap method on the [sqlite3_io_methods] object
  while trying to map a shared memory segment into the process address space.
}
RESCODE SQLITE_IOERR_SEEK              {SQLITE_IOERR | (22<<8)} {
  The SQLITE_IOERR_SEEK error code is an [ext-v-prim|extended error code]
  for [SQLITE_IOERR] indicating an I/O error
  within the xRead or xWrite methods on the [sqlite3_io_methods] object
  while trying to seek a file descriptor to the beginning point of the
  file where the read or write is to occur.
}
RESCODE SQLITE_IOERR_DELETE_NOENT      {SQLITE_IOERR | (23<<8)} {
  The SQLITE_IOERR_DELETE_NOENT error code
  is an [ext-v-prim|extended error code]
  for [SQLITE_IOERR] indicating that the
  xDelete method on the [sqlite3_vfs] object failed because the
  file being deleted does not exist.
}
RESCODE SQLITE_IOERR_MMAP              {SQLITE_IOERR | (24<<8)} {
  The SQLITE_IOERR_SEEK error code is an [ext-v-prim|extended error code]
  for [SQLITE_IOERR] indicating an I/O error
  within the xFetch or xUnfetch methods on the [sqlite3_io_methods] object
  while trying to map or unmap part of the database file into the
  process address space.
}
RESCODE SQLITE_IOERR_GETTEMPPATH       {SQLITE_IOERR | (25<<8)} {
  The SQLITE_IOERR_SEEK error code is an [ext-v-prim|extended error code]
  for [SQLITE_IOERR] indicating that the [VFS] is unable to determine
  a suitable directory in which to place temporary files.
}
RESCODE SQLITE_IOERR_CONVPATH          {SQLITE_IOERR | (26<<8)} {
  The SQLITE_IOERR_SEEK error code is an [ext-v-prim|extended error code]
  for [SQLITE_IOERR] used only by Cygwin [VFS] and indicating that
  the cygwin_conv_path() system call failed.
  See also: [SQLITE_CANTOPEN_CONVPATH]
}
RESCODE SQLITE_LOCKED_SHAREDCACHE      {SQLITE_LOCKED |  (1<<8)} {
  The SQLITE_LOCKED_SHAREDCACHE error code is
  an [ext-v-prim|extended error code] for [SQLITE_LOCKED]
  indicating that the locking conflict has occurred due to contention
  with a different [database connection] that happens to hold a 
  [shared cache] with the database connection to which the error was
  returned.  For example, if the other database connection is holding
  an [exclusive lock] on the database, then the database connection
  that receives this error will be unable to read or write any part
  of the database file unless it has the [read_uncommitted pragma]
  enabled.
  <p>
  The SQLITE_LOCKED_SHARECACHE error code works very much like the
  [SQLITE_BUSY] error code except that SQLITE_LOCKED_SHARECACHE is
  for separate database connections that share a cache whereas 
  SQLITE_BUSY is for the much more common case of separate database
  connections that do not share the same cache.  Also, the
  [sqlite3_busy_handler()] and [sqlite3_busy_timeout()] interfaces
  do not help in resolving SQLITE_LOCKED_SHAREDCACHE conflicts.
}
RESCODE SQLITE_BUSY_RECOVERY           {SQLITE_BUSY   |  (1<<8)} {
  The SQLITE_BUSY_RECOVERY error code is an [ext-v-prim|extended error code]
  for [SQLITE_BUSY] that indicates that an operation could not proceed
  because another process is busy recovering a [WAL mode] database file
  following a crash.  The SQLITE_BUSY_RECOVERY error code only occurs
  on [WAL mode] databases.
}
RESCODE SQLITE_BUSY_SNAPSHOT           {SQLITE_BUSY   |  (2<<8)} {
  The SQLITE_BUSY_SNAPSHOT error code is an [ext-v-prim|extended error code]
  for [SQLITE_BUSY] that occurs on [WAL mode] databases when a database
  connection tries to promote a read transaction into a write transaction
  but finds that another [database connection] has already written to the
  database and thus invalidated prior reads.
  <p>
  The following scenario illustrates how an SQLITE_BUSY_SNAPSHOT error
  might arise:
  <ol>
  <li> Process A starts a read transaction on the database and does one
       or more SELECT statement.  Process A keeps the transaction open.
  <li> Process B updates the database, changing values previous read by
       process A.
  <li> Process A now tries to write to the database.  But process A's view
       of the database content is now obsolete because process B has
       modified the database file after process A read from it.  Hence
       process B gets an SQLITE_BUSY_SNAPSHOT error.
  </ol>
}
RESCODE SQLITE_CANTOPEN_NOTEMPDIR      {SQLITE_CANTOPEN | (1<<8)} {
  The SQLITE_CANTOPEN_NOTEMPDIR error code is no longer used.
}
RESCODE SQLITE_CANTOPEN_ISDIR          {SQLITE_CANTOPEN | (2<<8)} {
  The SQLITE_CANTOPEN_ISDIR error code is an [ext-v-prim|extended error code]
  for [SQLITE_CANTOPEN] indicating that a file open operation failed because
  the file is really a directory.
}
RESCODE SQLITE_CANTOPEN_FULLPATH       {SQLITE_CANTOPEN | (3<<8)} {
  The SQLITE_CANTOPEN_FULLPATH error code is an [ext-v-prim|extended error code]
  for [SQLITE_CANTOPEN] indicating that a file open operation failed because
  the operating system was unable to convert the filename into a full pathname.
}
RESCODE SQLITE_CANTOPEN_CONVPATH       {SQLITE_CANTOPEN | (4<<8)} {
  The SQLITE_CANTOPEN_SEEK error code is an [ext-v-prim|extended error code]
  for [SQLITE_CANTOPEN] used only by Cygwin [VFS] and indicating that
  the cygwin_conv_path() system call failed while trying to open a file.
  See also: [SQLITE_IOERR_CONVPATH]
}
RESCODE SQLITE_CORRUPT_VTAB            {SQLITE_CORRUPT | (1<<8)} {
  The SQLITE_CORRUPT_VTAB error code is an [ext-v-prim|extended error code]
  for [SQLITE_CORRUPT] used by [virtual tables].  A [virtual table] might
  return SQLITE_CORRUPT_VTAB to indicate that content in the virtual table
  is corrupt.
}
RESCODE SQLITE_READONLY_RECOVERY       {SQLITE_READONLY | (1<<8)} {
  The SQLITE_READONLY_RECOVERY error code is an [ext-v-prim|extended error code]
  for [SQLITE_READONLY].  The SQLITE_READONLY_RECOVERY error code indicates
  that a [WAL mode] database cannot be opened because the database file
  needs to be recovered and recovery requires write access but only
  read access is available.
}
RESCODE SQLITE_READONLY_CANTLOCK       {SQLITE_READONLY | (2<<8)} {
  The SQLITE_READONLY_CANTLOCK error code is an [ext-v-prim|extended error code]
  for [SQLITE_READONLY].  The SQLITE_READONLY_CANTLOCK error code indicates
  that SQLite is unable to obtain a read lock on a [WAL mode] database
  because the shared-memory file associated with that database is read-only.
}
RESCODE SQLITE_READONLY_ROLLBACK       {SQLITE_READONLY | (3<<8)} {
  The SQLITE_READONLY_ROLLBACK error code is an [ext-v-prim|extended error code]
  for [SQLITE_READONLY].  The SQLITE_READONLY_ROLLBACK error code indicates
  that a database cannot be opened because it has a [hot journal] that
  needs to be rolled back but cannot because the database is readonly.
}
RESCODE SQLITE_READONLY_DBMOVED        {SQLITE_READONLY | (4<<8)} {
  The SQLITE_READONLY_DBMOVED error code is an [ext-v-prim|extended error code]
  for [SQLITE_READONLY].  The SQLITE_READONLY_DBMOVED error code indicates
  that a database cannot be modified because the database file has been
  moved since it was opened, and so any attempt to modify the database
  might result in database corruption if the processes crashes because the
  [rollback journal] would not be correctly named.
}
RESCODE SQLITE_ABORT_ROLLBACK          {SQLITE_ABORT | (2<<8)} {
  The SQLITE_ABORT_ROLLBACK error code is an [ext-v-prim|extended error code]
  for [SQLITE_ABORT] indicating that an SQL statement aborted because
  the transaction that was active when the SQL statement first started
  was rolled back.
}
RESCODE SQLITE_CONSTRAINT_CHECK        {SQLITE_CONSTRAINT | (1<<8)} {
  The SQLITE_CONSTRAINT_CHECK error code is an [ext-v-prim|extended error code]
  for [SQLITE_CONSTRAINT] indicating that a [CHECK constraint] failed.
}
RESCODE SQLITE_CONSTRAINT_COMMITHOOK   {SQLITE_CONSTRAINT | (2<<8)} {
  The SQLITE_CONSTRAINT_COMMITHOOK error code
  is an [ext-v-prim|extended error code]
  for [SQLITE_CONSTRAINT] indicating that a
  [sqlite3_commit_hook|commit hook callback] returned non-zero that thus
  caused the SQL statement to be rolled back.
}
RESCODE SQLITE_CONSTRAINT_FOREIGNKEY   {SQLITE_CONSTRAINT | (3<<8)} {
  The SQLITE_CONSTRAINT_FOREIGNKEY error code
  is an [ext-v-prim|extended error code]
  for [SQLITE_CONSTRAINT] indicating that a [foreign key constraint] failed.
}
RESCODE SQLITE_CONSTRAINT_FUNCTION     {SQLITE_CONSTRAINT | (4<<8)} {
  The SQLITE_CONSTRAINT_FUNCTION error code is not currently used
  by the SQLite core.  However, this error code is available for use
  by extension functions.
}
RESCODE SQLITE_CONSTRAINT_NOTNULL      {SQLITE_CONSTRAINT | (5<<8)} {
  The SQLITE_CONSTRAINT_NOTNULL error code
  is an [ext-v-prim|extended error code]
  for [SQLITE_CONSTRAINT] indicating that a [NOT NULL constraint] failed.
}
RESCODE SQLITE_CONSTRAINT_PRIMARYKEY   {SQLITE_CONSTRAINT | (6<<8)} {
  The SQLITE_CONSTRAINT_PRIMARYKEY error code
  is an [ext-v-prim|extended error code]
  for [SQLITE_CONSTRAINT] indicating that a [PRIMARY KEY constraint] failed.
}
RESCODE SQLITE_CONSTRAINT_TRIGGER      {SQLITE_CONSTRAINT | (7<<8)} {
  The SQLITE_CONSTRAINT_TRIGGER error code
  is an [ext-v-prim|extended error code]
  for [SQLITE_CONSTRAINT] indicating that a [RAISE function] within
  a [CREATE TRIGGER|trigger] fired, causing the SQL statement to abort.
}
RESCODE SQLITE_CONSTRAINT_UNIQUE       {SQLITE_CONSTRAINT | (8<<8)} {
  The SQLITE_CONSTRAINT_UNIQUE error code
  is an [ext-v-prim|extended error code]
  for [SQLITE_CONSTRAINT] indicating that a [UNIQUE constraint] failed.
}
RESCODE SQLITE_CONSTRAINT_VTAB         {SQLITE_CONSTRAINT | (9<<8)} {
  The SQLITE_CONSTRAINT_VTAB error code is not currently used
  by the SQLite core.  However, this error code is available for use
  by application-defined [virtual tables].
}
RESCODE SQLITE_CONSTRAINT_ROWID        {SQLITE_CONSTRAINT |(10<<8)} {
  The SQLITE_CONSTRAINT_ROWID error code
  is an [ext-v-prim|extended error code]
  for [SQLITE_CONSTRAINT] indicating that a [rowid] is not unique.
}
RESCODE SQLITE_NOTICE_RECOVER_WAL      {SQLITE_NOTICE | (1<<8)} {
  The SQLITE_NOTICE_RECOVER_WAL result code is
  passed to the callback of
  [sqlite3_log()] when a [WAL mode] database file is recovered.
}
RESCODE SQLITE_NOTICE_RECOVER_ROLLBACK {SQLITE_NOTICE | (2<<8)} {
  The SQLITE_NOTICE_RECOVER_ROLLBACK result code is
  passed to the callback of
  [sqlite3_log()] when a [hot journal] is rolled back.
}
RESCODE SQLITE_WARNING_AUTOINDEX       {SQLITE_WARNING | (1<<8)} {
  The SQLITE_WARNING_AUTOINDEX result code is
  passed to the callback of
  [sqlite3_log()] whenever [automatic indexing] is used.
  This can serve as a warning to application designers that the
  database might benefit from additional indexes.
}

#############################################################################
# Code to process the RESCODE values
#
# Convert formula RESCODE values into numerics
set nResCode 0
set nPrimCode 0