diff options
Diffstat (limited to 'include/mysql_com.h')
-rw-r--r-- | include/mysql_com.h | 136 |
1 files changed, 93 insertions, 43 deletions
diff --git a/include/mysql_com.h b/include/mysql_com.h index d76dc72e2b8..3c8301eddbf 100644 --- a/include/mysql_com.h +++ b/include/mysql_com.h @@ -64,10 +64,11 @@ /* Maximum length of comments */ -#define TABLE_COMMENT_INLINE_MAXLEN 180 /* pre 6.0: 60 characters */ +#define TABLE_COMMENT_INLINE_MAXLEN 180 /* pre 5.5: 60 characters */ #define TABLE_COMMENT_MAXLEN 2048 #define COLUMN_COMMENT_MAXLEN 1024 #define INDEX_COMMENT_MAXLEN 1024 +#define TABLE_PARTITION_COMMENT_MAXLEN 1024 /* USER_HOST_BUFF_SIZE -- length of string buffer, that is enough to contain @@ -110,7 +111,7 @@ enum enum_server_command #define MYSQL_TYPE_VIRTUAL 245 /* Length of random string sent by server on handshake; this is also length of - obfuscated password, recieved from client + obfuscated password, received from client */ #define SCRAMBLE_LENGTH 20 #define SCRAMBLE_LENGTH_323 8 @@ -142,46 +143,55 @@ enum enum_server_command #define BINCMP_FLAG 131072 /* Intern: Used by sql_yacc */ #define GET_FIXED_FIELDS_FLAG (1 << 18) /* Used to get fields in item tree */ #define FIELD_IN_PART_FUNC_FLAG (1 << 19)/* Field part of partition func */ -#define FIELD_IN_ADD_INDEX (1<< 20) /* Intern: Field used in ADD INDEX */ + +/** + Intern: Field in TABLE object for new version of altered table, + which participates in a newly added index. +*/ +#define FIELD_IN_ADD_INDEX (1 << 20) #define FIELD_IS_RENAMED (1<< 21) /* Intern: Field is being renamed */ -#define FIELD_FLAGS_STORAGE_MEDIA 22 /* Field storage media, bit 22-23, - reserved by MySQL Cluster */ -#define FIELD_FLAGS_COLUMN_FORMAT 24 /* Field column format, bit 24-25, - reserved by MySQL Cluster */ - -#define REFRESH_GRANT (1UL << 0) /* Refresh grant tables */ -#define REFRESH_LOG (1UL << 1) /* Start on new log file */ -#define REFRESH_TABLES (1UL << 2) /* close all tables */ -#define REFRESH_HOSTS (1UL << 3) /* Flush host cache */ -#define REFRESH_STATUS (1UL << 4) /* Flush status variables */ -#define REFRESH_THREADS (1UL << 5) /* Flush thread cache */ -#define REFRESH_SLAVE (1UL << 6) /* Reset master info and restart slave +#define FIELD_FLAGS_STORAGE_MEDIA 22 /* Field storage media, bit 22-23 */ +#define FIELD_FLAGS_STORAGE_MEDIA_MASK (3 << FIELD_FLAGS_STORAGE_MEDIA) +#define FIELD_FLAGS_COLUMN_FORMAT 24 /* Field column format, bit 24-25 */ +#define FIELD_FLAGS_COLUMN_FORMAT_MASK (3 << FIELD_FLAGS_COLUMN_FORMAT) +#define FIELD_IS_DROPPED (1<< 26) /* Intern: Field is being dropped */ +#define HAS_EXPLICIT_VALUE (1 << 27) /* An INSERT/UPDATE operation supplied + an explicit default value */ + +#define REFRESH_GRANT (1ULL << 0) /* Refresh grant tables */ +#define REFRESH_LOG (1ULL << 1) /* Start on new log file */ +#define REFRESH_TABLES (1ULL << 2) /* close all tables */ +#define REFRESH_HOSTS (1ULL << 3) /* Flush host cache */ +#define REFRESH_STATUS (1ULL << 4) /* Flush status variables */ +#define REFRESH_THREADS (1ULL << 5) /* Flush thread cache */ +#define REFRESH_SLAVE (1ULL << 6) /* Reset master info and restart slave thread */ -#define REFRESH_MASTER (1UL << 7) /* Remove all bin logs in the index +#define REFRESH_MASTER (1ULL << 7) /* Remove all bin logs in the index and truncate the index */ /* The following can't be set with mysql_refresh() */ -#define REFRESH_ERROR_LOG (1UL << 8) /* Rotate only the erorr log */ -#define REFRESH_ENGINE_LOG (1UL << 9) /* Flush all storage engine logs */ -#define REFRESH_BINARY_LOG (1UL << 10) /* Flush the binary log */ -#define REFRESH_RELAY_LOG (1UL << 11) /* Flush the relay log */ -#define REFRESH_GENERAL_LOG (1UL << 12) /* Flush the general log */ -#define REFRESH_SLOW_LOG (1UL << 13) /* Flush the slow query log */ +#define REFRESH_ERROR_LOG (1ULL << 8) /* Rotate only the erorr log */ +#define REFRESH_ENGINE_LOG (1ULL << 9) /* Flush all storage engine logs */ +#define REFRESH_BINARY_LOG (1ULL << 10) /* Flush the binary log */ +#define REFRESH_RELAY_LOG (1ULL << 11) /* Flush the relay log */ +#define REFRESH_GENERAL_LOG (1ULL << 12) /* Flush the general log */ +#define REFRESH_SLOW_LOG (1ULL << 13) /* Flush the slow query log */ -#define REFRESH_READ_LOCK (1UL << 14) /* Lock tables for read */ -#define REFRESH_CHECKPOINT (1UL << 15) /* With REFRESH_READ_LOCK: block checkpoints too */ +#define REFRESH_READ_LOCK (1ULL << 14) /* Lock tables for read */ +#define REFRESH_CHECKPOINT (1ULL << 15) /* With REFRESH_READ_LOCK: block checkpoints too */ -#define REFRESH_QUERY_CACHE (1UL << 16) /* clear the query cache */ -#define REFRESH_QUERY_CACHE_FREE (1UL << 17) /* pack query cache */ -#define REFRESH_DES_KEY_FILE (1UL << 18) -#define REFRESH_USER_RESOURCES (1UL << 19) +#define REFRESH_QUERY_CACHE (1ULL << 16) /* clear the query cache */ +#define REFRESH_QUERY_CACHE_FREE (1ULL << 17) /* pack query cache */ +#define REFRESH_DES_KEY_FILE (1ULL << 18) +#define REFRESH_USER_RESOURCES (1ULL << 19) +#define REFRESH_FOR_EXPORT (1ULL << 20) /* FLUSH TABLES ... FOR EXPORT */ -#define REFRESH_TABLE_STATS (1UL << 20) /* Refresh table stats hash table */ -#define REFRESH_INDEX_STATS (1UL << 21) /* Refresh index stats hash table */ -#define REFRESH_USER_STATS (1UL << 22) /* Refresh user stats hash table */ -#define REFRESH_CLIENT_STATS (1UL << 23) /* Refresh client stats hash table */ +#define REFRESH_TABLE_STATS (1ULL << 27) /* Refresh table stats hash table */ +#define REFRESH_INDEX_STATS (1ULL << 28) /* Refresh index stats hash table */ +#define REFRESH_USER_STATS (1ULL << 29) /* Refresh user stats hash table */ +#define REFRESH_CLIENT_STATS (1ULL << 30) /* Refresh client stats hash table */ -#define REFRESH_FAST (1UL << 31) /* Intern flag */ +#define REFRESH_FAST (1ULL << 31) /* Intern flag */ #define CLIENT_LONG_PASSWORD 1 /* new more secure passwords */ #define CLIENT_FOUND_ROWS 2 /* Found instead of affected rows */ @@ -204,8 +214,15 @@ enum enum_server_command #define CLIENT_PS_MULTI_RESULTS (1UL << 18) /* Multi-results in PS-protocol */ #define CLIENT_PLUGIN_AUTH (1UL << 19) /* Client supports plugin authentication */ -#define CLIENT_PROGRESS (1UL << 29) /* Client support progress indicator */ +#define CLIENT_PLUGIN_AUTH (1UL << 19) /* Client supports plugin authentication */ +#define CLIENT_CONNECT_ATTRS (1UL << 20) /* Client supports connection attributes */ +/* Enable authentication response packet to be larger than 255 bytes. */ +#define CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA (1UL << 21) +/* Don't close the connection for a connection with expired password. */ +#define CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS (1UL << 22) + +#define CLIENT_PROGRESS (1UL << 29) /* Client support progress indicator */ #define CLIENT_SSL_VERIFY_SERVER_CERT (1UL << 30) /* It used to be that if mysql_real_connect() failed, it would delete any @@ -247,7 +264,14 @@ enum enum_server_command CLIENT_SSL_VERIFY_SERVER_CERT | \ CLIENT_REMEMBER_OPTIONS | \ CLIENT_PROGRESS | \ - CLIENT_PLUGIN_AUTH) + CLIENT_PLUGIN_AUTH | \ + CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA | \ + CLIENT_CONNECT_ATTRS) + +/* + To be added later: + CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS +*/ /* Switch off the flags that are optional and depending on build flags @@ -296,8 +320,18 @@ enum enum_server_command */ #define SERVER_PS_OUT_PARAMS 4096 +/** + Set at the same time as SERVER_STATUS_IN_TRANS if the started + multi-statement transaction is a read-only transaction. Cleared + when the transaction commits or aborts. Since this flag is sent + to clients in OK and EOF packets, the flag indicates the + transaction status at the end of command execution. +*/ +#define SERVER_STATUS_IN_TRANS_READONLY 8192 + #define SERVER_STATUS_ANSI_QUOTES 32768 + /** Server status flags that must be cleared when starting execution of a new SQL statement. @@ -353,8 +387,8 @@ typedef struct st_net { unsigned char reading_or_writing; char save_char; char net_skip_rest_factor; - my_bool unused1; /* Please remove with the next incompatible ABI change */ - my_bool compress; + my_bool thread_specific_malloc; + unsigned char compress; my_bool unused3; /* Please remove with the next incompatible ABI change. */ /* Pointer to query object in query cache, do not equal NULL (0) for @@ -388,6 +422,16 @@ enum enum_field_types { MYSQL_TYPE_DECIMAL, MYSQL_TYPE_TINY, MYSQL_TYPE_DATETIME, MYSQL_TYPE_YEAR, MYSQL_TYPE_NEWDATE, MYSQL_TYPE_VARCHAR, MYSQL_TYPE_BIT, + /* + mysql-5.6 compatibility temporal types. + They're only used internally for reading RBR + mysql-5.6 binary log events and mysql-5.6 frm files. + They're never sent to the client. + */ + MYSQL_TYPE_TIMESTAMP2, + MYSQL_TYPE_DATETIME2, + MYSQL_TYPE_TIME2, + MYSQL_TYPE_NEWDECIMAL=246, MYSQL_TYPE_ENUM=247, MYSQL_TYPE_SET=248, @@ -488,10 +532,10 @@ enum enum_mysql_set_option extern "C" { #endif -my_bool my_net_init(NET *net, Vio* vio); +my_bool my_net_init(NET *net, Vio* vio, unsigned int my_flags); void my_net_local_init(NET *net); void net_end(NET *net); - void net_clear(NET *net, my_bool clear_buffer); +void net_clear(NET *net, my_bool clear_buffer); my_bool net_realloc(NET *net, size_t length); my_bool net_flush(NET *net); my_bool my_net_write(NET *net,const unsigned char *packet, size_t len); @@ -499,9 +543,10 @@ my_bool net_write_command(NET *net,unsigned char command, const unsigned char *header, size_t head_len, const unsigned char *packet, size_t len); int net_real_write(NET *net,const unsigned char *packet, size_t len); -unsigned long my_net_read(NET *net); +unsigned long my_net_read_packet(NET *net, my_bool read_from_server); +#define my_net_read(A) my_net_read_packet((A), 0) -#ifdef _global_h +#ifdef MY_GLOBAL_INCLUDED void my_net_set_write_timeout(NET *net, uint timeout); void my_net_set_read_timeout(NET *net, uint timeout); #endif @@ -575,14 +620,17 @@ void scramble_323(char *to, const char *message, const char *password); my_bool check_scramble_323(const unsigned char *reply, const char *message, unsigned long *salt); void get_salt_from_password_323(unsigned long *res, const char *password); +#if MYSQL_VERSION_ID < 100100 void make_password_from_salt_323(char *to, const unsigned long *salt); - +#endif void make_scrambled_password(char *to, const char *password); void scramble(char *to, const char *message, const char *password); my_bool check_scramble(const unsigned char *reply, const char *message, const unsigned char *hash_stage2); void get_salt_from_password(unsigned char *res, const char *password); +#if MYSQL_VERSION_ID < 100100 void make_password_from_salt(char *to, const unsigned char *hash_stage2); +#endif char *octet2hex(char *to, const char *str, unsigned int len); /* end of password.c */ @@ -596,10 +644,12 @@ const char *mysql_errno_to_sqlstate(unsigned int mysql_errno); my_bool my_thread_init(void); void my_thread_end(void); -#ifdef _global_h +#ifdef MY_GLOBAL_INCLUDED ulong STDCALL net_field_length(uchar **packet); my_ulonglong net_field_length_ll(uchar **packet); +my_ulonglong safe_net_field_length_ll(uchar **packet, size_t packet_len); uchar *net_store_length(uchar *pkg, ulonglong length); +uchar *safe_net_store_length(uchar *pkg, size_t pkg_len, ulonglong length); #endif #ifdef __cplusplus |