Commit e7b9eabe authored by unknown's avatar unknown

Added support of INSERT to MERGE tables

Fixes for embedded libary and openssl


BUILD/compile-pentium-debug-max:
  Added --with-openssl
acinclude.m4:
  Cleanup
client/client_priv.h:
  Include mysql_embed.h to remove not used functions in embedded server
client/mysql.cc:
  Don't use openssl with embedded server
include/Makefile.am:
  Move mysql_embed.h to 'include' directory
include/myisammrg.h:
  Added support of INSERT to MERGE tables
include/mysql.h:
  Fixes for embedded libary and openssl
include/mysql_com.h:
  Fixes for embedded libary and openssl
include/mysql_embed.h:
  Fixes for embedded libary and openssl
include/violite.h:
  Cleanup
libmysql/libmysql.c:
  Safety
libmysqld/examples/Makefile.am:
  Fixes for embedded libary and openssl
libmysqld/lib_sql.cc:
  Fixes for embedded libary and openssl
libmysqld/lib_vio.c:
  Fixes for embedded libary and openssl
libmysqld/libmysqld.c:
  Fixes for embedded libary and openssl
myisammrg/Makefile.am:
  Added support of INSERT to MERGE tables
myisammrg/myrg_create.c:
  Added support of INSERT to MERGE tables
myisammrg/myrg_open.c:
  Added support of INSERT to MERGE tables
myisammrg/myrg_static.c:
  Added support of INSERT to MERGE tables
mysql-test/t/union.test:
  Portability fix
sql/Makefile.am:
  Fixes for embedded libary and openssl
sql/gen_lex_hash.cc:
  Added support of INSERT to MERGE tables
sql/ha_myisammrg.cc:
  Added support of INSERT to MERGE tables
sql/handler.h:
  Added support of INSERT to MERGE tables
sql/mini_client.cc:
  Fixes for embedded libary and openssl
sql/net_serv.cc:
  Fixes for embedded libary and openssl
sql/sql_show.cc:
  Cleanup
Build-tools/Do-all-build-steps:
  Don't build openssl (Need to add proper configure test when to build ssl)
sql/lex.h:
  Added support of INSERT to MERGE tables
sql/sql_yacc.yy:
  Fixes for embedded libary and openssl
parent 2504336b
...@@ -8,6 +8,6 @@ c_warnings="$c_warnings $debug_extra_warnings" ...@@ -8,6 +8,6 @@ c_warnings="$c_warnings $debug_extra_warnings"
cxx_warnings="$cxx_warnings $debug_extra_warnings" cxx_warnings="$cxx_warnings $debug_extra_warnings"
extra_configs="$pentium_configs $debug_configs" extra_configs="$pentium_configs $debug_configs"
extra_configs="$extra_configs --with-berkeley-db --with-innodb --with-embedded-server" extra_configs="$extra_configs --with-berkeley-db --with-innodb --with-vio --with-openssl --with-embedded-server"
. "$path/FINISH.sh" . "$path/FINISH.sh"
...@@ -65,7 +65,6 @@ aclocal; autoheader; aclocal; automake; autoconf ...@@ -65,7 +65,6 @@ aclocal; autoheader; aclocal; automake; autoconf
--enable-thread-safe-client \ --enable-thread-safe-client \
--with-berkeley-db \ --with-berkeley-db \
--with-innodb \ --with-innodb \
--with-openssl \
--with-vio \ --with-vio \
--without-pstack \ --without-pstack \
--with-extra-tools \ --with-extra-tools \
......
...@@ -690,8 +690,7 @@ fi ...@@ -690,8 +690,7 @@ fi
AC_DEFUN(MYSQL_CHECK_VIO, [ AC_DEFUN(MYSQL_CHECK_VIO, [
AC_ARG_WITH([vio], AC_ARG_WITH([vio],
[\ [ --with-vio Include the Virtual IO support],
--with-vio Include the Virtual IO support],
[vio="$withval"], [vio="$withval"],
[vio=no]) [vio=no])
...@@ -712,8 +711,7 @@ AC_DEFUN(MYSQL_CHECK_VIO, [ ...@@ -712,8 +711,7 @@ AC_DEFUN(MYSQL_CHECK_VIO, [
AC_DEFUN(MYSQL_CHECK_OPENSSL, [ AC_DEFUN(MYSQL_CHECK_OPENSSL, [
AC_MSG_CHECKING(for OpenSSL) AC_MSG_CHECKING(for OpenSSL)
AC_ARG_WITH([openssl], AC_ARG_WITH([openssl],
[\ [ --with-openssl Include the OpenSSL support],
--with-openssl Include the OpenSSL support],
[openssl="$withval"], [openssl="$withval"],
[openssl=no]) [openssl=no])
...@@ -722,7 +720,7 @@ AC_MSG_CHECKING(for OpenSSL) ...@@ -722,7 +720,7 @@ AC_MSG_CHECKING(for OpenSSL)
if test -n "$vio_dir" if test -n "$vio_dir"
then then
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
openssl_libs="-lssl -lcrypto -L/usr/local/ssl/lib" openssl_libs="-L/usr/local/ssl/lib -lssl -lcrypto"
openssl_includes="-I/usr/local/ssl/include" openssl_includes="-I/usr/local/ssl/include"
else else
AC_MSG_ERROR([OpenSSL requires Virtual IO support (--with-vio)]) AC_MSG_ERROR([OpenSSL requires Virtual IO support (--with-vio)])
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include <my_global.h> #include <my_global.h>
#include <my_sys.h> #include <my_sys.h>
#include <m_string.h> #include <m_string.h>
#include <mysql_embed.h>
#include <mysql.h> #include <mysql.h>
#include <errmsg.h> #include <errmsg.h>
#include <getopt.h> #include <getopt.h>
......
...@@ -303,6 +303,7 @@ int main(int argc,char *argv[]) ...@@ -303,6 +303,7 @@ int main(int argc,char *argv[])
exit(1); exit(1);
glob_buffer.realloc(512); glob_buffer.realloc(512);
completion_hash_init(&ht,50); completion_hash_init(&ht,50);
bzero((char*) &mysql, sizeof(mysql));
if (sql_connect(current_host,current_db,current_user,opt_password, if (sql_connect(current_host,current_db,current_user,opt_password,
opt_silent)) opt_silent))
{ {
...@@ -326,11 +327,13 @@ int main(int argc,char *argv[]) ...@@ -326,11 +327,13 @@ int main(int argc,char *argv[])
put_info((char*) glob_buffer.ptr(),INFO_INFO); put_info((char*) glob_buffer.ptr(),INFO_INFO);
#ifdef HAVE_OPENSSL #ifdef HAVE_OPENSSL
if(mysql.net.vio->ssl_ && SSL_get_cipher(mysql.net.vio->ssl_)) { if (mysql.net.vio->ssl_ && SSL_get_cipher(mysql.net.vio->ssl_))
{
sprintf((char*) glob_buffer.ptr(), sprintf((char*) glob_buffer.ptr(),
"SSL cipher in use is %s\n", SSL_get_cipher(mysql.net.vio->ssl_)); "SSL cipher in use is %s\n", SSL_get_cipher(mysql.net.vio->ssl_));
put_info((char*) glob_buffer.ptr(),INFO_INFO); put_info((char*) glob_buffer.ptr(),INFO_INFO);
} else }
else
put_info("SSL is not in use\n",INFO_INFO); put_info("SSL is not in use\n",INFO_INFO);
#endif /* HAVE_OPENSSL */ #endif /* HAVE_OPENSSL */
...@@ -373,13 +376,7 @@ int main(int argc,char *argv[]) ...@@ -373,13 +376,7 @@ int main(int argc,char *argv[])
sig_handler mysql_end(int sig) sig_handler mysql_end(int sig)
{ {
if (connected)
mysql_close(&mysql); mysql_close(&mysql);
#ifdef HAVE_OPENSSL
else
mysql_ssl_clear(&mysql); /* SSL data structres should be freed
even if connection was not made */
#endif
#ifdef HAVE_READLINE #ifdef HAVE_READLINE
if (!status.batch && !quick && !opt_html && !opt_xml) if (!status.batch && !quick && !opt_html && !opt_xml)
{ {
...@@ -2208,16 +2205,8 @@ static int ...@@ -2208,16 +2205,8 @@ static int
sql_real_connect(char *host,char *database,char *user,char *password, sql_real_connect(char *host,char *database,char *user,char *password,
uint silent) uint silent)
{ {
if (connected)
{ /* if old is open, close it first */
mysql_close(&mysql); mysql_close(&mysql);
connected= 0; connected= 0;
}
#ifdef HAVE_OPENSSL
else
mysql_ssl_clear(&mysql); /* SSL data structres should be freed
even if connection was not made */
#endif
mysql_init(&mysql); mysql_init(&mysql);
if (opt_connect_timeout) if (opt_connect_timeout)
{ {
...@@ -2569,7 +2558,7 @@ static void mysql_end_timer(ulong start_time,char *buff) ...@@ -2569,7 +2558,7 @@ static void mysql_end_timer(ulong start_time,char *buff)
strmov(strend(buff),")"); strmov(strend(buff),")");
} }
#ifndef EMBEDDED_SERVER #ifndef EMBEDDED_LIBRARY
/* Keep sql_string library happy */ /* Keep sql_string library happy */
gptr sql_alloc(unsigned int Size) gptr sql_alloc(unsigned int Size)
...@@ -2581,4 +2570,4 @@ void sql_element_free(void *ptr) ...@@ -2581,4 +2570,4 @@ void sql_element_free(void *ptr)
{ {
my_free((gptr) ptr,MYF(0)); my_free((gptr) ptr,MYF(0));
} }
#endif /* EMBEDDED_SERVER */ #endif /* EMBEDDED_LIBRARY */
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
# MA 02111-1307, USA # MA 02111-1307, USA
BUILT_SOURCES = mysql_version.h m_ctype.h my_config.h BUILT_SOURCES = mysql_version.h m_ctype.h my_config.h
pkginclude_HEADERS = dbug.h m_string.h my_sys.h mysql.h mysql_com.h \ pkginclude_HEADERS = dbug.h m_string.h my_sys.h my_list.h \
mysqld_error.h my_list.h \ mysql.h mysql_com.h mysqld_error.h mysql_embed.h \
my_pthread.h my_no_pthread.h raid.h errmsg.h \ my_pthread.h my_no_pthread.h raid.h errmsg.h \
my_global.h my_net.h \ my_global.h my_net.h \
sslopt-case.h sslopt-longopts.h sslopt-usage.h \ sslopt-case.h sslopt-longopts.h sslopt-usage.h \
......
...@@ -34,6 +34,13 @@ extern "C" { ...@@ -34,6 +34,13 @@ extern "C" {
#define MYRG_NAME_EXT ".MRG" #define MYRG_NAME_EXT ".MRG"
/* In which table to INSERT rows */
#define MERGE_INSERT_DISABLED 0
#define MERGE_INSERT_TO_FIRST 1
#define MERGE_INSERT_TO_LAST 2
extern TYPELIB merge_insert_method;
/* Param to/from myrg_info */ /* Param to/from myrg_info */
typedef struct st_mymerge_info /* Struct from h_info */ typedef struct st_mymerge_info /* Struct from h_info */
...@@ -44,7 +51,7 @@ typedef struct st_mymerge_info /* Struct from h_info */ ...@@ -44,7 +51,7 @@ typedef struct st_mymerge_info /* Struct from h_info */
ulonglong data_file_length; ulonglong data_file_length;
uint reclength; /* Recordlength */ uint reclength; /* Recordlength */
int errkey; /* With key was dupplicated on err */ int errkey; /* With key was dupplicated on err */
uint options; /* HA_OPTIONS_... used */ uint options; /* HA_OPTION_... used */
} MYMERGE_INFO; } MYMERGE_INFO;
typedef struct st_myrg_table_info typedef struct st_myrg_table_info
...@@ -56,6 +63,7 @@ typedef struct st_myrg_table_info ...@@ -56,6 +63,7 @@ typedef struct st_myrg_table_info
typedef struct st_myrg_info typedef struct st_myrg_info
{ {
MYRG_TABLE *open_tables,*current_table,*end_table,*last_used_table; MYRG_TABLE *open_tables,*current_table,*end_table,*last_used_table;
uint merge_insert_method;
ulonglong records; /* records in tables */ ulonglong records; /* records in tables */
ulonglong del; /* Removed records */ ulonglong del; /* Removed records */
ulonglong data_file_length; ulonglong data_file_length;
...@@ -81,10 +89,11 @@ extern int myrg_rkey(MYRG_INFO *file,byte *buf,int inx,const byte *key, ...@@ -81,10 +89,11 @@ extern int myrg_rkey(MYRG_INFO *file,byte *buf,int inx,const byte *key,
extern int myrg_rrnd(MYRG_INFO *file,byte *buf,ulonglong pos); extern int myrg_rrnd(MYRG_INFO *file,byte *buf,ulonglong pos);
extern int myrg_rsame(MYRG_INFO *file,byte *record,int inx); extern int myrg_rsame(MYRG_INFO *file,byte *record,int inx);
extern int myrg_update(MYRG_INFO *file,const byte *old,byte *new_rec); extern int myrg_update(MYRG_INFO *file,const byte *old,byte *new_rec);
extern int myrg_write(MYRG_INFO *info,byte *rec);
extern int myrg_status(MYRG_INFO *file,MYMERGE_INFO *x,int flag); extern int myrg_status(MYRG_INFO *file,MYMERGE_INFO *x,int flag);
extern int myrg_lock_database(MYRG_INFO *file,int lock_type); extern int myrg_lock_database(MYRG_INFO *file,int lock_type);
extern int myrg_create(const char *name,const char **table_names, extern int myrg_create(const char *name, const char **table_names,
my_bool fix_names); uint insert_method, my_bool fix_names);
extern int myrg_extra(MYRG_INFO *file,enum ha_extra_function function); extern int myrg_extra(MYRG_INFO *file,enum ha_extra_function function);
extern ha_rows myrg_records_in_range(MYRG_INFO *info,int inx, extern ha_rows myrg_records_in_range(MYRG_INFO *info,int inx,
const byte *start_key,uint start_key_len, const byte *start_key,uint start_key_len,
......
...@@ -48,32 +48,15 @@ typedef char my_bool; ...@@ -48,32 +48,15 @@ typedef char my_bool;
#endif #endif
typedef char * gptr; typedef char * gptr;
#ifndef ST_USED_MEM_DEFINED
#define ST_USED_MEM_DEFINED
typedef struct st_used_mem { /* struct for once_alloc */
struct st_used_mem *next; /* Next block in use */
unsigned int left; /* memory left in block */
unsigned int size; /* size of block */
} USED_MEM;
typedef struct st_mem_root {
USED_MEM *free;
USED_MEM *used;
USED_MEM *pre_alloc;
unsigned int min_malloc;
unsigned int block_size;
void (*error_handler)(void);
} MEM_ROOT;
#endif
#ifndef my_socket_defined #ifndef my_socket_defined
#ifdef __WIN__ #ifdef __WIN__
#define my_socket SOCKET #define my_socket SOCKET
#else #else
typedef int my_socket; typedef int my_socket;
#endif #endif /* __WIN__ */
#endif #endif /* my_socket_defined */
#endif #endif /* _global_h */
#include "mysql_com.h" #include "mysql_com.h"
#include "mysql_version.h" #include "mysql_version.h"
...@@ -118,6 +101,24 @@ typedef struct st_mysql_rows { ...@@ -118,6 +101,24 @@ typedef struct st_mysql_rows {
typedef MYSQL_ROWS *MYSQL_ROW_OFFSET; /* offset to current row */ typedef MYSQL_ROWS *MYSQL_ROW_OFFSET; /* offset to current row */
#ifndef ST_USED_MEM_DEFINED
#define ST_USED_MEM_DEFINED
typedef struct st_used_mem { /* struct for once_alloc */
struct st_used_mem *next; /* Next block in use */
unsigned int left; /* memory left in block */
unsigned int size; /* size of block */
} USED_MEM;
typedef struct st_mem_root {
USED_MEM *free;
USED_MEM *used;
USED_MEM *pre_alloc;
unsigned int min_malloc;
unsigned int block_size;
void (*error_handler)(void);
} MEM_ROOT;
#endif
typedef struct st_mysql_data { typedef struct st_mysql_data {
my_ulonglong rows; my_ulonglong rows;
unsigned int fields; unsigned int fields;
......
...@@ -113,10 +113,12 @@ typedef struct st_net { ...@@ -113,10 +113,12 @@ typedef struct st_net {
unsigned int last_errno,max_packet,timeout,pkt_nr; unsigned int last_errno,max_packet,timeout,pkt_nr;
unsigned char error; unsigned char error;
my_bool return_errno,compress; my_bool return_errno,compress;
my_bool no_send_ok; /* needed if we are doing several /*
queries in one command ( as in LOAD TABLE ... FROM MASTER ), 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 and do not want to confuse the client with OK at the wrong time
*/ */
my_bool no_send_ok;
unsigned long remain_in_buf,length, buf_length, where_b; unsigned long remain_in_buf,length, buf_length, where_b;
unsigned int *return_status; unsigned int *return_status;
unsigned char reading_or_writing; unsigned char reading_or_writing;
......
...@@ -22,5 +22,8 @@ ...@@ -22,5 +22,8 @@
#undef HAVE_PSTACK /* No stacktrace */ #undef HAVE_PSTACK /* No stacktrace */
#undef HAVE_DLOPEN /* No udf functions */ #undef HAVE_DLOPEN /* No udf functions */
#undef HAVE_OPENSSL
#undef HAVE_VIO
#define DONT_USE_RAID
#endif /* EMBEDDED_LIBRARY */ #endif /* EMBEDDED_LIBRARY */
...@@ -39,9 +39,7 @@ enum enum_vio_type { VIO_CLOSED, VIO_TYPE_TCPIP, VIO_TYPE_SOCKET, ...@@ -39,9 +39,7 @@ enum enum_vio_type { VIO_CLOSED, VIO_TYPE_TCPIP, VIO_TYPE_SOCKET,
#define HANDLE void * #define HANDLE void *
#endif #endif
Vio* vio_new(my_socket sd, Vio* vio_new(my_socket sd, enum enum_vio_type type, my_bool localhost);
enum enum_vio_type type,
my_bool localhost);
#ifdef __WIN__ #ifdef __WIN__
Vio* vio_new_win32pipe(HANDLE hPipe); Vio* vio_new_win32pipe(HANDLE hPipe);
#endif #endif
...@@ -51,38 +49,32 @@ void vio_delete(Vio* vio); ...@@ -51,38 +49,32 @@ void vio_delete(Vio* vio);
void vio_reset(Vio *vio); void vio_reset(Vio *vio);
#else #else
void vio_reset(Vio* vio, enum enum_vio_type type, void vio_reset(Vio* vio, enum enum_vio_type type,
my_socket sd, HANDLE hPipe, my_socket sd, HANDLE hPipe, my_bool localhost);
my_bool localhost);
#endif #endif
/* /*
* vio_read and vio_write should have the same semantics * vio_read and vio_write should have the same semantics
* as read(2) and write(2). * as read(2) and write(2).
*/ */
int vio_read( Vio* vio, int vio_read(Vio *vio, gptr buf, int size);
gptr buf, int size); int vio_write(Vio *vio, const gptr buf, int size);
int vio_write( Vio* vio,
const gptr buf,
int size);
/* /*
* Whenever the socket is set to blocking mode or not. * Whenever the socket is set to blocking mode or not.
*/ */
int vio_blocking( Vio* vio, int vio_blocking(Vio *vio, my_bool onoff);
my_bool onoff); my_bool vio_is_blocking(Vio *vio);
my_bool vio_is_blocking( Vio* vio);
/* /*
* setsockopt TCP_NODELAY at IPPROTO_TCP level, when possible. * setsockopt TCP_NODELAY at IPPROTO_TCP level, when possible.
*/ */
int vio_fastsend( Vio* vio); int vio_fastsend(Vio *vio);
/* /*
* setsockopt SO_KEEPALIVE at SOL_SOCKET level, when possible. * setsockopt SO_KEEPALIVE at SOL_SOCKET level, when possible.
*/ */
int vio_keepalive( Vio* vio, int vio_keepalive(Vio *vio, my_bool onoff);
my_bool onoff);
/* /*
* Whenever we should retry the last read/write operation. * Whenever we should retry the last read/write operation.
*/ */
my_bool vio_should_retry( Vio* vio); my_bool vio_should_retry(Vio *vio);
/* /*
* When the workday is over... * When the workday is over...
*/ */
...@@ -90,10 +82,10 @@ int vio_close(Vio* vio); ...@@ -90,10 +82,10 @@ int vio_close(Vio* vio);
/* /*
* Short text description of the socket for those, who are curious.. * Short text description of the socket for those, who are curious..
*/ */
const char* vio_description( Vio* vio); const char* vio_description(Vio *vio);
/* Return the type of the connection */ /* Return the type of the connection */
enum enum_vio_type vio_type(Vio* vio); enum enum_vio_type vio_type(Vio* vio);
/* Return last error number */ /* Return last error number */
int vio_errno(Vio*vio); int vio_errno(Vio*vio);
...@@ -117,8 +109,8 @@ my_bool vio_poll_read(Vio *vio,uint timeout); ...@@ -117,8 +109,8 @@ my_bool vio_poll_read(Vio *vio,uint timeout);
} }
#endif #endif
#endif /* vio_violite_h_ */ #endif /* vio_violite_h_ */
#ifdef HAVE_VIO
#ifndef DONT_MAP_VIO #if defined(HAVE_VIO) && !defined(DONT_MAP_VIO)
#define vio_delete(vio) (vio)->viodelete(vio) #define vio_delete(vio) (vio)->viodelete(vio)
#define vio_errno(vio) (vio)->vioerrno(vio) #define vio_errno(vio) (vio)->vioerrno(vio)
#define vio_read(vio, buf, size) (vio)->read(vio,buf,size) #define vio_read(vio, buf, size) (vio)->read(vio,buf,size)
...@@ -132,9 +124,7 @@ my_bool vio_poll_read(Vio *vio,uint timeout); ...@@ -132,9 +124,7 @@ my_bool vio_poll_read(Vio *vio,uint timeout);
#define vio_peer_addr(vio, buf) (vio)->peer_addr(vio, buf) #define vio_peer_addr(vio, buf) (vio)->peer_addr(vio, buf)
#define vio_in_addr(vio, in) (vio)->in_addr(vio, in) #define vio_in_addr(vio, in) (vio)->in_addr(vio, in)
#define vio_poll_read(vio,timeout) (vio)->poll_read(vio,timeout) #define vio_poll_read(vio,timeout) (vio)->poll_read(vio,timeout)
#endif /* !DONT_MAP_VIO */ #endif /* defined(HAVE_VIO) && !defined(DONT_MAP_VIO) */
#endif /* HAVE_VIO */
#ifdef HAVE_OPENSSL #ifdef HAVE_OPENSSL
#define HEADER_DES_LOCL_H dummy_something #define HEADER_DES_LOCL_H dummy_something
...@@ -142,7 +132,6 @@ my_bool vio_poll_read(Vio *vio,uint timeout); ...@@ -142,7 +132,6 @@ my_bool vio_poll_read(Vio *vio,uint timeout);
#include <openssl/err.h> #include <openssl/err.h>
#include "my_net.h" /* needed because of struct in_addr */ #include "my_net.h" /* needed because of struct in_addr */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif /* __cplusplus */ #endif /* __cplusplus */
...@@ -170,8 +159,6 @@ void vio_ssl_in_addr(Vio *vio, struct in_addr *in); ...@@ -170,8 +159,6 @@ void vio_ssl_in_addr(Vio *vio, struct in_addr *in);
/* Return 1 if there is data to be read */ /* Return 1 if there is data to be read */
my_bool vio_ssl_poll_read(Vio *vio,uint timeout); my_bool vio_ssl_poll_read(Vio *vio,uint timeout);
#ifdef HAVE_OPENSSL
/* Single copy for server */ /* Single copy for server */
struct st_VioSSLAcceptorFd struct st_VioSSLAcceptorFd
{ {
...@@ -200,14 +187,12 @@ struct st_VioSSLConnectorFd ...@@ -200,14 +187,12 @@ struct st_VioSSLConnectorFd
void sslaccept(struct st_VioSSLAcceptorFd*, Vio*); void sslaccept(struct st_VioSSLAcceptorFd*, Vio*);
void sslconnect(struct st_VioSSLConnectorFd*, Vio*); void sslconnect(struct st_VioSSLConnectorFd*, Vio*);
#else /* HAVE_OPENSSL */ struct st_VioSSLConnectorFd
/* This dummy is required to maintain proper size of st_mysql in mysql.h */ *new_VioSSLConnectorFd(const char* key_file, const char* cert_file,
struct st_VioSSLConnectorFd {}; const char* ca_file, const char* ca_path);
#endif /* HAVE_OPENSSL */ struct st_VioSSLAcceptorFd
struct st_VioSSLConnectorFd *new_VioSSLConnectorFd( *new_VioSSLAcceptorFd(const char* key_file, const char* cert_file,
const char* key_file,const char* cert_file,const char* ca_file,const char* ca_path); const char* ca_file,const char* ca_path);
struct st_VioSSLAcceptorFd *new_VioSSLAcceptorFd(
const char* key_file,const char* cert_file,const char* ca_file,const char* ca_path);
Vio* new_VioSSL(struct st_VioSSLAcceptorFd* fd, Vio* sd,int state); Vio* new_VioSSL(struct st_VioSSLAcceptorFd* fd, Vio* sd,int state);
#ifdef __cplusplus #ifdef __cplusplus
...@@ -230,18 +215,18 @@ struct st_vio ...@@ -230,18 +215,18 @@ struct st_vio
#ifdef HAVE_VIO #ifdef HAVE_VIO
/* function pointers. They are similar for socket/SSL/whatever */ /* function pointers. They are similar for socket/SSL/whatever */
void (*viodelete)(Vio*); void (*viodelete)(Vio*);
int(*vioerrno)(Vio*); int (*vioerrno)(Vio*);
int(*read)(Vio*, gptr, int); int (*read)(Vio*, gptr, int);
int(*write)(Vio*, gptr, int); int (*write)(Vio*, gptr, int);
int(*vioblocking)(Vio*, my_bool); int (*vioblocking)(Vio*, my_bool);
my_bool(*is_blocking)(Vio*); my_bool (*is_blocking)(Vio*);
int(*viokeepalive)(Vio*, my_bool); int (*viokeepalive)(Vio*, my_bool);
int(*fastsend)(Vio*); int (*fastsend)(Vio*);
my_bool(*peer_addr)(Vio*, gptr); my_bool (*peer_addr)(Vio*, gptr);
void(*in_addr)(Vio*, struct in_addr*); void (*in_addr)(Vio*, struct in_addr*);
my_bool(*should_retry)(Vio*); my_bool (*should_retry)(Vio*);
int(*vioclose)(Vio*); int (*vioclose)(Vio*);
my_bool(*poll_read)(Vio*,uint); my_bool (*poll_read)(Vio*,uint);
#ifdef HAVE_OPENSSL #ifdef HAVE_OPENSSL
BIO* bio_; BIO* bio_;
...@@ -252,4 +237,3 @@ struct st_vio ...@@ -252,4 +237,3 @@ struct st_vio
#endif /* HAVE_VIO */ #endif /* HAVE_VIO */
}; };
#endif /* EMBEDDED_LIBRARY */ #endif /* EMBEDDED_LIBRARY */
...@@ -2014,6 +2014,7 @@ mysql_close(MYSQL *mysql) ...@@ -2014,6 +2014,7 @@ mysql_close(MYSQL *mysql)
mysql_close(tmp); mysql_close(tmp);
tmp = tmp1; tmp = tmp1;
} }
mysql->rpl_pivot=0;
} }
if (mysql != mysql->master) if (mysql != mysql->master)
mysql_close(mysql->master); mysql_close(mysql->master);
......
...@@ -7,7 +7,7 @@ link_sources: ...@@ -7,7 +7,7 @@ link_sources:
@LN_CP_F@ $(srcdir)/../../client/$$f $(srcdir)/$$f; \ @LN_CP_F@ $(srcdir)/../../client/$$f $(srcdir)/$$f; \
done; done;
DEFS = -DEMBEDDED_SERVER DEFS = -DEMBEDDED_LIBRARY
INCLUDES = -I$(top_srcdir)/include $(openssl_includes) \ INCLUDES = -I$(top_srcdir)/include $(openssl_includes) \
-I$(srcdir) -I$(top_srcdir) -I$(top_srcdir)/client -I$(srcdir) -I$(top_srcdir) -I$(top_srcdir)/client
LIBS = @LIBS@ LIBS = @LIBS@
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
* *
*/ */
#include "my_global.h" #include "my_global.h"
#include "mysql_embed.h"
#include "my_pthread.h" #include "my_pthread.h"
#include "sys/types.h" #include "sys/types.h"
#include "../regex/regex.h" #include "../regex/regex.h"
......
...@@ -23,12 +23,13 @@ ...@@ -23,12 +23,13 @@
*/ */
#include <my_global.h> #include <my_global.h>
#include "mysql_embed.h"
#include "mysql.h"
#ifndef HAVE_VIO /* is Vio suppored by the Vio lib ? */ #ifndef HAVE_VIO /* is Vio suppored by the Vio lib ? */
#include <errno.h> #include <errno.h>
#include <my_sys.h> #include <my_sys.h>
#include "mysql.h"
#include <violite.h> #include <violite.h>
#include <my_sys.h> #include <my_sys.h>
#include <my_net.h> #include <my_net.h>
......
...@@ -15,19 +15,19 @@ ...@@ -15,19 +15,19 @@
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA */ MA 02111-1307, USA */
#define DONT_USE_RAID
#include <my_global.h> #include <my_global.h>
#if defined(__WIN__) || defined(_WIN32) || defined(_WIN64) #if defined(__WIN__) || defined(_WIN32) || defined(_WIN64)
#include <winsock.h> #include <winsock.h>
#include <odbcinst.h> #include <odbcinst.h>
#endif #endif
#include "mysql_embed.h"
#include "mysql.h"
#include "mysql_version.h"
#include "mysqld_error.h"
#include <my_sys.h> #include <my_sys.h>
#include <mysys_err.h> #include <mysys_err.h>
#include <m_string.h> #include <m_string.h>
#include <m_ctype.h> #include <m_ctype.h>
#include "mysql.h"
#include "mysql_version.h"
#include "mysqld_error.h"
#include "errmsg.h" #include "errmsg.h"
#include <violite.h> #include <violite.h>
#include <sys/stat.h> #include <sys/stat.h>
...@@ -88,7 +88,6 @@ static int read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row, ...@@ -88,7 +88,6 @@ static int read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row,
static void end_server(MYSQL *mysql); static void end_server(MYSQL *mysql);
static void read_user_name(char *name); static void read_user_name(char *name);
static void append_wild(char *to,char *end,const char *wild); static void append_wild(char *to,char *end,const char *wild);
static my_bool mysql_reconnect(MYSQL *mysql);
static int send_file_to_server(MYSQL *mysql,const char *filename); static int send_file_to_server(MYSQL *mysql,const char *filename);
static sig_handler pipe_sig_handler(int sig); static sig_handler pipe_sig_handler(int sig);
static ulong mysql_sub_escape_string(CHARSET_INFO *charset_info, char *to, static ulong mysql_sub_escape_string(CHARSET_INFO *charset_info, char *to,
...@@ -1346,35 +1345,6 @@ error: ...@@ -1346,35 +1345,6 @@ error:
} }
static my_bool mysql_reconnect(MYSQL *mysql)
{
MYSQL tmp_mysql;
DBUG_ENTER("mysql_reconnect");
if (!mysql->reconnect ||
(mysql->server_status & SERVER_STATUS_IN_TRANS) || !mysql->host_info)
{
/* Allov reconnect next time */
mysql->server_status&= ~SERVER_STATUS_IN_TRANS;
DBUG_RETURN(1);
}
mysql_init(&tmp_mysql);
tmp_mysql.options=mysql->options;
if (!mysql_real_connect(&tmp_mysql,mysql->host,mysql->user,mysql->passwd,
mysql->db, mysql->port, mysql->unix_socket,
mysql->client_flag))
DBUG_RETURN(1);
tmp_mysql.free_me=mysql->free_me;
mysql->free_me=0;
bzero((char*) &mysql->options,sizeof(mysql->options));
mysql_close(mysql);
*mysql=tmp_mysql;
net_clear(&mysql->net);
mysql->affected_rows= ~(my_ulonglong) 0;
DBUG_RETURN(0);
}
/************************************************************************** /**************************************************************************
** Change user and database ** Change user and database
**************************************************************************/ **************************************************************************/
......
...@@ -21,7 +21,7 @@ libmyisammrg_a_SOURCES = myrg_open.c myrg_extra.c myrg_info.c myrg_locking.c \ ...@@ -21,7 +21,7 @@ libmyisammrg_a_SOURCES = myrg_open.c myrg_extra.c myrg_info.c myrg_locking.c \
myrg_rrnd.c myrg_update.c myrg_delete.c myrg_rsame.c \ myrg_rrnd.c myrg_update.c myrg_delete.c myrg_rsame.c \
myrg_panic.c myrg_close.c myrg_create.c myrg_static.c \ myrg_panic.c myrg_close.c myrg_create.c myrg_static.c \
myrg_rkey.c myrg_rfirst.c myrg_rlast.c myrg_rnext.c \ myrg_rkey.c myrg_rfirst.c myrg_rlast.c myrg_rnext.c \
myrg_rprev.c myrg_queue.c myrg_rprev.c myrg_queue.c myrg_write.c
OMIT_DEPENDENCIES = pthread.h stdio.h __stdio.h stdlib.h __stdlib.h math.h\ OMIT_DEPENDENCIES = pthread.h stdio.h __stdio.h stdlib.h __stdlib.h math.h\
__math.h time.h __time.h unistd.h __unistd.h types.h \ __math.h time.h __time.h unistd.h __unistd.h types.h \
xtypes.h ac-types.h posix.h string.h __string.h \ xtypes.h ac-types.h posix.h string.h __string.h \
......
...@@ -23,7 +23,8 @@ ...@@ -23,7 +23,8 @@
a NULL-pointer last a NULL-pointer last
*/ */
int myrg_create(const char *name, const char **table_names, my_bool fix_names) int myrg_create(const char *name, const char **table_names,
uint insert_method, my_bool fix_names)
{ {
int save_errno; int save_errno;
uint errpos; uint errpos;
...@@ -50,6 +51,13 @@ int myrg_create(const char *name, const char **table_names, my_bool fix_names) ...@@ -50,6 +51,13 @@ int myrg_create(const char *name, const char **table_names, my_bool fix_names)
goto err; goto err;
} }
} }
if (insert_method != MERGE_INSERT_DISABLED)
{
end=strxmov(buff,"#INSERT_METHOD=",
get_type(&merge_insert_method,insert_method),"\n",NullS);
if (my_write(file,buff,(uint) (end-buff),MYF(MY_WME | MY_NABP)))
goto err;
}
if (my_close(file,MYF(0))) if (my_close(file,MYF(0)))
goto err; goto err;
DBUG_RETURN(0); DBUG_RETURN(0);
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* open a MYMERGE_-database */ /* open a MyISAM MERGE table */
#include "mymrgdef.h" #include "mymrgdef.h"
#include <stddef.h> #include <stddef.h>
...@@ -23,17 +23,14 @@ ...@@ -23,17 +23,14 @@
#include "mrg_static.c" #include "mrg_static.c"
#endif #endif
/* open a MYMERGE_-database. /*
open a MyISAM MERGE table
if handle_locking is 0 then exit with error if some database is locked if handle_locking is 0 then exit with error if some database is locked
if handle_locking is 1 then wait if database is locked if handle_locking is 1 then wait if database is locked
*/ */
MYRG_INFO *myrg_open( MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
const char *name,
int mode,
int handle_locking)
{ {
int save_errno,i,errpos; int save_errno,i,errpos;
uint files,dir_length,length,options; uint files,dir_length,length,options;
...@@ -63,8 +60,18 @@ int handle_locking) ...@@ -63,8 +60,18 @@ int handle_locking)
{ {
if ((end=buff+length)[-1] == '\n') if ((end=buff+length)[-1] == '\n')
end[-1]='\0'; end[-1]='\0';
if (buff[0] && buff[0] != '#') /* Skipp empty lines and comments */ if (!buff[0])
continue; /* Skip empty lines */
if (buff[0] == '#')
{ {
if( !strncmp(buff+1,"INSERT_METHOD=",14))
{ /* Lookup insert method */
int tmp=find_type(buff+15,&merge_insert_method,2);
info.merge_insert_method = (uint) (tmp >= 0 ? tmp : 0);
}
continue; /* Skip comments */
}
if (!test_if_hard_path(buff)) if (!test_if_hard_path(buff))
{ {
VOID(strmake(name_buff+dir_length,buff, VOID(strmake(name_buff+dir_length,buff,
...@@ -82,7 +89,6 @@ int handle_locking) ...@@ -82,7 +89,6 @@ int handle_locking)
} }
info.reclength=isam->s->base.reclength; info.reclength=isam->s->base.reclength;
} }
}
if (!(m_info= (MYRG_INFO*) my_malloc(sizeof(MYRG_INFO)+ if (!(m_info= (MYRG_INFO*) my_malloc(sizeof(MYRG_INFO)+
files*sizeof(MYRG_TABLE), files*sizeof(MYRG_TABLE),
MYF(MY_WME)))) MYF(MY_WME))))
......
...@@ -24,3 +24,7 @@ ...@@ -24,3 +24,7 @@
#endif #endif
LIST *myrg_open_list=0; LIST *myrg_open_list=0;
static const char *merge_insert_methods[] =
{ "FIRST", "LAST", NullS };
TYPELIB merge_insert_method= { array_elements(merge_insert_methods),"",
merge_insert_methods};
/* Copyright (C) 2001 MySQL AB & MySQL Finland AB & TCX DataKonsult 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 */
/* Write a row to a MyISAM MERGE table */
#include "mymrgdef.h"
int myrg_write(register MYRG_INFO *info, byte *rec)
{
/* [phi] MERGE_WRITE_DISABLED is handled by the else case */
if (info->merge_insert_method == MERGE_INSERT_TO_FIRST)
return mi_write(info->open_tables[0].table,rec);
else if (info->merge_insert_method == MERGE_INSERT_TO_LAST)
return mi_write(info->end_table[-1].table,rec);
else /* unsupported insertion method */
return (my_errno=HA_ERR_WRONG_COMMAND);
}
...@@ -61,7 +61,7 @@ CREATE TABLE t1 ( ...@@ -61,7 +61,7 @@ CREATE TABLE t1 (
INSERT INTO t1 (pseudo,pseudo1,same) VALUES ('joce', 'testtt', 1),('joce', 'tsestset', 1),('dekad', 'joce', 1); INSERT INTO t1 (pseudo,pseudo1,same) VALUES ('joce', 'testtt', 1),('joce', 'tsestset', 1),('dekad', 'joce', 1);
SELECT pseudo FROM t1 WHERE pseudo1='joce' UNION SELECT pseudo FROM t1 WHERE pseudo='joce'; SELECT pseudo FROM t1 WHERE pseudo1='joce' UNION SELECT pseudo FROM t1 WHERE pseudo='joce';
SELECT pseudo1 FROM t1 WHERE pseudo1='joce' UNION SELECT pseudo1 FROM t1 WHERE pseudo='joce'; SELECT pseudo1 FROM t1 WHERE pseudo1='joce' UNION SELECT pseudo1 FROM t1 WHERE pseudo='joce';
SELECT * FROM t1 WHERE pseudo1='joce' UNION SELECT * FROM t1 WHERE pseudo='joce' order by pseudo desc; SELECT * FROM t1 WHERE pseudo1='joce' UNION SELECT * FROM t1 WHERE pseudo='joce' order by pseudo desc,pseudo1 desc;
SELECT pseudo1 FROM t1 WHERE pseudo='joce' UNION SELECT pseudo FROM t1 WHERE pseudo1='joce'; SELECT pseudo1 FROM t1 WHERE pseudo='joce' UNION SELECT pseudo FROM t1 WHERE pseudo1='joce';
SELECT pseudo1 FROM t1 WHERE pseudo='joce' UNION ALL SELECT pseudo FROM t1 WHERE pseudo1='joce'; SELECT pseudo1 FROM t1 WHERE pseudo='joce' UNION ALL SELECT pseudo FROM t1 WHERE pseudo1='joce';
SELECT pseudo1 FROM t1 WHERE pseudo='joce' UNION SELECT 1; SELECT pseudo1 FROM t1 WHERE pseudo='joce' UNION SELECT 1;
......
...@@ -57,7 +57,7 @@ noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \ ...@@ -57,7 +57,7 @@ noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \
sql_select.h structs.h table.h sql_udf.h hash_filo.h\ sql_select.h structs.h table.h sql_udf.h hash_filo.h\
lex.h lex_symbol.h sql_acl.h sql_crypt.h md5.h \ lex.h lex_symbol.h sql_acl.h sql_crypt.h md5.h \
log_event.h mini_client.h sql_repl.h slave.h \ log_event.h mini_client.h sql_repl.h slave.h \
stacktrace.h sql_sort.h mysql_embed.h stacktrace.h sql_sort.h
mysqld_SOURCES = sql_lex.cc sql_handler.cc \ mysqld_SOURCES = sql_lex.cc sql_handler.cc \
item.cc item_sum.cc item_buff.cc item_func.cc \ item.cc item_sum.cc item_buff.cc item_func.cc \
item_cmpfunc.cc item_strfunc.cc item_timefunc.cc \ item_cmpfunc.cc item_strfunc.cc item_timefunc.cc \
......
...@@ -216,7 +216,7 @@ you have to change 'main' to print out the new function\n"); ...@@ -216,7 +216,7 @@ you have to change 'main' to print out the new function\n");
return(1); return(1);
} }
if (opt_verbose) if (opt_verbose > 1)
fprintf (stderr,"Info: Possible add values: %d\n",found-type_count); fprintf (stderr,"Info: Possible add values: %d\n",found-type_count);
for (prime=primes; (function_mod=*prime) ; prime++) for (prime=primes; (function_mod=*prime) ; prime++)
...@@ -376,7 +376,7 @@ static int get_options(int argc, char **argv) ...@@ -376,7 +376,7 @@ static int get_options(int argc, char **argv)
opt_search=1; opt_search=1;
break; break;
case 'v': case 'v':
opt_verbose=1; opt_verbose++;
break; break;
case 'V': usage(1); exit(0); case 'V': usage(1); exit(0);
case 'I': case 'I':
...@@ -473,7 +473,7 @@ int main(int argc,char **argv) ...@@ -473,7 +473,7 @@ int main(int argc,char **argv)
MY_INIT(argv[0]); MY_INIT(argv[0]);
start_value=2250933L; best_t1=2721579L; best_t2=4627039L; best_type=3; /* mode=4567 add=4 type: 0 */ start_value=4198729L; best_t1=6245075L; best_t2=3686256L; best_type=4; /* mode=5839 add=1 type: 0 */
if (get_options(argc,(char **) argv)) if (get_options(argc,(char **) argv))
exit(1); exit(1);
...@@ -493,7 +493,7 @@ int main(int argc,char **argv) ...@@ -493,7 +493,7 @@ int main(int argc,char **argv)
printf("start_value=%ldL; best_t1=%ldL; best_t2=%ldL; best_type=%d; /* mode=%d add=%d type: %d */\n", printf("start_value=%ldL; best_t1=%ldL; best_t2=%ldL; best_type=%d; /* mode=%d add=%d type: %d */\n",
start_value, best_t1,best_t2,best_type,best_mod,best_add, start_value, best_t1,best_t2,best_type,best_mod,best_add,
best_functype); best_functype);
best_start_value=start_value;
for (uint i=1 ; i <= opt_count ; i++) for (uint i=1 ; i <= opt_count ; i++)
{ {
if (i % 10 == 0) if (i % 10 == 0)
...@@ -516,6 +516,10 @@ int main(int argc,char **argv) ...@@ -516,6 +516,10 @@ int main(int argc,char **argv)
best_start_value,best_t1,best_t2,best_type,best_mod,best_add, best_start_value,best_t1,best_t2,best_type,best_mod,best_add,
best_functype); best_functype);
} }
if (opt_verbose && (i % 20000) == 0)
printf("\nstart_value=%ldL; best_t1=%ldL; best_t2=%ldL; best_type=%d; /* mode=%d add=%d type: %d */\n",
best_start_value,best_t1,best_t2,best_type,best_mod,best_add,
best_functype);
} }
} }
......
...@@ -66,7 +66,13 @@ int ha_myisammrg::close(void) ...@@ -66,7 +66,13 @@ int ha_myisammrg::close(void)
int ha_myisammrg::write_row(byte * buf) int ha_myisammrg::write_row(byte * buf)
{ {
statistic_increment(ha_write_count,&LOCK_status);
if (table->time_stamp)
update_timestamp(buf+table->time_stamp-1);
if (table->next_number_field && buf == table->record[0])
return (my_errno=HA_ERR_WRONG_COMMAND); return (my_errno=HA_ERR_WRONG_COMMAND);
// update_auto_increment(); - [phi] have to check this before allowing it
return myrg_write(file,buf);
} }
int ha_myisammrg::update_row(const byte * old_data, byte * new_data) int ha_myisammrg::update_row(const byte * old_data, byte * new_data)
...@@ -217,6 +223,7 @@ THR_LOCK_DATA **ha_myisammrg::store_lock(THD *thd, ...@@ -217,6 +223,7 @@ THR_LOCK_DATA **ha_myisammrg::store_lock(THD *thd,
void ha_myisammrg::update_create_info(HA_CREATE_INFO *create_info) void ha_myisammrg::update_create_info(HA_CREATE_INFO *create_info)
{ {
// [phi] auto_increment stuff is missing (but currently not needed)
DBUG_ENTER("ha_myisammrg::update_create_info"); DBUG_ENTER("ha_myisammrg::update_create_info");
if (!(create_info->used_fields & HA_CREATE_USED_UNION)) if (!(create_info->used_fields & HA_CREATE_USED_UNION))
{ {
...@@ -241,6 +248,10 @@ void ha_myisammrg::update_create_info(HA_CREATE_INFO *create_info) ...@@ -241,6 +248,10 @@ void ha_myisammrg::update_create_info(HA_CREATE_INFO *create_info)
} }
*create_info->merge_list.next=0; *create_info->merge_list.next=0;
} }
if (!(create_info->used_fields & HA_CREATE_USED_INSERT_METHOD))
{
create_info->merge_insert_method = file->merge_insert_method;
}
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
err: err:
...@@ -263,12 +274,20 @@ int ha_myisammrg::create(const char *name, register TABLE *form, ...@@ -263,12 +274,20 @@ int ha_myisammrg::create(const char *name, register TABLE *form,
*pos++= tables->real_name; *pos++= tables->real_name;
*pos=0; *pos=0;
DBUG_RETURN(myrg_create(fn_format(buff,name,"","",2+4+16), DBUG_RETURN(myrg_create(fn_format(buff,name,"","",2+4+16),
(const char **) table_names, (my_bool) 0)); (const char **) table_names,
create_info->merge_insert_method,
(my_bool) 0));
} }
void ha_myisammrg::append_create_info(String *packet) void ha_myisammrg::append_create_info(String *packet)
{ {
char buff[FN_REFLEN]; char buff[FN_REFLEN];
if (file->merge_insert_method != MERGE_INSERT_DISABLED)
{
packet->append(" INSERT_METHOD=",15);
const char *tmp = get_type(&merge_insert_method,file->merge_insert_method);
packet->append(tmp);
}
packet->append(" UNION=(",8); packet->append(" UNION=(",8);
MYRG_TABLE *table,*first; MYRG_TABLE *table,*first;
......
...@@ -123,6 +123,7 @@ enum row_type { ROW_TYPE_DEFAULT, ROW_TYPE_FIXED, ROW_TYPE_DYNAMIC, ...@@ -123,6 +123,7 @@ enum row_type { ROW_TYPE_DEFAULT, ROW_TYPE_FIXED, ROW_TYPE_DYNAMIC,
#define HA_CREATE_USED_AUTO 1 #define HA_CREATE_USED_AUTO 1
#define HA_CREATE_USED_RAID 2 #define HA_CREATE_USED_RAID 2
#define HA_CREATE_USED_UNION 4 #define HA_CREATE_USED_UNION 4
#define HA_CREATE_USED_INSERT_METHOD 8
typedef struct st_thd_trans { typedef struct st_thd_trans {
void *bdb_tid; void *bdb_tid;
...@@ -150,6 +151,7 @@ typedef struct st_ha_create_information ...@@ -150,6 +151,7 @@ typedef struct st_ha_create_information
bool if_not_exists; bool if_not_exists;
ulong used_fields; ulong used_fields;
SQL_LIST merge_list; SQL_LIST merge_list;
uint merge_insert_method;
} HA_CREATE_INFO; } HA_CREATE_INFO;
......
...@@ -178,6 +178,7 @@ static SYMBOL symbols[] = { ...@@ -178,6 +178,7 @@ static SYMBOL symbols[] = {
{ "INNODB", SYM(INNOBASE_SYM),0,0}, { "INNODB", SYM(INNOBASE_SYM),0,0},
{ "INSERT", SYM(INSERT),0,0}, { "INSERT", SYM(INSERT),0,0},
{ "INSERT_ID", SYM(INSERT_ID),0,0}, { "INSERT_ID", SYM(INSERT_ID),0,0},
{ "INSERT_METHOD", SYM(INSERT_METHOD),0,0},
{ "INT", SYM(INT_SYM),0,0}, { "INT", SYM(INT_SYM),0,0},
{ "INTEGER", SYM(INT_SYM),0,0}, { "INTEGER", SYM(INT_SYM),0,0},
{ "INTERVAL", SYM(INTERVAL_SYM),0,0}, { "INTERVAL", SYM(INTERVAL_SYM),0,0},
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
in case we decide to make them external at some point in case we decide to make them external at some point
*/ */
#define DONT_USE_RAID
#if defined(__WIN__) #if defined(__WIN__)
#include <winsock.h> #include <winsock.h>
#include <odbcinst.h> #include <odbcinst.h>
...@@ -41,6 +40,7 @@ inline int local_thr_alarm(my_bool *A,int B __attribute__((unused)),ALARM *C __a ...@@ -41,6 +40,7 @@ inline int local_thr_alarm(my_bool *A,int B __attribute__((unused)),ALARM *C __a
#endif #endif
#include <my_global.h> #include <my_global.h>
#include <mysql_embed.h>
#include <mysql_com.h> #include <mysql_com.h>
#include <violite.h> #include <violite.h>
#include <my_sys.h> #include <my_sys.h>
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <winsock.h> #include <winsock.h>
#endif #endif
#include <my_global.h> #include <my_global.h>
#include "mysql_embed.h"
#include <mysql_com.h> #include <mysql_com.h>
#include <violite.h> #include <violite.h>
#include <my_sys.h> #include <my_sys.h>
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
/* Function with list databases, tables or fields */ /* Function with list databases, tables or fields */
#include "my_global.h"
#include "mysql_priv.h" #include "mysql_priv.h"
#include "sql_select.h" // For select_describe #include "sql_select.h" // For select_describe
#include "sql_acl.h" #include "sql_acl.h"
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "sql_acl.h" #include "sql_acl.h"
#include "lex_symbol.h" #include "lex_symbol.h"
#include <myisam.h> #include <myisam.h>
#include <myisammrg.h>
extern void yyerror(const char*); extern void yyerror(const char*);
int yylex(void *yylval); int yylex(void *yylval);
...@@ -390,6 +391,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); ...@@ -390,6 +391,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token IDENTIFIED_SYM %token IDENTIFIED_SYM
%token IF %token IF
%token INSERT_ID %token INSERT_ID
%token INSERT_METHOD
%token INTERVAL_SYM %token INTERVAL_SYM
%token LAST_INSERT_ID %token LAST_INSERT_ID
%token LEFT %token LEFT
...@@ -490,7 +492,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); ...@@ -490,7 +492,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
table_option opt_if_not_exists table_option opt_if_not_exists
%type <ulong_num> %type <ulong_num>
ULONG_NUM raid_types ULONG_NUM raid_types merge_insert_types
%type <ulonglong_number> %type <ulonglong_number>
ulonglong_num ulonglong_num
...@@ -796,6 +798,7 @@ create_table_option: ...@@ -796,6 +798,7 @@ create_table_option:
table_list->next=0; table_list->next=0;
lex->create_info.used_fields|= HA_CREATE_USED_UNION; lex->create_info.used_fields|= HA_CREATE_USED_UNION;
} }
| INSERT_METHOD EQ merge_insert_types { Lex->create_info.merge_insert_method= $3; Lex->create_info.used_fields|= HA_CREATE_USED_INSERT_METHOD;}
| DATA_SYM DIRECTORY_SYM EQ TEXT_STRING { Lex->create_info.data_file_name= $4.str; } | DATA_SYM DIRECTORY_SYM EQ TEXT_STRING { Lex->create_info.data_file_name= $4.str; }
| INDEX DIRECTORY_SYM EQ TEXT_STRING { Lex->create_info.index_file_name= $4.str; } | INDEX DIRECTORY_SYM EQ TEXT_STRING { Lex->create_info.index_file_name= $4.str; }
...@@ -819,6 +822,11 @@ raid_types: ...@@ -819,6 +822,11 @@ raid_types:
| RAID_0_SYM { $$= RAID_TYPE_0; } | RAID_0_SYM { $$= RAID_TYPE_0; }
| ULONG_NUM { $$=$1;} | ULONG_NUM { $$=$1;}
merge_insert_types:
NO_SYM { $$= MERGE_INSERT_DISABLED; }
| FIRST_SYM { $$= MERGE_INSERT_TO_FIRST; }
| LAST_SYM { $$= MERGE_INSERT_TO_LAST; }
opt_select_from: opt_select_from:
/* empty */ /* empty */
| select_from select_lock_type | select_from select_lock_type
...@@ -2862,6 +2870,7 @@ keyword: ...@@ -2862,6 +2870,7 @@ keyword:
| ISAM_SYM {} | ISAM_SYM {}
| ISSUER_SYM {} | ISSUER_SYM {}
| INNOBASE_SYM {} | INNOBASE_SYM {}
| INSERT_METHOD {}
| LAST_SYM {} | LAST_SYM {}
| LEVEL_SYM {} | LEVEL_SYM {}
| LOCAL_SYM {} | LOCAL_SYM {}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment