forked from sqlancer/sqlancer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMySQLErrors.java
More file actions
64 lines (46 loc) · 1.85 KB
/
MySQLErrors.java
File metadata and controls
64 lines (46 loc) · 1.85 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
package sqlancer.mysql;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;
import sqlancer.common.query.ExpectedErrors;
public final class MySQLErrors {
private MySQLErrors() {
}
public static List<String> getExpressionErrors() {
ArrayList<String> errors = new ArrayList<>();
errors.add("BIGINT value is out of range"); // e.g., CAST(-('-1e500') AS SIGNED)
errors.add("is not valid for CHARACTER SET");
if (MySQLBugs.bug111471) {
errors.add("Memory capacity exceeded");
}
return errors;
}
public static List<Pattern> getExpressionRegexErrors() {
ArrayList<Pattern> errors = new ArrayList<>();
if (MySQLBugs.bug114533) {
errors.add(Pattern.compile("For input string: \"0+-0\"")); // match: For input string:
// "00000000000000000000-0"
}
errors.add(Pattern.compile("Unknown column '.*' in 'order clause'"));
return errors;
}
public static void addExpressionErrors(ExpectedErrors errors) {
errors.addAll(getExpressionErrors());
errors.addAllRegexes(getExpressionRegexErrors());
}
public static List<String> getInsertUpdateErrors() {
ArrayList<String> errors = new ArrayList<>();
errors.add("doesn't have a default value");
errors.add("Data truncation");
errors.add("Incorrect integer value");
errors.add("Duplicate entry");
errors.add("Data truncated for column");
errors.add("Data truncated for functional index");
errors.add("cannot be null");
errors.add("Incorrect decimal value");
return errors;
}
public static void addInsertUpdateErrors(ExpectedErrors errors) {
errors.addAll(getInsertUpdateErrors());
}
}