-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathsql_type.go
176 lines (110 loc) · 2.57 KB
/
sql_type.go
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
package mysql
import "fmt"
type SQLType byte
const (
SQLType_SELECT SQLType = iota
SQLType_INSERT
SQLType_UPDATE
SQLType_DELETE
SQLType_SELECT_FOR_UPDATE
SQLType_REPLACE
SQLType_TRUNCATE
SQLType_CREATE
SQLType_DROP
SQLType_LOAD
SQLType_MERGE
SQLType_SHOW
SQLType_ALTER
SQLType_RENAME
SQLType_DUMP
SQLType_DEBUG
SQLType_EXPLAIN
SQLType_PROCEDURE
SQLType_DESC
// ******************************************
// 一些 java mybatis 特有的 sql 方法省略
// ******************************************
SQLType_SET SQLType = 27
SQLType_RELOAD SQLType = 28
SQLType_SELECT_UNION SQLType = 29
SQLType_CREATE_TABLE SQLType = 30
SQLType_DROP_TABLE SQLType = 31
SQLType_ALTER_TABLE SQLType = 32
SQLType_SAVE_POINT SQLType = 33
SQLType_SELECT_FROM_UPDATE SQLType = 34
SQLType_MULTI_DELETE SQLType = 35
SQLType_MULTI_UPDATE SQLType = 36
SQLType_CREATE_INDEX SQLType = 37
SQLType_DROP_INDEX SQLType = 38
// ******************************************
// 一些不常见的 sql 类型省略,确有需要,以后再加
// ******************************************
)
func (sqlType SQLType) String() string {
switch sqlType {
case SQLType_SELECT:
return "SELECT"
case SQLType_INSERT:
return "INSERT"
case SQLType_UPDATE:
return "UPDATE"
case SQLType_DELETE:
return "DELETE"
case SQLType_SELECT_FOR_UPDATE:
return "SELECT_FOR_UPDATE"
case SQLType_REPLACE:
return "REPLACE"
case SQLType_TRUNCATE:
return "TRUNCATE"
case SQLType_CREATE:
return "CREATE"
case SQLType_DROP:
return "DROP"
case SQLType_LOAD:
return "LOAD"
case SQLType_MERGE:
return "MERGE"
case SQLType_SHOW:
return "SHOW"
case SQLType_ALTER:
return "ALTER"
case SQLType_RENAME:
return "RENAME"
case SQLType_DUMP:
return "DUMP"
case SQLType_DEBUG:
return "DEBUG"
case SQLType_EXPLAIN:
return "EXPLAIN"
case SQLType_PROCEDURE:
return "PROCEDURE"
case SQLType_DESC:
return "DESC"
case SQLType_SET:
return "SET"
case SQLType_RELOAD:
return "RELOAD"
case SQLType_SELECT_UNION:
return "SELECT_UNION"
case SQLType_CREATE_TABLE:
return "CREATE_TABLE"
case SQLType_DROP_TABLE:
return "DROP_TABLE"
case SQLType_ALTER_TABLE:
return "ALTER_TABLE"
case SQLType_SAVE_POINT:
return "SAVE_POINT"
case SQLType_SELECT_FROM_UPDATE:
return "SELECT_FROM_UPDATE"
case SQLType_MULTI_DELETE:
return "MULTI_DELETE"
case SQLType_MULTI_UPDATE:
return "MULTI_UPDATE"
case SQLType_CREATE_INDEX:
return "CREATE_INDEX"
case SQLType_DROP_INDEX:
return "DROP_INDEX"
default:
return fmt.Sprintf("%d", sqlType)
}
}