diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/Makefile.am | 2 | ||||
-rw-r--r-- | include/config-win.h | 10 | ||||
-rw-r--r-- | include/decimal.h | 34 | ||||
-rw-r--r-- | include/hash.h | 1 | ||||
-rw-r--r-- | include/m_ctype.h | 20 | ||||
-rw-r--r-- | include/my_base.h | 3 | ||||
-rw-r--r-- | include/my_dbug.h | 3 | ||||
-rw-r--r-- | include/my_global.h | 16 | ||||
-rw-r--r-- | include/my_list.h | 4 | ||||
-rw-r--r-- | include/my_pthread.h | 1 | ||||
-rw-r--r-- | include/my_sys.h | 4 | ||||
-rw-r--r-- | include/my_time.h | 14 | ||||
-rw-r--r-- | include/myisam.h | 1 | ||||
-rw-r--r-- | include/mysql.h | 20 | ||||
-rw-r--r-- | include/mysql_com.h | 18 | ||||
-rw-r--r-- | include/sql_common.h | 1 | ||||
-rw-r--r-- | include/typelib.h | 1 |
17 files changed, 112 insertions, 41 deletions
diff --git a/include/Makefile.am b/include/Makefile.am index 0c845900a4f..cbb8e1ead53 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -30,7 +30,7 @@ noinst_HEADERS = config-win.h config-os2.h config-netware.h \ my_nosys.h my_alarm.h queues.h rijndael.h sha1.h \ my_aes.h my_tree.h hash.h thr_alarm.h \ thr_lock.h t_ctype.h violite.h md5.h \ - mysql_version.h.in my_handler.h my_time.h + mysql_version.h.in my_handler.h my_time.h decimal.h # mysql_version.h are generated SUPERCLEANFILES = mysql_version.h my_config.h diff --git a/include/config-win.h b/include/config-win.h index 0ba8dd2cf43..946a91d7d42 100644 --- a/include/config-win.h +++ b/include/config-win.h @@ -175,6 +175,8 @@ typedef uint rf_SetTimer; #define sigset(A,B) signal((A),(B)) #define finite(A) _finite(A) #define sleep(A) Sleep((A)*1000) +#define popen(A) popen(A,B) _popen((A),(B)) +#define pclose(A) _pclose(A) #ifndef __BORLANDC__ #define access(A,B) _access(A,B) @@ -229,7 +231,13 @@ inline double ulonglong2double(ulonglong value) ((uint32) (uchar) (A)[0]))) #define sint4korr(A) (*((long *) (A))) #define uint2korr(A) (*((uint16 *) (A))) -#define uint3korr(A) (long) (*((unsigned long *) (A)) & 0xFFFFFF) +/* + ATTENTION ! + + Please, note, uint3korr reads 4 bytes (not 3) ! + It means, that you have to provide enough allocated space ! +*/ +#define uint3korr(A) (long) (*((unsigned int *) (A)) & 0xFFFFFF) #define uint4korr(A) (*((unsigned long *) (A))) #define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\ (((uint32) ((uchar) (A)[1])) << 8) +\ diff --git a/include/decimal.h b/include/decimal.h index fbe507f4049..5b5b8c0b460 100644 --- a/include/decimal.h +++ b/include/decimal.h @@ -19,7 +19,7 @@ #include <my_global.h> -typedef enum {TRUNCATE=0, EVEN} dec_round_mode; +typedef enum {TRUNCATE=0, HALF_EVEN, HALF_UP, CEILING, FLOOR} decimal_round_mode; typedef int32 decimal_digit; typedef struct st_decimal { @@ -30,6 +30,7 @@ typedef struct st_decimal { int decimal2string(decimal *from, char *to, int *to_len); int string2decimal(char *from, decimal *to, char **end); +int string2decimal_fixed(char *from, decimal *to, char **end); int decimal2ulonglong(decimal *from, ulonglong *to); int ulonglong2decimal(ulonglong from, decimal *to); int decimal2longlong(decimal *from, longlong *to); @@ -49,14 +50,34 @@ int decimal_cmp(decimal *from1, decimal *from2); int decimal_mul(decimal *from1, decimal *from2, decimal *to); int decimal_div(decimal *from1, decimal *from2, decimal *to, int scale_incr); int decimal_mod(decimal *from1, decimal *from2, decimal *to); -int decimal_round(decimal *dec, int new_scale, dec_round_mode mode); +int decimal_round(decimal *from, decimal *to, int new_scale, decimal_round_mode mode); /* the following works only on special "zero" decimal, not on any decimal that happen to evaluate to zero */ + #define decimal_is_zero(dec) ((dec)->intg1==1 && (dec)->frac1==0 && (dec)->buf[0]==0) +/* set a decimal to zero */ + +#define decimal_make_zero(dec) do { \ + (dec)->buf[0]=0; \ + (dec)->intg=1; \ + (dec)->frac=0; \ + (dec)->sign=0; \ + } while(0) + +/* + returns the length of the buffer to hold string representation + of the decimal (including decimal dot, possible sign and \0) +*/ + +#define decimal_string_size(dec) ((dec)->intg + (dec)->frac + ((dec)->frac > 0) + 2) + +/* negate a decimal */ +#define decimal_neg(dec) do { (dec)->sign^=1; } while(0) + /* conventions: @@ -70,9 +91,12 @@ int decimal_round(decimal *dec, int new_scale, dec_round_mode mode); #define E_DEC_OK 0 #define E_DEC_TRUNCATED 1 #define E_DEC_OVERFLOW 2 -#define E_DEC_DIV_ZERO 3 -#define E_DEC_BAD_NUM 4 -#define E_DEC_OOM 5 +#define E_DEC_DIV_ZERO 4 +#define E_DEC_BAD_NUM 8 +#define E_DEC_OOM 16 + +#define E_DEC_ERROR 31 +#define E_DEC_FATAL_ERROR 30 #endif diff --git a/include/hash.h b/include/hash.h index c7cc118b7bd..cd7210a290c 100644 --- a/include/hash.h +++ b/include/hash.h @@ -47,6 +47,7 @@ my_bool _hash_init(HASH *hash, CHARSET_INFO *charset, uint key_length, hash_get_key get_key, void (*free_element)(void*), uint flags CALLER_INFO_PROTO); void hash_free(HASH *tree); +void hash_reset(HASH *hash); byte *hash_element(HASH *hash,uint idx); gptr hash_search(HASH *info,const byte *key,uint length); gptr hash_next(HASH *info,const byte *key,uint length); diff --git a/include/m_ctype.h b/include/m_ctype.h index 65b11f4c06a..ddc21070547 100644 --- a/include/m_ctype.h +++ b/include/m_ctype.h @@ -184,7 +184,8 @@ typedef struct my_charset_handler_st int base, char **e, int *err); double (*strntod)(struct charset_info_st *, char *s, uint l, char **e, int *err); - + longlong (*my_strtoll10)(struct charset_info_st *cs, + const char *nptr, char **endptr, int *error); ulong (*scan)(struct charset_info_st *, const char *b, const char *e, int sq); } MY_CHARSET_HANDLER; @@ -303,6 +304,11 @@ int my_long10_to_str_8bit(CHARSET_INFO *, char *to, uint l, int radix, int my_longlong10_to_str_8bit(CHARSET_INFO *, char *to, uint l, int radix, longlong val); +longlong my_strtoll10_8bit(CHARSET_INFO *cs, + const char *nptr, char **endptr, int *error); +longlong my_strtoll10_ucs2(CHARSET_INFO *cs, + const char *nptr, char **endptr, int *error); + void my_fill_8bit(CHARSET_INFO *cs, char* to, uint l, int fill); my_bool my_like_range_simple(CHARSET_INFO *cs, @@ -312,6 +318,13 @@ my_bool my_like_range_simple(CHARSET_INFO *cs, char *min_str, char *max_str, uint *min_length, uint *max_length); +my_bool my_like_range_mb(CHARSET_INFO *cs, + const char *ptr, uint ptr_length, + pbool escape, pbool w_one, pbool w_many, + uint res_length, + char *min_str, char *max_str, + uint *min_length, uint *max_length); + my_bool my_like_range_ucs2(CHARSET_INFO *cs, const char *ptr, uint ptr_length, pbool escape, pbool w_one, pbool w_many, @@ -352,6 +365,11 @@ uint my_instr_mb(struct charset_info_st *, const char *s, uint s_length, my_match_t *match, uint nmatch); +int my_wildcmp_unicode(CHARSET_INFO *cs, + const char *str, const char *str_end, + const char *wildstr, const char *wildend, + int escape, int w_one, int w_many, + MY_UNICASE_INFO **weights); extern my_bool my_parse_charset_xml(const char *bug, uint len, int (*add)(CHARSET_INFO *cs)); diff --git a/include/my_base.h b/include/my_base.h index 583cd473936..815a1c76c0e 100644 --- a/include/my_base.h +++ b/include/my_base.h @@ -247,6 +247,7 @@ enum ha_base_keytype { #define HA_CREATE_TMP_TABLE 4 #define HA_CREATE_CHECKSUM 8 #define HA_CREATE_DELAY_KEY_WRITE 64 +#define HA_CREATE_FROM_ENGINE 128 /* Bits in flag to _status */ @@ -293,7 +294,7 @@ enum ha_base_keytype { #define HA_ERR_ROW_IS_REFERENCED 152 /* Cannot delete a parent row */ #define HA_ERR_NO_SAVEPOINT 153 /* No savepoint with that name */ #define HA_ERR_NON_UNIQUE_BLOCK_SIZE 154 /* Non unique key block size */ -#define HA_ERR_OLD_METADATA 155 /* The frm file on disk is old */ +#define HA_ERR_NO_SUCH_TABLE 155 /* The table does not exist in engine */ #define HA_ERR_TABLE_EXIST 156 /* The table existed in storage engine */ #define HA_ERR_NO_CONNECTION 157 /* Could not connect to storage engine */ diff --git a/include/my_dbug.h b/include/my_dbug.h index 9174a8b1ef9..711ece4335c 100644 --- a/include/my_dbug.h +++ b/include/my_dbug.h @@ -38,6 +38,7 @@ extern void _db_pargs_(uint _line_,const char *keyword); extern void _db_doprnt_ _VARARGS((const char *format,...)); extern void _db_dump_(uint _line_,const char *keyword,const char *memory, uint length); +extern void _db_output_(); extern void _db_lock_file(); extern void _db_unlock_file(); @@ -66,6 +67,7 @@ extern void _db_unlock_file(); #define DEBUGGER_ON _no_db_=0 #define DBUG_LOCK_FILE { _db_lock_file(); } #define DBUG_UNLOCK_FILE { _db_unlock_file(); } +#define DBUG_OUTPUT(A) { _db_output_(A); } #define DBUG_ASSERT(A) assert(A) #else /* No debugger */ @@ -86,6 +88,7 @@ extern void _db_unlock_file(); #define DEBUGGER_ON #define DBUG_LOCK_FILE #define DBUG_UNLOCK_FILE +#define DBUG_OUTPUT(A) #define DBUG_ASSERT(A) {} #endif #ifdef __cplusplus diff --git a/include/my_global.h b/include/my_global.h index 684617695a7..369ba838698 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -370,6 +370,12 @@ int __void__; #define LINT_INIT(var) #endif +#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || defined(HAVE_purify) +#define PURIFY_OR_LINT_INIT(var) var=0 +#else +#define PURIFY_OR_LINT_INIT(var) +#endif + /* Define some useful general macros */ #if defined(__cplusplus) && defined(__GNUC__) #define max(a, b) ((a) >? (b)) @@ -724,7 +730,7 @@ typedef void *gptr; /* Generic pointer */ typedef char *gptr; /* Generic pointer */ #endif #ifndef HAVE_INT_8_16_32 -typedef char int8; /* Signed integer >= 8 bits */ +typedef signed char int8; /* Signed integer >= 8 bits */ typedef short int16; /* Signed integer >= 16 bits */ #endif #ifndef HAVE_UCHAR @@ -930,7 +936,13 @@ typedef char bool; /* Ordinary boolean values 0 1 */ (((uint32) ((uchar) (A)[1])) << 8) +\ (((uint32) ((uchar) (A)[2])) << 16)) #else -#define uint3korr(A) (long) (*((unsigned long *) (A)) & 0xFFFFFF) +/* + ATTENTION ! + + Please, note, uint3korr reads 4 bytes (not 3) ! + It means, that you have to provide enough allocated space ! +*/ +#define uint3korr(A) (long) (*((unsigned int *) (A)) & 0xFFFFFF) #endif #define uint4korr(A) (*((unsigned long *) (A))) #define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\ diff --git a/include/my_list.h b/include/my_list.h index 789bbb50f97..f786621e311 100644 --- a/include/my_list.h +++ b/include/my_list.h @@ -33,8 +33,8 @@ extern LIST *list_delete(LIST *root,LIST *element); extern LIST *list_cons(void *data,LIST *root); extern LIST *list_reverse(LIST *root); extern void list_free(LIST *root,unsigned int free_data); -extern unsigned int list_length(LIST *list); -extern int list_walk(LIST *list,list_walk_action action,gptr argument); +extern unsigned int list_length(LIST *); +extern int list_walk(LIST *,list_walk_action action,gptr argument); #define rest(a) ((a)->next) #define list_push(a,b) (a)=list_cons((b),(a)) diff --git a/include/my_pthread.h b/include/my_pthread.h index 602a4439575..cd0cf49a891 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -234,7 +234,6 @@ extern int my_sigwait(const sigset_t *set,int *sig); #include <signal.h> #undef sigwait #endif -#undef _REENTRANT /* Fix if _REENTRANT is in pthread.h */ #include <pthread.h> #ifndef _REENTRANT #define _REENTRANT diff --git a/include/my_sys.h b/include/my_sys.h index cc40b7a7693..f95329950eb 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -221,6 +221,7 @@ extern ulong my_cache_w_requests, my_cache_write, my_cache_r_requests, my_cache_read; extern ulong my_blocks_used, my_blocks_changed; extern ulong my_file_opened,my_stream_opened, my_tmp_file_created; +extern uint mysys_usage_id; extern my_bool my_init_done; /* Point to current my_message() */ @@ -738,7 +739,8 @@ extern void my_free_lock(byte *ptr,myf flags); #define my_free_lock(A,B) my_free((A),(B)) #endif #define alloc_root_inited(A) ((A)->min_malloc != 0) -#define clear_alloc_root(A) bzero((void *) (A), sizeof(MEM_ROOT)) +#define ALLOC_ROOT_MIN_BLOCK_SIZE (MALLOC_OVERHEAD + sizeof(USED_MEM) + 8) +#define clear_alloc_root(A) do { (A)->free= (A)->used= (A)->pre_alloc= 0; (A)->min_malloc=0;} while(0) extern void init_alloc_root(MEM_ROOT *mem_root, uint block_size, uint pre_alloc_size); extern gptr alloc_root(MEM_ROOT *mem_root,unsigned int Size); diff --git a/include/my_time.h b/include/my_time.h index 332b26a15eb..c55eb051a1a 100644 --- a/include/my_time.h +++ b/include/my_time.h @@ -66,6 +66,20 @@ my_system_gmt_sec(const MYSQL_TIME *t, long *my_timezone, bool *in_dst_time_gap) void set_zero_time(MYSQL_TIME *tm); +/* + Required buffer length for my_time_to_str, my_date_to_str, + my_datetime_to_str and TIME_to_string functions. Note, that the + caller is still responsible to check that given TIME structure + has values in valid ranges, otherwise size of the buffer could + be not enough. +*/ +#define MAX_DATE_STRING_REP_LENGTH 30 + +int my_time_to_str(const MYSQL_TIME *l_time, char *to); +int my_date_to_str(const MYSQL_TIME *l_time, char *to); +int my_datetime_to_str(const MYSQL_TIME *l_time, char *to); +int my_TIME_to_str(const MYSQL_TIME *l_time, char *to); + C_MODE_END #endif /* _my_time_h_ */ diff --git a/include/myisam.h b/include/myisam.h index 02c56115dfd..6d097770646 100644 --- a/include/myisam.h +++ b/include/myisam.h @@ -98,6 +98,7 @@ typedef struct st_mi_create_info ha_rows reloc_rows; ulonglong auto_increment; ulonglong data_file_length; + ulonglong key_file_length; uint raid_type,raid_chunks; ulong raid_chunksize; uint old_options; diff --git a/include/mysql.h b/include/mysql.h index 9d08bf5aa57..0edd3873192 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -490,6 +490,8 @@ MYSQL_RES * STDCALL mysql_list_fields(MYSQL *mysql, const char *table, const char *wild); unsigned long STDCALL mysql_escape_string(char *to,const char *from, unsigned long from_length); +unsigned long STDCALL mysql_hex_string(char *to,const char *from, + unsigned long from_length); unsigned long STDCALL mysql_real_escape_string(MYSQL *mysql, char *to,const char *from, unsigned long length); @@ -506,6 +508,7 @@ char * STDCALL mysql_odbc_escape_string(MYSQL *mysql, unsigned long *length)); void STDCALL myodbc_remove_escape(MYSQL *mysql,char *name); unsigned int STDCALL mysql_thread_safe(void); +my_bool STDCALL mysql_embedded(void); MYSQL_MANAGER* STDCALL mysql_manager_init(MYSQL_MANAGER* con); MYSQL_MANAGER* STDCALL mysql_manager_connect(MYSQL_MANAGER* con, const char* host, @@ -652,23 +655,6 @@ typedef struct st_mysql_methods #endif } MYSQL_METHODS; -#ifdef HAVE_DEPRECATED_411_API -/* Deprecated calls (since MySQL 4.1.2) */ - -/* Use mysql_stmt_init + mysql_stmt_prepare instead */ -MYSQL_STMT * STDCALL mysql_prepare(MYSQL * mysql, const char *query, - unsigned long length); -#define mysql_execute mysql_stmt_execute -#define mysql_fetch mysql_stmt_fetch -#define mysql_fetch_column mysql_stmt_fetch_column -#define mysql_bind_param mysql_stmt_bind_param -#define mysql_bind_result mysql_stmt_bind_result -#define mysql_param_count mysql_stmt_param_count -#define mysql_param_result mysql_stmt_param_metadata -#define mysql_get_metadata mysql_stmt_result_metadata -#define mysql_send_long_data mysql_stmt_send_long_data - -#endif /* HAVE_DEPRECATED_411_API */ MYSQL_STMT * STDCALL mysql_stmt_init(MYSQL *mysql); int STDCALL mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query, diff --git a/include/mysql_com.h b/include/mysql_com.h index 16a1581a6c9..92a67ac0279 100644 --- a/include/mysql_com.h +++ b/include/mysql_com.h @@ -50,13 +50,16 @@ enum enum_server_command COM_TABLE_DUMP, COM_CONNECT_OUT, COM_REGISTER_SLAVE, COM_PREPARE, COM_EXECUTE, COM_LONG_DATA, COM_CLOSE_STMT, COM_RESET_STMT, COM_SET_OPTION, COM_FETCH, - COM_END /* Must be last */ + /* don't forget to update const char *command_name[] in sql_parse.cc */ + + /* Must be last */ + COM_END }; /* Length of random string sent by server on handshake; this is also length of - obfuscated password, recieved from client + obfuscated password, recieved from client */ #define SCRAMBLE_LENGTH 20 #define SCRAMBLE_LENGTH_323 8 @@ -155,6 +158,11 @@ enum enum_server_command struct st_vio; /* Only C */ typedef struct st_vio Vio; +#define MAX_TINYINT_WIDTH 3 /* Max width for a TINY w.o. sign */ +#define MAX_SMALLINT_WIDTH 5 /* Max width for a SHORT w.o. sign */ +#define MAX_MEDIUMINT_WIDTH 8 /* Max width for a INT24 w.o. sign */ +#define MAX_INT_WIDTH 10 /* Max width for a LONG w.o. sign */ +#define MAX_BIGINT_WIDTH 20 /* Max width for a LONGLONG */ #define MAX_CHAR_WIDTH 255 /* Max length for a CHAR colum */ #define MAX_BLOB_WIDTH 8192 /* Default width for blob */ @@ -304,13 +312,7 @@ void my_net_local_init(NET *net); void net_end(NET *net); void net_clear(NET *net); my_bool net_realloc(NET *net, unsigned long length); - -#ifndef EMBEDDED_LIBRARY /* To be removed by HF */ my_bool net_flush(NET *net); -#else -#define net_flush(A) -#endif - my_bool my_net_write(NET *net,const char *packet,unsigned long len); my_bool net_write_command(NET *net,unsigned char command, const char *header, unsigned long head_len, diff --git a/include/sql_common.h b/include/sql_common.h index cde53786f83..c07a4a831bb 100644 --- a/include/sql_common.h +++ b/include/sql_common.h @@ -25,7 +25,6 @@ extern "C" { MYSQL_FIELD *unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields, my_bool default_value, uint server_capabilities); void free_rows(MYSQL_DATA *cur); -my_bool mysql_autenticate(MYSQL *mysql, const char *passwd); void free_old_query(MYSQL *mysql); void end_server(MYSQL *mysql); my_bool mysql_reconnect(MYSQL *mysql); diff --git a/include/typelib.h b/include/typelib.h index 1b049d19a11..4d6a90ad51e 100644 --- a/include/typelib.h +++ b/include/typelib.h @@ -22,6 +22,7 @@ typedef struct st_typelib { /* Different types saved here */ unsigned int count; /* How many types */ const char *name; /* Name of typelib */ const char **type_names; + unsigned int *type_lengths; } TYPELIB; extern int find_type(char *x,TYPELIB *typelib,unsigned int full_name); |