@@ -49,6 +49,162 @@ class Query
4949 'SUM ' , 'AVG ' , 'STD ' , 'STDDEV ' , 'MIN ' , 'MAX ' , 'BIT_OR ' , 'BIT_AND ' ,
5050 );
5151
52+ public static $ ALLFLAGS = array (
53+ /*
54+ * select ... DISTINCT ...
55+ */
56+ 'distinct ' => false ,
57+
58+ /*
59+ * drop ... DATABASE ...
60+ */
61+ 'drop_database ' => false ,
62+
63+ /*
64+ * ... GROUP BY ...
65+ */
66+ 'group ' => false ,
67+
68+ /*
69+ * ... HAVING ...
70+ */
71+ 'having ' => false ,
72+
73+ /*
74+ * INSERT ...
75+ * or
76+ * REPLACE ...
77+ * or
78+ * DELETE ...
79+ */
80+ 'is_affected ' => false ,
81+
82+ /*
83+ * select ... PROCEDURE ANALYSE( ... ) ...
84+ */
85+ 'is_analyse ' => false ,
86+
87+ /*
88+ * select COUNT( ... ) ...
89+ */
90+ 'is_count ' => false ,
91+
92+ /*
93+ * DELETE ...
94+ */
95+ 'is_delete ' => false , // @deprecated; use `querytype`
96+
97+ /*
98+ * EXPLAIN ...
99+ */
100+ 'is_explain ' => false , // @deprecated; use `querytype`
101+
102+ /*
103+ * select ... INTO OUTFILE ...
104+ */
105+ 'is_export ' => false ,
106+
107+ /*
108+ * select FUNC( ... ) ...
109+ */
110+ 'is_func ' => false ,
111+
112+ /*
113+ * select ... GROUP BY ...
114+ * or
115+ * select ... HAVING ...
116+ */
117+ 'is_group ' => false ,
118+
119+ /*
120+ * INSERT ...
121+ * or
122+ * REPLACE ...
123+ * or
124+ * TODO: LOAD DATA ...
125+ */
126+ 'is_insert ' => false ,
127+
128+ /*
129+ * ANALYZE ...
130+ * or
131+ * CHECK ...
132+ * or
133+ * CHECKSUM ...
134+ * or
135+ * OPTIMIZE ...
136+ * or
137+ * REPAIR ...
138+ */
139+ 'is_maint ' => false ,
140+
141+ /*
142+ * CALL ...
143+ */
144+ 'is_procedure ' => false ,
145+
146+ /*
147+ * REPLACE ...
148+ */
149+ 'is_replace ' => false , // @deprecated; use `querytype`
150+
151+ /*
152+ * SELECT ...
153+ */
154+ 'is_select ' => false , // @deprecated; use `querytype`
155+
156+ /*
157+ * SHOW ...
158+ */
159+ 'is_show ' => false , // @deprecated; use `querytype`
160+
161+ /*
162+ * Contains a subquery.
163+ */
164+ 'is_subquery ' => false ,
165+
166+ /*
167+ * ... JOIN ...
168+ */
169+ 'join ' => false ,
170+
171+ /*
172+ * ... LIMIT ...
173+ */
174+ 'limit ' => false ,
175+
176+ /*
177+ * TODO
178+ */
179+ 'offset ' => false ,
180+
181+ /*
182+ * ... ORDER ...
183+ */
184+ 'order ' => false ,
185+
186+ /*
187+ * The type of the query (which is usually the first keyword of
188+ * the statement).
189+ */
190+ 'querytype ' => false ,
191+
192+ /*
193+ * Whether a page reload is required.
194+ */
195+ 'reload ' => false ,
196+
197+ /*
198+ * SELECT ... FROM ...
199+ */
200+ 'select_from ' => false ,
201+
202+ /*
203+ * ... UNION ...
204+ */
205+ 'union ' => false ,
206+ );
207+
52208 /**
53209 * Gets an array with flags this statement has.
54210 *
@@ -61,161 +217,7 @@ public static function getFlags($statement, $all = false)
61217 {
62218 $ flags = array ();
63219 if ($ all ) {
64- $ flags = array (
65- /*
66- * select ... DISTINCT ...
67- */
68- 'distinct ' => false ,
69-
70- /*
71- * drop ... DATABASE ...
72- */
73- 'drop_database ' => false ,
74-
75- /*
76- * ... GROUP BY ...
77- */
78- 'group ' => false ,
79-
80- /*
81- * ... HAVING ...
82- */
83- 'having ' => false ,
84-
85- /*
86- * INSERT ...
87- * or
88- * REPLACE ...
89- * or
90- * DELETE ...
91- */
92- 'is_affected ' => false ,
93-
94- /*
95- * select ... PROCEDURE ANALYSE( ... ) ...
96- */
97- 'is_analyse ' => false ,
98-
99- /*
100- * select COUNT( ... ) ...
101- */
102- 'is_count ' => false ,
103-
104- /*
105- * DELETE ...
106- */
107- 'is_delete ' => false , // @deprecated; use `querytype`
108-
109- /*
110- * EXPLAIN ...
111- */
112- 'is_explain ' => false , // @deprecated; use `querytype`
113-
114- /*
115- * select ... INTO OUTFILE ...
116- */
117- 'is_export ' => false ,
118-
119- /*
120- * select FUNC( ... ) ...
121- */
122- 'is_func ' => false ,
123-
124- /*
125- * select ... GROUP BY ...
126- * or
127- * select ... HAVING ...
128- */
129- 'is_group ' => false ,
130-
131- /*
132- * INSERT ...
133- * or
134- * REPLACE ...
135- * or
136- * TODO: LOAD DATA ...
137- */
138- 'is_insert ' => false ,
139-
140- /*
141- * ANALYZE ...
142- * or
143- * CHECK ...
144- * or
145- * CHECKSUM ...
146- * or
147- * OPTIMIZE ...
148- * or
149- * REPAIR ...
150- */
151- 'is_maint ' => false ,
152-
153- /*
154- * CALL ...
155- */
156- 'is_procedure ' => false ,
157-
158- /*
159- * REPLACE ...
160- */
161- 'is_replace ' => false , // @deprecated; use `querytype`
162-
163- /*
164- * SELECT ...
165- */
166- 'is_select ' => false , // @deprecated; use `querytype`
167-
168- /*
169- * SHOW ...
170- */
171- 'is_show ' => false , // @deprecated; use `querytype`
172-
173- /*
174- * Contains a subquery.
175- */
176- 'is_subquery ' => false ,
177-
178- /*
179- * ... JOIN ...
180- */
181- 'join ' => false ,
182-
183- /*
184- * ... LIMIT ...
185- */
186- 'limit ' => false ,
187-
188- /*
189- * TODO
190- */
191- 'offset ' => false ,
192-
193- /*
194- * ... ORDER ...
195- */
196- 'order ' => false ,
197-
198- /*
199- * The type of the query (which is usually the first keyword of
200- * the statement).
201- */
202- 'querytype ' => false ,
203-
204- /*
205- * Whether a page reload is required.
206- */
207- 'reload ' => false ,
208-
209- /*
210- * SELECT ... FROM ...
211- */
212- 'select_from ' => false ,
213-
214- /*
215- * ... UNION ...
216- */
217- 'union ' => false ,
218- );
220+ $ flags = self ::$ ALLFLAGS ;
219221 }
220222
221223 if ($ statement instanceof AlterStatement) {
0 commit comments