Skip to content

Commit a95182b

Browse files
t-richardsbcardiff
authored andcommitted
Add error codes to LibSQLite3::Code (#36)
1 parent 2152441 commit a95182b

File tree

1 file changed

+61
-2
lines changed

1 file changed

+61
-2
lines changed

src/sqlite3/lib_sqlite3.cr

Lines changed: 61 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,67 @@ lib LibSQLite3
77
type SQLite3Backup = Void*
88

99
enum Code
10-
OKAY = 0
11-
ROW = 100
10+
# Successful result
11+
OKAY = 0
12+
# Generic error
13+
ERROR = 1
14+
# Internal logic error in SQLite
15+
INTERNAL = 2
16+
# Access permission denied
17+
PERM = 3
18+
# Callback routine requested an abort
19+
ABORT = 4
20+
# The database file is locked
21+
BUSY = 5
22+
# A table in the database is locked
23+
LOCKED = 6
24+
# A malloc() failed
25+
NOMEM = 7
26+
# Attempt to write a readonly database
27+
READONLY = 8
28+
# Operation terminated by sqlite3_interrupt()
29+
INTERRUPT = 9
30+
# Some kind of disk I/O error occurred
31+
IOERR = 10
32+
# The database disk image is malformed
33+
CORRUPT = 11
34+
# Unknown opcode in sqlite3_file_control()
35+
NOTFOUND = 12
36+
# Insertion failed because database is full
37+
FULL = 13
38+
# Unable to open the database file
39+
CANTOPEN = 14
40+
# Database lock protocol error
41+
PROTOCOL = 15
42+
# Internal use only
43+
EMPTY = 16
44+
# The database schema changed
45+
SCHEMA = 17
46+
# String or BLOB exceeds size limit
47+
TOOBIG = 18
48+
# Abort due to constraint violation
49+
CONSTRAINT = 19
50+
# Data type mismatch
51+
MISMATCH = 20
52+
# Library used incorrectly
53+
MISUSE = 21
54+
# Uses OS features not supported on host
55+
NOLFS = 22
56+
# Authorization denied
57+
AUTH = 23
58+
# Not used
59+
FORMAT = 24
60+
# 2nd parameter to sqlite3_bind out of range
61+
RANGE = 25
62+
# File opened that is not a database file
63+
NOTADB = 26
64+
# Notifications from sqlite3_log()
65+
NOTICE = 27
66+
# Warnings from sqlite3_log()
67+
WARNING = 28
68+
# sqlite3_step() has another row ready
69+
ROW = 100
70+
# sqlite3_step() has finished executing
1271
DONE = 101
1372
end
1473

0 commit comments

Comments
 (0)