summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <serg@serg.mylan>2004-05-15 11:26:58 +0200
committerunknown <serg@serg.mylan>2004-05-15 11:26:58 +0200
commit36bce251128b8fd300c4a6329d0c2d8f601a14bc (patch)
tree7511a87efd9dc5060078495d60fc5092288b31ec
parentb40430e08cf40d931c511d4d31ea517b7294417b (diff)
parentfdd4717730796ba178cc59c3609e8693ed967105 (diff)
downloadmariadb-git-36bce251128b8fd300c4a6329d0c2d8f601a14bc.tar.gz
merged
mysql-test/r/innodb.result: Auto merged mysql-test/t/innodb.test: Auto merged sql/sql_select.cc: Auto merged
-rw-r--r--innobase/btr/btr0cur.c6
-rw-r--r--innobase/btr/btr0sea.c4
-rw-r--r--innobase/buf/buf0buf.c8
-rw-r--r--innobase/ibuf/ibuf0ibuf.c2
-rw-r--r--innobase/include/buf0buf.h14
-rw-r--r--innobase/include/buf0buf.ic2
-rw-r--r--innobase/include/mem0mem.h96
-rw-r--r--innobase/include/mem0mem.ic96
-rw-r--r--innobase/include/mtr0mtr.h8
-rw-r--r--innobase/include/mtr0mtr.ic4
-rw-r--r--innobase/include/pars0pars.h2
-rw-r--r--innobase/include/sync0arr.h2
-rw-r--r--innobase/include/sync0ipm.ic4
-rw-r--r--innobase/include/sync0rw.h44
-rw-r--r--innobase/include/sync0rw.ic22
-rw-r--r--innobase/include/sync0sync.h16
-rw-r--r--innobase/include/sync0sync.ic8
-rw-r--r--innobase/include/univ.i5
-rw-r--r--innobase/include/ut0dbg.h6
-rw-r--r--innobase/include/ut0mem.h21
-rw-r--r--innobase/include/ut0mem.ic12
-rw-r--r--innobase/lock/lock0lock.c2
-rw-r--r--innobase/log/log0recv.c6
-rw-r--r--innobase/mem/mem0mem.c34
-rw-r--r--innobase/os/os0file.c19
-rw-r--r--innobase/pars/pars0pars.c3
-rw-r--r--innobase/sync/sync0arr.c4
-rw-r--r--innobase/sync/sync0rw.c12
-rw-r--r--innobase/sync/sync0sync.c13
-rw-r--r--innobase/trx/trx0rec.c2
-rw-r--r--innobase/ut/ut0mem.c26
-rw-r--r--libmysqld/examples/Makefile.am1
-rw-r--r--mysql-test/r/func_encrypt.result2
-rw-r--r--mysql-test/r/func_gconcat.result9
-rw-r--r--mysql-test/r/innodb.result31
-rw-r--r--mysql-test/r/subselect.result89
-rw-r--r--mysql-test/t/func_gconcat.test10
-rw-r--r--mysql-test/t/innodb.test10
-rw-r--r--mysql-test/t/subselect.test34
-rw-r--r--sql/item_subselect.cc107
-rw-r--r--sql/item_subselect.h4
-rw-r--r--sql/item_sum.cc8
-rw-r--r--sql/item_sum.h8
-rw-r--r--sql/sql_base.cc9
-rw-r--r--sql/sql_class.cc2
-rw-r--r--sql/sql_lex.cc3
-rw-r--r--sql/sql_lex.h1
-rw-r--r--sql/sql_select.cc29
-rw-r--r--sql/sql_select.h1
-rw-r--r--sql/sql_table.cc11
-rw-r--r--sql/sql_union.cc29
-rw-r--r--tests/client_test.c5
52 files changed, 608 insertions, 298 deletions
diff --git a/innobase/btr/btr0cur.c b/innobase/btr/btr0cur.c
index e67d1d76113..5829cc2c406 100644
--- a/innobase/btr/btr0cur.c
+++ b/innobase/btr/btr0cur.c
@@ -399,7 +399,7 @@ btr_cur_search_to_nth_level(
retry_page_get:
page = buf_page_get_gen(space, page_no, rw_latch, guess,
buf_mode,
- IB__FILE__, __LINE__,
+ __FILE__, __LINE__,
mtr);
if (page == NULL) {
/* This must be a search to perform an insert;
@@ -580,7 +580,7 @@ btr_cur_open_at_index_side(
for (;;) {
page = buf_page_get_gen(space, page_no, RW_NO_LATCH, NULL,
BUF_GET,
- IB__FILE__, __LINE__,
+ __FILE__, __LINE__,
mtr);
ut_ad(0 == ut_dulint_cmp(tree->id,
btr_page_get_index_id(page)));
@@ -689,7 +689,7 @@ btr_cur_open_at_rnd_pos(
for (;;) {
page = buf_page_get_gen(space, page_no, RW_NO_LATCH, NULL,
BUF_GET,
- IB__FILE__, __LINE__,
+ __FILE__, __LINE__,
mtr);
ut_ad(0 == ut_dulint_cmp(tree->id,
btr_page_get_index_id(page)));
diff --git a/innobase/btr/btr0sea.c b/innobase/btr/btr0sea.c
index f2b03f9f348..9384168df88 100644
--- a/innobase/btr/btr0sea.c
+++ b/innobase/btr/btr0sea.c
@@ -764,7 +764,7 @@ btr_search_guess_on_hash(
success = buf_page_get_known_nowait(latch_mode, page,
BUF_MAKE_YOUNG,
- IB__FILE__, __LINE__,
+ __FILE__, __LINE__,
mtr);
rw_lock_s_unlock(&btr_search_latch);
@@ -1048,7 +1048,7 @@ btr_search_drop_page_hash_when_freed(
having to fear a deadlock. */
page = buf_page_get_gen(space, page_no, RW_S_LATCH, NULL,
- BUF_GET_IF_IN_POOL, IB__FILE__, __LINE__,
+ BUF_GET_IF_IN_POOL, __FILE__, __LINE__,
&mtr);
#ifdef UNIV_SYNC_DEBUG
diff --git a/innobase/buf/buf0buf.c b/innobase/buf/buf0buf.c
index 7a5ef3c5e14..4d83fb4c9f2 100644
--- a/innobase/buf/buf0buf.c
+++ b/innobase/buf/buf0buf.c
@@ -1048,7 +1048,7 @@ buf_page_get_gen(
buf_frame_t* guess, /* in: guessed frame or NULL */
ulint mode, /* in: BUF_GET, BUF_GET_IF_IN_POOL,
BUF_GET_NO_LATCH, BUF_GET_NOWAIT */
- char* file, /* in: file name */
+ const char* file, /* in: file name */
ulint line, /* in: line where called */
mtr_t* mtr) /* in: mini-transaction */
{
@@ -1257,7 +1257,7 @@ buf_page_optimistic_get_func(
frames */
dulint modify_clock,/* in: modify clock value if mode is
..._GUESS_ON_CLOCK */
- char* file, /* in: file name */
+ const char* file, /* in: file name */
ulint line, /* in: line where called */
mtr_t* mtr) /* in: mini-transaction */
{
@@ -1382,7 +1382,7 @@ buf_page_get_known_nowait(
ulint rw_latch,/* in: RW_S_LATCH, RW_X_LATCH */
buf_frame_t* guess, /* in: the known page frame */
ulint mode, /* in: BUF_MAKE_YOUNG or BUF_KEEP_OLD */
- char* file, /* in: file name */
+ const char* file, /* in: file name */
ulint line, /* in: line where called */
mtr_t* mtr) /* in: mini-transaction */
{
@@ -1742,7 +1742,7 @@ buf_page_create(
buf_LRU_add_block(block, FALSE);
#ifdef UNIV_SYNC_DEBUG
- buf_block_buf_fix_inc_debug(block, IB__FILE__, __LINE__);
+ buf_block_buf_fix_inc_debug(block, __FILE__, __LINE__);
#else
buf_block_buf_fix_inc(block);
#endif
diff --git a/innobase/ibuf/ibuf0ibuf.c b/innobase/ibuf/ibuf0ibuf.c
index ecdcf08e4c6..7dc0bd98001 100644
--- a/innobase/ibuf/ibuf0ibuf.c
+++ b/innobase/ibuf/ibuf0ibuf.c
@@ -3042,7 +3042,7 @@ loop:
if (page) {
ibool success = buf_page_get_known_nowait(RW_X_LATCH, page,
BUF_KEEP_OLD,
- IB__FILE__, __LINE__,
+ __FILE__, __LINE__,
&mtr);
ut_a(success);
#ifdef UNIV_SYNC_DEBUG
diff --git a/innobase/include/buf0buf.h b/innobase/include/buf0buf.h
index 6b8da886045..9590fea1276 100644
--- a/innobase/include/buf0buf.h
+++ b/innobase/include/buf0buf.h
@@ -132,7 +132,7 @@ to improve debugging. Only values RW_S_LATCH and RW_X_LATCH are allowed
in LA! */
#define buf_page_get(SP, OF, LA, MTR) buf_page_get_gen(\
SP, OF, LA, NULL,\
- BUF_GET, IB__FILE__, __LINE__, MTR)
+ BUF_GET, __FILE__, __LINE__, MTR)
/******************************************************************
Use these macros to bufferfix a page with no latching. Remember not to
read the contents of the page unless you know it is safe. Do not modify
@@ -141,19 +141,19 @@ error-prone programming not to set a latch, and it should be used
with care. */
#define buf_page_get_with_no_latch(SP, OF, MTR) buf_page_get_gen(\
SP, OF, RW_NO_LATCH, NULL,\
- BUF_GET_NO_LATCH, IB__FILE__, __LINE__, MTR)
+ BUF_GET_NO_LATCH, __FILE__, __LINE__, MTR)
/******************************************************************
NOTE! The following macros should be used instead of buf_page_get_gen, to
improve debugging. Only values RW_S_LATCH and RW_X_LATCH are allowed as LA! */
#define buf_page_get_nowait(SP, OF, LA, MTR) buf_page_get_gen(\
SP, OF, LA, NULL,\
- BUF_GET_NOWAIT, IB__FILE__, __LINE__, MTR)
+ BUF_GET_NOWAIT, __FILE__, __LINE__, MTR)
/******************************************************************
NOTE! The following macros should be used instead of
buf_page_optimistic_get_func, to improve debugging. Only values RW_S_LATCH and
RW_X_LATCH are allowed as LA! */
#define buf_page_optimistic_get(LA, BL, G, MC, MTR) buf_page_optimistic_get_func(\
- LA, BL, G, MC, IB__FILE__, __LINE__, MTR)
+ LA, BL, G, MC, __FILE__, __LINE__, MTR)
/************************************************************************
This is the general function used to get optimistic access to a database
page. */
@@ -168,7 +168,7 @@ buf_page_optimistic_get_func(
frames */
dulint modify_clock,/* in: modify clock value if mode is
..._GUESS_ON_CLOCK */
- char* file, /* in: file name */
+ const char* file, /* in: file name */
ulint line, /* in: line where called */
mtr_t* mtr); /* in: mini-transaction */
/************************************************************************
@@ -201,7 +201,7 @@ buf_page_get_known_nowait(
ulint rw_latch,/* in: RW_S_LATCH, RW_X_LATCH */
buf_frame_t* guess, /* in: the known page frame */
ulint mode, /* in: BUF_MAKE_YOUNG or BUF_KEEP_OLD */
- char* file, /* in: file name */
+ const char* file, /* in: file name */
ulint line, /* in: line where called */
mtr_t* mtr); /* in: mini-transaction */
/************************************************************************
@@ -217,7 +217,7 @@ buf_page_get_gen(
buf_frame_t* guess, /* in: guessed frame or NULL */
ulint mode, /* in: BUF_GET, BUF_GET_IF_IN_POOL,
BUF_GET_NO_LATCH */
- char* file, /* in: file name */
+ const char* file, /* in: file name */
ulint line, /* in: line where called */
mtr_t* mtr); /* in: mini-transaction */
/************************************************************************
diff --git a/innobase/include/buf0buf.ic b/innobase/include/buf0buf.ic
index b644afcbdff..4d1173a0d7f 100644
--- a/innobase/include/buf0buf.ic
+++ b/innobase/include/buf0buf.ic
@@ -585,7 +585,7 @@ buf_page_get_release_on_io(
frame = buf_page_get_gen(space, offset, rw_latch, guess,
BUF_GET_IF_IN_POOL,
- IB__FILE__, __LINE__,
+ __FILE__, __LINE__,
mtr);
if (frame != NULL) {
diff --git a/innobase/include/mem0mem.h b/innobase/include/mem0mem.h
index 89e2a337c99..18bffe5732e 100644
--- a/innobase/include/mem0mem.h
+++ b/innobase/include/mem0mem.h
@@ -64,14 +64,14 @@ heap creation. */
#define mem_heap_create(N) mem_heap_create_func(\
(N), NULL, MEM_HEAP_DYNAMIC,\
- IB__FILE__, __LINE__)
+ __FILE__, __LINE__)
/******************************************************************
Use this macro instead of the corresponding function! Macro for memory
heap creation. */
#define mem_heap_create_in_buffer(N) mem_heap_create_func(\
(N), NULL, MEM_HEAP_BUFFER,\
- IB__FILE__, __LINE__)
+ __FILE__, __LINE__)
/******************************************************************
Use this macro instead of the corresponding function! Macro for memory
heap creation. */
@@ -79,7 +79,7 @@ heap creation. */
#define mem_heap_create_in_btr_search(N) mem_heap_create_func(\
(N), NULL, MEM_HEAP_BTR_SEARCH |\
MEM_HEAP_BUFFER,\
- IB__FILE__, __LINE__)
+ __FILE__, __LINE__)
/******************************************************************
Use this macro instead of the corresponding function! Macro for fast
memory heap creation. An initial block of memory B is given by the
@@ -88,14 +88,14 @@ mem_heap_free. See the parameter comment in mem_heap_create_func below. */
#define mem_heap_fast_create(N, B) mem_heap_create_func(\
(N), (B), MEM_HEAP_DYNAMIC,\
- IB__FILE__, __LINE__)
+ __FILE__, __LINE__)
/******************************************************************
Use this macro instead of the corresponding function! Macro for memory
heap freeing. */
#define mem_heap_free(heap) mem_heap_free_func(\
- (heap), IB__FILE__, __LINE__)
+ (heap), __FILE__, __LINE__)
/*********************************************************************
NOTE: Use the corresponding macros instead of this function. Creates a
memory heap which allocates memory from dynamic space. For debugging
@@ -105,26 +105,27 @@ UNIV_INLINE
mem_heap_t*
mem_heap_create_func(
/*=================*/
- /* out, own: memory heap */
- ulint n, /* in: desired start block size,
- this means that a single user buffer
- of size n will fit in the block,
- 0 creates a default size block;
- if init_block is not NULL, n tells
- its size in bytes */
- void* init_block, /* in: if very fast creation is
- wanted, the caller can reserve some
- memory from its stack, for example,
- and pass it as the the initial block
- to the heap: then no OS call of malloc
- is needed at the creation. CAUTION:
- the caller must make sure the initial
- block is not unintentionally erased
- (if allocated in the stack), before
- the memory heap is explicitly freed. */
- ulint type, /* in: MEM_HEAP_DYNAMIC or MEM_HEAP_BUFFER */
- char* file_name, /* in: file name where created */
- ulint line /* in: line where created */
+ /* out, own: memory heap */
+ ulint n, /* in: desired start block size,
+ this means that a single user buffer
+ of size n will fit in the block,
+ 0 creates a default size block;
+ if init_block is not NULL, n tells
+ its size in bytes */
+ void* init_block, /* in: if very fast creation is
+ wanted, the caller can reserve some
+ memory from its stack, for example,
+ and pass it as the the initial block
+ to the heap: then no OS call of malloc
+ is needed at the creation. CAUTION:
+ the caller must make sure the initial
+ block is not unintentionally erased
+ (if allocated in the stack), before
+ the memory heap is explicitly freed. */
+ ulint type, /* in: MEM_HEAP_DYNAMIC
+ or MEM_HEAP_BUFFER */
+ const char* file_name, /* in: file name where created */
+ ulint line /* in: line where created */
);
/*********************************************************************
NOTE: Use the corresponding macro instead of this function. Frees the space
@@ -135,7 +136,7 @@ void
mem_heap_free_func(
/*===============*/
mem_heap_t* heap, /* in, own: heap to be freed */
- char* file_name __attribute__((unused)),
+ const char* file_name __attribute__((unused)),
/* in: file name where freed */
ulint line __attribute__((unused)));
/* in: line where freed */
@@ -206,13 +207,13 @@ mem_heap_get_size(
Use this macro instead of the corresponding function!
Macro for memory buffer allocation */
-#define mem_alloc(N) mem_alloc_func((N), IB__FILE__, __LINE__)
+#define mem_alloc(N) mem_alloc_func((N), __FILE__, __LINE__)
/******************************************************************
Use this macro instead of the corresponding function!
Macro for memory buffer allocation */
#define mem_alloc_noninline(N) mem_alloc_func_noninline(\
- (N), IB__FILE__, __LINE__)
+ (N), __FILE__, __LINE__)
/*******************************************************************
NOTE: Use the corresponding macro instead of this function.
Allocates a single buffer of memory from the dynamic memory of
@@ -222,11 +223,11 @@ UNIV_INLINE
void*
mem_alloc_func(
/*===========*/
- /* out, own: free storage, NULL
- if did not succeed */
- ulint n, /* in: desired number of bytes */
- char* file_name, /* in: file name where created */
- ulint line /* in: line where created */
+ /* out, own: free storage, NULL
+ if did not succeed */
+ ulint n, /* in: desired number of bytes */
+ const char* file_name, /* in: file name where created */
+ ulint line /* in: line where created */
);
/*******************************************************************
NOTE: Use the corresponding macro instead of this function.
@@ -237,17 +238,17 @@ with mem_free. */
void*
mem_alloc_func_noninline(
/*=====================*/
- /* out, own: free storage, NULL if did not
- succeed */
- ulint n, /* in: desired number of bytes */
- char* file_name, /* in: file name where created */
- ulint line /* in: line where created */
+ /* out, own: free storage,
+ NULL if did not succeed */
+ ulint n, /* in: desired number of bytes */
+ const char* file_name, /* in: file name where created */
+ ulint line /* in: line where created */
);
/******************************************************************
Use this macro instead of the corresponding function!
Macro for memory buffer freeing */
-#define mem_free(PTR) mem_free_func((PTR), IB__FILE__, __LINE__)
+#define mem_free(PTR) mem_free_func((PTR), __FILE__, __LINE__)
/*******************************************************************
NOTE: Use the corresponding macro instead of this function.
Frees a single buffer of storage from
@@ -256,9 +257,9 @@ UNIV_INLINE
void
mem_free_func(
/*==========*/
- void* ptr, /* in, own: buffer to be freed */
- char* file_name, /* in: file name where created */
- ulint line /* in: line where created */
+ void* ptr, /* in, own: buffer to be freed */
+ const char* file_name, /* in: file name where created */
+ ulint line /* in: line where created */
);
/*******************************************************************
Implements realloc. */
@@ -266,11 +267,12 @@ UNIV_INLINE
void*
mem_realloc(
/*========*/
- /* out, own: free storage, NULL if did not succeed */
- void* buf, /* in: pointer to an old buffer */
- ulint n, /* in: desired number of bytes */
- char* file_name,/* in: file name where called */
- ulint line); /* in: line where called */
+ /* out, own: free storage,
+ NULL if did not succeed */
+ void* buf, /* in: pointer to an old buffer */
+ ulint n, /* in: desired number of bytes */
+ const char* file_name, /* in: file name where called */
+ ulint line); /* in: line where called */
/**************************************************************************
Duplicates a NUL-terminated string. */
diff --git a/innobase/include/mem0mem.ic b/innobase/include/mem0mem.ic
index c250e6948ec..df3dbf9b576 100644
--- a/innobase/include/mem0mem.ic
+++ b/innobase/include/mem0mem.ic
@@ -16,18 +16,18 @@ Creates a memory heap block where data can be allocated. */
mem_block_t*
mem_heap_create_block(
/*==================*/
- /* out, own: memory heap block, NULL if did not
- succeed */
- mem_heap_t* heap,/* in: memory heap or NULL if first block should
- be created */
- ulint n, /* in: number of bytes needed for user data, or
- if init_block is not NULL, its size in bytes */
- void* init_block, /* in: init block in fast create, type must be
- MEM_HEAP_DYNAMIC */
- ulint type, /* in: type of heap: MEM_HEAP_DYNAMIC or
- MEM_HEAP_BUFFER */
- char* file_name,/* in: file name where created */
- ulint line); /* in: line where created */
+ /* out, own: memory heap block,
+ NULL if did not succeed */
+ mem_heap_t* heap, /* in: memory heap or NULL if first block
+ should be created */
+ ulint n, /* in: number of bytes needed for user data, or
+ if init_block is not NULL, its size in bytes */
+ void* init_block, /* in: init block in fast create,
+ type must be MEM_HEAP_DYNAMIC */
+ ulint type, /* in: type of heap: MEM_HEAP_DYNAMIC or
+ MEM_HEAP_BUFFER */
+ const char* file_name,/* in: file name where created */
+ ulint line); /* in: line where created */
/**********************************************************************
Frees a block from a memory heap. */
@@ -377,27 +377,27 @@ UNIV_INLINE
mem_heap_t*
mem_heap_create_func(
/*=================*/
- /* out, own: memory heap */
- ulint n, /* in: desired start block size,
- this means that a single user buffer
- of size n will fit in the block,
- 0 creates a default size block;
- if init_block is not NULL, n tells
- its size in bytes */
- void* init_block, /* in: if very fast creation is
- wanted, the caller can reserve some
- memory from its stack, for example,
- and pass it as the the initial block
- to the heap: then no OS call of malloc
- is needed at the creation. CAUTION:
- the caller must make sure the initial
- block is not unintentionally erased
- (if allocated in the stack), before
- the memory heap is explicitly freed. */
- ulint type, /* in: MEM_HEAP_DYNAMIC, or MEM_HEAP_BUFFER
- possibly ORed to MEM_HEAP_BTR_SEARCH */
- char* file_name, /* in: file name where created */
- ulint line /* in: line where created */
+ /* out, own: memory heap */
+ ulint n, /* in: desired start block size,
+ this means that a single user buffer
+ of size n will fit in the block,
+ 0 creates a default size block;
+ if init_block is not NULL, n tells
+ its size in bytes */
+ void* init_block, /* in: if very fast creation is
+ wanted, the caller can reserve some
+ memory from its stack, for example,
+ and pass it as the the initial block
+ to the heap: then no OS call of malloc
+ is needed at the creation. CAUTION:
+ the caller must make sure the initial
+ block is not unintentionally erased
+ (if allocated in the stack), before
+ the memory heap is explicitly freed. */
+ ulint type, /* in: MEM_HEAP_DYNAMIC
+ or MEM_HEAP_BUFFER */
+ const char* file_name, /* in: file name where created */
+ ulint line /* in: line where created */
)
{
mem_block_t* block;
@@ -440,10 +440,9 @@ void
mem_heap_free_func(
/*===============*/
mem_heap_t* heap, /* in, own: heap to be freed */
- char* file_name __attribute__((unused)),
+ const char* file_name __attribute__((unused)),
/* in: file name where freed */
ulint line __attribute__((unused)))
- /* in: line where freed */
{
mem_block_t* block;
mem_block_t* prev_block;
@@ -486,11 +485,11 @@ UNIV_INLINE
void*
mem_alloc_func(
/*===========*/
- /* out, own: free storage, NULL if did not
- succeed */
- ulint n, /* in: desired number of bytes */
- char* file_name, /* in: file name where created */
- ulint line /* in: line where created */
+ /* out, own: free storage, NULL
+ if did not succeed */
+ ulint n, /* in: desired number of bytes */
+ const char* file_name, /* in: file name where created */
+ ulint line /* in: line where created */
)
{
mem_heap_t* heap;
@@ -523,9 +522,9 @@ UNIV_INLINE
void
mem_free_func(
/*==========*/
- void* ptr, /* in, own: buffer to be freed */
- char* file_name, /* in: file name where created */
- ulint line /* in: line where created */
+ void* ptr, /* in, own: buffer to be freed */
+ const char* file_name, /* in: file name where created */
+ ulint line /* in: line where created */
)
{
mem_heap_t* heap;
@@ -569,11 +568,12 @@ UNIV_INLINE
void*
mem_realloc(
/*========*/
- /* out, own: free storage, NULL if did not succeed */
- void* buf, /* in: pointer to an old buffer */
- ulint n, /* in: desired number of bytes */
- char* file_name,/* in: file name where called */
- ulint line) /* in: line where called */
+ /* out, own: free storage,
+ NULL if did not succeed */
+ void* buf, /* in: pointer to an old buffer */
+ ulint n, /* in: desired number of bytes */
+ const char* file_name, /* in: file name where called */
+ ulint line) /* in: line where called */
{
mem_free(buf);
diff --git a/innobase/include/mtr0mtr.h b/innobase/include/mtr0mtr.h
index 73338977b9c..f6dfe23bc41 100644
--- a/innobase/include/mtr0mtr.h
+++ b/innobase/include/mtr0mtr.h
@@ -198,11 +198,11 @@ mtr_read_dulint(
mtr_t* mtr); /* in: mini-transaction handle */
/*************************************************************************
This macro locks an rw-lock in s-mode. */
-#define mtr_s_lock(B, MTR) mtr_s_lock_func((B), IB__FILE__, __LINE__,\
+#define mtr_s_lock(B, MTR) mtr_s_lock_func((B), __FILE__, __LINE__,\
(MTR))
/*************************************************************************
This macro locks an rw-lock in x-mode. */
-#define mtr_x_lock(B, MTR) mtr_x_lock_func((B), IB__FILE__, __LINE__,\
+#define mtr_x_lock(B, MTR) mtr_x_lock_func((B), __FILE__, __LINE__,\
(MTR))
/*************************************************************************
NOTE! Use the macro above!
@@ -212,7 +212,7 @@ void
mtr_s_lock_func(
/*============*/
rw_lock_t* lock, /* in: rw-lock */
- char* file, /* in: file name */
+ const char* file, /* in: file name */
ulint line, /* in: line number */
mtr_t* mtr); /* in: mtr */
/*************************************************************************
@@ -223,7 +223,7 @@ void
mtr_x_lock_func(
/*============*/
rw_lock_t* lock, /* in: rw-lock */
- char* file, /* in: file name */
+ const char* file, /* in: file name */
ulint line, /* in: line number */
mtr_t* mtr); /* in: mtr */
diff --git a/innobase/include/mtr0mtr.ic b/innobase/include/mtr0mtr.ic
index 51112fc0d14..4fc6dd2f6a9 100644
--- a/innobase/include/mtr0mtr.ic
+++ b/innobase/include/mtr0mtr.ic
@@ -217,7 +217,7 @@ void
mtr_s_lock_func(
/*============*/
rw_lock_t* lock, /* in: rw-lock */
- char* file, /* in: file name */
+ const char* file, /* in: file name */
ulint line, /* in: line number */
mtr_t* mtr) /* in: mtr */
{
@@ -236,7 +236,7 @@ void
mtr_x_lock_func(
/*============*/
rw_lock_t* lock, /* in: rw-lock */
- char* file, /* in: file name */
+ const char* file, /* in: file name */
ulint line, /* in: line number */
mtr_t* mtr) /* in: mtr */
{
diff --git a/innobase/include/pars0pars.h b/innobase/include/pars0pars.h
index 2e86a7e5534..c260557c424 100644
--- a/innobase/include/pars0pars.h
+++ b/innobase/include/pars0pars.h
@@ -92,7 +92,7 @@ Called by yyparse on error. */
void
yyerror(
/*====*/
- char* s); /* in: error message string */
+ const char* s); /* in: error message string */
/*************************************************************************
Parses a variable declaration. */
diff --git a/innobase/include/sync0arr.h b/innobase/include/sync0arr.h
index 383d0c69fb2..e7d511f8137 100644
--- a/innobase/include/sync0arr.h
+++ b/innobase/include/sync0arr.h
@@ -51,7 +51,7 @@ sync_array_reserve_cell(
sync_array_t* arr, /* in: wait array */
void* object, /* in: pointer to the object to wait for */
ulint type, /* in: lock request type */
- char* file, /* in: file where requested */
+ const char* file, /* in: file where requested */
ulint line, /* in: line where requested */
ulint* index); /* out: index of the reserved cell */
/**********************************************************************
diff --git a/innobase/include/sync0ipm.ic b/innobase/include/sync0ipm.ic
index b8aa87ba6d6..126aceae1eb 100644
--- a/innobase/include/sync0ipm.ic
+++ b/innobase/include/sync0ipm.ic
@@ -92,7 +92,7 @@ loop:
loop_count++;
ut_ad(loop_count < 15);
- if (mutex_enter_nowait(mutex, IB__FILE__, __LINE__) == 0) {
+ if (mutex_enter_nowait(mutex, __FILE__, __LINE__) == 0) {
/* Succeeded! */
return(0);
@@ -105,7 +105,7 @@ loop:
/* Order is important here: FIRST reset event, then set waiters */
ip_mutex_set_waiters(ip_mutex, 1);
- if (mutex_enter_nowait(mutex, IB__FILE__, __LINE__) == 0) {
+ if (mutex_enter_nowait(mutex, __FILE__, __LINE__) == 0) {
/* Succeeded! */
return(0);
diff --git a/innobase/include/sync0rw.h b/innobase/include/sync0rw.h
index 82123a529a3..63b01ffac80 100644
--- a/innobase/include/sync0rw.h
+++ b/innobase/include/sync0rw.h
@@ -62,7 +62,7 @@ location (which must be appropriately aligned). The rw-lock is initialized
to the non-locked state. Explicit freeing of the rw-lock with rw_lock_free
is necessary only if the memory block containing it is freed. */
-#define rw_lock_create(L) rw_lock_create_func((L), IB__FILE__, __LINE__)
+#define rw_lock_create(L) rw_lock_create_func((L), __FILE__, __LINE__)
/*=====================*/
/**********************************************************************
Creates, or rather, initializes an rw-lock object in a specified memory
@@ -74,7 +74,7 @@ void
rw_lock_create_func(
/*================*/
rw_lock_t* lock, /* in: pointer to memory */
- char* cfile_name, /* in: file name where created */
+ const char* cfile_name, /* in: file name where created */
ulint cline); /* in: file line where created */
/**********************************************************************
Calling this function is obligatory only if the memory buffer containing
@@ -100,19 +100,19 @@ NOTE! The following macros should be used in rw s-locking, not the
corresponding function. */
#define rw_lock_s_lock(M) rw_lock_s_lock_func(\
- (M), 0, IB__FILE__, __LINE__)
+ (M), 0, __FILE__, __LINE__)
/******************************************************************
NOTE! The following macros should be used in rw s-locking, not the
corresponding function. */
#define rw_lock_s_lock_gen(M, P) rw_lock_s_lock_func(\
- (M), (P), IB__FILE__, __LINE__)
+ (M), (P), __FILE__, __LINE__)
/******************************************************************
NOTE! The following macros should be used in rw s-locking, not the
corresponding function. */
#define rw_lock_s_lock_nowait(M) rw_lock_s_lock_func_nowait(\
- (M), IB__FILE__, __LINE__)
+ (M), __FILE__, __LINE__)
/**********************************************************************
NOTE! Use the corresponding macro, not directly this function, except if
you supply the file name and line number. Lock an rw-lock in shared mode
@@ -127,7 +127,7 @@ rw_lock_s_lock_func(
rw_lock_t* lock, /* in: pointer to rw-lock */
ulint pass, /* in: pass value; != 0, if the lock will
be passed to another thread to unlock */
- char* file_name,/* in: file name where lock requested */
+ const char* file_name,/* in: file name where lock requested */
ulint line); /* in: line where requested */
/**********************************************************************
NOTE! Use the corresponding macro, not directly this function, except if
@@ -139,7 +139,7 @@ rw_lock_s_lock_func_nowait(
/*=======================*/
/* out: TRUE if success */
rw_lock_t* lock, /* in: pointer to rw-lock */
- char* file_name,/* in: file name where lock requested */
+ const char* file_name,/* in: file name where lock requested */
ulint line); /* in: line where requested */
/**********************************************************************
NOTE! Use the corresponding macro, not directly this function! Lock an
@@ -151,7 +151,7 @@ rw_lock_x_lock_func_nowait(
/*=======================*/
/* out: TRUE if success */
rw_lock_t* lock, /* in: pointer to rw-lock */
- char* file_name,/* in: file name where lock requested */
+ const char* file_name,/* in: file name where lock requested */
ulint line); /* in: line where requested */
/**********************************************************************
Releases a shared mode lock. */
@@ -186,19 +186,19 @@ NOTE! The following macro should be used in rw x-locking, not the
corresponding function. */
#define rw_lock_x_lock(M) rw_lock_x_lock_func(\
- (M), 0, IB__FILE__, __LINE__)
+ (M), 0, __FILE__, __LINE__)
/******************************************************************
NOTE! The following macro should be used in rw x-locking, not the
corresponding function. */
#define rw_lock_x_lock_gen(M, P) rw_lock_x_lock_func(\
- (M), (P), IB__FILE__, __LINE__)
+ (M), (P), __FILE__, __LINE__)
/******************************************************************
NOTE! The following macros should be used in rw x-locking, not the
corresponding function. */
#define rw_lock_x_lock_nowait(M) rw_lock_x_lock_func_nowait(\
- (M), IB__FILE__, __LINE__)
+ (M), __FILE__, __LINE__)
/**********************************************************************
NOTE! Use the corresponding macro, not directly this function! Lock an
rw-lock in exclusive mode for the current thread. If the rw-lock is locked
@@ -215,7 +215,7 @@ rw_lock_x_lock_func(
rw_lock_t* lock, /* in: pointer to rw-lock */
ulint pass, /* in: pass value; != 0, if the lock will
be passed to another thread to unlock */
- char* file_name,/* in: file name where lock requested */
+ const char* file_name,/* in: file name where lock requested */
ulint line); /* in: line where requested */
/**********************************************************************
Releases an exclusive mode lock. */
@@ -253,9 +253,9 @@ UNIV_INLINE
void
rw_lock_s_lock_direct(
/*==================*/
- rw_lock_t* lock /* in: pointer to rw-lock */
- ,char* file_name, /* in: file name where lock requested */
- ulint line /* in: line where requested */
+ rw_lock_t* lock, /* in: pointer to rw-lock */
+ const char* file_name, /* in: file name where requested */
+ ulint line /* in: line where lock requested */
);
/**********************************************************************
Low-level function which locks an rw-lock in x-mode when we know that it
@@ -265,9 +265,9 @@ UNIV_INLINE
void
rw_lock_x_lock_direct(
/*==================*/
- rw_lock_t* lock /* in: pointer to rw-lock */
- ,char* file_name, /* in: file name where lock requested */
- ulint line /* in: line where requested */
+ rw_lock_t* lock, /* in: pointer to rw-lock */
+ const char* file_name, /* in: file name where requested */
+ ulint line /* in: line where lock requested */
);
/**********************************************************************
This function is used in the insert buffer to move the ownership of an
@@ -451,10 +451,10 @@ struct rw_lock_struct {
#endif /* UNIV_SYNC_DEBUG */
ulint level; /* Level in the global latching
order; default SYNC_LEVEL_NONE */
- char* cfile_name; /* File name where lock created */
+ const char* cfile_name;/* File name where lock created */
ulint cline; /* Line where created */
- char* last_s_file_name;/* File name where last time s-locked */
- char* last_x_file_name;/* File name where last time x-locked */
+ const char* last_s_file_name;/* File name where last s-locked */
+ const char* last_x_file_name;/* File name where last x-locked */
ulint last_s_line; /* Line number where last time s-locked */
ulint last_x_line; /* Line number where last time x-locked */
ulint magic_n;
@@ -471,7 +471,7 @@ struct rw_lock_debug_struct {
ulint pass; /* Pass value given in the lock operation */
ulint lock_type; /* Type of the lock: RW_LOCK_EX,
RW_LOCK_SHARED, RW_LOCK_WAIT_EX */
- char* file_name; /* File name where the lock was obtained */
+ const char* file_name;/* File name where the lock was obtained */
ulint line; /* Line where the rw-lock was locked */
UT_LIST_NODE_T(rw_lock_debug_t) list;
/* Debug structs are linked in a two-way
diff --git a/innobase/include/sync0rw.ic b/innobase/include/sync0rw.ic
index 8fc93f4a9da..655bd7f6517 100644
--- a/innobase/include/sync0rw.ic
+++ b/innobase/include/sync0rw.ic
@@ -18,7 +18,7 @@ rw_lock_s_lock_spin(
rw_lock_t* lock, /* in: pointer to rw-lock */
ulint pass, /* in: pass value; != 0, if the lock will
be passed to another thread to unlock */
- char* file_name,/* in: file name where lock requested */
+ const char* file_name,/* in: file name where lock requested */
ulint line); /* in: line where requested */
#ifdef UNIV_SYNC_DEBUG
/**********************************************************************
@@ -130,7 +130,7 @@ rw_lock_s_lock_low(
ulint pass __attribute__((unused)),
/* in: pass value; != 0, if the lock will be
passed to another thread to unlock */
- char* file_name, /* in: file name where lock requested */
+ const char* file_name, /* in: file name where lock requested */
ulint line) /* in: line where requested */
{
#ifdef UNIV_SYNC_DEBUG
@@ -163,9 +163,9 @@ UNIV_INLINE
void
rw_lock_s_lock_direct(
/*==================*/
- rw_lock_t* lock, /* in: pointer to rw-lock */
- char* file_name,/* in: file name where lock requested */
- ulint line) /* in: line where requested */
+ rw_lock_t* lock, /* in: pointer to rw-lock */
+ const char* file_name, /* in: file name where requested */
+ ulint line) /* in: line where lock requested */
{
ut_ad(lock->writer == RW_LOCK_NOT_LOCKED);
ut_ad(rw_lock_get_reader_count(lock) == 0);
@@ -189,9 +189,9 @@ UNIV_INLINE
void
rw_lock_x_lock_direct(
/*==================*/
- rw_lock_t* lock, /* in: pointer to rw-lock */
- char* file_name, /* in: file name where lock requested */
- ulint line) /* in: line where requested */
+ rw_lock_t* lock, /* in: pointer to rw-lock */
+ const char* file_name, /* in: file name where requested */
+ ulint line) /* in: line where lock requested */
{
ut_ad(rw_lock_validate(lock));
ut_ad(rw_lock_get_reader_count(lock) == 0);
@@ -223,7 +223,7 @@ rw_lock_s_lock_func(
rw_lock_t* lock, /* in: pointer to rw-lock */
ulint pass, /* in: pass value; != 0, if the lock will
be passed to another thread to unlock */
- char* file_name, /* in: file name where lock requested */
+ const char* file_name,/* in: file name where lock requested */
ulint line) /* in: line where requested */
{
/* NOTE: As we do not know the thread ids for threads which have
@@ -267,7 +267,7 @@ rw_lock_s_lock_func_nowait(
/*=======================*/
/* out: TRUE if success */
rw_lock_t* lock, /* in: pointer to rw-lock */
- char* file_name,/* in: file name where lock requested */
+ const char* file_name,/* in: file name where lock requested */
ulint line) /* in: line where requested */
{
ibool success = FALSE;
@@ -304,7 +304,7 @@ rw_lock_x_lock_func_nowait(
/*=======================*/
/* out: TRUE if success */
rw_lock_t* lock, /* in: pointer to rw-lock */
- char* file_name, /* in: file name where lock requested */
+ const char* file_name,/* in: file name where lock requested */
ulint line) /* in: line where requested */
{
ibool success = FALSE;
diff --git a/innobase/include/sync0sync.h b/innobase/include/sync0sync.h
index 0cc48d5f299..4307ca5ba0c 100644
--- a/innobase/include/sync0sync.h
+++ b/innobase/include/sync0sync.h
@@ -36,7 +36,7 @@ in the reset state. Explicit freeing of the mutex with mutex_free is
necessary only if the memory block containing it is freed. */
-#define mutex_create(M) mutex_create_func((M), IB__FILE__, __LINE__)
+#define mutex_create(M) mutex_create_func((M), __FILE__, __LINE__)
/*===================*/
/**********************************************************************
Creates, or rather, initializes a mutex object in a specified memory
@@ -48,7 +48,7 @@ void
mutex_create_func(
/*==============*/
mutex_t* mutex, /* in: pointer to memory */
- char* cfile_name, /* in: file name where created */
+ const char* cfile_name, /* in: file name where created */
ulint cline); /* in: file line where created */
/**********************************************************************
Calling this function is obligatory only if the memory buffer containing
@@ -64,7 +64,7 @@ mutex_free(
NOTE! The following macro should be used in mutex locking, not the
corresponding function. */
-#define mutex_enter(M) mutex_enter_func((M), IB__FILE__, __LINE__)
+#define mutex_enter(M) mutex_enter_func((M), __FILE__, __LINE__)
/**********************************************************************
A noninlined function that reserves a mutex. In ha_innodb.cc we have disabled
inlining of InnoDB functions, and no inlined functions should be called from
@@ -80,7 +80,7 @@ corresponding function. */
/* NOTE! currently same as mutex_enter! */
-#define mutex_enter_fast(M) mutex_enter_func((M), IB__FILE__, __LINE__)
+#define mutex_enter_fast(M) mutex_enter_func((M), __FILE__, __LINE__)
#define mutex_enter_fast_func mutex_enter_func;
/**********************************************************************
NOTE! Use the corresponding macro in the header file, not this function
@@ -92,7 +92,7 @@ void
mutex_enter_func(
/*=============*/
mutex_t* mutex, /* in: pointer to mutex */
- char* file_name, /* in: file name where locked */
+ const char* file_name, /* in: file name where locked */
ulint line); /* in: line where locked */
/************************************************************************
Tries to lock the mutex for the current thread. If the lock is not acquired
@@ -103,9 +103,9 @@ mutex_enter_nowait(
/*===============*/
/* out: 0 if succeed, 1 if not */
mutex_t* mutex, /* in: pointer to mutex */
- char* file_name, /* in: file name where mutex
+ const char* file_name, /* in: file name where mutex
requested */
- ulint line); /* in: line where requested */
+ ulint line); /* in: line where requested */
/**********************************************************************
Unlocks a mutex owned by the current thread. */
UNIV_INLINE
@@ -470,7 +470,7 @@ struct mutex_struct {
#endif /* UNIV_SYNC_DEBUG */
ulint level; /* Level in the global latching
order; default SYNC_LEVEL_NONE */
- char* cfile_name; /* File name where mutex created */
+ const char* cfile_name;/* File name where mutex created */
ulint cline; /* Line where created */
ulint magic_n;
};
diff --git a/innobase/include/sync0sync.ic b/innobase/include/sync0sync.ic
index 758c8524f66..ecb498918e2 100644
--- a/innobase/include/sync0sync.ic
+++ b/innobase/include/sync0sync.ic
@@ -23,7 +23,7 @@ void
mutex_spin_wait(
/*============*/
mutex_t* mutex, /* in: pointer to mutex */
- char* file_name,/* in: file name where mutex requested */
+ const char* file_name,/* in: file name where mutex requested */
ulint line); /* in: line where requested */
#ifdef UNIV_SYNC_DEBUG
/**********************************************************************
@@ -241,9 +241,9 @@ UNIV_INLINE
void
mutex_enter_func(
/*=============*/
- mutex_t* mutex, /* in: pointer to mutex */
- char* file_name,/* in: file name where locked */
- ulint line) /* in: line where locked */
+ mutex_t* mutex, /* in: pointer to mutex */
+ const char* file_name, /* in: file name where locked */
+ ulint line) /* in: line where locked */
{
ut_ad(mutex_validate(mutex));
diff --git a/innobase/include/univ.i b/innobase/include/univ.i
index cd471a89607..be71d4211b3 100644
--- a/innobase/include/univ.i
+++ b/innobase/include/univ.i
@@ -242,11 +242,6 @@ contains the sum of the following flag and the locally stored len. */
#define UNIV_EXTERN_STORAGE_FIELD (UNIV_SQL_NULL - UNIV_PAGE_SIZE)
-/* The following definition of __FILE__ removes compiler warnings
-associated with const char* / char* mismatches with __FILE__ */
-
-#define IB__FILE__ ((char*)__FILE__)
-
#include <stdio.h>
#include "ut0dbg.h"
#include "ut0ut.h"
diff --git a/innobase/include/ut0dbg.h b/innobase/include/ut0dbg.h
index 085b4811a73..a155f68bd12 100644
--- a/innobase/include/ut0dbg.h
+++ b/innobase/include/ut0dbg.h
@@ -27,7 +27,7 @@ extern const char* ut_dbg_msg_stop;
if (!((ulint)(EXPR) + ut_dbg_zero)) {\
ut_print_timestamp(stderr);\
fprintf(stderr, ut_dbg_msg_assert_fail,\
- os_thread_pf(os_thread_get_curr_id()), IB__FILE__,\
+ os_thread_pf(os_thread_get_curr_id()), __FILE__,\
(ulint)__LINE__);\
fputs("InnoDB: Failing assertion: " #EXPR "\n", stderr);\
fputs(ut_dbg_msg_trap, stderr);\
@@ -36,7 +36,7 @@ extern const char* ut_dbg_msg_stop;
}\
if (ut_dbg_stop_threads) {\
fprintf(stderr, ut_dbg_msg_stop,\
- os_thread_pf(os_thread_get_curr_id()), IB__FILE__, (ulint)__LINE__);\
+ os_thread_pf(os_thread_get_curr_id()), __FILE__, (ulint)__LINE__);\
os_thread_sleep(1000000000);\
}\
} while (0)
@@ -44,7 +44,7 @@ extern const char* ut_dbg_msg_stop;
#define ut_error do {\
ut_print_timestamp(stderr);\
fprintf(stderr, ut_dbg_msg_assert_fail,\
- os_thread_pf(os_thread_get_curr_id()), IB__FILE__, (ulint)__LINE__);\
+ os_thread_pf(os_thread_get_curr_id()), __FILE__, (ulint)__LINE__);\
fprintf(stderr, ut_dbg_msg_trap);\
ut_dbg_stop_threads = TRUE;\
if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = NULL;\
diff --git a/innobase/include/ut0mem.h b/innobase/include/ut0mem.h
index bfc937eb212..85b99efff68 100644
--- a/innobase/include/ut0mem.h
+++ b/innobase/include/ut0mem.h
@@ -18,15 +18,15 @@ extern ulint ut_total_allocated_memory;
UNIV_INLINE
void*
-ut_memcpy(void* dest, void* sour, ulint n);
+ut_memcpy(void* dest, const void* sour, ulint n);
UNIV_INLINE
void*
-ut_memmove(void* dest, void* sour, ulint n);
+ut_memmove(void* dest, const void* sour, ulint n);
UNIV_INLINE
int
-ut_memcmp(void* str1, void* str2, ulint n);
+ut_memcmp(const void* str1, const void* str2, ulint n);
/**************************************************************************
@@ -75,7 +75,7 @@ ut_free_all_mem(void);
UNIV_INLINE
char*
-ut_strcpy(char* dest, char* sour);
+ut_strcpy(char* dest, const char* sour);
UNIV_INLINE
ulint
@@ -83,7 +83,7 @@ ut_strlen(const char* str);
UNIV_INLINE
int
-ut_strcmp(void* str1, void* str2);
+ut_strcmp(const void* str1, const void* str2);
/**************************************************************************
Determine the length of a string when it is quoted with ut_strcpyq(). */
@@ -118,17 +118,6 @@ ut_memcpyq(
const char* src, /* in: string to be quoted */
ulint len); /* in: length of src */
-/**************************************************************************
-Catenates two strings into newly allocated memory. The memory must be freed
-using mem_free. */
-
-char*
-ut_str_catenate(
-/*============*/
- /* out, own: catenated null-terminated string */
- char* str1, /* in: null-terminated string */
- char* str2); /* in: null-terminated string */
-
#ifndef UNIV_NONINL
#include "ut0mem.ic"
#endif
diff --git a/innobase/include/ut0mem.ic b/innobase/include/ut0mem.ic
index 951d9538424..3bb30a80f22 100644
--- a/innobase/include/ut0mem.ic
+++ b/innobase/include/ut0mem.ic
@@ -8,28 +8,28 @@ Created 5/30/1994 Heikki Tuuri
UNIV_INLINE
void*
-ut_memcpy(void* dest, void* sour, ulint n)
+ut_memcpy(void* dest, const void* sour, ulint n)
{
return(memcpy(dest, sour, n));
}
UNIV_INLINE
void*
-ut_memmove(void* dest, void* sour, ulint n)
+ut_memmove(void* dest, const void* sour, ulint n)
{
return(memmove(dest, sour, n));
}
UNIV_INLINE
int
-ut_memcmp(void* str1, void* str2, ulint n)
+ut_memcmp(const void* str1, const void* str2, ulint n)
{
return(memcmp(str1, str2, n));
}
UNIV_INLINE
char*
-ut_strcpy(char* dest, char* sour)
+ut_strcpy(char* dest, const char* sour)
{
return(strcpy(dest, sour));
}
@@ -43,9 +43,9 @@ ut_strlen(const char* str)
UNIV_INLINE
int
-ut_strcmp(void* str1, void* str2)
+ut_strcmp(const void* str1, const void* str2)
{
- return(strcmp((char*)str1, (char*)str2));
+ return(strcmp((const char*)str1, (const char*)str2));
}
/**************************************************************************
diff --git a/innobase/lock/lock0lock.c b/innobase/lock/lock0lock.c
index 8805a22bb57..056d502e858 100644
--- a/innobase/lock/lock0lock.c
+++ b/innobase/lock/lock0lock.c
@@ -3889,7 +3889,7 @@ lock_rec_print(
page = buf_page_get_gen(space, page_no, RW_NO_LATCH,
NULL, BUF_GET_IF_IN_POOL,
- IB__FILE__, __LINE__, &mtr);
+ __FILE__, __LINE__, &mtr);
if (page) {
page = buf_page_get_nowait(space, page_no, RW_S_LATCH, &mtr);
diff --git a/innobase/log/log0recv.c b/innobase/log/log0recv.c
index 4f4220962f0..65fb3466ad5 100644
--- a/innobase/log/log0recv.c
+++ b/innobase/log/log0recv.c
@@ -1080,7 +1080,7 @@ recv_recover_page(
success = buf_page_get_known_nowait(RW_X_LATCH, page,
BUF_KEEP_OLD,
- IB__FILE__, __LINE__,
+ __FILE__, __LINE__,
&mtr);
ut_a(success);
@@ -1664,7 +1664,7 @@ recv_compare_spaces(
frame = buf_page_get_gen(space1, page_no, RW_S_LATCH, NULL,
BUF_GET_IF_IN_POOL,
- IB__FILE__, __LINE__,
+ __FILE__, __LINE__,
&mtr);
if (frame) {
#ifdef UNIV_SYNC_DEBUG
@@ -1679,7 +1679,7 @@ recv_compare_spaces(
frame = buf_page_get_gen(space2, page_no, RW_S_LATCH, NULL,
BUF_GET_IF_IN_POOL,
- IB__FILE__, __LINE__,
+ __FILE__, __LINE__,
&mtr);
if (frame) {
#ifdef UNIV_SYNC_DEBUG
diff --git a/innobase/mem/mem0mem.c b/innobase/mem/mem0mem.c
index e1b9a762381..c090b25a632 100644
--- a/innobase/mem/mem0mem.c
+++ b/innobase/mem/mem0mem.c
@@ -92,11 +92,11 @@ with mem_free. */
void*
mem_alloc_func_noninline(
/*=====================*/
- /* out, own: free storage, NULL if did not
- succeed */
- ulint n, /* in: desired number of bytes */
- char* file_name, /* in: file name where created */
- ulint line /* in: line where created */
+ /* out, own: free storage,
+ NULL if did not succeed */
+ ulint n, /* in: desired number of bytes */
+ const char* file_name, /* in: file name where created */
+ ulint line /* in: line where created */
)
{
return(mem_alloc_func(n, file_name, line));
@@ -108,18 +108,18 @@ Creates a memory heap block where data can be allocated. */
mem_block_t*
mem_heap_create_block(
/*==================*/
- /* out, own: memory heap block, NULL if did not
- succeed */
- mem_heap_t* heap,/* in: memory heap or NULL if first block should
- be created */
- ulint n, /* in: number of bytes needed for user data, or
- if init_block is not NULL, its size in bytes */
- void* init_block, /* in: init block in fast create, type must be
- MEM_HEAP_DYNAMIC */
- ulint type, /* in: type of heap: MEM_HEAP_DYNAMIC, or
- MEM_HEAP_BUFFER possibly ORed to MEM_HEAP_BTR_SEARCH */
- char* file_name,/* in: file name where created */
- ulint line) /* in: line where created */
+ /* out, own: memory heap block,
+ NULL if did not succeed */
+ mem_heap_t* heap, /* in: memory heap or NULL if first block
+ should be created */
+ ulint n, /* in: number of bytes needed for user data, or
+ if init_block is not NULL, its size in bytes */
+ void* init_block, /* in: init block in fast create,
+ type must be MEM_HEAP_DYNAMIC */
+ ulint type, /* in: type of heap: MEM_HEAP_DYNAMIC or
+ MEM_HEAP_BUFFER */
+ const char* file_name,/* in: file name where created */
+ ulint line) /* in: line where created */
{
mem_block_t* block;
ulint len;
diff --git a/innobase/os/os0file.c b/innobase/os/os0file.c
index aad8a911fd5..79185c30f79 100644
--- a/innobase/os/os0file.c
+++ b/innobase/os/os0file.c
@@ -369,7 +369,16 @@ os_file_handle_error(
return(FALSE);
}
-#if !defined(__WIN__) && !defined(UNIV_HOTBACKUP)
+#undef USE_FILE_LOCK
+#define USE_FILE_LOCK
+#if defined(UNIV_HOTBACKUP) || defined(__WIN__) || defined(__FreeBSD__)
+/* InnoDB Hot Backup does not lock the data files.
+ * On Windows, mandatory locking is used.
+ * On FreeBSD with LinuxThreads, advisory locking does not work properly.
+ */
+# undef USE_FILE_LOCK
+#endif
+#ifdef USE_FILE_LOCK
/********************************************************************
Obtain an exclusive lock on a file. */
static
@@ -393,7 +402,7 @@ os_file_lock(
}
return 0;
}
-#endif /* !defined(__WIN__) && !defined(UNIV_HOTBACKUP) */
+#endif /* USE_FILE_LOCK */
/********************************************************************
Does error handling when a file operation fails. */
@@ -852,7 +861,7 @@ try_again:
if (retry) {
goto try_again;
}
-#ifndef UNIV_HOTBACKUP
+#ifdef USE_FILE_LOCK
} else if (os_file_lock(file, name)) {
*success = FALSE;
file = -1;
@@ -961,7 +970,7 @@ os_file_create_simple_no_error_handling(
if (file == -1) {
*success = FALSE;
-#ifndef UNIV_HOTBACKUP
+#ifdef USE_FILE_LOCK
} else if (os_file_lock(file, name)) {
*success = FALSE;
file = -1;
@@ -1172,7 +1181,7 @@ try_again:
if (retry) {
goto try_again;
}
-#ifndef UNIV_HOTBACKUP
+#ifdef USE_FILE_LOCK
} else if (os_file_lock(file, name)) {
*success = FALSE;
file = -1;
diff --git a/innobase/pars/pars0pars.c b/innobase/pars/pars0pars.c
index a4124672df0..7e835d9ada1 100644
--- a/innobase/pars/pars0pars.c
+++ b/innobase/pars/pars0pars.c
@@ -1713,7 +1713,8 @@ Called by yyparse on error. */
void
yyerror(
/*====*/
- char* s __attribute__((unused))) /* in: error message string */
+ const char* s __attribute__((unused)))
+ /* in: error message string */
{
ut_ad(s);
diff --git a/innobase/sync/sync0arr.c b/innobase/sync/sync0arr.c
index 426d7ff9f92..02a9771be35 100644
--- a/innobase/sync/sync0arr.c
+++ b/innobase/sync/sync0arr.c
@@ -53,7 +53,7 @@ struct sync_cell_struct {
rw_lock_t* old_wait_rw_lock;/* the latest wait rw-lock in cell */
ulint request_type; /* lock type requested on the
object */
- char* file; /* in debug version file where
+ const char* file; /* in debug version file where
requested */
ulint line; /* in debug version line where
requested */
@@ -329,7 +329,7 @@ sync_array_reserve_cell(
sync_array_t* arr, /* in: wait array */
void* object, /* in: pointer to the object to wait for */
ulint type, /* in: lock request type */
- char* file, /* in: file where requested */
+ const char* file, /* in: file where requested */
ulint line, /* in: line where requested */
ulint* index) /* out: index of the reserved cell */
{
diff --git a/innobase/sync/sync0rw.c b/innobase/sync/sync0rw.c
index 43f8d646eaa..769eb326ce2 100644
--- a/innobase/sync/sync0rw.c
+++ b/innobase/sync/sync0rw.c
@@ -89,7 +89,7 @@ void
rw_lock_create_func(
/*================*/
rw_lock_t* lock, /* in: pointer to memory */
- char* cfile_name, /* in: file name where created */
+ const char* cfile_name, /* in: file name where created */
ulint cline) /* in: file line where created */
{
/* If this is the very first time a synchronization
@@ -213,7 +213,7 @@ rw_lock_s_lock_spin(
rw_lock_t* lock, /* in: pointer to rw-lock */
ulint pass, /* in: pass value; != 0, if the lock
will be passed to another thread to unlock */
- char* file_name, /* in: file name where lock requested */
+ const char* file_name, /* in: file name where lock requested */
ulint line) /* in: line where requested */
{
ulint index; /* index of the reserved wait cell */
@@ -324,7 +324,7 @@ rw_lock_x_lock_low(
rw_lock_t* lock, /* in: pointer to rw-lock */
ulint pass, /* in: pass value; != 0, if the lock will
be passed to another thread to unlock */
- char* file_name,/* in: file name where lock requested */
+ const char* file_name,/* in: file name where lock requested */
ulint line) /* in: line where requested */
{
#ifdef UNIV_SYNC_DEBUG
@@ -429,7 +429,7 @@ rw_lock_x_lock_func(
rw_lock_t* lock, /* in: pointer to rw-lock */
ulint pass, /* in: pass value; != 0, if the lock will
be passed to another thread to unlock */
- char* file_name,/* in: file name where lock requested */
+ const char* file_name,/* in: file name where lock requested */
ulint line) /* in: line where requested */
{
ulint index; /* index of the reserved wait cell */
@@ -551,7 +551,7 @@ rw_lock_debug_mutex_enter(void)
{
loop:
if (0 == mutex_enter_nowait(&rw_lock_debug_mutex,
- IB__FILE__, __LINE__)) {
+ __FILE__, __LINE__)) {
return;
}
@@ -560,7 +560,7 @@ loop:
rw_lock_debug_waiters = TRUE;
if (0 == mutex_enter_nowait(&rw_lock_debug_mutex,
- IB__FILE__, __LINE__)) {
+ __FILE__, __LINE__)) {
return;
}
diff --git a/innobase/sync/sync0sync.c b/innobase/sync/sync0sync.c
index c1fb31bc966..31f287b6341 100644
--- a/innobase/sync/sync0sync.c
+++ b/innobase/sync/sync0sync.c
@@ -201,7 +201,7 @@ void
mutex_create_func(
/*==============*/
mutex_t* mutex, /* in: pointer to memory */
- char* cfile_name, /* in: file name where created */
+ const char* cfile_name, /* in: file name where created */
ulint cline) /* in: file line where created */
{
#if defined(_WIN32) && defined(UNIV_CAN_USE_X86_ASSEMBLER)
@@ -294,10 +294,10 @@ mutex_enter_nowait(
/*===============*/
/* out: 0 if succeed, 1 if not */
mutex_t* mutex, /* in: pointer to mutex */
- char* file_name __attribute__((unused)),
+ const char* file_name __attribute__((unused)),
/* in: file name where mutex
requested */
- ulint line __attribute__((unused)))
+ ulint line __attribute__((unused)))
/* in: line where requested */
{
ut_ad(mutex_validate(mutex));
@@ -357,9 +357,10 @@ for the mutex before suspending the thread. */
void
mutex_spin_wait(
/*============*/
- mutex_t* mutex, /* in: pointer to mutex */
- char* file_name, /* in: file name where mutex requested */
- ulint line) /* in: line where requested */
+ mutex_t* mutex, /* in: pointer to mutex */
+ const char* file_name, /* in: file name where
+ mutex requested */
+ ulint line) /* in: line where requested */
{
ulint index; /* index of the reserved wait cell */
ulint i; /* spin round count */
diff --git a/innobase/trx/trx0rec.c b/innobase/trx/trx0rec.c
index 7963bec7f33..16f9f3d093d 100644
--- a/innobase/trx/trx0rec.c
+++ b/innobase/trx/trx0rec.c
@@ -1067,7 +1067,7 @@ trx_undo_report_row_operation(
undo_page = buf_page_get_gen(undo->space, page_no,
RW_X_LATCH, undo->guess_page,
BUF_GET,
- IB__FILE__, __LINE__,
+ __FILE__, __LINE__,
&mtr);
#ifdef UNIV_SYNC_DEBUG
diff --git a/innobase/ut/ut0mem.c b/innobase/ut/ut0mem.c
index f21bb752fac..47b612d757e 100644
--- a/innobase/ut/ut0mem.c
+++ b/innobase/ut/ut0mem.c
@@ -273,29 +273,3 @@ ut_memcpyq(
return(dest);
}
-
-/**************************************************************************
-Catenates two strings into newly allocated memory. The memory must be freed
-using mem_free. */
-
-char*
-ut_str_catenate(
-/*============*/
- /* out, own: catenated null-terminated string */
- char* str1, /* in: null-terminated string */
- char* str2) /* in: null-terminated string */
-{
- ulint len1;
- ulint len2;
- char* str;
-
- len1 = ut_strlen(str1);
- len2 = ut_strlen(str2);
-
- str = mem_alloc(len1 + len2 + 1);
-
- ut_memcpy(str, str1, len1);
- ut_memcpy(str + len1, str2, len2 + 1);
-
- return(str);
-}
diff --git a/libmysqld/examples/Makefile.am b/libmysqld/examples/Makefile.am
index b11db65baf6..b3db54d305a 100644
--- a/libmysqld/examples/Makefile.am
+++ b/libmysqld/examples/Makefile.am
@@ -26,6 +26,7 @@ mysql_SOURCES = mysql.cc readline.cc completion_hash.cc \
my_readline.h sql_string.h completion_hash.h
mysql_LDADD = @readline_link@ @TERMCAP_LIB@ $(LDADD)
+client_test_LINK = $(CXXLINK)
client_test_SOURCES = client_test.c
clean:
diff --git a/mysql-test/r/func_encrypt.result b/mysql-test/r/func_encrypt.result
index abdfda0423f..d32e67fe7d5 100644
--- a/mysql-test/r/func_encrypt.result
+++ b/mysql-test/r/func_encrypt.result
@@ -138,4 +138,4 @@ explain extended select des_decrypt(des_encrypt("hello",4),'password2'), des_dec
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select high_priority des_decrypt(des_encrypt(_latin1'hello',4),_latin1'password2') AS `des_decrypt(des_encrypt("hello",4),'password2')`,des_decrypt(des_encrypt(_latin1'hello',_latin1'hidden')) AS `des_decrypt(des_encrypt("hello","hidden"))`
+Note 1003 select des_decrypt(des_encrypt(_latin1'hello',4),_latin1'password2') AS `des_decrypt(des_encrypt("hello",4),'password2')`,des_decrypt(des_encrypt(_latin1'hello',_latin1'hidden')) AS `des_decrypt(des_encrypt("hello","hidden"))`
diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result
index fdde8f766a9..60a28e5018f 100644
--- a/mysql-test/r/func_gconcat.result
+++ b/mysql-test/r/func_gconcat.result
@@ -301,3 +301,12 @@ a c grp
2 4 4
1 2 5
drop table t1,t2;
+CREATE TABLE t1 ( a int );
+CREATE TABLE t2 ( a int );
+INSERT INTO t1 VALUES (1), (2);
+INSERT INTO t2 VALUES (1), (2);
+SELECT GROUP_CONCAT(t1.a*t2.a ORDER BY t2.a) FROM t1, t2 GROUP BY t1.a;
+GROUP_CONCAT(t1.a*t2.a ORDER BY t2.a)
+1,2
+2,4
+DROP TABLE t1, t2;
diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result
index 259e1fb3059..700fe1a4111 100644
--- a/mysql-test/r/innodb.result
+++ b/mysql-test/r/innodb.result
@@ -1538,6 +1538,37 @@ t2 CREATE TABLE `t2` (
CONSTRAINT `t1_id_fk` FOREIGN KEY (`id2`, `id`) REFERENCES `t1` (`id`, `id2`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table t2;
+create table t2 (id int(11) not null auto_increment, id2 int(11) not null, constraint t1_id_fk foreign key (id) references t1 (id), primary key (id), index (id,id2)) engine = innodb;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL auto_increment,
+ `id2` int(11) NOT NULL default '0',
+ PRIMARY KEY (`id`),
+ KEY `id` (`id`,`id2`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t2;
+create table t2 (id int(11) not null auto_increment, id2 int(11) not null, constraint t1_id_fk foreign key (id) references t1 (id)) engine= innodb;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL auto_increment,
+ `id2` int(11) NOT NULL default '0',
+ KEY `t1_id_fk` (`id`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+alter table t2 add index id_test (id), add index id_test2 (id,id2);
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL auto_increment,
+ `id2` int(11) NOT NULL default '0',
+ KEY `id_test` (`id`),
+ KEY `id_test2` (`id`,`id2`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t2;
create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id2,id) references t1 (id)) engine = innodb;
ERROR HY000: Can't create table './test/t2.frm' (errno: 150)
create table t2 (a int auto_increment primary key, b int, index(b), foreign key (b) references t1(id), unique(b)) engine=innodb;
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index d512ecdf34d..8fe447c59fd 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -1719,3 +1719,92 @@ SELECT t1.id, ( SELECT COUNT(t.id) FROM t2 AS t WHERE t.id = t1.id ) AS c FROM t
id c
1 1
2 0
+DROP TABLE t1,t2;
+CREATE TABLE t1 ( a int, b int );
+INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
+SELECT a FROM t1 WHERE a > ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+3
+SELECT a FROM t1 WHERE a < ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+SELECT a FROM t1 WHERE a = ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+2
+SELECT a FROM t1 WHERE a >= ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+2
+3
+SELECT a FROM t1 WHERE a <= ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+2
+SELECT a FROM t1 WHERE a <> ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+3
+SELECT a FROM t1 WHERE a > ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+3
+SELECT a FROM t1 WHERE a < ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+SELECT a FROM t1 WHERE a = ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+2
+SELECT a FROM t1 WHERE a >= ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+2
+3
+SELECT a FROM t1 WHERE a <= ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+2
+SELECT a FROM t1 WHERE a <> ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+3
+ALTER TABLE t1 ADD INDEX (a);
+SELECT a FROM t1 WHERE a > ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+3
+SELECT a FROM t1 WHERE a < ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+SELECT a FROM t1 WHERE a = ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+2
+SELECT a FROM t1 WHERE a >= ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+2
+3
+SELECT a FROM t1 WHERE a <= ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+2
+SELECT a FROM t1 WHERE a <> ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+3
+SELECT a FROM t1 WHERE a > ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+3
+SELECT a FROM t1 WHERE a < ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+SELECT a FROM t1 WHERE a = ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+2
+SELECT a FROM t1 WHERE a >= ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+2
+3
+SELECT a FROM t1 WHERE a <= ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+2
+SELECT a FROM t1 WHERE a <> ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+3
+DROP TABLE t1;
diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test
index 9d99a57afe5..aede2220466 100644
--- a/mysql-test/t/func_gconcat.test
+++ b/mysql-test/t/func_gconcat.test
@@ -179,3 +179,13 @@ select group_concat(c order by (select mid(group_concat(c order by a),1,5) from
select a,c,(select group_concat(c order by a) from t2 where a=t1.a) as grp from t1 order by grp;
drop table t1,t2;
+
+#
+# group_concat of expression with GROUP BY and external GROUP BY
+#
+CREATE TABLE t1 ( a int );
+CREATE TABLE t2 ( a int );
+INSERT INTO t1 VALUES (1), (2);
+INSERT INTO t2 VALUES (1), (2);
+SELECT GROUP_CONCAT(t1.a*t2.a ORDER BY t2.a) FROM t1, t2 GROUP BY t1.a;
+DROP TABLE t1, t2;
diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test
index babfdcb535f..47e82db2dc4 100644
--- a/mysql-test/t/innodb.test
+++ b/mysql-test/t/innodb.test
@@ -1082,6 +1082,16 @@ create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2),cons
show create table t2;
drop table t2;
+create table t2 (id int(11) not null auto_increment, id2 int(11) not null, constraint t1_id_fk foreign key (id) references t1 (id), primary key (id), index (id,id2)) engine = innodb;
+show create table t2;
+drop table t2;
+
+create table t2 (id int(11) not null auto_increment, id2 int(11) not null, constraint t1_id_fk foreign key (id) references t1 (id)) engine= innodb;
+show create table t2;
+alter table t2 add index id_test (id), add index id_test2 (id,id2);
+show create table t2;
+drop table t2;
+
# Test error handling
--error 1005
create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id2,id) references t1 (id)) engine = innodb;
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index 1b5bb807b97..94389963ae6 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -1125,4 +1125,36 @@ INSERT INTO t1 VALUES (1), (2);
INSERT INTO t2 VALUES (1);
SELECT t1.id, ( SELECT COUNT(t.id) FROM t2 AS t WHERE t.id = t1.id ) AS c FROM t1 LEFT JOIN t2 USING (id);
SELECT t1.id, ( SELECT COUNT(t.id) FROM t2 AS t WHERE t.id = t1.id ) AS c FROM t1 LEFT JOIN t2 USING (id) ORDER BY t1.id;
-DROP TABLE t1,t2
+DROP TABLE t1,t2;
+
+#
+# ALL/ANY test
+#
+CREATE TABLE t1 ( a int, b int );
+INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
+SELECT a FROM t1 WHERE a > ANY ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a < ANY ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a = ANY ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a >= ANY ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a <= ANY ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a <> ANY ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a > ALL ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a < ALL ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a = ALL ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a >= ALL ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a <= ALL ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a <> ALL ( SELECT a FROM t1 WHERE b = 2 );
+ALTER TABLE t1 ADD INDEX (a);
+SELECT a FROM t1 WHERE a > ANY ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a < ANY ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a = ANY ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a >= ANY ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a <= ANY ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a <> ANY ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a > ALL ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a < ALL ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a = ALL ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a >= ALL ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a <= ALL ( SELECT a FROM t1 WHERE b = 2 );
+SELECT a FROM t1 WHERE a <> ALL ( SELECT a FROM t1 WHERE b = 2 );
+DROP TABLE t1;
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index 2d10be62d53..4503c1b63a9 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -56,10 +56,24 @@ void Item_subselect::init(st_select_lex *select_lex,
DBUG_PRINT("subs", ("select_lex 0x%xl", (ulong) select_lex));
unit= select_lex->master_unit();
- if (select_lex->next_select())
- engine= new subselect_union_engine(unit, result, this);
+ if (unit->item)
+ {
+ /*
+ Item can be changed in JOIN::prepare while engine in JOIN::optimize
+ => we do not copy old_engine here
+ */
+ engine= unit->item->engine;
+ unit->item->engine= 0;
+ unit->item= this;
+ engine->change_item(this, result);
+ }
else
- engine= new subselect_single_select_engine(select_lex, result, this);
+ {
+ if (select_lex->next_select())
+ engine= new subselect_union_engine(unit, result, this);
+ else
+ engine= new subselect_single_select_engine(select_lex, result, this);
+ }
DBUG_VOID_RETURN;
}
@@ -69,11 +83,13 @@ void Item_subselect::cleanup()
Item_result_field::cleanup();
if (old_engine)
{
- engine->cleanup();
+ if (engine)
+ engine->cleanup();
engine= old_engine;
old_engine= 0;
}
- engine->cleanup();
+ if (engine)
+ engine->cleanup();
reset();
value_assigned= 0;
DBUG_VOID_RETURN;
@@ -127,7 +143,6 @@ bool Item_subselect::fix_fields(THD *thd_param, TABLE_LIST *tables, Item **ref)
if (have_to_be_excluded)
engine->exclude();
substitution= 0;
- fixed= 1;
thd->where= "checking transformed subquery";
if (!(*ref)->fixed)
ret= (*ref)->fix_fields(thd, tables, ref);
@@ -660,10 +675,20 @@ Item_in_subselect::single_value_transformer(JOIN *join,
item= new Item_sum_min(*select_lex->ref_pointer_array);
}
*select_lex->ref_pointer_array= item;
- select_lex->item_list.empty();
- select_lex->item_list.push_back(item);
+ {
+ List_iterator<Item> it(select_lex->item_list);
+ it++;
+ it.replace(item);
+ }
- // fix_fields call for 'item' will be made during new subquery fix_fields
+ /*
+ Item_sum_(max|min) can't substitute other item => we can use 0 as
+ reference
+ */
+ if (item->fix_fields(thd, join->tables_list, 0))
+ goto err;
+ /* we added aggregate function => we have to change statistic */
+ count_field_types(&join->tmp_table_param, join->all_fields, 0);
subs= new Item_singlerow_subselect(select_lex);
}
@@ -1428,3 +1453,67 @@ void subselect_indexsubquery_engine::print(String *str)
}
str->append(')');
}
+
+/*
+ change select_result object of engine
+
+ SINOPSYS
+ subselect_single_select_engine::change_result()
+ si new subselect Item
+ res new select_result object
+
+ RETURN
+ 0 OK
+ -1 error
+*/
+
+int subselect_single_select_engine::change_item(Item_subselect *si,
+ select_subselect *res)
+{
+ item= si;
+ result= res;
+ return select_lex->join->change_result(result);
+}
+
+
+/*
+ change select_result object of engine
+
+ SINOPSYS
+ subselect_single_select_engine::change_result()
+ si new subselect Item
+ res new select_result object
+
+ RETURN
+ 0 OK
+ -1 error
+*/
+
+int subselect_union_engine::change_item(Item_subselect *si,
+ select_subselect *res)
+{
+ item= si;
+ int rc= unit->change_result(res, result);
+ result= res;
+ return rc;
+}
+
+
+/*
+ change select_result emulation, never should be called
+
+ SINOPSYS
+ subselect_single_select_engine::change_result()
+ si new subselect Item
+ res new select_result object
+
+ RETURN
+ -1 error
+*/
+
+int subselect_uniquesubquery_engine::change_item(Item_subselect *si,
+ select_subselect *res)
+{
+ DBUG_ASSERT(0);
+ return -1;
+}
diff --git a/sql/item_subselect.h b/sql/item_subselect.h
index 6d8f5353695..364781de362 100644
--- a/sql/item_subselect.h
+++ b/sql/item_subselect.h
@@ -290,6 +290,7 @@ public:
virtual table_map upper_select_const_tables()= 0;
static table_map calc_const_tables(TABLE_LIST *);
virtual void print(String *str)= 0;
+ virtual int change_item(Item_subselect *si, select_subselect *result)= 0;
};
@@ -313,6 +314,7 @@ public:
void exclude();
table_map upper_select_const_tables();
void print (String *str);
+ int change_item(Item_subselect *si, select_subselect *result);
};
@@ -332,6 +334,7 @@ public:
void exclude();
table_map upper_select_const_tables();
void print (String *str);
+ int change_item(Item_subselect *si, select_subselect *result);
};
@@ -360,6 +363,7 @@ public:
void exclude();
table_map upper_select_const_tables() { return 0; }
void print (String *str);
+ int change_item(Item_subselect *si, select_subselect *result);
};
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index eac8d31b256..0c5b29fc069 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -502,6 +502,14 @@ void Item_sum_variance::update_field()
/* min & max */
+void Item_sum_hybrid::clear()
+{
+ sum= 0.0;
+ sum_int= 0;
+ value.length(0);
+ null_value= 1;
+}
+
double Item_sum_hybrid::val()
{
DBUG_ASSERT(fixed == 1);
diff --git a/sql/item_sum.h b/sql/item_sum.h
index 4cded41a9f6..ef947900fd2 100644
--- a/sql/item_sum.h
+++ b/sql/item_sum.h
@@ -415,13 +415,7 @@ class Item_sum_hybrid :public Item_sum
table_map used_tables() const { return used_table_cache; }
bool const_item() const { return !used_table_cache; }
- void clear()
- {
- sum=0.0;
- sum_int=0;
- value.length(0);
- null_value=1;
- }
+ void clear();
double val();
longlong val_int();
void reset_field();
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 3a18b7eaabc..14a54a410a2 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -2096,7 +2096,14 @@ find_item_in_list(Item *find, List<Item> &items, uint *counter,
if (field_name && item->type() == Item::FIELD_ITEM)
{
Item_field *item_field= (Item_field*) item;
- if (!my_strcasecmp(system_charset_info, item_field->name, field_name))
+ /*
+ In case of group_concat() with ORDER BY condition in the QUERY
+ item_field can be field of temporary table without item name
+ (if this field created from expression argument of group_concat()),
+ => we have to check presence of name before compare
+ */
+ if (item_field->name &&
+ !my_strcasecmp(system_charset_info, item_field->name, field_name))
{
if (!table_name)
{
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 03d67c4f300..f7992c3db9e 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -86,7 +86,7 @@ bool key_part_spec::operator==(const key_part_spec& other) const
/*
- Test if a foreign key is a prefix of the given key
+ Test if a foreign key (= generated key) is a prefix of the given key
(ignoring key name, key type and order of columns)
NOTES:
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 5fa8b37285e..1038066f6ef 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -1710,6 +1710,7 @@ TABLE_LIST *st_lex::link_first_table_back(TABLE_LIST *tables,
st_select_lex::print is in sql_select.h
st_select_lex_unit::prepare, st_select_lex_unit::exec,
- st_select_lex_unit::cleanup, st_select_lex_unit::reinit_exec_mechanism
+ st_select_lex_unit::cleanup, st_select_lex_unit::reinit_exec_mechanism,
+ st_select_lex_unit::change_result
are in sql_union.cc
*/
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index aa3e81fd9c9..557c037c799 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -371,6 +371,7 @@ public:
void print(String *str);
ulong init_prepare_fake_select_lex(THD *thd);
+ int change_result(select_subselect *result, select_subselect *old_result);
friend void mysql_init_query(THD *thd);
friend int subselect_union_engine::exec();
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 92bc13cb01e..a89ef6b05ea 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -1584,8 +1584,7 @@ mysql_select(THD *thd, Item ***rref_pointer_array,
if (select_lex->linkage != GLOBAL_OPTIONS_TYPE)
{
//here is EXPLAIN of subselect or derived table
- join->result= result;
- if (!join->procedure && result->prepare(join->fields_list, unit))
+ if (join->change_result(result))
{
DBUG_RETURN(-1);
}
@@ -9385,7 +9384,7 @@ void st_select_lex::print(THD *thd, String *str)
if (!thd->lex->safe_to_cache_query)
str->append("sql_no_cache ", 13);
if (options & OPTION_TO_QUERY_CACHE)
- str->append("cache ", 6);
+ str->append("sql_cache ", 10);
//Item List
bool first= 1;
@@ -9513,3 +9512,27 @@ void st_select_lex::print(THD *thd, String *str)
// PROCEDURE unsupported here
}
+
+
+/*
+ change select_result object of JOIN
+
+ SYNOPSIS
+ JOIN::change_result()
+ res new select_result object
+
+ RETURN
+ 0 - OK
+ -1 - error
+*/
+
+int JOIN::change_result(select_result *res)
+{
+ DBUG_ENTER("JOIN::change_result");
+ result= res;
+ if (!procedure && result->prepare(fields_list, select_lex->master_unit()))
+ {
+ DBUG_RETURN(-1);
+ }
+ DBUG_RETURN(0);
+}
diff --git a/sql/sql_select.h b/sql/sql_select.h
index 5a246a477cf..8aca43484d2 100644
--- a/sql/sql_select.h
+++ b/sql/sql_select.h
@@ -304,6 +304,7 @@ class JOIN :public Sql_alloc
return (do_send_rows && tmp_table_param.sum_func_count != 0 &&
!group_list);
}
+ int change_result(select_result *result);
};
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 8d5ec56add9..e017bc7e6b5 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -684,12 +684,13 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
while ((key2 = key_iterator2++) != key)
{
/*
- foreign_key_prefix(key, key2) returns 0 if key or key2, or both, is
- 'generated', and a generated key is a prefix of the other key. Then we
- do not need the generated shorter key.
+ foreign_key_prefix(key, key2) returns 0 if key or key2, or both, is
+ 'generated', and a generated key is a prefix of the other key.
+ Then we do not need the generated shorter key.
*/
- if (key2->name != ignore_key && key2->type != Key::FOREIGN_KEY &&
- !foreign_key_prefix(key, key2))
+ if ((key2->type != Key::FOREIGN_KEY &&
+ key2->name != ignore_key &&
+ !foreign_key_prefix(key, key2)))
{
/* TODO: issue warning message */
/* mark that the generated key should be ignored */
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index 63638b618d9..de3eeec0db0 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -555,3 +555,32 @@ void st_select_lex_unit::reinit_exec_mechanism()
}
#endif
}
+
+
+/*
+ change select_result object of unit
+
+ SYNOPSIS
+ st_select_lex_unit::change_result()
+ result new select_result object
+ old_result old select_result object
+
+ RETURN
+ 0 - OK
+ -1 - error
+*/
+
+int st_select_lex_unit::change_result(select_subselect *result,
+ select_subselect *old_result)
+{
+ int res= 0;
+ for (SELECT_LEX *sl= first_select_in_union(); sl; sl= sl->next_select())
+ {
+ if (sl->join && sl->join->result == old_result)
+ if ((res= sl->join->change_result(result)))
+ return (res);
+ }
+ if (fake_select_lex && fake_select_lex->join)
+ res= fake_select_lex->join->change_result(result);
+ return (res);
+}
diff --git a/tests/client_test.c b/tests/client_test.c
index ba70bcd7fa7..c244274a2e7 100644
--- a/tests/client_test.c
+++ b/tests/client_test.c
@@ -9614,7 +9614,6 @@ union distinct \
select sum(a) + 200, 1 from t1 \
group by b ");
check_stmt(stmt);
-
mysql_stmt_close(stmt);
stmt= mysql_simple_prepare(mysql,
@@ -9624,14 +9623,14 @@ union distinct \
select sum(a) + 200, 1 from t1 \
group by b ");
check_stmt(stmt);
+ mysql_stmt_close(stmt);
- stmt= mysql_simple_prepare(mysql,
+ stmt= mysql_simple_prepare(mysql,
"select sum(a) + 200, ? from t1 \
union distinct \
select sum(a) + 200, 1 from t1 \
group by b ");
check_stmt(stmt);
-
mysql_stmt_close(stmt);
rc= mysql_query(mysql, "DROP TABLE t1");