@@ -131,77 +131,77 @@ abstract class Context
131
131
132
132
// Compatibility mode for Microsoft's SQL server.
133
133
// This is the equivalent of ANSI_QUOTES.
134
- const COMPAT_MYSQL = 2 ;
134
+ const SQL_MODE_COMPAT_MYSQL = 2 ;
135
135
136
136
// https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sqlmode_allow_invalid_dates
137
- const ALLOW_INVALID_DATES = 1 ;
137
+ const SQL_MODE_ALLOW_INVALID_DATES = 1 ;
138
138
139
139
// https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sqlmode_ansi_quotes
140
- const ANSI_QUOTES = 2 ;
140
+ const SQL_MODE_ANSI_QUOTES = 2 ;
141
141
142
142
// https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sqlmode_error_for_division_by_zero
143
- const ERROR_FOR_DIVISION_BY_ZERO = 4 ;
143
+ const SQL_MODE_ERROR_FOR_DIVISION_BY_ZERO = 4 ;
144
144
145
145
// https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sqlmode_high_not_precedence
146
- const HIGH_NOT_PRECEDENCE = 8 ;
146
+ const SQL_MODE_HIGH_NOT_PRECEDENCE = 8 ;
147
147
148
148
// https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sqlmode_ignore_space
149
- const IGNORE_SPACE = 16 ;
149
+ const SQL_MODE_IGNORE_SPACE = 16 ;
150
150
151
151
// https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sqlmode_no_auto_create_user
152
- const NO_AUTO_CREATE_USER = 32 ;
152
+ const SQL_MODE_NO_AUTO_CREATE_USER = 32 ;
153
153
154
154
// https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sqlmode_no_auto_value_on_zero
155
- const NO_AUTO_VALUE_ON_ZERO = 64 ;
155
+ const SQL_MODE_NO_AUTO_VALUE_ON_ZERO = 64 ;
156
156
157
157
// https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sqlmode_no_backslash_escapes
158
- const NO_BACKSLASH_ESCAPES = 128 ;
158
+ const SQL_MODE_NO_BACKSLASH_ESCAPES = 128 ;
159
159
160
160
// https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sqlmode_no_dir_in_create
161
- const NO_DIR_IN_CREATE = 256 ;
161
+ const SQL_MODE_NO_DIR_IN_CREATE = 256 ;
162
162
163
163
// https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sqlmode_no_dir_in_create
164
- const NO_ENGINE_SUBSTITUTION = 512 ;
164
+ const SQL_MODE_NO_ENGINE_SUBSTITUTION = 512 ;
165
165
166
166
// https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sqlmode_no_field_options
167
- const NO_FIELD_OPTIONS = 1024 ;
167
+ const SQL_MODE_NO_FIELD_OPTIONS = 1024 ;
168
168
169
169
// https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sqlmode_no_key_options
170
- const NO_KEY_OPTIONS = 2048 ;
170
+ const SQL_MODE_NO_KEY_OPTIONS = 2048 ;
171
171
172
172
// https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sqlmode_no_table_options
173
- const NO_TABLE_OPTIONS = 4096 ;
173
+ const SQL_MODE_NO_TABLE_OPTIONS = 4096 ;
174
174
175
175
// https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sqlmode_no_unsigned_subtraction
176
- const NO_UNSIGNED_SUBTRACTION = 8192 ;
176
+ const SQL_MODE_NO_UNSIGNED_SUBTRACTION = 8192 ;
177
177
178
178
// https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sqlmode_no_zero_date
179
- const NO_ZERO_DATE = 16384 ;
179
+ const SQL_MODE_NO_ZERO_DATE = 16384 ;
180
180
181
181
// https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sqlmode_no_zero_in_date
182
- const NO_ZERO_IN_DATE = 32768 ;
182
+ const SQL_MODE_NO_ZERO_IN_DATE = 32768 ;
183
183
184
184
// https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sqlmode_only_full_group_by
185
- const ONLY_FULL_GROUP_BY = 65536 ;
185
+ const SQL_MODE_ONLY_FULL_GROUP_BY = 65536 ;
186
186
187
187
// https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sqlmode_pipes_as_concat
188
- const PIPES_AS_CONCAT = 131072 ;
188
+ const SQL_MODE_PIPES_AS_CONCAT = 131072 ;
189
189
190
190
// https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sqlmode_real_as_float
191
- const REAL_AS_FLOAT = 262144 ;
191
+ const SQL_MODE_REAL_AS_FLOAT = 262144 ;
192
192
193
193
// https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sqlmode_strict_all_tables
194
- const STRICT_ALL_TABLES = 524288 ;
194
+ const SQL_MODE_STRICT_ALL_TABLES = 524288 ;
195
195
196
196
// https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sqlmode_strict_trans_tables
197
- const STRICT_TRANS_TABLES = 1048576 ;
197
+ const SQL_MODE_STRICT_TRANS_TABLES = 1048576 ;
198
198
199
199
// Custom modes.
200
200
201
201
// The table and column names and any other field that must be escaped will
202
202
// not be.
203
203
// Reserved keywords are being escaped regardless this mode is used or not.
204
- const NO_ENCLOSING_QUOTES = 1073741824 ;
204
+ const SQL_MODE_NO_ENCLOSING_QUOTES = 1073741824 ;
205
205
206
206
/*
207
207
* Combination SQL Modes
@@ -514,7 +514,7 @@ public static function setMode($mode = '')
514
514
}
515
515
$ mode = explode (', ' , $ mode );
516
516
foreach ($ mode as $ m ) {
517
- static ::$ MODE |= constant ('static:: ' . $ m );
517
+ static ::$ MODE |= constant ('static::SQL_MODE_ ' . $ m );
518
518
}
519
519
}
520
520
@@ -536,13 +536,13 @@ public static function escape($str, $quote = '`')
536
536
return $ str ;
537
537
}
538
538
539
- if ((static ::$ MODE & self ::NO_ENCLOSING_QUOTES )
539
+ if ((static ::$ MODE & self ::SQL_MODE_NO_ENCLOSING_QUOTES )
540
540
&& (!static ::isKeyword ($ str , true ))
541
541
) {
542
542
return $ str ;
543
543
}
544
544
545
- if (static ::$ MODE & self ::ANSI_QUOTES ) {
545
+ if (static ::$ MODE & self ::SQL_MODE_ANSI_QUOTES ) {
546
546
$ quote = '" ' ;
547
547
}
548
548
0 commit comments