xref: /PHP-7.3/ext/mysqlnd/mysqlnd_enum_n_def.h (revision 03740ef7)
1 /*
2   +----------------------------------------------------------------------+
3   | PHP Version 7                                                        |
4   +----------------------------------------------------------------------+
5   | Copyright (c) 2006-2018 The PHP Group                                |
6   +----------------------------------------------------------------------+
7   | This source file is subject to version 3.01 of the PHP license,      |
8   | that is bundled with this package in the file LICENSE, and is        |
9   | available through the world-wide-web at the following url:           |
10   | http://www.php.net/license/3_01.txt                                  |
11   | If you did not receive a copy of the PHP license and are unable to   |
12   | obtain it through the world-wide-web, please send a note to          |
13   | license@php.net so we can mail you a copy immediately.               |
14   +----------------------------------------------------------------------+
15   | Authors: Andrey Hristov <andrey@php.net>                             |
16   |          Ulf Wendel <uw@php.net>                                     |
17   |          Georg Richter <georg@php.net>                               |
18   +----------------------------------------------------------------------+
19 */
20 
21 #ifndef MYSQLND_ENUM_N_DEF_H
22 #define MYSQLND_ENUM_N_DEF_H
23 
24 #ifndef TRUE
25 #define TRUE 1
26 #endif
27 
28 #ifndef FALSE
29 #define FALSE 0
30 #endif
31 
32 
33 #define MYSQLND_MIN_COMPRESS_LEN 0
34 
35 #define MYSQLND_MAX_PACKET_SIZE (256L*256L*256L-1)
36 
37 #define MYSQLND_ASSEMBLED_PACKET_MAX_SIZE 3UL*1024UL*1024UL*1024UL
38 
39 #define MYSQLND_DEFAULT_AUTH_PROTOCOL "mysql_native_password"
40 
41 #define MYSQLND_ERRMSG_SIZE			512
42 #define MYSQLND_SQLSTATE_LENGTH		5
43 #define MYSQLND_SQLSTATE_NULL		"00000"
44 
45 #define MYSQLND_MAX_ALLOWED_USER_LEN	252		/* 63 char * 4byte . MySQL supports now only 16 char, but let it be forward compatible */
46 #define MYSQLND_MAX_ALLOWED_DB_LEN		1024	/* 256 char * 4byte. MySQL supports now only 64 char in the tables, but on the FS could be different. Forward compatible. */
47 
48 #define MYSQLND_NET_CMD_BUFFER_MIN_SIZE			4096
49 #define MYSQLND_NET_CMD_BUFFER_MIN_SIZE_STR		"4096"
50 
51 #define MYSQLND_STMT_ID_LENGTH 4
52 
53 
54 #define SERVER_STATUS_IN_TRANS					1	/* Transaction has started */
55 #define SERVER_STATUS_AUTOCOMMIT				2	/* Server in auto_commit mode */
56 #define SERVER_MORE_RESULTS_EXISTS				8	/* Multi query - next query exists */
57 #define SERVER_QUERY_NO_GOOD_INDEX_USED	16
58 #define SERVER_QUERY_NO_INDEX_USED		32
59 /*
60   The server was able to fulfill the clients request and opened a
61   read-only non-scrollable cursor for a query. This flag comes
62   in reply to COM_STMT_EXECUTE and COM_STMT_FETCH commands.
63 */
64 #define SERVER_STATUS_CURSOR_EXISTS				64
65 /*
66   This flag is sent when a read-only cursor is exhausted, in reply to
67   COM_STMT_FETCH command.
68 */
69 #define SERVER_STATUS_LAST_ROW_SENT				128
70 #define SERVER_STATUS_DB_DROPPED				256 /* A database was dropped */
71 #define SERVER_STATUS_NO_BACKSLASH_ESCAPES		512
72 #define SERVER_QUERY_WAS_SLOW					2048
73 #define SERVER_PS_OUT_PARAMS            		4096
74 
75 #define MYSQLND_NO_DATA			100
76 #define MYSQLND_DATA_TRUNCATED	101
77 
78 #define SHA1_MAX_LENGTH 20
79 #define SCRAMBLE_LENGTH 20
80 #define SCRAMBLE_LENGTH_323 8
81 
82 #define CLIENT_LONG_PASSWORD		1		/* new more secure passwords */
83 #define CLIENT_FOUND_ROWS			2		/* Found instead of affected rows */
84 #define CLIENT_LONG_FLAG			4		/* Get all column flags */
85 #define CLIENT_CONNECT_WITH_DB		8		/* One can specify db on connect */
86 #define CLIENT_NO_SCHEMA			16		/* Don't allow database.table.column */
87 #define CLIENT_COMPRESS				32		/* Can use compression protocol */
88 #define CLIENT_ODBC					64		/* Odbc client */
89 #define CLIENT_LOCAL_FILES			128		/* Can use LOAD DATA LOCAL */
90 #define CLIENT_IGNORE_SPACE			256		/* Ignore spaces before '(' */
91 #define CLIENT_PROTOCOL_41			512		/* New 4.1 protocol */
92 #define CLIENT_INTERACTIVE			1024	/* This is an interactive client */
93 #define CLIENT_SSL					2048	/* Switch to SSL after handshake */
94 #define CLIENT_IGNORE_SIGPIPE		4096	/* IGNORE sigpipes */
95 #define CLIENT_TRANSACTIONS			8192	/* Client knows about transactions */
96 #define CLIENT_RESERVED				16384	/* Old flag for 4.1 protocol */
97 #define CLIENT_SECURE_CONNECTION	32768	/* New 4.1 authentication */
98 #define CLIENT_MULTI_STATEMENTS		(1UL << 16) /* Enable/disable multi-stmt support */
99 #define CLIENT_MULTI_RESULTS		(1UL << 17) /* Enable/disable multi-results */
100 #define CLIENT_PS_MULTI_RESULTS		(1UL << 18) /* Multi-results in PS-protocol */
101 #define CLIENT_PLUGIN_AUTH			(1UL << 19) /* Client supports plugin authentication */
102 #define CLIENT_CONNECT_ATTRS		(1UL << 20) /* Client supports connection attributes */
103 #define CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA	(1UL << 21) /* Enable authentication response packet to be larger than 255 bytes. */
104 #define CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS		(1UL << 22) /* Don't close the connection for a connection with expired password. */
105 #define CLIENT_SESSION_TRACK					(1UL << 23) /* Extended OK */
106 /*
107   This is a mysqlnd extension. CLIENT_ODBC is not used anyway. We will reuse it for our case and translate it to not using SSL peer verification
108 */
109 #define CLIENT_SSL_DONT_VERIFY_SERVER_CERT	CLIENT_ODBC
110 #define CLIENT_SSL_VERIFY_SERVER_CERT	(1UL << 30)
111 #define CLIENT_REMEMBER_OPTIONS			(1UL << 31)
112 
113 #define MYSQLND_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | CLIENT_TRANSACTIONS | \
114 				CLIENT_PROTOCOL_41 | CLIENT_SECURE_CONNECTION | \
115 				CLIENT_MULTI_RESULTS  | CLIENT_LOCAL_FILES | CLIENT_PLUGIN_AUTH)
116 
117 #define MYSQLND_PROTOCOL_FLAG_USE_COMPRESSION 1
118 
119 
120 /* Client Error codes */
121 #define CR_UNKNOWN_ERROR		2000
122 #define CR_CONNECTION_ERROR		2002
123 #define CR_SERVER_GONE_ERROR	2006
124 #define CR_OUT_OF_MEMORY		2008
125 #define CR_SERVER_LOST			2013
126 #define CR_COMMANDS_OUT_OF_SYNC	2014
127 #define CR_CANT_FIND_CHARSET	2019
128 #define CR_MALFORMED_PACKET		2027
129 #define CR_NOT_IMPLEMENTED		2054
130 #define CR_NO_PREPARE_STMT		2030
131 #define CR_PARAMS_NOT_BOUND		2031
132 #define CR_INVALID_PARAMETER_NO	2034
133 #define CR_INVALID_BUFFER_USE	2035
134 
135 #define MYSQLND_EE_FILENOTFOUND	 7890
136 
137 #define UNKNOWN_SQLSTATE		"HY000"
138 
139 #define MAX_CHARSET_LEN			32
140 
141 
142 #define TRANS_START_NO_OPT						0
143 #define TRANS_START_WITH_CONSISTENT_SNAPSHOT	1
144 #define TRANS_START_READ_WRITE					2
145 #define TRANS_START_READ_ONLY					4
146 
147 #define TRANS_COR_NO_OPT		0
148 #define TRANS_COR_AND_CHAIN		1
149 #define TRANS_COR_AND_NO_CHAIN	2
150 #define TRANS_COR_RELEASE		4
151 #define TRANS_COR_NO_RELEASE	8
152 
153 typedef enum mysqlnd_extension
154 {
155 	MYSQLND_MYSQL = 0,
156 	MYSQLND_MYSQLI
157 } enum_mysqlnd_extension;
158 
159 enum
160 {
161 	MYSQLND_FETCH_ASSOC = 1,
162 	MYSQLND_FETCH_NUM = 2,
163 	MYSQLND_FETCH_BOTH = 1|2
164 };
165 
166 /* Follow libmysql convention */
167 typedef enum func_status
168 {
169 	PASS = 0,
170 	FAIL = 1
171 } enum_func_status;
172 
173 typedef enum mysqlnd_query_type
174 {
175 	QUERY_UPSERT,
176 	QUERY_SELECT,
177 	QUERY_LOAD_LOCAL
178 } enum_mysqlnd_query_type;
179 
180 typedef enum mysqlnd_res_type
181 {
182 	MYSQLND_RES_NORMAL = 1,
183 	MYSQLND_RES_PS_BUF,
184 	MYSQLND_RES_PS_UNBUF
185 } enum_mysqlnd_res_type;
186 
187 typedef enum mysqlnd_send_query_type
188 {
189 	MYSQLND_SEND_QUERY_IMPLICIT = 0,
190 	MYSQLND_SEND_QUERY_EXPLICIT
191 } enum_mysqlnd_send_query_type;
192 
193 typedef enum mysqlnd_reap_result_type
194 {
195 	MYSQLND_REAP_RESULT_IMPLICIT = 0,
196 	MYSQLND_REAP_RESULT_EXPLICIT
197 } enum_mysqlnd_reap_result_type;
198 
199 typedef enum mysqlnd_send_execute_type
200 {
201 	MYSQLND_SEND_EXECUTE_IMPLICIT = 0,
202 	MYSQLND_SEND_EXECUTE_EXPLICIT
203 } enum_mysqlnd_send_execute_type;
204 
205 typedef enum mysqlnd_parse_exec_response_type
206 {
207 	MYSQLND_PARSE_EXEC_RESPONSE_IMPLICIT = 0,
208 	MYSQLND_PARSE_EXEC_RESPONSE_IMPLICIT_NEXT_RESULT,
209 	MYSQLND_PARSE_EXEC_RESPONSE_IMPLICIT_OUT_VARIABLES,
210 	MYSQLND_PARSE_EXEC_RESPONSE_EXPLICIT,
211 } enum_mysqlnd_parse_exec_response_type;
212 
213 typedef enum mysqlnd_client_option
214 {
215 	MYSQL_OPT_CONNECT_TIMEOUT,
216 	MYSQL_OPT_COMPRESS,
217 	MYSQL_OPT_NAMED_PIPE,
218 	MYSQL_INIT_COMMAND,
219 	MYSQL_READ_DEFAULT_FILE,
220 	MYSQL_READ_DEFAULT_GROUP,
221 	MYSQL_SET_CHARSET_DIR,
222 	MYSQL_SET_CHARSET_NAME,
223 	MYSQL_OPT_LOCAL_INFILE,
224 	MYSQL_OPT_PROTOCOL,
225 	MYSQL_SHARED_MEMORY_BASE_NAME,
226 	MYSQL_OPT_READ_TIMEOUT,
227 	MYSQL_OPT_WRITE_TIMEOUT,
228 	MYSQL_OPT_USE_RESULT,
229 	MYSQL_OPT_USE_REMOTE_CONNECTION,
230 	MYSQL_OPT_USE_EMBEDDED_CONNECTION,
231 	MYSQL_OPT_GUESS_CONNECTION,
232 	MYSQL_SET_CLIENT_IP,
233 	MYSQL_SECURE_AUTH,
234 	MYSQL_REPORT_DATA_TRUNCATION,
235 	MYSQL_OPT_RECONNECT,
236 	MYSQL_OPT_SSL_VERIFY_SERVER_CERT,
237 	MYSQL_PLUGIN_DIR,
238 	MYSQL_DEFAULT_AUTH,
239 	MYSQL_OPT_BIND,
240 	MYSQL_OPT_SSL_KEY,
241 	MYSQL_OPT_SSL_CERT,
242 	MYSQL_OPT_SSL_CA,
243 	MYSQL_OPT_SSL_CAPATH,
244 	MYSQL_OPT_SSL_CIPHER,
245 	MYSQL_OPT_SSL_CRL,
246 	MYSQL_OPT_SSL_CRLPATH,
247 	MYSQL_OPT_CONNECT_ATTR_RESET,
248 	MYSQL_OPT_CONNECT_ATTR_ADD,
249 	MYSQL_OPT_CONNECT_ATTR_DELETE,
250 	MYSQL_SERVER_PUBLIC_KEY,
251 	MYSQL_ENABLE_CLEARTEXT_PLUGIN,
252 	MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS,
253 	MYSQL_OPT_SSL_ENFORCE,
254 	MYSQL_OPT_MAX_ALLOWED_PACKET,
255 	MYSQL_OPT_NET_BUFFER_LENGTH,
256 	MYSQL_OPT_TLS_VERSION,
257 	MYSQL_OPT_SSL_MODE,
258 	MYSQLND_DEPRECATED_ENUM1 = 200,
259 #ifdef MYSQLND_STRING_TO_INT_CONVERSION
260 	MYSQLND_OPT_INT_AND_FLOAT_NATIVE = 201,
261 #endif
262 	MYSQLND_OPT_NET_CMD_BUFFER_SIZE = 202,
263 	MYSQLND_OPT_NET_READ_BUFFER_SIZE = 203,
264 	MYSQLND_OPT_SSL_KEY = 204,
265 	MYSQLND_OPT_SSL_CERT = 205,
266 	MYSQLND_OPT_SSL_CA = 206,
267 	MYSQLND_OPT_SSL_CAPATH = 207,
268 	MYSQLND_OPT_SSL_CIPHER = 208,
269 	MYSQLND_OPT_SSL_PASSPHRASE = 209,
270 	MYSQLND_OPT_MAX_ALLOWED_PACKET = 210,
271 	MYSQLND_OPT_AUTH_PROTOCOL = 211
272 } enum_mysqlnd_client_option;
273 
274 typedef enum mysqlnd_session_protocol_type
275 {
276 	MYSQL_PROTOCOL_DEFAULT = 0,
277 	MYSQL_PROTOCOL_TCP,		/* all, supported */
278 	MYSQL_PROTOCOL_SOCKET,	/* unix, supported */
279 	MYSQL_PROTOCOL_PIPE,	/* win32, not-supported */
280 	MYSQL_PROTOCOL_MEMORY,	/* win32, not-supported */
281 	MYSQL_PROTOCOL_LAST
282 } enum_mysqlnd_session_protocol_type;
283 
284 typedef enum mysqlnd_field_types
285 {
286 	MYSQL_TYPE_DECIMAL	= 0,
287 	MYSQL_TYPE_TINY		= 1,
288 	MYSQL_TYPE_SHORT	= 2,
289 	MYSQL_TYPE_LONG		= 3,
290 	MYSQL_TYPE_FLOAT	= 4,
291 	MYSQL_TYPE_DOUBLE	= 5,
292 	MYSQL_TYPE_NULL		= 6,
293 	MYSQL_TYPE_TIMESTAMP= 7,
294 	MYSQL_TYPE_LONGLONG	= 8,
295 	MYSQL_TYPE_INT24	= 9,
296 	MYSQL_TYPE_DATE		= 10,
297 	MYSQL_TYPE_TIME		= 11,
298 	MYSQL_TYPE_DATETIME	= 12,
299 	MYSQL_TYPE_YEAR		= 13,
300 	MYSQL_TYPE_NEWDATE	= 14,
301 	MYSQL_TYPE_VARCHAR	= 15,
302 	MYSQL_TYPE_BIT		= 16,
303 	MYSQL_TYPE_JSON=245,
304 	MYSQL_TYPE_NEWDECIMAL=246,
305 	MYSQL_TYPE_ENUM=247,
306 	MYSQL_TYPE_SET=248,
307 	MYSQL_TYPE_TINY_BLOB=249,
308 	MYSQL_TYPE_MEDIUM_BLOB=250,
309 	MYSQL_TYPE_LONG_BLOB=251,
310 	MYSQL_TYPE_BLOB=252,
311 	MYSQL_TYPE_VAR_STRING=253,
312 	MYSQL_TYPE_STRING=254,
313 	MYSQL_TYPE_GEOMETRY=255
314 } enum_mysqlnd_field_types;
315 
316 /* Please update this if there is a new type after MYSQL_TYPE_GEOMETRY */
317 #define MYSQL_TYPE_LAST		MYSQL_TYPE_GEOMETRY
318 
319 
320 typedef enum mysqlnd_server_option
321 {
322 	MYSQL_OPTION_MULTI_STATEMENTS_ON,
323 	MYSQL_OPTION_MULTI_STATEMENTS_OFF
324 } enum_mysqlnd_server_option;
325 
326 
327 #define FIELD_TYPE_DECIMAL		MYSQL_TYPE_DECIMAL
328 #define FIELD_TYPE_NEWDECIMAL	MYSQL_TYPE_NEWDECIMAL
329 #define FIELD_TYPE_TINY			MYSQL_TYPE_TINY
330 #define FIELD_TYPE_SHORT		MYSQL_TYPE_SHORT
331 #define FIELD_TYPE_LONG			MYSQL_TYPE_LONG
332 #define FIELD_TYPE_FLOAT		MYSQL_TYPE_FLOAT
333 #define FIELD_TYPE_DOUBLE		MYSQL_TYPE_DOUBLE
334 #define FIELD_TYPE_NULL			MYSQL_TYPE_NULL
335 #define FIELD_TYPE_TIMESTAMP	MYSQL_TYPE_TIMESTAMP
336 #define FIELD_TYPE_LONGLONG		MYSQL_TYPE_LONGLONG
337 #define FIELD_TYPE_INT24		MYSQL_TYPE_INT24
338 #define FIELD_TYPE_DATE			MYSQL_TYPE_DATE
339 #define FIELD_TYPE_TIME			MYSQL_TYPE_TIME
340 #define FIELD_TYPE_DATETIME		MYSQL_TYPE_DATETIME
341 #define FIELD_TYPE_YEAR			MYSQL_TYPE_YEAR
342 #define FIELD_TYPE_NEWDATE		MYSQL_TYPE_NEWDATE
343 #define FIELD_TYPE_ENUM			MYSQL_TYPE_ENUM
344 #define FIELD_TYPE_SET			MYSQL_TYPE_SET
345 #define FIELD_TYPE_JSON 		MYSQL_TYPE_JSON
346 #define FIELD_TYPE_TINY_BLOB	MYSQL_TYPE_TINY_BLOB
347 #define FIELD_TYPE_MEDIUM_BLOB	MYSQL_TYPE_MEDIUM_BLOB
348 #define FIELD_TYPE_LONG_BLOB	MYSQL_TYPE_LONG_BLOB
349 #define FIELD_TYPE_BLOB			MYSQL_TYPE_BLOB
350 #define FIELD_TYPE_VAR_STRING	MYSQL_TYPE_VAR_STRING
351 #define FIELD_TYPE_STRING		MYSQL_TYPE_STRING
352 #define FIELD_TYPE_CHAR			MYSQL_TYPE_TINY
353 #define FIELD_TYPE_INTERVAL		MYSQL_TYPE_ENUM
354 #define FIELD_TYPE_GEOMETRY		MYSQL_TYPE_GEOMETRY
355 #define FIELD_TYPE_BIT			MYSQL_TYPE_BIT
356 
357 #define NOT_NULL_FLAG			    1
358 #define PRI_KEY_FLAG			    2
359 #define UNIQUE_KEY_FLAG			    4
360 #define MULTIPLE_KEY_FLAG		    8
361 #define BLOB_FLAG				   16
362 #define UNSIGNED_FLAG			   32
363 #define ZEROFILL_FLAG			   64
364 #define BINARY_FLAG				  128
365 #define ENUM_FLAG				  256
366 #define AUTO_INCREMENT_FLAG		  512
367 #define TIMESTAMP_FLAG			 1024
368 #define SET_FLAG				 2048
369 #define NO_DEFAULT_VALUE_FLAG	 4096
370 #define ON_UPDATE_NOW_FLAG		 8192
371 #define PART_KEY_FLAG			16384
372 #define GROUP_FLAG				32768
373 #define NUM_FLAG				32768
374 
375 #define IS_PRI_KEY(n)	((n) & PRI_KEY_FLAG)
376 #define IS_NOT_NULL(n)	((n) & NOT_NULL_FLAG)
377 #define IS_BLOB(n)		((n) & BLOB_FLAG)
378 #define IS_NUM(t)		((t) <= FIELD_TYPE_INT24 || (t) == FIELD_TYPE_YEAR || (t) == FIELD_TYPE_NEWDECIMAL)
379 
380 
381 /* see mysqlnd_charset.c for more information */
382 #define MYSQLND_BINARY_CHARSET_NR	63
383 
384 
385 /*
386 		/-----> CONN_CLOSE  <---------------\
387 		|           ^                         \
388 		|           |                         \
389 	CONN_READY -> CONN_QUERY_SENT -> CONN_FETCHING_DATA
390 		^                                      |
391 		\-------------------------------------/
392 */
393 typedef enum mysqlnd_connection_state
394 {
395 	CONN_ALLOCED = 0,
396 	CONN_READY = 1,
397 	CONN_QUERY_SENT = 2,
398 	CONN_SENDING_LOAD_DATA = 3,
399 	CONN_FETCHING_DATA = 4,
400 	CONN_NEXT_RESULT_PENDING = 5,
401 	CONN_QUIT_SENT = 6 /* object is "destroyed" at this stage */
402 } enum_mysqlnd_connection_state;
403 
404 
405 typedef enum mysqlnd_stmt_state
406 {
407 	MYSQLND_STMT_INITTED = 0,
408 	MYSQLND_STMT_PREPARED = 1,
409 	MYSQLND_STMT_EXECUTED = 2,
410 	MYSQLND_STMT_WAITING_USE_OR_STORE = 3,
411 	MYSQLND_STMT_USE_OR_STORE_CALLED = 4,
412 	MYSQLND_STMT_USER_FETCHING = 5/* fetch_row_buff or fetch_row_unbuf */
413 } enum_mysqlnd_stmt_state;
414 
415 
416 typedef enum param_bind_flags
417 {
418 	MYSQLND_PARAM_BIND_BLOB_USED = 1
419 } enum_param_bind_flags;
420 
421 
422 /* PS */
423 enum mysqlnd_stmt_attr
424 {
425 	STMT_ATTR_UPDATE_MAX_LENGTH,
426 	STMT_ATTR_CURSOR_TYPE,
427 	STMT_ATTR_PREFETCH_ROWS
428 };
429 
430 enum myslqnd_cursor_type
431 {
432 	CURSOR_TYPE_NO_CURSOR= 0,
433 	CURSOR_TYPE_READ_ONLY= 1,
434 	CURSOR_TYPE_FOR_UPDATE= 2,
435 	CURSOR_TYPE_SCROLLABLE= 4
436 };
437 
438 typedef enum mysqlnd_connection_close_type
439 {
440 	MYSQLND_CLOSE_EXPLICIT = 0,
441 	MYSQLND_CLOSE_IMPLICIT,
442 	MYSQLND_CLOSE_DISCONNECTED,
443 	MYSQLND_CLOSE_LAST	/* for checking, should always be last */
444 } enum_connection_close_type;
445 
446 
447 typedef enum mysqlnd_collected_stats
448 {
449 	STAT_BYTES_SENT,
450 	STAT_BYTES_RECEIVED,
451 	STAT_PACKETS_SENT,
452 	STAT_PACKETS_RECEIVED,
453 	STAT_PROTOCOL_OVERHEAD_IN,
454 	STAT_PROTOCOL_OVERHEAD_OUT,
455 	STAT_BYTES_RECEIVED_OK,
456 	STAT_BYTES_RECEIVED_EOF,
457 	STAT_BYTES_RECEIVED_RSET_HEADER,
458 	STAT_BYTES_RECEIVED_RSET_FIELD_META,
459 	STAT_BYTES_RECEIVED_RSET_ROW,
460 	STAT_BYTES_RECEIVED_PREPARE_RESPONSE,
461 	STAT_BYTES_RECEIVED_CHANGE_USER,
462 	STAT_PACKETS_SENT_CMD,
463 	STAT_PACKETS_RECEIVED_OK,
464 	STAT_PACKETS_RECEIVED_EOF,
465 	STAT_PACKETS_RECEIVED_RSET_HEADER,
466 	STAT_PACKETS_RECEIVED_RSET_FIELD_META,
467 	STAT_PACKETS_RECEIVED_RSET_ROW,
468 	STAT_PACKETS_RECEIVED_PREPARE_RESPONSE,
469 	STAT_PACKETS_RECEIVED_CHANGE_USER,
470 	STAT_RSET_QUERY,
471 	STAT_NON_RSET_QUERY,
472 	STAT_NO_INDEX_USED,
473 	STAT_BAD_INDEX_USED,
474 	STAT_QUERY_WAS_SLOW,
475 	STAT_BUFFERED_SETS,
476 	STAT_UNBUFFERED_SETS,
477 	STAT_PS_BUFFERED_SETS,
478 	STAT_PS_UNBUFFERED_SETS,
479 	STAT_FLUSHED_NORMAL_SETS,
480 	STAT_FLUSHED_PS_SETS,
481 	STAT_PS_PREPARED_NEVER_EXECUTED,
482 	STAT_PS_PREPARED_ONCE_USED,
483 	STAT_ROWS_FETCHED_FROM_SERVER_NORMAL,
484 	STAT_ROWS_FETCHED_FROM_SERVER_PS,
485 	STAT_ROWS_BUFFERED_FROM_CLIENT_NORMAL,
486 	STAT_ROWS_BUFFERED_FROM_CLIENT_PS,
487 	STAT_ROWS_FETCHED_FROM_CLIENT_NORMAL_BUF,
488 	STAT_ROWS_FETCHED_FROM_CLIENT_NORMAL_UNBUF,
489 	STAT_ROWS_FETCHED_FROM_CLIENT_PS_BUF,
490 	STAT_ROWS_FETCHED_FROM_CLIENT_PS_UNBUF,
491 	STAT_ROWS_FETCHED_FROM_CLIENT_PS_CURSOR,
492 	STAT_ROWS_AFFECTED_NORMAL,
493 	STAT_ROWS_AFFECTED_PS,
494 	STAT_ROWS_SKIPPED_NORMAL,
495 	STAT_ROWS_SKIPPED_PS,
496 	STAT_COPY_ON_WRITE_SAVED,
497 	STAT_COPY_ON_WRITE_PERFORMED,
498 	STAT_CMD_BUFFER_TOO_SMALL,
499 	STAT_CONNECT_SUCCESS,
500 	STAT_CONNECT_FAILURE,
501 	STAT_CONNECT_REUSED,
502 	STAT_RECONNECT,
503 	STAT_PCONNECT_SUCCESS,
504 	STAT_OPENED_CONNECTIONS,
505 	STAT_OPENED_PERSISTENT_CONNECTIONS,
506 	STAT_CLOSE_EXPLICIT,
507 	STAT_CLOSE_IMPLICIT,
508 	STAT_CLOSE_DISCONNECT,
509 	STAT_CLOSE_IN_MIDDLE,
510 	STAT_FREE_RESULT_EXPLICIT,
511 	STAT_FREE_RESULT_IMPLICIT,
512 	STAT_STMT_CLOSE_EXPLICIT,
513 	STAT_STMT_CLOSE_IMPLICIT,
514 	STAT_MEM_EMALLOC_COUNT,
515 	STAT_MEM_EMALLOC_AMOUNT,
516 	STAT_MEM_ECALLOC_COUNT,
517 	STAT_MEM_ECALLOC_AMOUNT,
518 	STAT_MEM_EREALLOC_COUNT,
519 	STAT_MEM_EREALLOC_AMOUNT,
520 	STAT_MEM_EFREE_COUNT,
521 	STAT_MEM_EFREE_AMOUNT,
522 	STAT_MEM_MALLOC_COUNT,
523 	STAT_MEM_MALLOC_AMOUNT,
524 	STAT_MEM_CALLOC_COUNT,
525 	STAT_MEM_CALLOC_AMOUNT,
526 	STAT_MEM_REALLOC_COUNT,
527 	STAT_MEM_REALLOC_AMOUNT,
528 	STAT_MEM_FREE_COUNT,
529 	STAT_MEM_FREE_AMOUNT,
530 	STAT_MEM_ESTRNDUP_COUNT,
531 	STAT_MEM_STRNDUP_COUNT,
532 	STAT_MEM_ESTRDUP_COUNT,
533 	STAT_MEM_STRDUP_COUNT,
534 	STAT_MEM_EDUP_COUNT,
535 	STAT_MEM_DUP_COUNT,
536 	STAT_TEXT_TYPE_FETCHED_NULL,
537 	STAT_TEXT_TYPE_FETCHED_BIT,
538 	STAT_TEXT_TYPE_FETCHED_INT8,
539 	STAT_TEXT_TYPE_FETCHED_INT16,
540 	STAT_TEXT_TYPE_FETCHED_INT24,
541 	STAT_TEXT_TYPE_FETCHED_INT32,
542 	STAT_TEXT_TYPE_FETCHED_INT64,
543 	STAT_TEXT_TYPE_FETCHED_DECIMAL,
544 	STAT_TEXT_TYPE_FETCHED_FLOAT,
545 	STAT_TEXT_TYPE_FETCHED_DOUBLE,
546 	STAT_TEXT_TYPE_FETCHED_DATE,
547 	STAT_TEXT_TYPE_FETCHED_YEAR,
548 	STAT_TEXT_TYPE_FETCHED_TIME,
549 	STAT_TEXT_TYPE_FETCHED_DATETIME,
550 	STAT_TEXT_TYPE_FETCHED_TIMESTAMP,
551 	STAT_TEXT_TYPE_FETCHED_STRING,
552 	STAT_TEXT_TYPE_FETCHED_JSON,
553 	STAT_TEXT_TYPE_FETCHED_BLOB,
554 	STAT_TEXT_TYPE_FETCHED_ENUM,
555 	STAT_TEXT_TYPE_FETCHED_SET,
556 	STAT_TEXT_TYPE_FETCHED_GEOMETRY,
557 	STAT_TEXT_TYPE_FETCHED_OTHER,
558 	STAT_BINARY_TYPE_FETCHED_NULL,
559 	STAT_BINARY_TYPE_FETCHED_BIT,
560 	STAT_BINARY_TYPE_FETCHED_INT8,
561 	STAT_BINARY_TYPE_FETCHED_INT16,
562 	STAT_BINARY_TYPE_FETCHED_INT24,
563 	STAT_BINARY_TYPE_FETCHED_INT32,
564 	STAT_BINARY_TYPE_FETCHED_INT64,
565 	STAT_BINARY_TYPE_FETCHED_DECIMAL,
566 	STAT_BINARY_TYPE_FETCHED_FLOAT,
567 	STAT_BINARY_TYPE_FETCHED_DOUBLE,
568 	STAT_BINARY_TYPE_FETCHED_DATE,
569 	STAT_BINARY_TYPE_FETCHED_YEAR,
570 	STAT_BINARY_TYPE_FETCHED_TIME,
571 	STAT_BINARY_TYPE_FETCHED_DATETIME,
572 	STAT_BINARY_TYPE_FETCHED_TIMESTAMP,
573 	STAT_BINARY_TYPE_FETCHED_STRING,
574 	STAT_BINARY_TYPE_FETCHED_BLOB,
575 	STAT_BINARY_TYPE_FETCHED_ENUM,
576 	STAT_BINARY_TYPE_FETCHED_SET,
577 	STAT_BINARY_TYPE_FETCHED_GEOMETRY,
578 	STAT_BINARY_TYPE_FETCHED_OTHER,
579 	STAT_INIT_COMMAND_EXECUTED_COUNT,
580 	STAT_INIT_COMMAND_FAILED_COUNT,
581 	STAT_COM_QUIT,
582 	STAT_COM_INIT_DB,
583 	STAT_COM_QUERY,
584 	STAT_COM_FIELD_LIST,
585 	STAT_COM_CREATE_DB,
586 	STAT_COM_DROP_DB,
587 	STAT_COM_REFRESH,
588 	STAT_COM_SHUTDOWN,
589 	STAT_COM_STATISTICS,
590 	STAT_COM_PROCESS_INFO,
591 	STAT_COM_CONNECT,
592 	STAT_COM_PROCESS_KILL,
593 	STAT_COM_DEBUG,
594 	STAT_COM_PING,
595 	STAT_COM_TIME,
596 	STAT_COM_DELAYED_INSERT,
597 	STAT_COM_CHANGE_USER,
598 	STAT_COM_BINLOG_DUMP,
599 	STAT_COM_TABLE_DUMP,
600 	STAT_COM_CONNECT_OUT,
601 	STAT_COM_REGISTER_SLAVE,
602 	STAT_COM_STMT_PREPARE,
603 	STAT_COM_STMT_EXECUTE,
604 	STAT_COM_STMT_SEND_LONG_DATA,
605 	STAT_COM_STMT_CLOSE,
606 	STAT_COM_STMT_RESET,
607 	STAT_COM_SET_OPTION,
608 	STAT_COM_STMT_FETCH,
609 	STAT_COM_DAEMON,
610 	STAT_BYTES_RECEIVED_PURE_DATA_TEXT,
611 	STAT_BYTES_RECEIVED_PURE_DATA_PS,
612 	STAT_LAST /* Should be always the last */
613 } enum_mysqlnd_collected_stats;
614 
615 
616 /* Enums */
617 enum mysqlnd_packet_type
618 {
619 	PROT_GREET_PACKET= 0,
620 	PROT_AUTH_PACKET,
621 	PROT_AUTH_RESP_PACKET,
622 	PROT_CHANGE_AUTH_RESP_PACKET,
623 	PROT_OK_PACKET,
624 	PROT_EOF_PACKET,
625 	PROT_CMD_PACKET,
626 	PROT_RSET_HEADER_PACKET,
627 	PROT_RSET_FLD_PACKET,
628 	PROT_ROW_PACKET,
629 	PROT_STATS_PACKET,
630 	PROT_PREPARE_RESP_PACKET,
631 	PROT_CHG_USER_RESP_PACKET,
632 	PROT_SHA256_PK_REQUEST_PACKET,
633 	PROT_SHA256_PK_REQUEST_RESPONSE_PACKET,
634 	PROT_LAST /* should always be last */
635 };
636 
637 
638 /*
639   After adding new elements please update
640   `mysqlnd_command_to_text` in mysqlnd_wireprotocol.c
641 */
642 enum php_mysqlnd_server_command
643 {
644 	COM_SLEEP = 0,
645 	COM_QUIT,
646 	COM_INIT_DB,
647 	COM_QUERY,
648 	COM_FIELD_LIST,
649 	COM_CREATE_DB,
650 	COM_DROP_DB,
651 	COM_REFRESH,
652 	COM_SHUTDOWN,
653 	COM_STATISTICS,
654 	COM_PROCESS_INFO,
655 	COM_CONNECT,
656 	COM_PROCESS_KILL,
657 	COM_DEBUG,
658 	COM_PING,
659 	COM_TIME = 15,
660 	COM_DELAYED_INSERT,
661 	COM_CHANGE_USER,
662 	COM_BINLOG_DUMP,
663 	COM_TABLE_DUMP,
664 	COM_CONNECT_OUT = 20,
665 	COM_REGISTER_SLAVE,
666 	COM_STMT_PREPARE = 22,
667 	COM_STMT_EXECUTE = 23,
668 	COM_STMT_SEND_LONG_DATA = 24,
669 	COM_STMT_CLOSE = 25,
670 	COM_STMT_RESET = 26,
671 	COM_SET_OPTION = 27,
672 	COM_STMT_FETCH = 28,
673 	COM_DAEMON = 29,
674 	COM_BINLOG_DUMP_GTID = 30,
675 	COM_RESET_CONNECTION = 31,
676 	COM_STMT_EXECUTE_BATCH = 32,
677 	COM_END,
678 	/* Here follow own, non-protocol, commands */
679 	COM_REAP_RESULT=240,	/* own command */
680 	COM_ENABLE_SSL,			/* own command */
681 	COM_HANDSHAKE,			/* own command */
682 };
683 
684 
685 #define MYSQLND_DEFAULT_PREFETCH_ROWS (zend_ulong) 1
686 
687 #define MYSQLND_REFRESH_GRANT		1	/* Refresh grant tables */
688 #define MYSQLND_REFRESH_LOG			2	/* Start on new log file */
689 #define MYSQLND_REFRESH_TABLES		4	/* close all tables */
690 #define MYSQLND_REFRESH_HOSTS		8	/* Flush host cache */
691 #define MYSQLND_REFRESH_STATUS		16	/* Flush status variables */
692 #define MYSQLND_REFRESH_THREADS		32	/* Flush thread cache */
693 #define MYSQLND_REFRESH_SLAVE		64	/* Reset master info and restart slave */
694 #define MYSQLND_REFRESH_MASTER		128	/* Remove all bin logs in the index */
695 #define MYSQLND_REFRESH_BACKUP_LOG	0x200000L
696 
697 
698 #define MYSQLND_STORE_PS		1
699 #define MYSQLND_STORE_NO_COPY	2
700 #define MYSQLND_STORE_COPY		4
701 
702 enum mysqlnd_buffered_type
703 {
704 	MYSQLND_BUFFERED_TYPE_ZVAL = 1,
705 	MYSQLND_BUFFERED_TYPE_C
706 };
707 
708 
709 #define MYSQLND_CLIENT_NO_FLAG				0
710 #define MYSQLND_CLIENT_KNOWS_RSET_COPY_DATA	1
711 
712 #endif	/* MYSQLND_ENUM_N_DEF_H */
713 
714 
715 /*
716  * Local variables:
717  * tab-width: 4
718  * c-basic-offset: 4
719  * End:
720  * vim600: noet sw=4 ts=4 fdm=marker
721  * vim<600: noet sw=4 ts=4
722  */
723