Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
00ce300b
Commit
00ce300b
authored
Jun 29, 2002
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge work:/home/bk/mysql-4.0
into sergbook.mysql.com:/usr/home/serg/Abk/mysql-4.0
parents
e933455c
ad3eb445
Changes
22
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
247 additions
and
45 deletions
+247
-45
BitKeeper/etc/logging_ok
BitKeeper/etc/logging_ok
+1
-0
Docs/manual.texi
Docs/manual.texi
+40
-0
include/my_global.h
include/my_global.h
+1
-1
include/my_pthread.h
include/my_pthread.h
+6
-0
include/my_sys.h
include/my_sys.h
+0
-7
mysql-test/r/func_test.result
mysql-test/r/func_test.result
+6
-0
mysql-test/r/rpl_get_lock.result
mysql-test/r/rpl_get_lock.result
+3
-0
mysql-test/t/func_test.test
mysql-test/t/func_test.test
+2
-1
mysql-test/t/rpl_get_lock.test
mysql-test/t/rpl_get_lock.test
+1
-0
mysys/thr_rwlock.c
mysys/thr_rwlock.c
+51
-20
sql/item_cmpfunc.cc
sql/item_cmpfunc.cc
+15
-0
sql/item_cmpfunc.h
sql/item_cmpfunc.h
+10
-0
sql/item_create.cc
sql/item_create.cc
+7
-0
sql/item_create.h
sql/item_create.h
+1
-0
sql/item_func.cc
sql/item_func.cc
+55
-0
sql/item_func.h
sql/item_func.h
+21
-1
sql/lex.h
sql/lex.h
+2
-0
sql/log.cc
sql/log.cc
+4
-4
sql/log_event.cc
sql/log_event.cc
+7
-4
sql/log_event.h
sql/log_event.h
+5
-6
sql/slave.cc
sql/slave.cc
+0
-1
sql/sql_yacc.yy
sql/sql_yacc.yy
+9
-0
No files found.
BitKeeper/etc/logging_ok
View file @
00ce300b
...
@@ -67,3 +67,4 @@ venu@work.mysql.com
...
@@ -67,3 +67,4 @@ venu@work.mysql.com
worm@altair.is.lan
worm@altair.is.lan
zak@balfor.local
zak@balfor.local
zak@linux.local
zak@linux.local
salle@geopard.(none)
Docs/manual.texi
View file @
00ce300b
...
@@ -49578,6 +49578,46 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}.
...
@@ -49578,6 +49578,46 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}.
@itemize @bullet
@itemize @bullet
@item
@item
Added binary XOR.
The one that with a query like :
@example
SELECT 11 ^ 3;
@end example
returns 8.
Based on code contributed by Hartmut Holzgraefe @email{hartmut@@six.de}.
@item
Added logical XOR.
The one that with a query like:
@example
SELECT 1 XOR 1;
@end example
returns 0;
Based on code contributed by Hartmut Holzgraefe @email{hartmut@@six.de}.
@item
Add function @code{CHECK_LOCK("lock_name")}.
This function returns a value indicating whether or not the lock with the
given name is available.
It does not attempt to acquire a lock.
It is used like this:
@example
SELECT CHECK_LOCK("some_lock");
@end example
@code{CHECK_LOCK()} returns 1 if the lock is available,
0 if the lock is held by any process (including the current process),
and @code{NULL} if an error occurs.
Based on code contributed by Hartmut Holzgraefe @email{hartmut@@six.de}.
@item
Removed @code{mysql_ssl_clear()}, as this was not needed.
Removed @code{mysql_ssl_clear()}, as this was not needed.
@item
@item
@code{DECIMAL} and @code{NUMERIC} types can now read exponential numbers.
@code{DECIMAL} and @code{NUMERIC} types can now read exponential numbers.
include/my_global.h
View file @
00ce300b
...
@@ -313,7 +313,7 @@ typedef unsigned short ushort;
...
@@ -313,7 +313,7 @@ typedef unsigned short ushort;
#define rint(A) floor((A)+0.5)
#define rint(A) floor((A)+0.5)
#endif
#endif
/* Define som general constants */
/* Define som
e
general constants */
#ifndef TRUE
#ifndef TRUE
#define TRUE (1)
/* Logical true */
#define TRUE (1)
/* Logical true */
#define FALSE (0)
/* Logical false */
#define FALSE (0)
/* Logical false */
...
...
include/my_pthread.h
View file @
00ce300b
...
@@ -485,6 +485,8 @@ int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp,
...
@@ -485,6 +485,8 @@ int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp,
#define my_rwlock_init(A,B) pthread_mutex_init((A),(B))
#define my_rwlock_init(A,B) pthread_mutex_init((A),(B))
#define rw_rdlock(A) pthread_mutex_lock((A))
#define rw_rdlock(A) pthread_mutex_lock((A))
#define rw_wrlock(A) pthread_mutex_lock((A))
#define rw_wrlock(A) pthread_mutex_lock((A))
#define rw_tryrdlock(A) pthread_mutex_trylock((A))
#define rw_trywrlock(A) pthread_mutex_trylock((A))
#define rw_unlock(A) pthread_mutex_unlock((A))
#define rw_unlock(A) pthread_mutex_unlock((A))
#define rwlock_destroy(A) pthread_mutex_destroy((A))
#define rwlock_destroy(A) pthread_mutex_destroy((A))
#elif defined(HAVE_PTHREAD_RWLOCK_RDLOCK)
#elif defined(HAVE_PTHREAD_RWLOCK_RDLOCK)
...
@@ -492,6 +494,8 @@ int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp,
...
@@ -492,6 +494,8 @@ int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp,
#define my_rwlock_init(A,B) pthread_rwlock_init((A),(B))
#define my_rwlock_init(A,B) pthread_rwlock_init((A),(B))
#define rw_rdlock(A) pthread_rwlock_rdlock(A)
#define rw_rdlock(A) pthread_rwlock_rdlock(A)
#define rw_wrlock(A) pthread_rwlock_wrlock(A)
#define rw_wrlock(A) pthread_rwlock_wrlock(A)
#define rw_tryrdlock(A) pthread_mutex_tryrdlock((A))
#define rw_trywrlock(A) pthread_mutex_trywrlock((A))
#define rw_unlock(A) pthread_rwlock_unlock(A)
#define rw_unlock(A) pthread_rwlock_unlock(A)
#define rwlock_destroy(A) pthread_rwlock_destroy(A)
#define rwlock_destroy(A) pthread_rwlock_destroy(A)
#elif defined(HAVE_RWLOCK_INIT)
#elif defined(HAVE_RWLOCK_INIT)
...
@@ -512,6 +516,8 @@ typedef struct _my_rw_lock_t {
...
@@ -512,6 +516,8 @@ typedef struct _my_rw_lock_t {
#define rw_lock_t my_rw_lock_t
#define rw_lock_t my_rw_lock_t
#define rw_rdlock(A) my_rw_rdlock((A))
#define rw_rdlock(A) my_rw_rdlock((A))
#define rw_wrlock(A) my_rw_wrlock((A))
#define rw_wrlock(A) my_rw_wrlock((A))
#define rw_tryrdlock(A) my_rw_tryrdlock((A))
#define rw_trywrlock(A) my_rw_trywrlock((A))
#define rw_unlock(A) my_rw_unlock((A))
#define rw_unlock(A) my_rw_unlock((A))
#define rwlock_destroy(A) my_rwlock_destroy((A))
#define rwlock_destroy(A) my_rwlock_destroy((A))
...
...
include/my_sys.h
View file @
00ce300b
...
@@ -750,13 +750,6 @@ byte *my_compress_alloc(const byte *packet, ulong *len, ulong *complen);
...
@@ -750,13 +750,6 @@ byte *my_compress_alloc(const byte *packet, ulong *len, ulong *complen);
ulong
checksum
(
const
byte
*
mem
,
uint
count
);
ulong
checksum
(
const
byte
*
mem
,
uint
count
);
uint
my_bit_log2
(
ulong
value
);
uint
my_bit_log2
(
ulong
value
);
#if defined(SAFE_MUTEX) && !defined(DBUG_OFF)
#define DBUG_ASSERT_LOCK(lock) DBUG_ASSERT((lock)->count == 1 && \
(lock)->thread == pthread_self())
#else
#define DBUG_ASSERT_LOCK(lock)
#endif
#if defined(_MSC_VER) && !defined(__WIN__)
#if defined(_MSC_VER) && !defined(__WIN__)
extern
void
sleep
(
int
sec
);
extern
void
sleep
(
int
sec
);
#endif
#endif
...
...
mysql-test/r/func_test.result
View file @
00ce300b
...
@@ -40,6 +40,12 @@ select 2 in (3,2,5,9,5,1),"monty" in ("david","monty","allan"), 1.2 in (1.4,1.2,
...
@@ -40,6 +40,12 @@ select 2 in (3,2,5,9,5,1),"monty" in ("david","monty","allan"), 1.2 in (1.4,1.2,
select -1.49 or -1.49,0.6 or 0.6;
select -1.49 or -1.49,0.6 or 0.6;
-1.49 or -1.49 0.6 or 0.6
-1.49 or -1.49 0.6 or 0.6
1 1
1 1
select 3 ^ 11;
3 ^ 11
8
select 1 XOR 0;
1 XOR 0
1
select 5 between 0 and 10 between 0 and 1,(5 between 0 and 10) between 0 and 1;
select 5 between 0 and 10 between 0 and 1,(5 between 0 and 10) between 0 and 1;
5 between 0 and 10 between 0 and 1 (5 between 0 and 10) between 0 and 1
5 between 0 and 10 between 0 and 1 (5 between 0 and 10) between 0 and 1
0 1
0 1
...
...
mysql-test/r/rpl_get_lock.result
View file @
00ce300b
...
@@ -17,4 +17,7 @@ get_lock("lock",3)
...
@@ -17,4 +17,7 @@ get_lock("lock",3)
select * from t1;
select * from t1;
n
n
1
1
select check_lock("lock");
check_lock("lock")
1
drop table t1;
drop table t1;
mysql-test/t/func_test.test
View file @
00ce300b
...
@@ -15,7 +15,8 @@ select 2 between 1 and 3, "monty" between "max" and "my",2=2 and "monty" between
...
@@ -15,7 +15,8 @@ select 2 between 1 and 3, "monty" between "max" and "my",2=2 and "monty" between
select
'b'
between
'a'
and
'c'
,
'B'
between
'a'
and
'c'
;
select
'b'
between
'a'
and
'c'
,
'B'
between
'a'
and
'c'
;
select
2
in
(
3
,
2
,
5
,
9
,
5
,
1
),
"monty"
in
(
"david"
,
"monty"
,
"allan"
),
1.2
in
(
1.4
,
1.2
,
1.0
);
select
2
in
(
3
,
2
,
5
,
9
,
5
,
1
),
"monty"
in
(
"david"
,
"monty"
,
"allan"
),
1.2
in
(
1.4
,
1.2
,
1.0
);
select
-
1.49
or
-
1.49
,
0.6
or
0.6
;
select
-
1.49
or
-
1.49
,
0.6
or
0.6
;
select
3
^
11
;
select
1
XOR
0
;
#
#
# Wrong usage of functions
# Wrong usage of functions
#
#
...
...
mysql-test/t/rpl_get_lock.test
View file @
00ce300b
...
@@ -22,6 +22,7 @@ sync_with_master;
...
@@ -22,6 +22,7 @@ sync_with_master;
select
get_lock
(
"lock"
,
3
);
select
get_lock
(
"lock"
,
3
);
select
*
from
t1
;
select
*
from
t1
;
connection
master1
;
connection
master1
;
select
check_lock
(
"lock"
);
drop
table
t1
;
drop
table
t1
;
save_master_pos
;
save_master_pos
;
connection
slave
;
connection
slave
;
...
...
mysys/thr_rwlock.c
View file @
00ce300b
...
@@ -19,11 +19,13 @@
...
@@ -19,11 +19,13 @@
#include "mysys_priv.h"
#include "mysys_priv.h"
#include <my_pthread.h>
#include <my_pthread.h>
#if defined(THREAD) && !defined(HAVE_PTHREAD_RWLOCK_RDLOCK) && !defined(HAVE_RWLOCK_INIT)
#if defined(THREAD) && !defined(HAVE_PTHREAD_RWLOCK_RDLOCK) && !defined(HAVE_RWLOCK_INIT)
#include <errno.h>
/*
/*
* Source base from Sun Microsystems SPILT, simplified
Source base from Sun Microsystems SPILT, simplified for MySQL use
* for MySQL use -- Joshua Chamas
-- Joshua Chamas
*/
Some cleanup and additional code by Monty
*/
/*
/*
* Multithreaded Demo Source
* Multithreaded Demo Source
...
@@ -71,7 +73,7 @@ int my_rwlock_init(rw_lock_t *rwp, void *arg __attribute__((unused)))
...
@@ -71,7 +73,7 @@ int my_rwlock_init(rw_lock_t *rwp, void *arg __attribute__((unused)))
rwp
->
state
=
0
;
rwp
->
state
=
0
;
rwp
->
waiters
=
0
;
rwp
->
waiters
=
0
;
return
(
0
);
return
(
0
);
}
}
...
@@ -80,8 +82,7 @@ int my_rwlock_destroy(rw_lock_t *rwp)
...
@@ -80,8 +82,7 @@ int my_rwlock_destroy(rw_lock_t *rwp)
pthread_mutex_destroy
(
&
rwp
->
lock
);
pthread_mutex_destroy
(
&
rwp
->
lock
);
pthread_cond_destroy
(
&
rwp
->
readers
);
pthread_cond_destroy
(
&
rwp
->
readers
);
pthread_cond_destroy
(
&
rwp
->
writers
);
pthread_cond_destroy
(
&
rwp
->
writers
);
return
(
0
);
return
(
0
);
}
}
...
@@ -89,54 +90,84 @@ int my_rw_rdlock(rw_lock_t *rwp)
...
@@ -89,54 +90,84 @@ int my_rw_rdlock(rw_lock_t *rwp)
{
{
pthread_mutex_lock
(
&
rwp
->
lock
);
pthread_mutex_lock
(
&
rwp
->
lock
);
/* active or queued writers
*/
/* active or queued writers
*/
while
((
rwp
->
state
<
0
)
||
rwp
->
waiters
)
while
((
rwp
->
state
<
0
)
||
rwp
->
waiters
)
pthread_cond_wait
(
&
rwp
->
readers
,
&
rwp
->
lock
);
pthread_cond_wait
(
&
rwp
->
readers
,
&
rwp
->
lock
);
rwp
->
state
++
;
rwp
->
state
++
;
pthread_mutex_unlock
(
&
rwp
->
lock
);
pthread_mutex_unlock
(
&
rwp
->
lock
);
return
(
0
);
}
return
(
0
);
int
my_rw_tryrdlock
(
rw_lock_t
*
rwp
)
{
int
res
;
pthread_mutex_lock
(
&
rwp
->
lock
);
if
((
rwp
->
state
<
0
)
||
rwp
->
waiters
)
res
=
EBUSY
;
/* Can't get lock */
else
{
res
=
0
;
rwp
->
state
++
;
}
pthread_mutex_unlock
(
&
rwp
->
lock
);
return
(
res
);
}
}
int
my_rw_wrlock
(
rw_lock_t
*
rwp
)
int
my_rw_wrlock
(
rw_lock_t
*
rwp
)
{
{
pthread_mutex_lock
(
&
rwp
->
lock
);
pthread_mutex_lock
(
&
rwp
->
lock
);
rwp
->
waiters
++
;
/* another writer queued
*/
rwp
->
waiters
++
;
/* another writer queued
*/
while
(
rwp
->
state
)
while
(
rwp
->
state
)
pthread_cond_wait
(
&
rwp
->
writers
,
&
rwp
->
lock
);
pthread_cond_wait
(
&
rwp
->
writers
,
&
rwp
->
lock
);
rwp
->
state
=
-
1
;
rwp
->
state
=
-
1
;
--
rwp
->
waiters
;
rwp
->
waiters
--
;
pthread_mutex_unlock
(
&
rwp
->
lock
);
pthread_mutex_unlock
(
&
rwp
->
lock
);
return
(
0
);
return
(
0
);
}
}
int
my_rw_trywrlock
(
rw_lock_t
*
rwp
)
{
int
res
;
pthread_mutex_lock
(
&
rwp
->
lock
);
if
(
rwp
->
state
)
res
=
EBUSY
;
/* Can't get lock */
else
{
res
=
0
;
rwp
->
state
=
-
1
;
}
pthread_mutex_unlock
(
&
rwp
->
lock
);
return
(
res
);
}
int
my_rw_unlock
(
rw_lock_t
*
rwp
)
int
my_rw_unlock
(
rw_lock_t
*
rwp
)
{
{
DBUG_PRINT
(
"rw_unlock"
,
DBUG_PRINT
(
"rw_unlock"
,
(
"state: %d waiters: %d"
,
rwp
->
state
,
rwp
->
waiters
));
(
"state: %d waiters: %d"
,
rwp
->
state
,
rwp
->
waiters
));
pthread_mutex_lock
(
&
rwp
->
lock
);
pthread_mutex_lock
(
&
rwp
->
lock
);
if
(
rwp
->
state
==
-
1
)
{
/* writer releasing */
if
(
rwp
->
state
==
-
1
)
/* writer releasing */
rwp
->
state
=
0
;
/* mark as available */
{
rwp
->
state
=
0
;
/* mark as available */
if
(
rwp
->
waiters
)
/* writers queued
*/
if
(
rwp
->
waiters
)
/* writers queued
*/
pthread_cond_signal
(
&
rwp
->
writers
);
pthread_cond_signal
(
&
rwp
->
writers
);
else
else
pthread_cond_broadcast
(
&
rwp
->
readers
);
pthread_cond_broadcast
(
&
rwp
->
readers
);
}
}
else
else
{
{
if
(
--
rwp
->
state
==
0
)
/* no more readers
*/
if
(
--
rwp
->
state
==
0
)
/* no more readers
*/
pthread_cond_signal
(
&
rwp
->
writers
);
pthread_cond_signal
(
&
rwp
->
writers
);
}
}
pthread_mutex_unlock
(
&
rwp
->
lock
);
pthread_mutex_unlock
(
&
rwp
->
lock
);
return
(
0
);
return
(
0
);
}
}
#endif
#endif
sql/item_cmpfunc.cc
View file @
00ce300b
...
@@ -1624,3 +1624,18 @@ bool Item_func_like::turboBM_matches(const char* text, int text_len) const
...
@@ -1624,3 +1624,18 @@ bool Item_func_like::turboBM_matches(const char* text, int text_len) const
return
false
;
return
false
;
}
}
}
}
longlong
Item_cond_xor
::
val_int
()
{
List_iterator
<
Item
>
li
(
list
);
Item
*
item
;
int
result
=
0
;
null_value
=
1
;
while
((
item
=
li
++
))
{
result
^=
(
item
->
val_int
()
!=
0
);
if
(
!
item
->
null_value
)
null_value
=
0
;
}
return
result
;
}
sql/item_cmpfunc.h
View file @
00ce300b
...
@@ -596,3 +596,13 @@ inline Item *and_conds(Item *a,Item *b)
...
@@ -596,3 +596,13 @@ inline Item *and_conds(Item *a,Item *b)
cond
->
update_used_tables
();
cond
->
update_used_tables
();
return
cond
;
return
cond
;
}
}
class
Item_cond_xor
:
public
Item_cond
{
public:
Item_cond_xor
()
:
Item_cond
()
{}
Item_cond_xor
(
Item
*
i1
,
Item
*
i2
)
:
Item_cond
(
i1
,
i2
)
{}
enum
Functype
functype
()
const
{
return
COND_XOR_FUNC
;
}
longlong
val_int
();
const
char
*
func_name
()
const
{
return
"xor"
;
}
};
sql/item_create.cc
View file @
00ce300b
...
@@ -428,3 +428,10 @@ Item *create_func_cast(Item *a, Item_cast cast_type)
...
@@ -428,3 +428,10 @@ Item *create_func_cast(Item *a, Item_cast cast_type)
}
}
return
res
;
return
res
;
}
}
Item
*
create_func_check_lock
(
Item
*
a
)
{
current_thd
->
safe_to_cache_query
=
0
;
return
new
Item_func_check_lock
(
a
);
}
sql/item_create.h
View file @
00ce300b
...
@@ -91,3 +91,4 @@ Item *create_func_version(void);
...
@@ -91,3 +91,4 @@ Item *create_func_version(void);
Item
*
create_func_weekday
(
Item
*
a
);
Item
*
create_func_weekday
(
Item
*
a
);
Item
*
create_load_file
(
Item
*
a
);
Item
*
create_load_file
(
Item
*
a
);
Item
*
create_wait_for_master_pos
(
Item
*
a
,
Item
*
b
);
Item
*
create_wait_for_master_pos
(
Item
*
a
,
Item
*
b
);
Item
*
create_func_check_lock
(
Item
*
a
);
sql/item_func.cc
View file @
00ce300b
...
@@ -2257,6 +2257,24 @@ double Item_func_match::val()
...
@@ -2257,6 +2257,24 @@ double Item_func_match::val()
return
ft_handler
->
please
->
find_relevance
(
ft_handler
,
record
,
0
);
return
ft_handler
->
please
->
find_relevance
(
ft_handler
,
record
,
0
);
}
}
longlong
Item_func_bit_xor
::
val_int
()
{
ulonglong
arg1
=
(
ulonglong
)
args
[
0
]
->
val_int
();
if
(
args
[
0
]
->
null_value
)
{
null_value
=
1
;
return
0
;
}
ulonglong
arg2
=
(
ulonglong
)
args
[
1
]
->
val_int
();
if
(
args
[
1
]
->
null_value
)
{
null_value
=
1
;
return
0
;
}
null_value
=
0
;
return
(
longlong
)
(
arg1
^
arg2
);
}
/***************************************************************************
/***************************************************************************
System variables
System variables
...
@@ -2274,3 +2292,40 @@ Item *get_system_var(LEX_STRING name)
...
@@ -2274,3 +2292,40 @@ Item *get_system_var(LEX_STRING name)
net_printf
(
&
current_thd
->
net
,
ER_UNKNOWN_SYSTEM_VARIABLE
,
name
.
str
);
net_printf
(
&
current_thd
->
net
,
ER_UNKNOWN_SYSTEM_VARIABLE
,
name
.
str
);
return
0
;
return
0
;
}
}
/*
Check a user level lock.
Returns 1: available
Returns 0: already taken
Returns NULL: Error
*/
longlong
Item_func_check_lock
::
val_int
()
{
String
*
res
=
args
[
0
]
->
val_str
(
&
value
);
struct
timespec
abstime
;
THD
*
thd
=
current_thd
;
ULL
*
ull
;
int
error
=
0
;
null_value
=
0
;
if
(
/* check_global_access(thd,SUPER_ACL) ||*/
!
res
||
!
res
->
length
())
{
null_value
=
1
;
return
0
;
}
pthread_mutex_lock
(
&
LOCK_user_locks
);
ull
=
(
ULL
*
)
hash_search
(
&
hash_user_locks
,(
byte
*
)
res
->
ptr
(),
res
->
length
());
pthread_mutex_unlock
(
&
LOCK_user_locks
);
if
(
!
ull
||
!
ull
->
locked
)
return
1
;
return
0
;
}
sql/item_func.h
View file @
00ce300b
...
@@ -39,7 +39,7 @@ class Item_func :public Item_result_field
...
@@ -39,7 +39,7 @@ class Item_func :public Item_result_field
enum
Functype
{
UNKNOWN_FUNC
,
EQ_FUNC
,
EQUAL_FUNC
,
NE_FUNC
,
LT_FUNC
,
LE_FUNC
,
enum
Functype
{
UNKNOWN_FUNC
,
EQ_FUNC
,
EQUAL_FUNC
,
NE_FUNC
,
LT_FUNC
,
LE_FUNC
,
GE_FUNC
,
GT_FUNC
,
FT_FUNC
,
GE_FUNC
,
GT_FUNC
,
FT_FUNC
,
LIKE_FUNC
,
NOTLIKE_FUNC
,
ISNULL_FUNC
,
ISNOTNULL_FUNC
,
LIKE_FUNC
,
NOTLIKE_FUNC
,
ISNULL_FUNC
,
ISNOTNULL_FUNC
,
COND_AND_FUNC
,
COND_OR_FUNC
,
BETWEEN
,
IN_FUNC
,
INTERVAL_FUNC
};
COND_AND_FUNC
,
COND_OR_FUNC
,
COND_XOR_FUNC
,
BETWEEN
,
IN_FUNC
,
INTERVAL_FUNC
};
enum
optimize_type
{
OPTIMIZE_NONE
,
OPTIMIZE_KEY
,
OPTIMIZE_OP
,
OPTIMIZE_NULL
};
enum
optimize_type
{
OPTIMIZE_NONE
,
OPTIMIZE_KEY
,
OPTIMIZE_OP
,
OPTIMIZE_NULL
};
enum
Type
type
()
const
{
return
FUNC_ITEM
;
}
enum
Type
type
()
const
{
return
FUNC_ITEM
;
}
virtual
enum
Functype
functype
()
const
{
return
UNKNOWN_FUNC
;
}
virtual
enum
Functype
functype
()
const
{
return
UNKNOWN_FUNC
;
}
...
@@ -989,3 +989,23 @@ enum Item_cast
...
@@ -989,3 +989,23 @@ enum Item_cast
};
};
Item
*
create_func_cast
(
Item
*
a
,
Item_cast
cast_type
);
Item
*
create_func_cast
(
Item
*
a
,
Item_cast
cast_type
);
class
Item_func_bit_xor
:
public
Item_int_func
{
public:
Item_func_bit_xor
(
Item
*
a
,
Item
*
b
)
:
Item_int_func
(
a
,
b
)
{}
longlong
val_int
();
const
char
*
func_name
()
const
{
return
"^"
;
}
void
fix_length_xor_dec
()
{
unsigned_flag
=
1
;
}
};
class
Item_func_check_lock
:
public
Item_int_func
{
String
value
;
public:
Item_func_check_lock
(
Item
*
a
)
:
Item_int_func
(
a
)
{}
longlong
val_int
();
const
char
*
func_name
()
const
{
return
"check_lock"
;
}
void
fix_length_and_dec
()
{
decimals
=
0
;
max_length
=
1
;
maybe_null
=
1
;}
};
sql/lex.h
View file @
00ce300b
...
@@ -384,6 +384,7 @@ static SYMBOL symbols[] = {
...
@@ -384,6 +384,7 @@ static SYMBOL symbols[] = {
{
"WRITE"
,
SYM
(
WRITE_SYM
),
0
,
0
},
{
"WRITE"
,
SYM
(
WRITE_SYM
),
0
,
0
},
{
"WHEN"
,
SYM
(
WHEN_SYM
),
0
,
0
},
{
"WHEN"
,
SYM
(
WHEN_SYM
),
0
,
0
},
{
"WHERE"
,
SYM
(
WHERE
),
0
,
0
},
{
"WHERE"
,
SYM
(
WHERE
),
0
,
0
},
{
"XOR"
,
SYM
(
XOR
),
0
,
0
},
{
"X509"
,
SYM
(
X509_SYM
),
0
,
0
},
{
"X509"
,
SYM
(
X509_SYM
),
0
,
0
},
{
"YEAR"
,
SYM
(
YEAR_SYM
),
0
,
0
},
{
"YEAR"
,
SYM
(
YEAR_SYM
),
0
,
0
},
{
"YEAR_MONTH"
,
SYM
(
YEAR_MONTH_SYM
),
0
,
0
},
{
"YEAR_MONTH"
,
SYM
(
YEAR_MONTH_SYM
),
0
,
0
},
...
@@ -412,6 +413,7 @@ static SYMBOL sql_functions[] = {
...
@@ -412,6 +413,7 @@ static SYMBOL sql_functions[] = {
{
"BIT_LENGTH"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_bit_length
)},
{
"BIT_LENGTH"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_bit_length
)},
{
"CHAR_LENGTH"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_char_length
)},
{
"CHAR_LENGTH"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_char_length
)},
{
"CHARACTER_LENGTH"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_char_length
)},
{
"CHARACTER_LENGTH"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_char_length
)},
{
"CHECK_LOCK"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_check_lock
)},
{
"COALESCE"
,
SYM
(
COALESCE
),
0
,
0
},
{
"COALESCE"
,
SYM
(
COALESCE
),
0
,
0
},
{
"CONCAT"
,
SYM
(
CONCAT
),
0
,
0
},
{
"CONCAT"
,
SYM
(
CONCAT
),
0
,
0
},
{
"CONCAT_WS"
,
SYM
(
CONCAT_WS
),
0
,
0
},
{
"CONCAT_WS"
,
SYM
(
CONCAT_WS
),
0
,
0
},
...
...
sql/log.cc
View file @
00ce300b
...
@@ -888,15 +888,15 @@ bool MYSQL_LOG::write(THD *thd,enum enum_server_command command,
...
@@ -888,15 +888,15 @@ bool MYSQL_LOG::write(THD *thd,enum enum_server_command command,
bool
MYSQL_LOG
::
write
(
Log_event
*
event_info
)
bool
MYSQL_LOG
::
write
(
Log_event
*
event_info
)
{
{
/* In most cases this is only called if 'is_open()' is true */
bool
error
=
0
;
bool
error
=
0
;
bool
should_rotate
=
0
;
if
(
!
inited
)
// Can't use mutex if not init
if
(
!
inited
)
// Can't use mutex if not init
return
0
;
return
0
;
VOID
(
pthread_mutex_lock
(
&
LOCK_log
));
VOID
(
pthread_mutex_lock
(
&
LOCK_log
));
/* In most cases this is only called if 'is_open()' is true */
if
(
is_open
())
if
(
is_open
())
{
{
bool
should_rotate
=
0
;
THD
*
thd
=
event_info
->
thd
;
THD
*
thd
=
event_info
->
thd
;
const
char
*
db
=
event_info
->
get_db
();
const
char
*
db
=
event_info
->
get_db
();
#ifdef USING_TRANSACTIONS
#ifdef USING_TRANSACTIONS
...
@@ -985,9 +985,9 @@ bool MYSQL_LOG::write(Log_event* event_info)
...
@@ -985,9 +985,9 @@ bool MYSQL_LOG::write(Log_event* event_info)
}
}
if
(
file
==
&
log_file
)
if
(
file
==
&
log_file
)
signal_update
();
signal_update
();
if
(
should_rotate
)
new_file
(
1
);
// inside mutex
}
}
if
(
should_rotate
)
new_file
(
1
);
// inside mutex
VOID
(
pthread_mutex_unlock
(
&
LOCK_log
));
VOID
(
pthread_mutex_unlock
(
&
LOCK_log
));
return
error
;
return
error
;
}
}
...
...
sql/log_event.cc
View file @
00ce300b
...
@@ -1022,16 +1022,19 @@ char* sql_ex_info::init(char* buf,char* buf_end,bool use_new_format)
...
@@ -1022,16 +1022,19 @@ char* sql_ex_info::init(char* buf,char* buf_end,bool use_new_format)
#ifndef MYSQL_CLIENT
#ifndef MYSQL_CLIENT
Load_log_event
::
Load_log_event
(
THD
*
thd
,
sql_exchange
*
ex
,
Load_log_event
::
Load_log_event
(
THD
*
thd
,
sql_exchange
*
ex
,
const
char
*
db_arg
,
const
char
*
table_name_arg
,
const
char
*
db_arg
,
const
char
*
table_name_arg
,
List
<
Item
>&
fields_arg
,
enum
enum_duplicates
handle_dup
)
List
<
Item
>&
fields_arg
,
enum
enum_duplicates
handle_dup
)
:
Log_event
(
thd
),
thread_id
(
thd
->
thread_id
),
num_fields
(
0
),
fields
(
0
),
:
Log_event
(
thd
),
thread_id
(
thd
->
thread_id
),
num_fields
(
0
),
fields
(
0
),
field_lens
(
0
),
field_block_len
(
0
),
table_name
(
table_name_arg
),
field_lens
(
0
),
field_block_len
(
0
),
table_name
(
table_name_arg
?
table_name_arg
:
""
),
db
(
db_arg
),
fname
(
ex
->
file_name
)
db
(
db_arg
),
fname
(
ex
->
file_name
)
{
{
time_t
end_time
;
time_t
end_time
;
time
(
&
end_time
);
time
(
&
end_time
);
exec_time
=
(
ulong
)
(
end_time
-
thd
->
start_time
);
exec_time
=
(
ulong
)
(
end_time
-
thd
->
start_time
);
db_len
=
(
db
)
?
(
uint32
)
strlen
(
db
)
:
0
;
/* db can never be a zero pointer in 4.0 */
table_name_len
=
(
table_name
)
?
(
uint32
)
strlen
(
table_name
)
:
0
;
db_len
=
(
uint32
)
strlen
(
db
);
table_name_len
=
(
uint32
)
strlen
(
table_name
);
fname_len
=
(
fname
)
?
(
uint
)
strlen
(
fname
)
:
0
;
fname_len
=
(
fname
)
?
(
uint
)
strlen
(
fname
)
:
0
;
sql_ex
.
field_term
=
(
char
*
)
ex
->
field_term
->
ptr
();
sql_ex
.
field_term
=
(
char
*
)
ex
->
field_term
->
ptr
();
sql_ex
.
field_term_len
=
(
uint8
)
ex
->
field_term
->
length
();
sql_ex
.
field_term_len
=
(
uint8
)
ex
->
field_term
->
length
();
...
...
sql/log_event.h
View file @
00ce300b
...
@@ -407,15 +407,15 @@ class Load_log_event: public Log_event
...
@@ -407,15 +407,15 @@ class Load_log_event: public Log_event
String
fields_buf
;
String
fields_buf
;
Load_log_event
(
THD
*
thd
,
sql_exchange
*
ex
,
const
char
*
db_arg
,
Load_log_event
(
THD
*
thd
,
sql_exchange
*
ex
,
const
char
*
db_arg
,
const
char
*
table_name_arg
,
const
char
*
table_name_arg
,
List
<
Item
>&
fields_arg
,
enum
enum_duplicates
handle_dup
);
List
<
Item
>&
fields_arg
,
enum
enum_duplicates
handle_dup
);
void
set_fields
(
List
<
Item
>
&
fields_arg
);
void
set_fields
(
List
<
Item
>
&
fields_arg
);
void
pack_info
(
String
*
packet
);
void
pack_info
(
String
*
packet
);
const
char
*
get_db
()
{
return
db
;
}
const
char
*
get_db
()
{
return
db
;
}
int
exec_event
(
struct
st_relay_log_info
*
rli
)
int
exec_event
(
struct
st_relay_log_info
*
rli
)
{
{
return
exec_event
(
thd
->
slave_net
,
rli
);
return
exec_event
(
thd
->
slave_net
,
rli
);
}
}
int
exec_event
(
NET
*
net
,
struct
st_relay_log_info
*
rli
);
int
exec_event
(
NET
*
net
,
struct
st_relay_log_info
*
rli
);
#else
#else
void
print
(
FILE
*
file
,
bool
short_form
=
0
,
char
*
last_db
=
0
);
void
print
(
FILE
*
file
,
bool
short_form
=
0
,
char
*
last_db
=
0
);
...
@@ -423,8 +423,7 @@ class Load_log_event: public Log_event
...
@@ -423,8 +423,7 @@ class Load_log_event: public Log_event
Load_log_event
(
const
char
*
buf
,
int
event_len
,
bool
old_format
);
Load_log_event
(
const
char
*
buf
,
int
event_len
,
bool
old_format
);
~
Load_log_event
()
~
Load_log_event
()
{
{}
}
Log_event_type
get_type_code
()
{
return
sql_ex
.
new_format
()
?
Log_event_type
get_type_code
()
{
return
sql_ex
.
new_format
()
?
NEW_LOAD_EVENT:
LOAD_EVENT
;
}
NEW_LOAD_EVENT:
LOAD_EVENT
;
}
int
write_data_header
(
IO_CACHE
*
file
);
int
write_data_header
(
IO_CACHE
*
file
);
...
...
sql/slave.cc
View file @
00ce300b
...
@@ -405,7 +405,6 @@ int terminate_slave_thread(THD* thd, pthread_mutex_t* term_lock,
...
@@ -405,7 +405,6 @@ int terminate_slave_thread(THD* thd, pthread_mutex_t* term_lock,
*/
*/
struct
timespec
abstime
;
struct
timespec
abstime
;
set_timespec
(
abstime
,
2
);
set_timespec
(
abstime
,
2
);
DBUG_ASSERT_LOCK
(
cond_lock
);
pthread_cond_timedwait
(
term_cond
,
cond_lock
,
&
abstime
);
pthread_cond_timedwait
(
term_cond
,
cond_lock
,
&
abstime
);
if
(
*
slave_running
)
if
(
*
slave_running
)
{
{
...
...
sql/sql_yacc.yy
View file @
00ce300b
...
@@ -339,6 +339,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
...
@@ -339,6 +339,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token WITH
%token WITH
%token WRITE_SYM
%token WRITE_SYM
%token X509_SYM
%token X509_SYM
%token XOR
%token COMPRESSED_SYM
%token COMPRESSED_SYM
%token BIGINT
%token BIGINT
...
@@ -496,6 +497,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
...
@@ -496,6 +497,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%left '-' '+'
%left '-' '+'
%left '*' '/' '%'
%left '*' '/' '%'
%left NEG '~'
%left NEG '~'
%left XOR
%left '^'
%right NOT
%right NOT
%right BINARY
%right BINARY
...
@@ -1524,6 +1527,7 @@ expr_expr:
...
@@ -1524,6 +1527,7 @@ expr_expr:
{ $$= new Item_func_not(new Item_func_between($1,$4,$6)); }
{ $$= new Item_func_not(new Item_func_between($1,$4,$6)); }
| expr OR_OR_CONCAT expr { $$= or_or_concat($1,$3); }
| expr OR_OR_CONCAT expr { $$= or_or_concat($1,$3); }
| expr OR expr { $$= new Item_cond_or($1,$3); }
| expr OR expr { $$= new Item_cond_or($1,$3); }
| expr XOR expr { $$= new Item_cond_xor($1,$3); }
| expr AND expr { $$= new Item_cond_and($1,$3); }
| expr AND expr { $$= new Item_cond_and($1,$3); }
| expr LIKE simple_expr opt_escape { $$= new Item_func_like($1,$3,$4); }
| expr LIKE simple_expr opt_escape { $$= new Item_func_like($1,$3,$4); }
| expr NOT LIKE simple_expr opt_escape { $$= new Item_func_not(new Item_func_like($1,$4,$5));}
| expr NOT LIKE simple_expr opt_escape { $$= new Item_func_not(new Item_func_like($1,$4,$5));}
...
@@ -1545,6 +1549,7 @@ expr_expr:
...
@@ -1545,6 +1549,7 @@ expr_expr:
| expr '*' expr { $$= new Item_func_mul($1,$3); }
| expr '*' expr { $$= new Item_func_mul($1,$3); }
| expr '/' expr { $$= new Item_func_div($1,$3); }
| expr '/' expr { $$= new Item_func_div($1,$3); }
| expr '|' expr { $$= new Item_func_bit_or($1,$3); }
| expr '|' expr { $$= new Item_func_bit_or($1,$3); }
| expr '^' expr { $$= new Item_func_bit_xor($1,$3); }
| expr '&' expr { $$= new Item_func_bit_and($1,$3); }
| expr '&' expr { $$= new Item_func_bit_and($1,$3); }
| expr '%' expr { $$= new Item_func_mod($1,$3); }
| expr '%' expr { $$= new Item_func_mod($1,$3); }
| expr '+' INTERVAL_SYM expr interval
| expr '+' INTERVAL_SYM expr interval
...
@@ -1560,6 +1565,7 @@ no_in_expr:
...
@@ -1560,6 +1565,7 @@ no_in_expr:
{ $$= new Item_func_not(new Item_func_between($1,$4,$6)); }
{ $$= new Item_func_not(new Item_func_between($1,$4,$6)); }
| no_in_expr OR_OR_CONCAT expr { $$= or_or_concat($1,$3); }
| no_in_expr OR_OR_CONCAT expr { $$= or_or_concat($1,$3); }
| no_in_expr OR expr { $$= new Item_cond_or($1,$3); }
| no_in_expr OR expr { $$= new Item_cond_or($1,$3); }
| no_in_expr XOR expr { $$= new Item_cond_xor($1,$3); }
| no_in_expr AND expr { $$= new Item_cond_and($1,$3); }
| no_in_expr AND expr { $$= new Item_cond_and($1,$3); }
| no_in_expr LIKE simple_expr opt_escape { $$= new Item_func_like($1,$3,$4); }
| no_in_expr LIKE simple_expr opt_escape { $$= new Item_func_like($1,$3,$4); }
| no_in_expr NOT LIKE simple_expr opt_escape { $$= new Item_func_not(new Item_func_like($1,$4,$5)); }
| no_in_expr NOT LIKE simple_expr opt_escape { $$= new Item_func_not(new Item_func_like($1,$4,$5)); }
...
@@ -1581,6 +1587,7 @@ no_in_expr:
...
@@ -1581,6 +1587,7 @@ no_in_expr:
| no_in_expr '*' expr { $$= new Item_func_mul($1,$3); }
| no_in_expr '*' expr { $$= new Item_func_mul($1,$3); }
| no_in_expr '/' expr { $$= new Item_func_div($1,$3); }
| no_in_expr '/' expr { $$= new Item_func_div($1,$3); }
| no_in_expr '|' expr { $$= new Item_func_bit_or($1,$3); }
| no_in_expr '|' expr { $$= new Item_func_bit_or($1,$3); }
| no_in_expr '^' expr { $$= new Item_func_bit_xor($1,$3); }
| no_in_expr '&' expr { $$= new Item_func_bit_and($1,$3); }
| no_in_expr '&' expr { $$= new Item_func_bit_and($1,$3); }
| no_in_expr '%' expr { $$= new Item_func_mod($1,$3); }
| no_in_expr '%' expr { $$= new Item_func_mod($1,$3); }
| no_in_expr '+' INTERVAL_SYM expr interval
| no_in_expr '+' INTERVAL_SYM expr interval
...
@@ -1601,6 +1608,7 @@ no_and_expr:
...
@@ -1601,6 +1608,7 @@ no_and_expr:
{ $$= new Item_func_not(new Item_func_between($1,$4,$6)); }
{ $$= new Item_func_not(new Item_func_between($1,$4,$6)); }
| no_and_expr OR_OR_CONCAT expr { $$= or_or_concat($1,$3); }
| no_and_expr OR_OR_CONCAT expr { $$= or_or_concat($1,$3); }
| no_and_expr OR expr { $$= new Item_cond_or($1,$3); }
| no_and_expr OR expr { $$= new Item_cond_or($1,$3); }
| no_and_expr XOR expr { $$= new Item_cond_xor($1,$3); }
| no_and_expr LIKE simple_expr opt_escape { $$= new Item_func_like($1,$3,$4); }
| no_and_expr LIKE simple_expr opt_escape { $$= new Item_func_like($1,$3,$4); }
| no_and_expr NOT LIKE simple_expr opt_escape { $$= new Item_func_not(new Item_func_like($1,$4,$5)); }
| no_and_expr NOT LIKE simple_expr opt_escape { $$= new Item_func_not(new Item_func_like($1,$4,$5)); }
| no_and_expr REGEXP expr { $$= new Item_func_regex($1,$3); }
| no_and_expr REGEXP expr { $$= new Item_func_regex($1,$3); }
...
@@ -1621,6 +1629,7 @@ no_and_expr:
...
@@ -1621,6 +1629,7 @@ no_and_expr:
| no_and_expr '*' expr { $$= new Item_func_mul($1,$3); }
| no_and_expr '*' expr { $$= new Item_func_mul($1,$3); }
| no_and_expr '/' expr { $$= new Item_func_div($1,$3); }
| no_and_expr '/' expr { $$= new Item_func_div($1,$3); }
| no_and_expr '|' expr { $$= new Item_func_bit_or($1,$3); }
| no_and_expr '|' expr { $$= new Item_func_bit_or($1,$3); }
| no_and_expr '^' expr { $$= new Item_func_bit_xor($1,$3); }
| no_and_expr '&' expr { $$= new Item_func_bit_and($1,$3); }
| no_and_expr '&' expr { $$= new Item_func_bit_and($1,$3); }
| no_and_expr '%' expr { $$= new Item_func_mod($1,$3); }
| no_and_expr '%' expr { $$= new Item_func_mod($1,$3); }
| no_and_expr '+' INTERVAL_SYM expr interval
| no_and_expr '+' INTERVAL_SYM expr interval
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment