This commit is contained in:
sasha@mysql.sashanet.com 2001-09-22 21:51:17 -06:00
commit eccda8f86d
68 changed files with 620 additions and 378 deletions

View File

@ -8,6 +8,6 @@ c_warnings="$c_warnings $debug_extra_warnings"
cxx_warnings="$cxx_warnings $debug_extra_warnings"
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"

View File

@ -28,3 +28,4 @@ tim@work.mysql.com
tonu@hundin.mysql.fi
tonu@x153.internalnet
tonu@x3.internalnet
tonu@volk.internalnet

View File

@ -65,6 +65,7 @@ aclocal; autoheader; aclocal; automake; autoconf
--enable-thread-safe-client \
--with-berkeley-db \
--with-innodb \
--with-vio \
--without-pstack \
--with-extra-tools \
--with-embedded-server

BIN
Docs/Flags/mexico.eps Executable file

Binary file not shown.

BIN
Docs/Flags/mexico.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 269 B

0
Docs/Flags/mexico.txt Normal file
View File

View File

@ -6824,6 +6824,12 @@ Please report bad or out-of-date mirrors to @email{webmaster@@mysql.com}.
@c @uref{http://mysql.cyberus.ca/, WWW}
@c @uref{ftp://mysql.cyberus.ca/, FTP}
@item
@c EMAIL: alagbe@servidor.unam.mx (Alfredo Aguayo)
@image{Flags/mexico} Mexico [UNAM] @
@uref{http://mysql.unam.mx/, WWW}
@uref{ftp://mysql.unam.mx/pub/mysql/, FTP}
@item
@c EMAIL: mleber@he.net (Mike Leber)
@c Added 980312
@ -46513,7 +46519,7 @@ newest version from @uref{http://civeng.com/sqldemo/, the home site}.
@item @uref{http://myadmin.cheapnet.net/, MyAdmin home page}
A Web-based MySQL administrator by Mike Machado.
@item @uref{http://www.mysql.com/Downloads/Contrib/phpMyAdmin_2.0.1.tar.gz,phpMyAdmin_2.0.1.tar.gz}
@item @uref{http://www.mysql.com/Downloads/Contrib/phpMyAdmin_2.2.0.tar.gz,phpMyAdmin_2.2.0.tar.gz}
A set of PHP3-scripts to adminstrate MySQL over the WWW.
@item @uref{http://www.phpwizard.net/projects/phpMyAdmin/, phpMyAdmin home page}

View File

@ -690,8 +690,7 @@ fi
AC_DEFUN(MYSQL_CHECK_VIO, [
AC_ARG_WITH([vio],
[\
--with-vio Include the Virtual IO support],
[ --with-vio Include the Virtual IO support],
[vio="$withval"],
[vio=no])
@ -712,8 +711,7 @@ AC_DEFUN(MYSQL_CHECK_VIO, [
AC_DEFUN(MYSQL_CHECK_OPENSSL, [
AC_MSG_CHECKING(for OpenSSL)
AC_ARG_WITH([openssl],
[\
--with-openssl Include the OpenSSL support],
[ --with-openssl Include the OpenSSL support],
[openssl="$withval"],
[openssl=no])
@ -722,7 +720,7 @@ AC_MSG_CHECKING(for OpenSSL)
if test -n "$vio_dir"
then
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"
else
AC_MSG_ERROR([OpenSSL requires Virtual IO support (--with-vio)])
@ -1152,8 +1150,7 @@ dnl echo "DBG_GEM1: gemini='$gemini'"
gemini_libs="\
../gemini/api/libapi.a\
../gemini/db/libdb.a\
../gemini/dbut/libdbut.a\
../gemini/vst/libvst.a"
../gemini/dbut/libdbut.a"
AC_MSG_RESULT([Using Gemini DB])
;;
esac

View File

@ -19,13 +19,13 @@
INCLUDES = -I$(srcdir)/../include $(openssl_includes) \
-I../include -I$(srcdir)/.. -I$(top_srcdir) \
-I..
noinst_HEADERS = client_priv.h
LIBS = @CLIENT_LIBS@
LDADD = @CLIENT_EXTRA_LDFLAGS@ ../libmysql/libmysqlclient.la
bin_PROGRAMS = mysql mysqladmin mysqlcheck mysqlshow \
mysqldump mysqlimport mysqltest mysqlbinlog mysqlmanagerc mysqlmanager-pwgen
noinst_PROGRAMS = insert_test select_test thread_test
noinst_HEADERS = sql_string.h completion_hash.h my_readline.h
noinst_HEADERS = sql_string.h completion_hash.h my_readline.h \
client_priv.h
mysql_SOURCES = mysql.cc readline.cc sql_string.cc completion_hash.cc
mysql_LDADD = @readline_link@ @TERMCAP_LIB@ $(LDADD) $(CXXLDFLAGS)
mysql_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES)

View File

@ -19,6 +19,7 @@
#include <my_global.h>
#include <my_sys.h>
#include <m_string.h>
#include <mysql_embed.h>
#include <mysql.h>
#include <errmsg.h>
#include <getopt.h>

View File

@ -303,6 +303,7 @@ int main(int argc,char *argv[])
exit(1);
glob_buffer.realloc(512);
completion_hash_init(&ht,50);
bzero((char*) &mysql, sizeof(mysql));
if (sql_connect(current_host,current_db,current_user,opt_password,
opt_silent))
{
@ -326,11 +327,13 @@ int main(int argc,char *argv[])
put_info((char*) glob_buffer.ptr(),INFO_INFO);
#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(),
"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);
} else
}
else
put_info("SSL is not in use\n",INFO_INFO);
#endif /* HAVE_OPENSSL */
@ -373,13 +376,7 @@ int main(int argc,char *argv[])
sig_handler mysql_end(int sig)
{
if (connected)
mysql_close(&mysql);
#ifdef HAVE_OPENSSL
else
mysql_ssl_clear(&mysql); /* SSL data structres should be freed
even if connection was not made */
#endif
mysql_close(&mysql);
#ifdef HAVE_READLINE
if (!status.batch && !quick && !opt_html && !opt_xml)
{
@ -2208,16 +2205,8 @@ static int
sql_real_connect(char *host,char *database,char *user,char *password,
uint silent)
{
if (connected)
{ /* if old is open, close it first */
mysql_close(&mysql);
connected= 0;
}
#ifdef HAVE_OPENSSL
else
mysql_ssl_clear(&mysql); /* SSL data structres should be freed
even if connection was not made */
#endif
mysql_close(&mysql);
connected= 0;
mysql_init(&mysql);
if (opt_connect_timeout)
{
@ -2569,7 +2558,7 @@ static void mysql_end_timer(ulong start_time,char *buff)
strmov(strend(buff),")");
}
#ifndef EMBEDDED_SERVER
#ifndef EMBEDDED_LIBRARY
/* Keep sql_string library happy */
gptr sql_alloc(unsigned int Size)
@ -2581,4 +2570,4 @@ void sql_element_free(void *ptr)
{
my_free((gptr) ptr,MYF(0));
}
#endif /* EMBEDDED_SERVER */
#endif /* EMBEDDED_LIBRARY */

View File

@ -321,6 +321,7 @@ static void dump_remote_log_entries(const char* logname)
for(;;)
{
const char *error;
len = net_safe_read(mysql);
if (len == packet_error)
die("Error reading packet from server: %s", mysql_error(mysql));
@ -330,8 +331,8 @@ static void dump_remote_log_entries(const char* logname)
len, net->read_pos[5]));
Log_event * ev = Log_event::read_log_event(
(const char*) net->read_pos + 1 ,
len - 1);
if(ev)
len - 1, &error);
if (ev)
{
ev->print(result_file, short_form, last_db);
if(ev->get_type_code() == LOAD_EVENT)

View File

@ -46,19 +46,15 @@
#define MTEST_VERSION "1.10"
#include <my_global.h>
#include <mysql_embed.h>
#include <my_sys.h>
#include <m_string.h>
#include <mysql.h>
#include <mysql_version.h>
#include <mysqld_error.h>
#include <m_ctype.h>
#ifdef OS2
#include <config-os2.h>
#else
#include <my_config.h>
#endif
#include <my_dir.h>
#include <hash.h>
#include <mysqld_error.h>
#include <stdio.h>
#include <stdlib.h>
#include <getopt.h>
@ -1067,18 +1063,18 @@ int close_connection(struct st_query* q)
p++;
*p = 0;
for(con = cons; con < next_con; con++)
for (con = cons; con < next_con; con++)
{
if (!strcmp(con->name, name))
{
if(q->type == Q_DIRTY_CLOSE)
if (q->type == Q_DIRTY_CLOSE)
{
if (con->mysql.net.vio)
{
if(con->mysql.net.vio)
{
vio_delete(con->mysql.net.vio);
con->mysql.net.vio = 0;
}
vio_delete(con->mysql.net.vio);
con->mysql.net.vio = 0;
}
}
mysql_close(&con->mysql);
DBUG_RETURN(0);

View File

@ -699,9 +699,9 @@ int main()
AC_MSG_RESULT($atom_ops)
AC_ARG_WITH(pstack,
[ --without-pstack Do not use the pstack backtrace library],
[USE_PSTACK=$withval],
[USE_PSTACK=yes])
[ --with-pstack Use the pstack backtrace library],
[ USE_PSTACK=$withval ],
[ USE_PSTACK=no ])
pstack_libs=
pstack_dirs=
if test "$USE_PSTACK" = yes -a "$IS_LINUX" = "true" -a "$BASE_MACHINE_TYPE" = "i386" -a "$with_mit_threads" = "no"
@ -717,7 +717,9 @@ dnl I have no idea if this is a good test - can not find docs for libiberty
if test x"$have_libiberty" = xyes -a x"$have_libbfd" = xyes
then
pstack_dirs='$(top_srcdir)'/pstack
pstack_libs="$pstack_dirs/libpstack.a -lbfd -liberty"
pstack_libs="../pstack/libpstack.a -lbfd -liberty"
# We must link staticly when using pstack
with_mysqld_ldflags="-all-static"
AC_SUBST([pstack_dirs])
AC_SUBST([pstack_libs])
AC_DEFINE([USE_PSTACK])

View File

@ -62,6 +62,7 @@ int heap_write(HP_INFO *info, const byte *record)
info->update|=HA_STATE_AKTIV;
DBUG_RETURN(0);
err:
DBUG_PRINT("info",("Duplicate key: %d",key));
info->errkey= key;
do
{

View File

@ -16,8 +16,8 @@
# MA 02111-1307, USA
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 \
mysqld_error.h my_list.h \
pkginclude_HEADERS = dbug.h m_string.h my_sys.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_global.h my_net.h \
sslopt-case.h sslopt-longopts.h sslopt-usage.h \

View File

@ -34,6 +34,13 @@ extern "C" {
#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 */
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;
uint reclength; /* Recordlength */
int errkey; /* With key was dupplicated on err */
uint options; /* HA_OPTIONS_... used */
uint options; /* HA_OPTION_... used */
} MYMERGE_INFO;
typedef struct st_myrg_table_info
@ -56,6 +63,7 @@ typedef struct st_myrg_table_info
typedef struct st_myrg_info
{
MYRG_TABLE *open_tables,*current_table,*end_table,*last_used_table;
uint merge_insert_method;
ulonglong records; /* records in tables */
ulonglong del; /* Removed records */
ulonglong data_file_length;
@ -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_rsame(MYRG_INFO *file,byte *record,int inx);
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_lock_database(MYRG_INFO *file,int lock_type);
extern int myrg_create(const char *name,const char **table_names,
my_bool fix_names);
extern int myrg_create(const char *name, const char **table_names,
uint insert_method, my_bool fix_names);
extern int myrg_extra(MYRG_INFO *file,enum ha_extra_function function);
extern ha_rows myrg_records_in_range(MYRG_INFO *info,int inx,
const byte *start_key,uint start_key_len,

View File

@ -48,32 +48,15 @@ typedef char my_bool;
#endif
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
#ifdef __WIN__
#define my_socket SOCKET
#else
typedef int my_socket;
#endif
#endif
#endif
#endif /* __WIN__ */
#endif /* my_socket_defined */
#endif /* _global_h */
#include "mysql_com.h"
#include "mysql_version.h"
@ -118,6 +101,24 @@ typedef struct st_mysql_rows {
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 {
my_ulonglong rows;
unsigned int fields;

View File

@ -113,10 +113,12 @@ typedef struct st_net {
unsigned int last_errno,max_packet,timeout,pkt_nr;
unsigned char error;
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 ),
and do not want to confuse the client with OK at the wrong time
*/
/*
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
*/
my_bool no_send_ok;
unsigned long remain_in_buf,length, buf_length, where_b;
unsigned int *return_status;
unsigned char reading_or_writing;

29
include/mysql_embed.h Normal file
View File

@ -0,0 +1,29 @@
/* Copyright (C) 2000 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 */
/* Defines that are unique to the embedded version of MySQL */
#ifdef EMBEDDED_LIBRARY
/* Things we don't need in the embedded version of MySQL */
#undef HAVE_PSTACK /* No stacktrace */
#undef HAVE_DLOPEN /* No udf functions */
#undef HAVE_OPENSSL
#undef HAVE_VIO
#define DONT_USE_RAID
#endif /* EMBEDDED_LIBRARY */

View File

@ -33,67 +33,59 @@ extern "C" {
#endif /* __cplusplus */
enum enum_vio_type { VIO_CLOSED, VIO_TYPE_TCPIP, VIO_TYPE_SOCKET,
VIO_TYPE_NAMEDPIPE, VIO_TYPE_SSL};
VIO_TYPE_NAMEDPIPE, VIO_TYPE_SSL};
#ifndef __WIN__
#define HANDLE void *
#endif
Vio* vio_new(my_socket sd,
enum enum_vio_type type,
my_bool localhost);
Vio* vio_new(my_socket sd, enum enum_vio_type type, my_bool localhost);
#ifdef __WIN__
Vio* vio_new_win32pipe(HANDLE hPipe);
Vio* vio_new_win32pipe(HANDLE hPipe);
#endif
void vio_delete(Vio* vio);
void vio_delete(Vio* vio);
#ifdef EMBEDDED_LIBRARY
void vio_reset(Vio *vio);
#else
void vio_reset(Vio* vio, enum enum_vio_type type,
my_socket sd, HANDLE hPipe,
my_bool localhost);
my_socket sd, HANDLE hPipe, my_bool localhost);
#endif
/*
* vio_read and vio_write should have the same semantics
* as read(2) and write(2).
*/
int vio_read( Vio* vio,
gptr buf, int size);
int vio_write( Vio* vio,
const gptr buf,
int size);
int vio_read(Vio *vio, gptr buf, int size);
int vio_write(Vio *vio, const gptr buf, int size);
/*
* Whenever the socket is set to blocking mode or not.
*/
int vio_blocking( Vio* vio,
my_bool onoff);
my_bool vio_is_blocking( Vio* vio);
int vio_blocking(Vio *vio, my_bool onoff);
my_bool vio_is_blocking(Vio *vio);
/*
* 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.
*/
int vio_keepalive( Vio* vio,
my_bool onoff);
int vio_keepalive(Vio *vio, my_bool onoff);
/*
* 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...
*/
int vio_close(Vio* vio);
int vio_close(Vio* vio);
/*
* 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 */
enum enum_vio_type vio_type(Vio* vio);
enum enum_vio_type vio_type(Vio* vio);
/* Return last error number */
int vio_errno(Vio*vio);
@ -117,8 +109,8 @@ my_bool vio_poll_read(Vio *vio,uint timeout);
}
#endif
#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_errno(vio) (vio)->vioerrno(vio)
#define vio_read(vio, buf, size) (vio)->read(vio,buf,size)
@ -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_in_addr(vio, in) (vio)->in_addr(vio, in)
#define vio_poll_read(vio,timeout) (vio)->poll_read(vio,timeout)
#endif /* !DONT_MAP_VIO */
#endif /* HAVE_VIO */
#endif /* defined(HAVE_VIO) && !defined(DONT_MAP_VIO) */
#ifdef HAVE_OPENSSL
#define HEADER_DES_LOCL_H dummy_something
@ -142,17 +132,16 @@ my_bool vio_poll_read(Vio *vio,uint timeout);
#include <openssl/err.h>
#include "my_net.h" /* needed because of struct in_addr */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
void vio_ssl_delete(Vio* vio);
void vio_ssl_delete(Vio* vio);
int vio_ssl_read(Vio* vio,gptr buf, int size);
int vio_ssl_write(Vio* vio,const gptr buf,int size);
int vio_ssl_blocking(Vio* vio,my_bool onoff);
my_bool vio_ssl_is_blocking(Vio* vio);
int vio_ssl_read(Vio* vio,gptr buf, int size);
int vio_ssl_write(Vio* vio,const gptr buf,int size);
int vio_ssl_blocking(Vio* vio,my_bool onoff);
my_bool vio_ssl_is_blocking(Vio* vio);
/* setsockopt TCP_NODELAY at IPPROTO_TCP level, when possible. */
int vio_ssl_fastsend(Vio* vio);
@ -170,8 +159,6 @@ void vio_ssl_in_addr(Vio *vio, struct in_addr *in);
/* Return 1 if there is data to be read */
my_bool vio_ssl_poll_read(Vio *vio,uint timeout);
#ifdef HAVE_OPENSSL
/* Single copy for server */
struct st_VioSSLAcceptorFd
{
@ -200,16 +187,14 @@ struct st_VioSSLConnectorFd
void sslaccept(struct st_VioSSLAcceptorFd*, Vio*);
void sslconnect(struct st_VioSSLConnectorFd*, Vio*);
#else /* HAVE_OPENSSL */
/* This dummy is required to maintain proper size of st_mysql in mysql.h */
struct st_VioSSLConnectorFd {};
#endif /* HAVE_OPENSSL */
struct st_VioSSLConnectorFd *new_VioSSLConnectorFd(
const char* key_file,const char* cert_file,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);
struct st_VioSSLConnectorFd
*new_VioSSLConnectorFd(const char* key_file, const char* cert_file,
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);
#ifdef __cplusplus
}
#endif
@ -229,19 +214,19 @@ struct st_vio
char desc[30]; /* String description */
#ifdef HAVE_VIO
/* function pointers. They are similar for socket/SSL/whatever */
void (*viodelete)(Vio*);
int(*vioerrno)(Vio*);
int(*read)(Vio*, gptr, int);
int(*write)(Vio*, gptr, int);
int(*vioblocking)(Vio*, my_bool);
my_bool(*is_blocking)(Vio*);
int(*viokeepalive)(Vio*, my_bool);
int(*fastsend)(Vio*);
my_bool(*peer_addr)(Vio*, gptr);
void(*in_addr)(Vio*, struct in_addr*);
my_bool(*should_retry)(Vio*);
int(*vioclose)(Vio*);
my_bool(*poll_read)(Vio*,uint);
void (*viodelete)(Vio*);
int (*vioerrno)(Vio*);
int (*read)(Vio*, gptr, int);
int (*write)(Vio*, gptr, int);
int (*vioblocking)(Vio*, my_bool);
my_bool (*is_blocking)(Vio*);
int (*viokeepalive)(Vio*, my_bool);
int (*fastsend)(Vio*);
my_bool (*peer_addr)(Vio*, gptr);
void (*in_addr)(Vio*, struct in_addr*);
my_bool (*should_retry)(Vio*);
int (*vioclose)(Vio*);
my_bool (*poll_read)(Vio*,uint);
#ifdef HAVE_OPENSSL
BIO* bio_;
@ -252,4 +237,3 @@ struct st_vio
#endif /* HAVE_VIO */
};
#endif /* EMBEDDED_LIBRARY */

View File

@ -170,7 +170,9 @@ mem_heap_alloc(
buf = (byte*)buf + MEM_FIELD_HEADER_SIZE;
#endif
#ifdef UNIV_SET_MEM_TO_ZERO
memset(buf, '\0', n);
#endif
return(buf);
}
@ -494,8 +496,14 @@ mem_alloc_func(
)
{
#ifndef UNIV_MEM_DEBUG
void* buf;
return(mem_area_alloc(n, mem_comm_pool));
buf = mem_area_alloc(n, mem_comm_pool);
#ifdef UNIV_SET_MEM_TO_ZERO
memset(buf, '\0', n);
#endif
return(buf);
#else

View File

@ -160,6 +160,7 @@ os_fast_mutex_trylock(
was reserved by another
thread */
os_fast_mutex_t* fast_mutex); /* in: mutex to acquire */
#endif
/**************************************************************
Releases ownership of a fast mutex. */
UNIV_INLINE
@ -188,7 +189,6 @@ void
os_fast_mutex_free(
/*===============*/
os_fast_mutex_t* fast_mutex); /* in: mutex to free */
#endif
#ifndef UNIV_NONINL
#include "os0sync.ic"

View File

@ -38,6 +38,7 @@ os_fast_mutex_trylock(
return((ulint) pthread_mutex_trylock(fast_mutex));
#endif
}
#endif
/**************************************************************
Releases ownership of a fast mutex. */
@ -53,4 +54,3 @@ os_fast_mutex_unlock(
pthread_mutex_unlock(fast_mutex);
#endif
}
#endif

View File

@ -61,8 +61,12 @@ subdirectory of 'mysql'. */
/* DEBUG VERSION CONTROL
===================== */
/* The following flag will make InnoDB to initialize
all memory it allocates to zero. It hides Purify
warnings about reading unallocated memory unless
memory is read outside the allocated blocks. */
/*
#define UNIV_SYNC_DEBUG
#define UNIV_INIT_MEM_TO_ZERO
*/
/* Make a non-inline debug version */
@ -72,7 +76,7 @@ subdirectory of 'mysql'. */
#define UNIV_SEARCH_DEBUG
#define UNIV_IBUF_DEBUG
#define UNIV_SYNC_DEBUG
#define UNIV_SYNC_PERF_STAT
#define UNIV_SEARCH_PERF_STAT
*/

View File

@ -26,12 +26,39 @@ int
ut_memcmp(void* str1, void* str2, ulint n);
void*
ut_malloc(ulint n);
/**************************************************************************
Allocates memory. Sets it also to zero if UNIV_SET_MEM_TO_ZERO is
defined and set_to_zero is TRUE. */
void*
ut_malloc_low(
/*==========*/
/* out, own: allocated memory */
ulint n, /* in: number of bytes to allocate */
ibool set_to_zero); /* in: TRUE if allocated memory should be set
to zero if UNIV_SET_MEM_TO_ZERO is defined */
/**************************************************************************
Allocates memory. Sets it also to zero if UNIV_SET_MEM_TO_ZERO is
defined. */
void*
ut_malloc(
/*======*/
/* out, own: allocated memory */
ulint n); /* in: number of bytes to allocate */
/**************************************************************************
Frees a memory bloock allocated with ut_malloc. */
UNIV_INLINE
void
ut_free(void* ptr);
ut_free(
/*====*/
void* ptr); /* in, own: memory block */
/**************************************************************************
Frees all allocated memory not freed yet. */
void
ut_free_all_mem(void);
/*=================*/
UNIV_INLINE
char*

View File

@ -27,13 +27,6 @@ ut_memcmp(void* str1, void* str2, ulint n)
return(memcmp(str1, str2, n));
}
UNIV_INLINE
void
ut_free(void* ptr)
{
free(ptr);
}
UNIV_INLINE
char*
ut_strcpy(char* dest, char* sour)

View File

@ -170,7 +170,11 @@ mem_pool_create(
pool = ut_malloc(sizeof(mem_pool_t));
pool->buf = ut_malloc(size);
/* We do not set the memory to zero (FALSE) in the pool,
but only when allocated at a higher level in mem0mem.c.
This is to avoid masking useful Purify warnings. */
pool->buf = ut_malloc_low(size, FALSE);
pool->size = size;
mutex_create(&(pool->mutex));

View File

@ -422,7 +422,6 @@ os_mutex_free(
#endif
}
#ifndef _WIN32
/*************************************************************
Initializes an operating system fast mutex semaphore. */
@ -472,4 +471,3 @@ os_fast_mutex_free(
#endif
}
#endif

View File

@ -916,5 +916,7 @@ innobase_shutdown_for_mysql(void)
logs_empty_and_mark_files_at_shutdown();
ut_free_all_mem();
return((int) DB_SUCCESS);
}

View File

@ -14,30 +14,136 @@ Created 5/11/1994 Heikki Tuuri
#include "mem0mem.h"
/* This struct is placed first in every allocated memory block */
typedef struct ut_mem_block_struct ut_mem_block_t;
struct ut_mem_block_struct{
UT_LIST_NODE_T(ut_mem_block_t) mem_block_list;/* mem block list node */
};
/* List of all memory blocks allocated from the operating system
with malloc */
UT_LIST_BASE_NODE_T(ut_mem_block_t) ut_mem_block_list;
os_fast_mutex_t ut_list_mutex; /* this protects the list */
ibool ut_mem_block_list_inited = FALSE;
/**************************************************************************
Initializes the mem block list at database startup. */
static
void
ut_mem_block_list_init(void)
/*========================*/
{
os_fast_mutex_init(&ut_list_mutex);
UT_LIST_INIT(ut_mem_block_list);
ut_mem_block_list_inited = TRUE;
}
/**************************************************************************
Allocates memory. Sets it also to zero if UNIV_SET_MEM_TO_ZERO is
defined and set_to_zero is TRUE. */
void*
ut_malloc(ulint n)
ut_malloc_low(
/*==========*/
/* out, own: allocated memory */
ulint n, /* in: number of bytes to allocate */
ibool set_to_zero) /* in: TRUE if allocated memory should be set
to zero if UNIV_SET_MEM_TO_ZERO is defined */
{
void* ret;
/*
ret = VirtualAlloc(NULL, n, MEM_COMMIT, PAGE_READWRITE);
*/
ret = malloc(n);
ut_ad((sizeof(ut_mem_block_t) % 8) == 0); /* check alignment ok */
if (!ut_mem_block_list_inited) {
ut_mem_block_list_init();
}
os_fast_mutex_lock(&ut_list_mutex);
ret = malloc(n + sizeof(ut_mem_block_t));
if (ret == NULL) {
fprintf(stderr,
"Innobase: Fatal error: cannot allocate memory!\n");
fprintf(stderr,
"Innobase: Cannot continue operation!\n");
fprintf(stderr,
"Innobase: Check if you can increase the swap file of your\n");
fprintf(stderr,
"Innobase: operating system.\n");
"InnoDB: Fatal error: cannot allocate %lu bytes of\n"
"InnoDB: memory with malloc!\n"
"InnoDB: Operating system errno: %lu\n"
"InnoDB: Cannot continue operation!\n"
"InnoDB: Check if you should increase the swap file or\n"
"InnoDB: ulimits of your operating system.\n", n, errno);
os_fast_mutex_unlock(&ut_list_mutex);
exit(1);
}
return(ret);
if (set_to_zero) {
#ifdef UNIV_SET_MEM_TO_ZERO
memset(ret, '\0', n + sizeof(ut_mem_block_t));
#endif
}
UT_LIST_ADD_FIRST(mem_block_list, ut_mem_block_list,
((ut_mem_block_t*)ret));
os_fast_mutex_unlock(&ut_list_mutex);
return((void*)((byte*)ret + sizeof(ut_mem_block_t)));
}
/**************************************************************************
Allocates memory. Sets it also to zero if UNIV_SET_MEM_TO_ZERO is
defined. */
void*
ut_malloc(
/*======*/
/* out, own: allocated memory */
ulint n) /* in: number of bytes to allocate */
{
return(ut_malloc_low(n, TRUE));
}
/**************************************************************************
Frees a memory bloock allocated with ut_malloc. */
void
ut_free(
/*====*/
void* ptr) /* in, own: memory block */
{
ut_mem_block_t* block;
block = (ut_mem_block_t*)((byte*)ptr - sizeof(ut_mem_block_t));
os_fast_mutex_lock(&ut_list_mutex);
UT_LIST_REMOVE(mem_block_list, ut_mem_block_list, block);
free(block);
os_fast_mutex_unlock(&ut_list_mutex);
}
/**************************************************************************
Frees all allocated memory not freed yet. */
void
ut_free_all_mem(void)
/*=================*/
{
ut_mem_block_t* block;
os_fast_mutex_lock(&ut_list_mutex);
while (block = UT_LIST_GET_FIRST(ut_mem_block_list)) {
UT_LIST_REMOVE(mem_block_list, ut_mem_block_list, block);
free(block);
}
os_fast_mutex_unlock(&ut_list_mutex);
}
/**************************************************************************

View File

@ -2014,6 +2014,7 @@ mysql_close(MYSQL *mysql)
mysql_close(tmp);
tmp = tmp1;
}
mysql->rpl_pivot=0;
}
if (mysql != mysql->master)
mysql_close(mysql->master);

View File

@ -7,7 +7,7 @@ link_sources:
@LN_CP_F@ $(srcdir)/../../client/$$f $(srcdir)/$$f; \
done;
DEFS = -DEMBEDDED_SERVER
DEFS = -DEMBEDDED_LIBRARY
INCLUDES = -I$(top_srcdir)/include $(openssl_includes) \
-I$(srcdir) -I$(top_srcdir) -I$(top_srcdir)/client
LIBS = @LIBS@

View File

@ -13,6 +13,7 @@
*
*/
#include "my_global.h"
#include "mysql_embed.h"
#include "my_pthread.h"
#include "sys/types.h"
#include "../regex/regex.h"

View File

@ -23,12 +23,13 @@
*/
#include <my_global.h>
#include "mysql_embed.h"
#include "mysql.h"
#ifndef HAVE_VIO /* is Vio suppored by the Vio lib ? */
#include <errno.h>
#include <my_sys.h>
#include "mysql.h"
#include <violite.h>
#include <my_sys.h>
#include <my_net.h>

View File

@ -15,19 +15,19 @@
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA */
#define DONT_USE_RAID
#include <my_global.h>
#if defined(__WIN__) || defined(_WIN32) || defined(_WIN64)
#include <winsock.h>
#include <odbcinst.h>
#endif
#include "mysql_embed.h"
#include "mysql.h"
#include "mysql_version.h"
#include "mysqld_error.h"
#include <my_sys.h>
#include <mysys_err.h>
#include <m_string.h>
#include <m_ctype.h>
#include "mysql.h"
#include "mysql_version.h"
#include "mysqld_error.h"
#include "errmsg.h"
#include <violite.h>
#include <sys/stat.h>
@ -88,7 +88,6 @@ static int read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row,
static void end_server(MYSQL *mysql);
static void read_user_name(char *name);
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 sig_handler pipe_sig_handler(int sig);
static ulong mysql_sub_escape_string(CHARSET_INFO *charset_info, char *to,
@ -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
**************************************************************************/

View File

@ -284,7 +284,7 @@ static void usage(void)
-?, --help Display this help and exit.\n\
-V, --version Output version information and exit.");
print_defaults("my",load_default_groups);
};
}
/* reads options */
/* Initiates DEBUG - but no debugging here ! */

View File

@ -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_panic.c myrg_close.c myrg_create.c myrg_static.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\
__math.h time.h __time.h unistd.h __unistd.h types.h \
xtypes.h ac-types.h posix.h string.h __string.h \

View File

@ -23,7 +23,8 @@
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;
uint errpos;
@ -50,6 +51,13 @@ int myrg_create(const char *name, const char **table_names, my_bool fix_names)
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)))
goto err;
DBUG_RETURN(0);

View File

@ -14,7 +14,7 @@
along with this program; if not, write to the Free Software
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 <stddef.h>
@ -23,17 +23,14 @@
#include "mrg_static.c"
#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 1 then wait if database is locked
*/
MYRG_INFO *myrg_open(
const char *name,
int mode,
int handle_locking)
MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
{
int save_errno,i,errpos;
uint files,dir_length,length,options;
@ -63,25 +60,34 @@ int handle_locking)
{
if ((end=buff+length)[-1] == '\n')
end[-1]='\0';
if (buff[0] && buff[0] != '#') /* Skipp empty lines and comments */
if (!buff[0])
continue; /* Skip empty lines */
if (buff[0] == '#')
{
if (!test_if_hard_path(buff))
{
VOID(strmake(name_buff+dir_length,buff,
sizeof(name_buff)-1-dir_length));
VOID(cleanup_dirname(buff,name_buff));
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);
}
if (!(isam=mi_open(buff,mode,test(handle_locking))))
goto err;
files++;
last_isam=isam;
if (info.reclength && info.reclength != isam->s->base.reclength)
{
my_errno=HA_ERR_WRONG_IN_RECORD;
goto err;
}
info.reclength=isam->s->base.reclength;
continue; /* Skip comments */
}
if (!test_if_hard_path(buff))
{
VOID(strmake(name_buff+dir_length,buff,
sizeof(name_buff)-1-dir_length));
VOID(cleanup_dirname(buff,name_buff));
}
if (!(isam=mi_open(buff,mode,test(handle_locking))))
goto err;
files++;
last_isam=isam;
if (info.reclength && info.reclength != isam->s->base.reclength)
{
my_errno=HA_ERR_WRONG_IN_RECORD;
goto err;
}
info.reclength=isam->s->base.reclength;
}
if (!(m_info= (MYRG_INFO*) my_malloc(sizeof(MYRG_INFO)+
files*sizeof(MYRG_TABLE),

View File

@ -24,3 +24,7 @@
#endif
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};

30
myisammrg/myrg_write.c Normal file
View File

@ -0,0 +1,30 @@
/* 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);
}

View File

@ -270,8 +270,7 @@ DASH72=`$ECHO '-----------------------------------------------------------------
# on binary, use what is installed
if [ x$SOURCE_DIST = x1 ] ; then
MYSQLD="$BASEDIR/sql/mysqld"
if [ -e "$BASEDIR/client/.libs/mysqltest" ] ; then
[ -e "$BASEDIR/client/.libs/lt-mysqltest" ] || $BASEDIR/client/mysqltest -V
if [ -f "$BASEDIR/client/.libs/lt-mysqltest" ] ; then
MYSQL_TEST="$BASEDIR/client/.libs/lt-mysqltest"
else
MYSQL_TEST="$BASEDIR/client/mysqltest"
@ -533,7 +532,7 @@ start_master()
#start master
if [ -z "$DO_BENCH" ]
then
master_args="--no-defaults --log-bin=master-bin \
master_args="--no-defaults --log-bin=$MYSQL_TEST_DIR/var/log/master-bin \
--server-id=1 \
--basedir=$MY_BASEDIR \
--port=$MASTER_MYPORT \
@ -550,7 +549,8 @@ start_master()
$SMALL_SERVER \
$EXTRA_MASTER_OPT $EXTRA_MASTER_MYSQLD_OPT"
else
master_args="--no-defaults --log-bin=master-bin --server-id=1 \
master_args="--no-defaults --log-bin=$MYSQL_TEST_DIR/var/log/master-bin \
--server-id=1 \
--basedir=$MY_BASEDIR \
--port=$MASTER_MYPORT \
--datadir=$MASTER_MYDDIR \
@ -607,7 +607,8 @@ start_slave()
$RM -f $SLAVE_MYDDIR/log.*
slave_args="--no-defaults $master_info \
--exit-info=256 \
--log-bin=slave-bin --log-slave-updates \
--log-bin=$MYSQL_TEST_DIR/var/log/slave-bin
--log-slave-updates \
--basedir=$MY_BASEDIR \
--datadir=$SLAVE_MYDDIR \
--pid-file=$SLAVE_MYPID \

View File

@ -70,3 +70,15 @@ pseudo pseudo1 same
joce tsestset 1
joce testtt 1
dekad joce 1
pseudo1
testtt
tsestset
dekad
pseudo1
testtt
tsestset
dekad
pseudo1
testtt
tsestset
1

View File

@ -61,5 +61,8 @@ CREATE TABLE t1 (
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 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 ALL SELECT pseudo FROM t1 WHERE pseudo1='joce';
SELECT pseudo1 FROM t1 WHERE pseudo='joce' UNION SELECT 1;
drop table t1;

View File

@ -200,6 +200,7 @@ sub new
$main::opt_create_options =~ /type=gemini/i)
{
$limits{'working_blobs'} = 0; # Blobs not implemented yet
$limits{'max_tables'} = 500;
}
return $self;

View File

@ -24,7 +24,7 @@ INCLUDES = @MT_INCLUDES@ \
@bdb_includes@ @innodb_includes@ @gemini_includes@ \
-I$(srcdir)/../include \
-I$(srcdir)/../regex \
-I$(srcdir) -I../include $(openssl_includes)
-I$(srcdir) -I../include -I. $(openssl_includes)
WRAPLIBS= @WRAPLIBS@
SUBDIRS = share
libexec_PROGRAMS = mysqld

View File

@ -4122,7 +4122,7 @@ ulonglong Field_blob::get_id(const char *from)
ulonglong id = 0;
ulong length=get_length(from);
if (length)
uint8korr(id, from+packlength);
id=uint8korr(from+packlength);
return id;
}

View File

@ -26,7 +26,8 @@
#include "mysql_version.h"
#include "lex.h"
bool opt_search=0,opt_verbose=0;
bool opt_search=0;
int opt_verbose=0;
ulong opt_count=100000;
#define max_allowed_array 8000 // Don't generate bigger arrays than this
@ -216,7 +217,7 @@ you have to change 'main' to print out the new function\n");
return(1);
}
if (opt_verbose)
if (opt_verbose > 1)
fprintf (stderr,"Info: Possible add values: %d\n",found-type_count);
for (prime=primes; (function_mod=*prime) ; prime++)
@ -376,7 +377,7 @@ static int get_options(int argc, char **argv)
opt_search=1;
break;
case 'v':
opt_verbose=1;
opt_verbose++;
break;
case 'V': usage(1); exit(0);
case 'I':
@ -473,7 +474,7 @@ int main(int argc,char **argv)
MY_INIT(argv[0]);
start_value=2250933L; best_t1=2721579L; best_t2=4627039L; best_type=3; /* mode=4567 add=4 type: 0 */
start_value=1060872L; best_t1=7930739L; best_t2=4311642L; best_type=3; /* mode=5333 add=6 type: 0 */
if (get_options(argc,(char **) argv))
exit(1);
@ -493,7 +494,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",
start_value, best_t1,best_t2,best_type,best_mod,best_add,
best_functype);
best_start_value=start_value;
for (uint i=1 ; i <= opt_count ; i++)
{
if (i % 10 == 0)
@ -516,6 +517,10 @@ int main(int argc,char **argv)
best_start_value,best_t1,best_t2,best_type,best_mod,best_add,
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);
}
}

View File

@ -66,7 +66,13 @@ int ha_myisammrg::close(void)
int ha_myisammrg::write_row(byte * buf)
{
return (my_errno=HA_ERR_WRONG_COMMAND);
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);
// 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)
@ -217,6 +223,7 @@ THR_LOCK_DATA **ha_myisammrg::store_lock(THD *thd,
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");
if (!(create_info->used_fields & HA_CREATE_USED_UNION))
{
@ -241,6 +248,10 @@ void ha_myisammrg::update_create_info(HA_CREATE_INFO *create_info)
}
*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;
err:
@ -263,12 +274,20 @@ int ha_myisammrg::create(const char *name, register TABLE *form,
*pos++= tables->real_name;
*pos=0;
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)
{
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);
MYRG_TABLE *table,*first;

View File

@ -120,9 +120,10 @@ enum row_type { ROW_TYPE_DEFAULT, ROW_TYPE_FIXED, ROW_TYPE_DYNAMIC,
/* struct to hold information about the table that should be created */
/* Bits in used_fields */
#define HA_CREATE_USED_AUTO 1
#define HA_CREATE_USED_RAID 2
#define HA_CREATE_USED_UNION 4
#define HA_CREATE_USED_AUTO 1
#define HA_CREATE_USED_RAID 2
#define HA_CREATE_USED_UNION 4
#define HA_CREATE_USED_INSERT_METHOD 8
typedef struct st_thd_trans {
void *bdb_tid;
@ -150,6 +151,7 @@ typedef struct st_ha_create_information
bool if_not_exists;
ulong used_fields;
SQL_LIST merge_list;
uint merge_insert_method;
} HA_CREATE_INFO;

View File

@ -298,13 +298,21 @@ bool Item::fix_fields(THD *thd,
bool Item_field::fix_fields(THD *thd,TABLE_LIST *tables)
{
if (!field)
if (!field) // If field is not checked
{
Field *tmp;
if (!(tmp=find_field_in_tables(thd,this,tables)))
return 1;
set_field(tmp);
}
else if (thd && thd->set_query_id && field->query_id != thd->query_id)
{
/* We only come here in unions */
TABLE *table=field->table;
field->query_id=thd->query_id;
table->used_fields++;
table->used_keys&=field->part_of_key;
}
return 0;
}

View File

@ -83,7 +83,7 @@ static SYMBOL symbols[] = {
{ "CHANGED", SYM(CHANGED),0,0},
{ "CHECK", SYM(CHECK_SYM),0,0},
{ "CHECKSUM", SYM(CHECKSUM_SYM),0,0},
{ "CHIPHER", SYM(CHIPHER_SYM),0,0},
{ "CIPHER", SYM(CIPHER_SYM),0,0},
{ "CLOSE", SYM(CLOSE_SYM),0,0},
{ "COLUMN", SYM(COLUMN_SYM),0,0},
{ "COLUMNS", SYM(COLUMNS),0,0},
@ -178,6 +178,7 @@ static SYMBOL symbols[] = {
{ "INNODB", SYM(INNOBASE_SYM),0,0},
{ "INSERT", SYM(INSERT),0,0},
{ "INSERT_ID", SYM(INSERT_ID),0,0},
{ "INSERT_METHOD", SYM(INSERT_METHOD),0,0},
{ "INT", SYM(INT_SYM),0,0},
{ "INTEGER", SYM(INT_SYM),0,0},
{ "INTERVAL", SYM(INTERVAL_SYM),0,0},

View File

@ -469,7 +469,7 @@ Log_event* Log_event::read_log_event(IO_CACHE* file)
error = "read error";
goto err;
}
if((res = read_log_event(buf, data_len)))
if ((res = read_log_event(buf, data_len, &error)))
res->register_temp_buf(buf);
err:
UNLOCK_MUTEX;
@ -481,10 +481,11 @@ err:
return res;
}
Log_event* Log_event::read_log_event(const char* buf, int event_len)
Log_event* Log_event::read_log_event(const char* buf, int event_len,
const char **error)
{
if(event_len < EVENT_LEN_OFFSET ||
(uint)event_len != uint4korr(buf+EVENT_LEN_OFFSET))
if (event_len < EVENT_LEN_OFFSET ||
(uint)event_len != uint4korr(buf+EVENT_LEN_OFFSET))
return NULL; // general sanity check - will fail on a partial read
Log_event* ev = NULL;
@ -531,6 +532,7 @@ Log_event* Log_event::read_log_event(const char* buf, int event_len)
if (!ev) return 0;
if (!ev->is_valid())
{
*error= "Found invalid event in binary log";
delete ev;
return 0;
}
@ -812,80 +814,92 @@ int Load_log_event::write_data_body(IO_CACHE* file)
if (sql_ex.write_data(file)) return 1;
if (num_fields && fields && field_lens)
{
if(my_b_write(file, (byte*)field_lens, num_fields) ||
my_b_write(file, (byte*)fields, field_block_len))
if (my_b_write(file, (byte*)field_lens, num_fields) ||
my_b_write(file, (byte*)fields, field_block_len))
return 1;
}
return my_b_write(file, (byte*)table_name, table_name_len + 1) ||
my_b_write(file, (byte*)db, db_len + 1) ||
my_b_write(file, (byte*)fname, fname_len);
return (my_b_write(file, (byte*)table_name, table_name_len + 1) ||
my_b_write(file, (byte*)db, db_len + 1) ||
my_b_write(file, (byte*)fname, fname_len));
}
#define WRITE_STR(name) my_b_write(file,(byte*)&name ## _len, 1) || \
my_b_write(file,(byte*)name,name ## _len)
#define OLD_EX_INIT(name) old_ex.##name = *name
static bool write_str(IO_CACHE *file, char *str, byte length)
{
return (my_b_write(file, &length, 1) ||
my_b_write(file, (byte*) str, (int) length));
}
int sql_ex_info::write_data(IO_CACHE* file)
{
if (new_format())
{
return WRITE_STR(field_term) || WRITE_STR(enclosed) ||
WRITE_STR(line_term) || WRITE_STR(line_start) ||
WRITE_STR(escaped) || my_b_write(file,(byte*)&opt_flags,1);
return (write_str(file, field_term, field_term_len) ||
write_str(file, enclosed, enclosed_len) ||
write_str(file, line_term, line_term_len) ||
write_str(file, line_start, line_start_len) ||
write_str(file, escaped, escaped_len) ||
my_b_write(file,(byte*) &opt_flags,1));
}
else
{
old_sql_ex old_ex;
OLD_EX_INIT(field_term);
OLD_EX_INIT(enclosed);
OLD_EX_INIT(line_term);
OLD_EX_INIT(line_start);
OLD_EX_INIT(escaped);
old_ex.opt_flags = opt_flags;
old_ex.empty_flags = empty_flags;
return my_b_write(file,(byte*)&old_ex,sizeof(old_ex));
old_ex.field_term= *field_term;
old_ex.enclosed= *enclosed;
old_ex.line_term= *line_term;
old_ex.line_start= *line_start;
old_ex.escaped= *escaped;
old_ex.opt_flags= opt_flags;
old_ex.empty_flags=empty_flags;
return my_b_write(file, (byte*) &old_ex, sizeof(old_ex));
}
}
#define READ_STR(name) name ## _len = *buf++;\
if (buf >= buf_end) return 0;\
name = buf; \
buf += name ## _len; \
if (buf >= buf_end) return 0;
#define READ_OLD_STR(name) name ## _len = 1; \
name = buf++; \
if (buf >= buf_end) return 0;
#define FIX_OLD_LEN(name,NAME) if (empty_flags & NAME ## _EMPTY) \
name ## _len = 0
static inline int read_str(char * &buf, char *buf_end, char * &str,
uint8 &len)
{
if (buf + (uint) (uchar) *buf >= buf_end)
return 1;
len = (uint8) *buf;
str= buf+1;
buf+= (uint) len+1;
return 0;
}
char* sql_ex_info::init(char* buf,char* buf_end,bool use_new_format)
{
cached_new_format = use_new_format;
if (use_new_format)
{
READ_STR(field_term);
READ_STR(enclosed);
READ_STR(line_term);
READ_STR(line_start);
READ_STR(escaped);
empty_flags=0;
if (read_str(buf, buf_end, field_term, field_term_len) ||
read_str(buf, buf_end, enclosed, enclosed_len) ||
read_str(buf, buf_end, line_term, line_term_len) ||
read_str(buf, buf_end, line_start, line_start_len) ||
read_str(buf, buf_end, escaped, escaped_len))
return 0;
opt_flags = *buf++;
}
else
{
READ_OLD_STR(field_term);
READ_OLD_STR(enclosed);
READ_OLD_STR(line_term);
READ_OLD_STR(line_start);
READ_OLD_STR(escaped);
field_term_len= enclosed_len= line_term_len= line_start_len= escaped_len=1;
*field_term=*buf++;
*enclosed= *buf++;
*line_term= *buf++;
*line_start=*buf++;
*escaped= *buf++;
opt_flags = *buf++;
empty_flags = *buf++;
FIX_OLD_LEN(field_term,FIELD_TERM);
FIX_OLD_LEN(enclosed,ENCLOSED);
FIX_OLD_LEN(line_term,LINE_TERM);
FIX_OLD_LEN(line_start,LINE_START);
FIX_OLD_LEN(escaped,ESCAPED);
empty_flags=*buf++;
if (empty_flags & FIELD_TERM_EMPTY)
field_term_len=0;
if (empty_flags & ENCLOSED_EMPTY)
enclosed_len=0;
if (empty_flags & LINE_TERM_EMPTY)
line_term_len=0;
if (empty_flags & LINE_START_EMPTY)
line_start_len=0;
if (empty_flags & ESCAPED_EMPTY)
escaped_len=0;
}
return buf;
}
@ -1271,6 +1285,8 @@ Create_file_log_event::Create_file_log_event(const char* buf, int len):
block = (char*)buf + block_offset;
block_len = len - block_offset;
}
#ifdef MYSQL_CLIENT
void Create_file_log_event::print(FILE* file, bool short_form,
char* last_db)
@ -1553,20 +1569,16 @@ int Load_log_event::exec_event(NET* net, struct st_master_info* mi)
handle_dup = DUP_REPLACE;
sql_exchange ex((char*)fname, sql_ex.opt_flags &&
DUMPFILE_FLAG );
#define SET_EX(name) String name(sql_ex.name,sql_ex.name ## _len);\
ex.name = &name;
SET_EX(field_term);
SET_EX(enclosed);
SET_EX(line_term);
SET_EX(line_start);
SET_EX(escaped);
String field_term(sql_ex.field_term,sql_ex.field_term_len);
String enclosed(sql_ex.enclosed,sql_ex.enclosed_len);
String line_term(sql_ex.line_term,sql_ex.line_term_len);
String line_start(sql_ex.line_start,sql_ex.line_start_len);
String escaped(sql_ex.escaped,sql_ex.escaped_len);
ex.opt_enclosed = (sql_ex.opt_flags & OPT_ENCLOSED_FLAG);
if(sql_ex.empty_flags & FIELD_TERM_EMPTY)
if (sql_ex.empty_flags & FIELD_TERM_EMPTY)
ex.field_term->length(0);
ex.skip_lines = skip_lines;
List<Item> fields;
set_fields(fields);
@ -1862,10 +1874,3 @@ err:
#endif

View File

@ -272,7 +272,8 @@ public:
#else // avoid having to link mysqlbinlog against libpthread
static Log_event* read_log_event(IO_CACHE* file);
#endif
static Log_event* read_log_event(const char* buf, int event_len);
static Log_event* read_log_event(const char* buf, int event_len,
const char **error);
const char* get_type_str();
#ifndef MYSQL_CLIENT
@ -567,9 +568,10 @@ public:
uint file_id;
#ifndef MYSQL_CLIENT
Create_file_log_event(THD* thd, sql_exchange* ex, const char* db_arg,
const char* table_name_arg,
List<Item>& fields_arg, enum enum_duplicates handle_dup,
char* block_arg, uint block_len_arg);
const char* table_name_arg,
List<Item>& fields_arg,
enum enum_duplicates handle_dup,
char* block_arg, uint block_len_arg);
#endif
Create_file_log_event(const char* buf, int event_len);

View File

@ -22,7 +22,6 @@
in case we decide to make them external at some point
*/
#define DONT_USE_RAID
#if defined(__WIN__)
#include <winsock.h>
#include <odbcinst.h>
@ -41,6 +40,7 @@ inline int local_thr_alarm(my_bool *A,int B __attribute__((unused)),ALARM *C __a
#endif
#include <my_global.h>
#include <mysql_embed.h>
#include <mysql_com.h>
#include <violite.h>
#include <my_sys.h>

View File

@ -18,9 +18,10 @@
#define _MYSQL_PRIV_H
#include <my_global.h>
#include "mysql_embed.h"
#include <my_sys.h>
#include <m_string.h>
#include "mysql_version.h"
#include <mysql_version.h>
#include <hash.h>
#include <signal.h>
#include <thr_lock.h>

View File

@ -2642,9 +2642,8 @@ static struct option long_options[] = {
{"default-table-type", required_argument, 0, (int) OPT_TABLE_TYPE},
{"delay-key-write-for-all-tables",
no_argument, 0, (int) OPT_DELAY_KEY_WRITE},
{"do-pstack",
no_argument, 0, (int) OPT_DO_PSTACK},
{"enable-locking", no_argument, 0, (int) OPT_ENABLE_LOCK},
{"enable-pstack", no_argument, 0, (int) OPT_DO_PSTACK},
{"exit-info", optional_argument, 0, 'T'},
{"flush", no_argument, 0, (int) OPT_FLUSH},
#ifdef HAVE_GEMINI_DB
@ -3188,6 +3187,7 @@ static void usage(void)
Don't flush key buffers between writes for any MyISAM\n\
table\n\
--enable-locking Enable system locking\n\
--enable-pstack Print a symbolic stack trace on failure\n\
-T, --exit-info Used for debugging; Use at your own risk!\n\
--flush Flush tables to disk between SQL commands\n\
-?, --help Display this help and exit\n\

View File

@ -31,6 +31,7 @@
#include <winsock.h>
#endif
#include <my_global.h>
#include "mysql_embed.h"
#include <mysql_com.h>
#include <violite.h>
#include <my_sys.h>

View File

@ -305,7 +305,7 @@ static bool find_range_key(TABLE_REF *ref, Field* field, COND *cond)
key>>=1;
ref->key_length=0;
ref->key=idx;
if (field->part_of_key & ((table_map) 1 << idx))
if (field->part_of_key & ((key_map) 1 << idx))
{
table->key_read=1;
table->file->extra(HA_EXTRA_KEYREAD);
@ -350,7 +350,7 @@ static bool find_range_key(TABLE_REF *ref, Field* field, COND *cond)
{
ref->key_length= (uint) (key_ptr-ref->key_buff);
ref->key=idx;
if (field->part_of_key & ((table_map) 1 << idx))
if (field->part_of_key & ((key_map) 1 << idx))
{
table->key_read=1;
table->file->extra(HA_EXTRA_KEYREAD);

View File

@ -934,8 +934,9 @@ point. If you are sure that your master is ok, run this query manually on the\
static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len)
{
const char *error_msg;
Log_event * ev = Log_event::read_log_event((const char*)net->read_pos + 1,
event_len);
event_len, &error_msg);
if (ev)
{
int type_code = ev->get_type_code();

View File

@ -160,7 +160,7 @@ OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *wild)
if (table)
continue;
if (!(*start_list = (OPEN_TABLE_LIST *)
sql_alloc(sizeof(OPEN_TABLE_LIST)+entry->key_length)))
sql_alloc(sizeof(*start_list)+entry->key_length)))
{
open_list=0; // Out of memory
break;
@ -172,6 +172,7 @@ OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *wild)
(*start_list)->locked= entry->locked_by_name ? 1 : 0;
start_list= &(*start_list)->next;
}
*start_list=0;
VOID(pthread_mutex_unlock(&LOCK_open));
DBUG_RETURN(open_list);
}
@ -1579,13 +1580,7 @@ Field *find_field_in_table(THD *thd,TABLE *table,const char *name,uint length,
{
field->query_id=thd->query_id;
table->used_fields++;
if (field->part_of_key)
{
if (!(field->part_of_key & table->ref_primary_key))
table->used_keys&=field->part_of_key;
}
else
table->used_keys=0;
table->used_keys&=field->part_of_key;
}
else
thd->dupp_field=field;
@ -1655,7 +1650,8 @@ find_field_in_tables(THD *thd,Item_field *item,TABLE_LIST *tables)
for (; tables ; tables=tables->next)
{
Field *field=find_field_in_table(thd,tables->table,name,length,
grant_option && !thd->master_access, allow_rowid);
grant_option &&
!thd->master_access, allow_rowid);
if (field)
{
if (field == WRONG_GRANT)
@ -1879,14 +1875,7 @@ insert_fields(THD *thd,TABLE_LIST *tables, const char *db_name,
if (field->query_id == thd->query_id)
thd->dupp_field=field;
field->query_id=thd->query_id;
if (field->part_of_key)
{
if (!(field->part_of_key & table->ref_primary_key))
table->used_keys&=field->part_of_key;
}
else
table->used_keys=0;
table->used_keys&=field->part_of_key;
}
/* All fields are used */
table->used_fields=table->fields;
@ -1967,20 +1956,8 @@ int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds)
/* Mark field used for table cache */
t1->field[i]->query_id=t2->field[j]->query_id=thd->query_id;
cond_and->list.push_back(tmp);
if ((tmp_map=t1->field[i]->part_of_key))
{
if (!(tmp_map & t1->ref_primary_key))
t1->used_keys&=tmp_map;
}
else
t1->used_keys=0;
if ((tmp_map=t2->field[j]->part_of_key))
{
if (!(tmp_map & t2->ref_primary_key))
t2->used_keys&=tmp_map;
}
else
t2->used_keys=0;
t1->used_keys&= t1->field[i]->part_of_key;
t2->used_keys&= t2->field[j]->part_of_key;
break;
}
}

View File

@ -17,7 +17,6 @@
/* Function with list databases, tables or fields */
#include "my_global.h"
#include "mysql_priv.h"
#include "sql_select.h" // For select_describe
#include "sql_acl.h"

View File

@ -31,7 +31,7 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
ORDER *order;
List<Item> item_list;
TABLE *table;
TABLE_LIST *first_table, result_table_list;
TABLE_LIST result_table_list;
TMP_TABLE_PARAM tmp_table_param;
select_union *union_result;
int res;
@ -75,9 +75,9 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
{
Item *item;
List_iterator<Item> it(lex->select_lex.item_list);
TABLE_LIST *first_table= (TABLE_LIST*) lex->select_lex.table_list.first;
/* Create a list of items that will be in the result set */
first_table= (TABLE_LIST*) lex->select_lex.table_list.first;
while ((item= it++))
if (item_list.push_back(item))
DBUG_RETURN(-1);

View File

@ -27,6 +27,7 @@
#include "sql_acl.h"
#include "lex_symbol.h"
#include <myisam.h>
#include <myisammrg.h>
extern void yyerror(const char*);
int yylex(void *yylval);
@ -390,6 +391,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token IDENTIFIED_SYM
%token IF
%token INSERT_ID
%token INSERT_METHOD
%token INTERVAL_SYM
%token LAST_INSERT_ID
%token LEFT
@ -451,7 +453,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token ISSUER_SYM
%token SUBJECT_SYM
%token CHIPHER_SYM
%token CIPHER_SYM
%left SET_VAR
%left OR_OR_CONCAT OR
@ -490,7 +492,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
table_option opt_if_not_exists
%type <ulong_num>
ULONG_NUM raid_types
ULONG_NUM raid_types merge_insert_types
%type <ulonglong_number>
ulonglong_num
@ -796,6 +798,7 @@ create_table_option:
table_list->next=0;
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; }
| INDEX DIRECTORY_SYM EQ TEXT_STRING { Lex->create_info.index_file_name= $4.str; }
@ -819,6 +822,11 @@ raid_types:
| RAID_0_SYM { $$= RAID_TYPE_0; }
| 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:
/* empty */
| select_from select_lock_type
@ -2822,7 +2830,7 @@ keyword:
| CHANGED {}
| CHECKSUM_SYM {}
| CHECK_SYM {}
| CHIPHER_SYM {}
| CIPHER_SYM {}
| CLOSE_SYM {}
| COMMENT_SYM {}
| COMMIT_SYM {}
@ -2862,6 +2870,7 @@ keyword:
| ISAM_SYM {}
| ISSUER_SYM {}
| INNOBASE_SYM {}
| INSERT_METHOD {}
| LAST_SYM {}
| LEVEL_SYM {}
| LOCAL_SYM {}
@ -3312,7 +3321,7 @@ require_list_element: SUBJECT_SYM TEXT_STRING
{
Lex->ssl_issuer=$2.str;
}
| CHIPHER_SYM TEXT_STRING
| CIPHER_SYM TEXT_STRING
{
Lex->ssl_chipher=$2.str;
}

View File

@ -455,8 +455,12 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
if (key == primary_key)
{
field->flags|= PRI_KEY_FLAG;
/*
If this field is part of the primary key and all keys contains
the primary key, then we can use any key to find this column
*/
if (ha_option & HA_PRIMARY_KEY_IN_READ_INDEX)
field->part_of_key|= ((key_map) 1 << primary_key);
field->part_of_key= outparam->keys_in_use;
}
if (field->key_length() != key_part->length)
{
@ -480,8 +484,6 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
(outparam->keys_in_use & ((key_map) 1 << primary_key)))
{
outparam->primary_key=primary_key;
if (outparam->file->option_flag() & HA_PRIMARY_KEY_IN_READ_INDEX)
outparam->ref_primary_key= (key_map) 1 << primary_key;
/*
If we are using an integer as the primary key then allow the user to
refer to it as '_rowid'

View File

@ -117,7 +117,7 @@ struct st_table {
byte *record_pointers; /* If sorted in memory */
ha_rows found_records; /* How many records in sort */
ORDER *group;
key_map quick_keys, used_keys, ref_primary_key;
key_map quick_keys, used_keys;
ha_rows quick_rows[MAX_KEY];
uint quick_key_parts[MAX_KEY];
key_part_map const_key_parts[MAX_KEY];

View File

@ -6,5 +6,15 @@ mysqlmanager_SOURCES= mysqlmanager.c
mysqlmanager_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES)
DEF= -DUNDEF_THREADS_HACK
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 \
xtypes.h ac-types.h posix.h string.h __string.h \
errno.h socket.h inet.h dirent.h netdb.h \
cleanup.h cond.h debug_out.h fd.h kernel.h mutex.h \
prio_queue.h pthread_attr.h pthread_once.h queue.h\
sleep.h specific.h version.h pwd.h timers.h uio.h \
cdefs.h machdep.h signal.h __signal.h util.h lex.h \
wait.h
# Don't update the files from bitkeeper
%::SCCS/s.%