mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
e72124c4cc
New multi-key-cache handling. This was needed becasue the old one didn't work reliable with MERGE tables. ALTER TABLE table_name ... CHARACTER SET ... now changes all char/varchar/text columns to the given character set (One must use ALTER TABLE ... DEFAULT CHARACTER SET ... to change the default character set) Fixed that have_compress is detected properly (fixes problems with func_compress.test on platforms without zlib) New syntax for CACHE INDEX ('keys' is optional if no index name is given and one mentions the key cache name only ones) Removed compiler warnings Added mysql_set_server_option() to allow clients like PHP to easaily set/reset the multi-statement flag. BUILD/compile-pentium-valgrind-max: Add test of isam client/mysql.cc: CLIENT_MULTI_QUERIES -> CLIENT_MULTI_STATEMENTS include/my_base.h: Remove HA_EXTRA_SET_KEY_CACHE include/my_no_pthread.h: Add defines to ignore rw-locks when running without threads include/my_sys.h: Added function for multi-key-caches include/myisam.h: Added function to handle multi-key-caches include/mysql.h: Added mysql_set_server_option include/mysql_com.h: CLIENT_MULTI_QUERIES -> CLIENT_MULTI_STATEMENTS Added enum_mysql_set_option include/mysqld_error.h: Added error message for unknown key cache innobase/srv/srv0start.c: Removed warning that is confused for MySQL users libmysql/libmysql.c: Added mysql_set_server_option() libmysql/libmysql.def: Added mysql_set_server_option() myisam/ft_nlq_search.c: Removed compiler warning myisam/ft_static.c: Removed compiler warning and fixed wrong return value myisam/mi_check.c: Clean up multi-key-cache usage myisam/mi_checksum.c: Removed not used variable myisam/mi_close.c: keycache -> key_cache myisam/mi_delete_all.c: keycache -> key_cache myisam/mi_extra.c: keycache -> key_cache Removed HA_EXTRA_SET_KEY_CACHE myisam/mi_keycache.c: Changed logic so that it's MyISAM that is responsible for assign tables to different key caches instead of the upper level myisam/mi_locking.c: Don't change key cache on unlock (must be done before) myisam/mi_open.c: Fetch key cache to use from multi_key_cache_search() myisam/mi_page.c: keycache -> key_cache myisam/mi_panic.c: keycache -> key_cache myisam/mi_preload.c: keycache -> key_cache myisam/mi_test1.c: Use KEY_CACHE_BLOCK_SIZE myisam/mi_test2.c: Always test resize_key_cache() myisam/mi_test3.c: Use KEY_CACHE_BLOCK_SIZE instead of 512 myisam/myisamchk.c: update for multiple key caches myisam/myisamdef.h: Remove reg_keycache Add unique_name_length for storing length of unique_file_name myisam/myisamlog.c: Change how end_key_cache() is called mysql-test/mysql-test-run.sh: Fixed web link Added name of failed test to abort row. mysql-test/r/alter_table.result: Testing of ALTER TABLE ... [DEFAULT] CHARACTER SET mysql-test/r/case.result: Update result for DEFAULT CHARSET... mysql-test/r/cast.result: Update result for DEFAULT CHARSET... mysql-test/r/create.result: Update result for DEFAULT CHARSET... mysql-test/r/ctype_collate.result: Update result for DEFAULT CHARSET... mysql-test/r/ctype_latin1_de.result: Update result for DEFAULT CHARSET... mysql-test/r/ctype_many.result: Update result for DEFAULT CHARSET... mysql-test/r/ctype_mb.result: Update result for DEFAULT CHARSET... mysql-test/r/ctype_recoding.result: Update result for DEFAULT CHARSET... mysql-test/r/ctype_ucs.result: Update result for DEFAULT CHARSET... mysql-test/r/derived.result: Use STRAIGHT_JOIN to make join order predictable mysql-test/r/fulltext.result: Update result for DEFAULT CHARSET... mysql-test/r/func_str.result: Update result for DEFAULT CHARSET... mysql-test/r/func_system.result: Update result for DEFAULT CHARSET... mysql-test/r/gis-rtree.result: Update result for DEFAULT CHARSET... mysql-test/r/innodb.result: Update result for DEFAULT CHARSET... mysql-test/r/key_cache.result: Update test for new key cache syntax. Added more tests mysql-test/r/merge.result: Update result for DEFAULT CHARSET... mysql-test/r/preload.result: New syntax mysql-test/r/show_check.result: Update result for DEFAULT CHARSET... mysql-test/r/sql_mode.result: Update result for DEFAULT CHARSET... mysql-test/r/subselect.result: Update result for DEFAULT CHARSET... mysql-test/r/type_blob.result: Update result for DEFAULT CHARSET... mysql-test/r/type_enum.result: Update result for DEFAULT CHARSET... mysql-test/r/type_nchar.result: Update result for DEFAULT CHARSET... mysql-test/r/type_set.result: Update result for DEFAULT CHARSET... mysql-test/r/union.result: Use STRAIGHT_JOIN to make join order predictable mysql-test/t/alter_table.test: Testing of ALTER TABLE ... [DEFAULT] CHARACTER SET mysql-test/t/ctype_many.test: Update result for DEFAULT CHARSET... mysql-test/t/derived.test: Use STRAIGHT_JOIN to make join order predictable mysql-test/t/isam.test: Use disable warnings for test loop mysql-test/t/join.test: Update test now when we only support 61 tables in join mysql-test/t/key_cache.test: Update test for new key cache syntax. Added more tests mysql-test/t/preload.test: Update for new syntax mysql-test/t/union.test: Use STRAIGHT_JOIN to make join order predictable mysys/Makefile.am: Added mf_keycaches.c mysys/hash.c: TRUE -> 1 mysys/mf_keycache.c: Removed compiler warnings Striped end space Fixed indentation and improved function comments TRUE -> 1 Changed parameters to end_key_cache() to make it easer to use Fixed bug when using key blocks size > 1024 bytes (First part of index file could be overwritten with wrong data) Split function flush_key_blocks into two functions to not get mutex used twice when called from flush_all_key_blocks() mysys/my_bitmap.c: More debugging Safe bitmap_free() Fixed indentation mysys/my_getopt.c: Ensure that we initialize option->value, option->max_value and value from GET_ASK_ADDR mysys/my_thr_init.c: Remove not used mutex THR_LOCK_keycache mysys/typelib.c: Fixed function comments sql-common/client.c: CLIENT_MULTI_QUERIES -> CLIENT_MULTI_STATEMENTS Fixed the multi_result flag is set also on SELECT;s sql/ha_myisam.cc: Fixed multiple key_cache handling (Now done on MyISAM level) sql/ha_myisammrg.cc: Fixed multiple key_cache handling (Now done on MyISAM level) sql/handler.cc: New multi key cache handling sql/handler.h: New multi key cache handling Added support for default character set sql/item.h: Added function cleanup() (Needed for prepared statements / cursors) sql/item_cmpfunc.h: Added cleanup function sql/item_func.cc: Indentation cleanup sql/mysql_priv.h: New multi-key-cache functions Removed LOCK_assign sql/mysqld.cc: New multi-key-cache handling Fixed that variable have_compress is set correctly sql/protocol.cc: SELECT didn't work reliable in multi-statements sql/set_var.cc: Support for new key cache variables sql/set_var.h: Support for new key cache variables sql/share/czech/errmsg.txt: New error messages sql/share/danish/errmsg.txt: New error messages sql/share/dutch/errmsg.txt: New error messages sql/share/english/errmsg.txt: New error messages sql/share/estonian/errmsg.txt: New error messages sql/share/french/errmsg.txt: New error messages sql/share/german/errmsg.txt: New error messages sql/share/greek/errmsg.txt: New error messages sql/share/hungarian/errmsg.txt: New error messages sql/share/italian/errmsg.txt: New error messages sql/share/japanese/errmsg.txt: New error messages sql/share/korean/errmsg.txt: New error messages sql/share/norwegian-ny/errmsg.txt: New error messages sql/share/norwegian/errmsg.txt: New error messages sql/share/polish/errmsg.txt: New error messages sql/share/portuguese/errmsg.txt: New error messages sql/share/romanian/errmsg.txt: New error messages sql/share/russian/errmsg.txt: New error messages sql/share/serbian/errmsg.txt: New error messages sql/share/slovak/errmsg.txt: New error messages sql/share/spanish/errmsg.txt: New error messages sql/share/swedish/errmsg.txt: New error messages sql/share/ukrainian/errmsg.txt: New error messages sql/sql_base.cc: Removed all key_cache handling (this is now done on MyISAM level) Change table_charset -> default_table_charset sql/sql_db.cc: table_charset -> default_table_charset sql/sql_delete.cc: table_charset -> default_table_charset sql/sql_lex.cc: CLIENT_MULTI_QUERIES -> CLIENT_MULTI_STATEMENTS sql/sql_lex.h: New option to store a name and length sql/sql_parse.cc: Support for mysql_set_server_option() Reset "default" keycache status variables in 'FLUSH STATUS' (Need to be improved later) sql/sql_show.cc: Add DEFAULT before CHARSET (for table character sets) Fetch key cache variables from 'sql_key_cache' sql/sql_table.cc: table_charset -> default_table_charset New multi-key-cache handling sql/sql_test.cc: Write information from all key caches sql/sql_yacc.yy: Changed syntax for CACHE INDEX ... Force user to use DEFAULT before database/table level character sets sql/structs.h: Added SHOW_KEY_CACHE_LONG (to get values from sql_key_cache) sql/table.cc: table_charset -> default_table_charset sql/table.h: New key cache handling (this is now done in mysys/mf_keycaches.c) sql/unireg.h: A
372 lines
13 KiB
C
372 lines
13 KiB
C
/* Copyright (C) 2000 MySQL AB
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; if not, write to the Free Software
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
|
|
|
/*
|
|
** Common definition between mysql server & client
|
|
*/
|
|
|
|
#ifndef _mysql_com_h
|
|
#define _mysql_com_h
|
|
|
|
#define NAME_LEN 64 /* Field/table name length */
|
|
#define HOSTNAME_LENGTH 60
|
|
#define USERNAME_LENGTH 16
|
|
#define SERVER_VERSION_LENGTH 60
|
|
#define SQLSTATE_LENGTH 5
|
|
|
|
#define LOCAL_HOST "localhost"
|
|
#define LOCAL_HOST_NAMEDPIPE "."
|
|
|
|
|
|
#if defined(__WIN__) && !defined( _CUSTOMCONFIG_)
|
|
#define MYSQL_NAMEDPIPE "MySQL"
|
|
#define MYSQL_SERVICENAME "MySQL"
|
|
#endif /* __WIN__ */
|
|
|
|
enum enum_server_command
|
|
{
|
|
COM_SLEEP, COM_QUIT, COM_INIT_DB, COM_QUERY, COM_FIELD_LIST,
|
|
COM_CREATE_DB, COM_DROP_DB, COM_REFRESH, COM_SHUTDOWN, COM_STATISTICS,
|
|
COM_PROCESS_INFO, COM_CONNECT, COM_PROCESS_KILL, COM_DEBUG, COM_PING,
|
|
COM_TIME, COM_DELAYED_INSERT, COM_CHANGE_USER, COM_BINLOG_DUMP,
|
|
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_END /* Must be last */
|
|
};
|
|
|
|
|
|
/*
|
|
Length of random string sent by server on handshake; this is also length of
|
|
obfuscated password, recieved from client
|
|
*/
|
|
#define SCRAMBLE_LENGTH 20
|
|
#define SCRAMBLE_LENGTH_323 8
|
|
/* length of password stored in the db: new passwords are preceeded with '*' */
|
|
#define SCRAMBLED_PASSWORD_CHAR_LENGTH (SCRAMBLE_LENGTH*2+1)
|
|
#define SCRAMBLED_PASSWORD_CHAR_LENGTH_323 (SCRAMBLE_LENGTH_323*2)
|
|
|
|
|
|
#define NOT_NULL_FLAG 1 /* Field can't be NULL */
|
|
#define PRI_KEY_FLAG 2 /* Field is part of a primary key */
|
|
#define UNIQUE_KEY_FLAG 4 /* Field is part of a unique key */
|
|
#define MULTIPLE_KEY_FLAG 8 /* Field is part of a key */
|
|
#define BLOB_FLAG 16 /* Field is a blob */
|
|
#define UNSIGNED_FLAG 32 /* Field is unsigned */
|
|
#define ZEROFILL_FLAG 64 /* Field is zerofill */
|
|
#define BINARY_FLAG 128 /* Field is binary */
|
|
|
|
/* The following are only sent to new clients */
|
|
#define ENUM_FLAG 256 /* field is an enum */
|
|
#define AUTO_INCREMENT_FLAG 512 /* field is a autoincrement field */
|
|
#define TIMESTAMP_FLAG 1024 /* Field is a timestamp */
|
|
#define SET_FLAG 2048 /* field is a set */
|
|
#define NUM_FLAG 32768 /* Field is num (for clients) */
|
|
#define PART_KEY_FLAG 16384 /* Intern; Part of some key */
|
|
#define GROUP_FLAG 32768 /* Intern: Group field */
|
|
#define UNIQUE_FLAG 65536 /* Intern: Used by sql_yacc */
|
|
|
|
#define REFRESH_GRANT 1 /* Refresh grant tables */
|
|
#define REFRESH_LOG 2 /* Start on new log file */
|
|
#define REFRESH_TABLES 4 /* close all tables */
|
|
#define REFRESH_HOSTS 8 /* Flush host cache */
|
|
#define REFRESH_STATUS 16 /* Flush status variables */
|
|
#define REFRESH_THREADS 32 /* Flush thread cache */
|
|
#define REFRESH_SLAVE 64 /* Reset master info and restart slave
|
|
thread */
|
|
#define REFRESH_MASTER 128 /* Remove all bin logs in the index
|
|
and truncate the index */
|
|
|
|
/* The following can't be set with mysql_refresh() */
|
|
#define REFRESH_READ_LOCK 16384 /* Lock tables for read */
|
|
#define REFRESH_FAST 32768 /* Intern flag */
|
|
|
|
/* RESET (remove all queries) from query cache */
|
|
#define REFRESH_QUERY_CACHE 65536
|
|
#define REFRESH_QUERY_CACHE_FREE 0x20000L /* pack query cache */
|
|
#define REFRESH_DES_KEY_FILE 0x40000L
|
|
#define REFRESH_USER_RESOURCES 0x80000L
|
|
|
|
#define CLIENT_LONG_PASSWORD 1 /* new more secure passwords */
|
|
#define CLIENT_FOUND_ROWS 2 /* Found instead of affected rows */
|
|
#define CLIENT_LONG_FLAG 4 /* Get all column flags */
|
|
#define CLIENT_CONNECT_WITH_DB 8 /* One can specify db on connect */
|
|
#define CLIENT_NO_SCHEMA 16 /* Don't allow database.table.column */
|
|
#define CLIENT_COMPRESS 32 /* Can use compression protocol */
|
|
#define CLIENT_ODBC 64 /* Odbc client */
|
|
#define CLIENT_LOCAL_FILES 128 /* Can use LOAD DATA LOCAL */
|
|
#define CLIENT_IGNORE_SPACE 256 /* Ignore spaces before '(' */
|
|
#define CLIENT_PROTOCOL_41 512 /* New 4.1 protocol */
|
|
#define CLIENT_INTERACTIVE 1024 /* This is an interactive client */
|
|
#define CLIENT_SSL 2048 /* Switch to SSL after handshake */
|
|
#define CLIENT_IGNORE_SIGPIPE 4096 /* IGNORE sigpipes */
|
|
#define CLIENT_TRANSACTIONS 8192 /* Client knows about transactions */
|
|
#define CLIENT_RESERVED 16384 /* Old flag for 4.1 protocol */
|
|
#define CLIENT_SECURE_CONNECTION 32768 /* New 4.1 authentication */
|
|
#define CLIENT_MULTI_STATEMENTS 65536 /* Enable/disable multi-stmt support */
|
|
#define CLIENT_MULTI_RESULTS 131072 /* Enable/disable multi-results */
|
|
#define CLIENT_REMEMBER_OPTIONS (1L << 31)
|
|
|
|
#define SERVER_STATUS_IN_TRANS 1 /* Transaction has started */
|
|
#define SERVER_STATUS_AUTOCOMMIT 2 /* Server in auto_commit mode */
|
|
#define SERVER_STATUS_MORE_RESULTS 4 /* More results on server */
|
|
#define SERVER_MORE_RESULTS_EXISTS 8 /* Multi query - next query exists */
|
|
|
|
#define MYSQL_ERRMSG_SIZE 512
|
|
#define NET_READ_TIMEOUT 30 /* Timeout on read */
|
|
#define NET_WRITE_TIMEOUT 60 /* Timeout on write */
|
|
#define NET_WAIT_TIMEOUT 8*60*60 /* Wait for new query */
|
|
|
|
struct st_vio; /* Only C */
|
|
typedef struct st_vio Vio;
|
|
|
|
#define MAX_CHAR_WIDTH 255 /* Max length for a CHAR colum */
|
|
#define MAX_BLOB_WIDTH 8192 /* Default width for blob */
|
|
|
|
typedef struct st_net {
|
|
#if !defined(CHECK_EMBEDDED_DIFFERENCES) || !defined(EMBEDDED_LIBRARY)
|
|
Vio* vio;
|
|
unsigned char *buff,*buff_end,*write_pos,*read_pos;
|
|
my_socket fd; /* For Perl DBI/dbd */
|
|
unsigned long max_packet,max_packet_size;
|
|
unsigned int pkt_nr,compress_pkt_nr;
|
|
unsigned int write_timeout, read_timeout, retry_count;
|
|
int fcntl;
|
|
my_bool compress;
|
|
/*
|
|
The following variable is set if we are doing several queries in one
|
|
command ( as in LOAD TABLE ... FROM MASTER ),
|
|
and do not want to confuse the client with OK at the wrong time
|
|
*/
|
|
unsigned long remain_in_buf,length, buf_length, where_b;
|
|
unsigned int *return_status;
|
|
unsigned char reading_or_writing;
|
|
char save_char;
|
|
my_bool no_send_ok;
|
|
/*
|
|
Pointer to query object in query cache, do not equal NULL (0) for
|
|
queries in cache that have not stored its results yet
|
|
*/
|
|
#endif
|
|
char last_error[MYSQL_ERRMSG_SIZE], sqlstate[SQLSTATE_LENGTH+1];
|
|
unsigned int last_errno;
|
|
unsigned char error;
|
|
gptr query_cache_query;
|
|
my_bool report_error; /* We should report error (we have unreported error) */
|
|
my_bool return_errno;
|
|
} NET;
|
|
|
|
#define packet_error (~(unsigned long) 0)
|
|
|
|
enum enum_field_types { MYSQL_TYPE_DECIMAL, MYSQL_TYPE_TINY,
|
|
MYSQL_TYPE_SHORT, MYSQL_TYPE_LONG,
|
|
MYSQL_TYPE_FLOAT, MYSQL_TYPE_DOUBLE,
|
|
MYSQL_TYPE_NULL, MYSQL_TYPE_TIMESTAMP,
|
|
MYSQL_TYPE_LONGLONG,MYSQL_TYPE_INT24,
|
|
MYSQL_TYPE_DATE, MYSQL_TYPE_TIME,
|
|
MYSQL_TYPE_DATETIME, MYSQL_TYPE_YEAR,
|
|
MYSQL_TYPE_NEWDATE,
|
|
MYSQL_TYPE_ENUM=247,
|
|
MYSQL_TYPE_SET=248,
|
|
MYSQL_TYPE_TINY_BLOB=249,
|
|
MYSQL_TYPE_MEDIUM_BLOB=250,
|
|
MYSQL_TYPE_LONG_BLOB=251,
|
|
MYSQL_TYPE_BLOB=252,
|
|
MYSQL_TYPE_VAR_STRING=253,
|
|
MYSQL_TYPE_STRING=254,
|
|
MYSQL_TYPE_GEOMETRY=255
|
|
|
|
};
|
|
|
|
/* For backward compatibility */
|
|
#define CLIENT_MULTI_QUERIES CLIENT_MULTI_STATEMENTS
|
|
#define FIELD_TYPE_DECIMAL MYSQL_TYPE_DECIMAL
|
|
#define FIELD_TYPE_TINY MYSQL_TYPE_TINY
|
|
#define FIELD_TYPE_SHORT MYSQL_TYPE_SHORT
|
|
#define FIELD_TYPE_LONG MYSQL_TYPE_LONG
|
|
#define FIELD_TYPE_FLOAT MYSQL_TYPE_FLOAT
|
|
#define FIELD_TYPE_DOUBLE MYSQL_TYPE_DOUBLE
|
|
#define FIELD_TYPE_NULL MYSQL_TYPE_NULL
|
|
#define FIELD_TYPE_TIMESTAMP MYSQL_TYPE_TIMESTAMP
|
|
#define FIELD_TYPE_LONGLONG MYSQL_TYPE_LONGLONG
|
|
#define FIELD_TYPE_INT24 MYSQL_TYPE_INT24
|
|
#define FIELD_TYPE_DATE MYSQL_TYPE_DATE
|
|
#define FIELD_TYPE_TIME MYSQL_TYPE_TIME
|
|
#define FIELD_TYPE_DATETIME MYSQL_TYPE_DATETIME
|
|
#define FIELD_TYPE_YEAR MYSQL_TYPE_YEAR
|
|
#define FIELD_TYPE_NEWDATE MYSQL_TYPE_NEWDATE
|
|
#define FIELD_TYPE_ENUM MYSQL_TYPE_ENUM
|
|
#define FIELD_TYPE_SET MYSQL_TYPE_SET
|
|
#define FIELD_TYPE_TINY_BLOB MYSQL_TYPE_TINY_BLOB
|
|
#define FIELD_TYPE_MEDIUM_BLOB MYSQL_TYPE_MEDIUM_BLOB
|
|
#define FIELD_TYPE_LONG_BLOB MYSQL_TYPE_LONG_BLOB
|
|
#define FIELD_TYPE_BLOB MYSQL_TYPE_BLOB
|
|
#define FIELD_TYPE_VAR_STRING MYSQL_TYPE_VAR_STRING
|
|
#define FIELD_TYPE_STRING MYSQL_TYPE_STRING
|
|
#define FIELD_TYPE_CHAR MYSQL_TYPE_TINY
|
|
#define FIELD_TYPE_INTERVAL MYSQL_TYPE_ENUM
|
|
#define FIELD_TYPE_GEOMETRY MYSQL_TYPE_GEOMETRY
|
|
|
|
#if TO_BE_INCLUDED_LATER
|
|
/* For bind applications, to indicate unsigned buffers */
|
|
#define MYSQL_TYPE_UTINY -10
|
|
#define MYSQL_TYPE_USHORT -9
|
|
#define MYSQL_TYPE_ULONG -8
|
|
#define MYSQL_TYPE_UFLOAT -7
|
|
#define MYSQL_TYPE_UDOUBLE -6
|
|
#define MYSQL_TYPE_ULONGLONG -5
|
|
#define MYSQL_TYPE_UINT24 -4
|
|
#endif
|
|
|
|
/* options for mysql_set_option */
|
|
enum enum_mysql_set_option
|
|
{
|
|
MYSQL_OPTION_MULTI_STATEMENTS_ON,
|
|
MYSQL_OPTION_MULTI_STATEMENTS_OFF
|
|
};
|
|
|
|
#define net_new_transaction(net) ((net)->pkt_nr=0)
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
my_bool my_net_init(NET *net, Vio* vio);
|
|
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,
|
|
const char *packet, unsigned long len);
|
|
int net_real_write(NET *net,const char *packet,unsigned long len);
|
|
unsigned long my_net_read(NET *net);
|
|
|
|
/*
|
|
The following function is not meant for normal usage
|
|
Currently it's used internally by manager.c
|
|
*/
|
|
struct sockaddr;
|
|
int my_connect(my_socket s, const struct sockaddr *name, unsigned int namelen,
|
|
unsigned int timeout);
|
|
|
|
struct rand_struct {
|
|
unsigned long seed1,seed2,max_value;
|
|
double max_value_dbl;
|
|
};
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
/* The following is for user defined functions */
|
|
|
|
enum Item_result {STRING_RESULT, REAL_RESULT, INT_RESULT, ROW_RESULT};
|
|
|
|
typedef struct st_udf_args
|
|
{
|
|
unsigned int arg_count; /* Number of arguments */
|
|
enum Item_result *arg_type; /* Pointer to item_results */
|
|
char **args; /* Pointer to argument */
|
|
unsigned long *lengths; /* Length of string arguments */
|
|
char *maybe_null; /* Set to 1 for all maybe_null args */
|
|
} UDF_ARGS;
|
|
|
|
/* This holds information about the result */
|
|
|
|
typedef struct st_udf_init
|
|
{
|
|
my_bool maybe_null; /* 1 if function can return NULL */
|
|
unsigned int decimals; /* for real functions */
|
|
unsigned long max_length; /* For string functions */
|
|
char *ptr; /* free pointer for function data */
|
|
my_bool const_item; /* 0 if result is independent of arguments */
|
|
} UDF_INIT;
|
|
|
|
/* Constants when using compression */
|
|
#define NET_HEADER_SIZE 4 /* standard header size */
|
|
#define COMP_HEADER_SIZE 3 /* compression header extra size */
|
|
|
|
/* Prototypes to password functions */
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
extern unsigned long max_allowed_packet;
|
|
extern unsigned long net_buffer_length;
|
|
|
|
/*
|
|
These functions are used for authentication by client and server and
|
|
implemented in sql/password.c
|
|
*/
|
|
|
|
void randominit(struct rand_struct *, unsigned long seed1,
|
|
unsigned long seed2);
|
|
double my_rnd(struct rand_struct *);
|
|
void create_random_string(char *to, unsigned int length, struct rand_struct *rand_st);
|
|
|
|
void hash_password(unsigned long *to, const char *password, unsigned int password_len);
|
|
void make_scrambled_password_323(char *to, const char *password);
|
|
void scramble_323(char *to, const char *message, const char *password);
|
|
my_bool check_scramble_323(const char *, const char *message,
|
|
unsigned long *salt);
|
|
void get_salt_from_password_323(unsigned long *res, const char *password);
|
|
void make_password_from_salt_323(char *to, const unsigned long *salt);
|
|
|
|
void make_scrambled_password(char *to, const char *password);
|
|
void scramble(char *to, const char *message, const char *password);
|
|
my_bool check_scramble(const char *reply, const char *message,
|
|
const unsigned char *hash_stage2);
|
|
void get_salt_from_password(unsigned char *res, const char *password);
|
|
void make_password_from_salt(char *to, const unsigned char *hash_stage2);
|
|
|
|
/* end of password.c */
|
|
|
|
char *get_tty_password(char *opt_message);
|
|
const char *mysql_errno_to_sqlstate(unsigned int mysql_errno);
|
|
|
|
/* Some other useful functions */
|
|
|
|
void my_init(void);
|
|
int load_defaults(const char *conf_file, const char **groups,
|
|
int *argc, char ***argv);
|
|
my_bool my_thread_init(void);
|
|
void my_thread_end(void);
|
|
|
|
#ifdef _global_h
|
|
ulong STDCALL net_field_length(uchar **packet);
|
|
my_ulonglong net_field_length_ll(uchar **packet);
|
|
char *net_store_length(char *pkg, ulonglong length);
|
|
#endif
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#define NULL_LENGTH ((unsigned long) ~0) /* For net_store_length */
|
|
#define MYSQL_STMT_HEADER 4
|
|
#define MYSQL_LONG_DATA_HEADER 6
|
|
|
|
#endif
|