-
Notifications
You must be signed in to change notification settings - Fork 397
Expand file tree
/
Copy pathSQLite3Errors.java
More file actions
177 lines (138 loc) · 6.82 KB
/
SQLite3Errors.java
File metadata and controls
177 lines (138 loc) · 6.82 KB
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
package sqlancer.sqlite3;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import sqlancer.common.query.ExpectedErrors;
public final class SQLite3Errors {
private SQLite3Errors() {
}
public static List<String> getDeleteErrors() {
ArrayList<String> errors = new ArrayList<>();
// DELETE trigger for a view/table to which colomns were added or deleted
errors.add("columns but");
// trigger with on conflict clause
errors.add("ON CONFLICT clause does not match any PRIMARY KEY or UNIQUE constraint");
return errors;
}
public static void addDeleteErrors(ExpectedErrors errors) {
errors.addAll(getDeleteErrors());
}
public static List<String> getExpectedExpressionErrors() {
ArrayList<String> errors = new ArrayList<>();
errors.add("[SQLITE_BUSY] The database file is locked");
errors.add("FTS expression tree is too large");
errors.add("String or BLOB exceeds size limit");
errors.add("[SQLITE_ERROR] SQL error or missing database (integer overflow)");
errors.add("ORDER BY term out of range");
errors.add("GROUP BY term out of range");
errors.add("not authorized"); // load_extension
errors.add("aggregate functions are not allowed in the GROUP BY clause");
errors.add("parser stack overflow");
// nested query
errors.add("misuse of aggregate");
errors.add("second argument to nth_value must be a positive integer");
errors.add("parser stack overflow");
// window functions
errors.add("RANGE with offset PRECEDING/FOLLOWING requires one ORDER BY expression");
errors.add("frame starting offset must be a non-negative integer");
errors.add("frame starting offset must be a non-negative number");
errors.add("unsupported frame specification");
errors.add("frame ending offset must be a non-negative integer");
errors.add("frame ending offset must be a non-negative number");
errors.add("argument of ntile must be a positive integer");
errors.add("malformed JSON");
errors.add("JSON cannot hold BLOB values");
errors.add("JSON path error");
errors.add("bad JSON path");
errors.add("json_insert() needs an odd number of arguments");
errors.add("json_object() labels must be TEXT");
errors.add("json_object() requires an even number of arguments");
errors.add("argument of ntile must be a positive integer");
// fts5 functions
errors.add("unable to use function highlight in the requested context");
errors.add("no such cursor");
// INDEXED BY
errors.add("no query solution");
errors.add("no such index");
// UNION/INTERSECT ...
errors.add("ORDER BY term does not match any column in the result set");
errors.add("ORDER BY clause should come after");
errors.add("LIMIT clause should come after");
errors.add("unsafe use of load_extension");
errors.add("table does not support scanning");
errors.add("circularly defined");
errors.add("[SQLITE_ERROR] SQL error or missing database"); // A possible delay in the execution of DROP TABLE
// statement.
return errors;
}
public static void addExpectedExpressionErrors(ExpectedErrors errors) {
errors.addAll(getExpectedExpressionErrors());
}
public static List<String> getMatchQueryErrors() {
ArrayList<String> errors = new ArrayList<>();
errors.add("unable to use function MATCH in the requested context");
errors.add("malformed MATCH expression");
errors.add("fts5: syntax error near");
errors.add("no such column"); // vt0.c0 MATCH '-799256540'
errors.add("unknown special query"); // vt0.c1 MATCH '*YD)LC3^cG|'
errors.add("fts5: column queries are not supported"); // vt0.c0 MATCH '2016456922'
errors.add("fts5: phrase queries are not supported");
errors.add("unterminated string");
return errors;
}
public static void addMatchQueryErrors(ExpectedErrors errors) {
errors.addAll(getMatchQueryErrors());
}
public static List<String> getTableManipulationErrors() {
ArrayList<String> errors = new ArrayList<>();
errors.add("unsupported frame specification");
errors.add("non-deterministic functions prohibited in CHECK constraints");
errors.addAll(Arrays.asList("subqueries prohibited in CHECK constraints",
"generated columns cannot be part of the PRIMARY KEY", "must have at least one non-generated column"));
return errors;
}
public static void addTableManipulationErrors(ExpectedErrors errors) {
errors.addAll(getTableManipulationErrors());
}
public static List<String> getQueryErrors() {
ArrayList<String> errors = new ArrayList<>();
errors.add("ON clause references tables to its right");
return errors;
}
public static void addQueryErrors(ExpectedErrors errors) {
errors.addAll(getQueryErrors());
}
public static List<String> getInsertNowErrors() {
ArrayList<String> errors = new ArrayList<>();
errors.add("non-deterministic use of strftime()");
errors.add("non-deterministic use of time()");
errors.add("non-deterministic use of datetime()");
errors.add("non-deterministic use of julianday()");
errors.add("non-deterministic use of date()");
return errors;
}
public static void addInsertNowErrors(ExpectedErrors errors) {
errors.addAll(getInsertNowErrors());
}
public static List<String> getInsertUpdateErrors() {
ArrayList<String> errors = new ArrayList<>();
errors.add("String or BLOB exceeds size limit");
errors.add("[SQLITE_CONSTRAINT_CHECK]");
errors.add("[SQLITE_CONSTRAINT_PRIMARYKEY]");
errors.add("[SQLITE_CONSTRAINT]");
errors.add("[SQLITE_CONSTRAINT_NOTNULL]");
errors.add("[SQLITE_CONSTRAINT_UNIQUE]");
errors.add("cannot INSERT into generated column"); // TODO: filter out generated columns
errors.add("A table in the database is locked"); // https://www.sqlite.org/src/tktview?name=56a74875be
errors.add("The database file is locked");
errors.add("too many levels of trigger recursion");
errors.add("cannot UPDATE generated column");
errors.add("[SQLITE_ERROR] SQL error or missing database (no such table:");
errors.add("[SQLITE_ERROR] SQL error or missing database (foreign key mismatch");
errors.add("no such column"); // trigger
return errors;
}
public static void addInsertUpdateErrors(ExpectedErrors errors) {
errors.addAll(getInsertUpdateErrors());
}
}