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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
568d72f0
Commit
568d72f0
authored
Apr 11, 2001
by
sasha@mysql.sashanet.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge work:/home/bk/mysql-4.0
into mysql.sashanet.com:/home/sasha/src/bk/mysql-4.0
parents
3d76b434
417dd728
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
81 additions
and
28 deletions
+81
-28
myisam/ft_boolean_search.c
myisam/ft_boolean_search.c
+4
-3
myisam/ft_parser.c
myisam/ft_parser.c
+2
-3
myisam/ft_update.c
myisam/ft_update.c
+3
-3
myisam/sort.c
myisam/sort.c
+4
-2
sql/item_create.cc
sql/item_create.cc
+5
-0
sql/item_create.h
sql/item_create.h
+1
-0
sql/lex.h
sql/lex.h
+2
-0
sql/mysql_priv.h
sql/mysql_priv.h
+1
-1
sql/sql_class.h
sql/sql_class.h
+5
-1
sql/sql_parse.cc
sql/sql_parse.cc
+2
-0
sql/sql_select.cc
sql/sql_select.cc
+49
-15
sql/sql_select.h
sql/sql_select.h
+1
-0
sql/sql_yacc.yy
sql/sql_yacc.yy
+2
-0
No files found.
myisam/ft_boolean_search.c
View file @
568d72f0
...
@@ -90,8 +90,9 @@ static double _nwghts[11]={
...
@@ -90,8 +90,9 @@ static double _nwghts[11]={
-
3
.
796875000000000
};
-
3
.
796875000000000
};
static
double
*
nwghts
=
_nwghts
+
5
;
// nwghts[i] = -0.5*1.5**i
static
double
*
nwghts
=
_nwghts
+
5
;
// nwghts[i] = -0.5*1.5**i
int
do_boolean
(
ALL_IN_ONE
*
aio
,
uint
nested
,
int
do_boolean
(
ALL_IN_ONE
*
aio
,
uint
nested
__attribute__
((
unused
)),
int
yesno
,
int
plusminus
,
bool
pmsign
)
int
yesno
__attribute__
((
unused
)),
int
plusminus
,
bool
pmsign
)
{
{
int
r
,
res
;
int
r
,
res
;
uint
keylen
,
wno
;
uint
keylen
,
wno
;
...
@@ -106,7 +107,7 @@ int do_boolean(ALL_IN_ONE *aio, uint nested,
...
@@ -106,7 +107,7 @@ int do_boolean(ALL_IN_ONE *aio, uint nested,
param
.
prev
=
' '
;
param
.
prev
=
' '
;
for
(
wno
=
1
;
res
=
ft_get_word
(
&
aio
->
start
,
aio
->
end
,
&
w
,
&
param
);
wno
++
)
for
(
wno
=
1
;
(
res
=
ft_get_word
(
&
aio
->
start
,
aio
->
end
,
&
w
,
&
param
)
);
wno
++
)
{
{
r
=
plusminus
+
param
.
plusminus
;
r
=
plusminus
+
param
.
plusminus
;
if
(
param
.
pmsign
^
pmsign
)
if
(
param
.
pmsign
^
pmsign
)
...
...
myisam/ft_parser.c
View file @
568d72f0
...
@@ -161,7 +161,7 @@ byte ft_get_word(byte **start, byte *end, FT_WORD *word, FTB_PARAM *param)
...
@@ -161,7 +161,7 @@ byte ft_get_word(byte **start, byte *end, FT_WORD *word, FTB_PARAM *param)
param
->
prev
=
'A'
;
// be sure *prev is true_word_char
param
->
prev
=
'A'
;
// be sure *prev is true_word_char
word
->
len
=
(
uint
)(
doc
-
word
->
pos
)
-
mwc
;
word
->
len
=
(
uint
)(
doc
-
word
->
pos
)
-
mwc
;
if
(
param
->
trunc
=
(
doc
<
end
&&
*
doc
==
FTB_TRUNC
))
if
(
(
param
->
trunc
=
(
doc
<
end
&&
*
doc
==
FTB_TRUNC
)
))
doc
++
;
doc
++
;
if
(
word
->
len
>=
MIN_WORD_LEN
&&
word
->
len
<
MAX_WORD_LEN
&&
if
(
word
->
len
>=
MIN_WORD_LEN
&&
word
->
len
<
MAX_WORD_LEN
&&
...
@@ -221,7 +221,6 @@ int is_boolean(byte *q, uint len)
...
@@ -221,7 +221,6 @@ int is_boolean(byte *q, uint len)
TREE
*
ft_parse
(
TREE
*
wtree
,
byte
*
doc
,
int
doclen
)
TREE
*
ft_parse
(
TREE
*
wtree
,
byte
*
doc
,
int
doclen
)
{
{
byte
*
end
=
doc
+
doclen
;
byte
*
end
=
doc
+
doclen
;
int
res
;
FT_WORD
w
;
FT_WORD
w
;
if
(
!
is_tree_inited
(
wtree
))
if
(
!
is_tree_inited
(
wtree
))
...
@@ -229,7 +228,7 @@ TREE * ft_parse(TREE *wtree, byte *doc, int doclen)
...
@@ -229,7 +228,7 @@ TREE * ft_parse(TREE *wtree, byte *doc, int doclen)
init_tree
(
wtree
,
0
,
sizeof
(
FT_WORD
),(
qsort_cmp
)
&
FT_WORD_cmp
,
0
,
NULL
);
init_tree
(
wtree
,
0
,
sizeof
(
FT_WORD
),(
qsort_cmp
)
&
FT_WORD_cmp
,
0
,
NULL
);
}
}
while
(
res
=
ft_simple_get_word
(
&
doc
,
end
,
&
w
))
while
(
ft_simple_get_word
(
&
doc
,
end
,
&
w
))
{
{
if
(
!
tree_insert
(
wtree
,
&
w
,
0
))
if
(
!
tree_insert
(
wtree
,
&
w
,
0
))
goto
err
;
goto
err
;
...
...
myisam/ft_update.c
View file @
568d72f0
...
@@ -160,7 +160,7 @@ int _mi_ft_update(MI_INFO *info, uint keynr, byte *keybuf,
...
@@ -160,7 +160,7 @@ int _mi_ft_update(MI_INFO *info, uint keynr, byte *keybuf,
int
error
=
-
1
;
int
error
=
-
1
;
FT_WORD
*
oldlist
,
*
newlist
,
*
old_word
,
*
new_word
;
FT_WORD
*
oldlist
,
*
newlist
,
*
old_word
,
*
new_word
;
uint
key_length
;
uint
key_length
;
u
int
cmp
;
int
cmp
;
if
(
!
(
old_word
=
oldlist
=
_mi_ft_parserecord
(
info
,
keynr
,
keybuf
,
oldrec
)))
if
(
!
(
old_word
=
oldlist
=
_mi_ft_parserecord
(
info
,
keynr
,
keybuf
,
oldrec
)))
goto
err0
;
goto
err0
;
...
@@ -187,7 +187,7 @@ int _mi_ft_update(MI_INFO *info, uint keynr, byte *keybuf,
...
@@ -187,7 +187,7 @@ int _mi_ft_update(MI_INFO *info, uint keynr, byte *keybuf,
switch
(
cmp
)
{
switch
(
cmp
)
{
case
-
1
:
case
-
1
:
key_length
=
_ft_make_key
(
info
,
keynr
,
keybuf
,
old_word
,
pos
);
key_length
=
_ft_make_key
(
info
,
keynr
,
keybuf
,
old_word
,
pos
);
if
(
error
=
_mi_ck_delete
(
info
,
keynr
,(
uchar
*
)
keybuf
,
key_length
))
if
(
(
error
=
_mi_ck_delete
(
info
,
keynr
,(
uchar
*
)
keybuf
,
key_length
)
))
goto
err2
;
goto
err2
;
old_word
++
;
old_word
++
;
break
;
break
;
...
@@ -197,7 +197,7 @@ int _mi_ft_update(MI_INFO *info, uint keynr, byte *keybuf,
...
@@ -197,7 +197,7 @@ int _mi_ft_update(MI_INFO *info, uint keynr, byte *keybuf,
break
;
break
;
case
1
:
case
1
:
key_length
=
_ft_make_key
(
info
,
keynr
,
keybuf
,
new_word
,
pos
);
key_length
=
_ft_make_key
(
info
,
keynr
,
keybuf
,
new_word
,
pos
);
if
(
error
=
_mi_ck_write
(
info
,
keynr
,(
uchar
*
)
keybuf
,
key_length
))
if
(
(
error
=
_mi_ck_write
(
info
,
keynr
,(
uchar
*
)
keybuf
,
key_length
)
))
goto
err2
;
goto
err2
;
new_word
++
;
new_word
++
;
break
;
break
;
...
...
myisam/sort.c
View file @
568d72f0
...
@@ -116,9 +116,11 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages,
...
@@ -116,9 +116,11 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages,
}
}
while
((
maxbuffer
=
(
int
)
(
records
/
(
keys
-
1
)
+
1
))
!=
skr
);
while
((
maxbuffer
=
(
int
)
(
records
/
(
keys
-
1
)
+
1
))
!=
skr
);
if
(
sort_keys
=
(
uchar
**
)
my_malloc
(
keys
*
(
sort_length
+
sizeof
(
char
*
))
+
HA_FT_MAXLEN
,
MYF
(
0
)))
if
((
sort_keys
=
(
uchar
**
)
my_malloc
(
keys
*
(
sort_length
+
sizeof
(
char
*
))
+
HA_FT_MAXLEN
,
MYF
(
0
))))
{
{
if
(
init_dynamic_array
(
&
buffpek
,
sizeof
(
BUFFPEK
),
maxbuffer
,
maxbuffer
/
2
))
if
(
init_dynamic_array
(
&
buffpek
,
sizeof
(
BUFFPEK
),
maxbuffer
,
maxbuffer
/
2
))
my_free
((
gptr
)
sort_keys
,
MYF
(
0
));
my_free
((
gptr
)
sort_keys
,
MYF
(
0
));
else
else
break
;
break
;
...
...
sql/item_create.cc
View file @
568d72f0
...
@@ -129,6 +129,11 @@ Item *create_func_floor(Item* a)
...
@@ -129,6 +129,11 @@ Item *create_func_floor(Item* a)
return
new
Item_func_floor
(
a
);
return
new
Item_func_floor
(
a
);
}
}
Item
*
create_func_found_rows
(
void
)
{
return
new
Item_int
(
"FOUND_ROWS()"
,(
longlong
)
current_thd
->
found_rows
(),
21
);
}
Item
*
create_func_from_days
(
Item
*
a
)
Item
*
create_func_from_days
(
Item
*
a
)
{
{
return
new
Item_func_from_days
(
a
);
return
new
Item_func_from_days
(
a
);
...
...
sql/item_create.h
View file @
568d72f0
...
@@ -37,6 +37,7 @@ Item *create_func_degrees(Item *);
...
@@ -37,6 +37,7 @@ Item *create_func_degrees(Item *);
Item
*
create_func_exp
(
Item
*
a
);
Item
*
create_func_exp
(
Item
*
a
);
Item
*
create_func_find_in_set
(
Item
*
a
,
Item
*
b
);
Item
*
create_func_find_in_set
(
Item
*
a
,
Item
*
b
);
Item
*
create_func_floor
(
Item
*
a
);
Item
*
create_func_floor
(
Item
*
a
);
Item
*
create_func_found_rows
(
void
);
Item
*
create_func_from_days
(
Item
*
a
);
Item
*
create_func_from_days
(
Item
*
a
);
Item
*
create_func_get_lock
(
Item
*
a
,
Item
*
b
);
Item
*
create_func_get_lock
(
Item
*
a
,
Item
*
b
);
Item
*
create_func_hex
(
Item
*
a
);
Item
*
create_func_hex
(
Item
*
a
);
...
...
sql/lex.h
View file @
568d72f0
...
@@ -287,6 +287,7 @@ static SYMBOL symbols[] = {
...
@@ -287,6 +287,7 @@ static SYMBOL symbols[] = {
{
"SQL_BIG_SELECTS"
,
SYM
(
SQL_BIG_SELECTS
),
0
,
0
},
{
"SQL_BIG_SELECTS"
,
SYM
(
SQL_BIG_SELECTS
),
0
,
0
},
{
"SQL_BIG_TABLES"
,
SYM
(
SQL_BIG_TABLES
),
0
,
0
},
{
"SQL_BIG_TABLES"
,
SYM
(
SQL_BIG_TABLES
),
0
,
0
},
{
"SQL_BUFFER_RESULT"
,
SYM
(
SQL_BUFFER_RESULT
),
0
,
0
},
{
"SQL_BUFFER_RESULT"
,
SYM
(
SQL_BUFFER_RESULT
),
0
,
0
},
{
"SQL_CALC_FOUND_ROWS"
,
SYM
(
SQL_CALC_FOUND_ROWS
),
0
,
0
},
{
"SQL_LOG_BIN"
,
SYM
(
SQL_LOG_BIN
),
0
,
0
},
{
"SQL_LOG_BIN"
,
SYM
(
SQL_LOG_BIN
),
0
,
0
},
{
"SQL_LOG_OFF"
,
SYM
(
SQL_LOG_OFF
),
0
,
0
},
{
"SQL_LOG_OFF"
,
SYM
(
SQL_LOG_OFF
),
0
,
0
},
{
"SQL_LOG_UPDATE"
,
SYM
(
SQL_LOG_UPDATE
),
0
,
0
},
{
"SQL_LOG_UPDATE"
,
SYM
(
SQL_LOG_UPDATE
),
0
,
0
},
...
@@ -392,6 +393,7 @@ static SYMBOL sql_functions[] = {
...
@@ -392,6 +393,7 @@ static SYMBOL sql_functions[] = {
{
"FIND_IN_SET"
,
SYM
(
FUNC_ARG2
),
0
,
CREATE_FUNC
(
create_func_find_in_set
)},
{
"FIND_IN_SET"
,
SYM
(
FUNC_ARG2
),
0
,
CREATE_FUNC
(
create_func_find_in_set
)},
{
"FLOOR"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_floor
)},
{
"FLOOR"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_floor
)},
{
"FORMAT"
,
SYM
(
FORMAT_SYM
),
0
,
0
},
{
"FORMAT"
,
SYM
(
FORMAT_SYM
),
0
,
0
},
{
"FOUND_ROWS"
,
SYM
(
FUNC_ARG0
),
0
,
CREATE_FUNC
(
create_func_found_rows
)},
{
"FROM_DAYS"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_from_days
)},
{
"FROM_DAYS"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_from_days
)},
{
"FROM_UNIXTIME"
,
SYM
(
FROM_UNIXTIME
),
0
,
0
},
{
"FROM_UNIXTIME"
,
SYM
(
FROM_UNIXTIME
),
0
,
0
},
{
"GET_LOCK"
,
SYM
(
FUNC_ARG2
),
0
,
CREATE_FUNC
(
create_func_get_lock
)},
{
"GET_LOCK"
,
SYM
(
FUNC_ARG2
),
0
,
CREATE_FUNC
(
create_func_get_lock
)},
...
...
sql/mysql_priv.h
View file @
568d72f0
...
@@ -145,9 +145,9 @@ void kill_one_thread(THD *thd, ulong id);
...
@@ -145,9 +145,9 @@ void kill_one_thread(THD *thd, ulong id);
#define SELECT_DESCRIBE 4
#define SELECT_DESCRIBE 4
#define SELECT_SMALL_RESULT 8
#define SELECT_SMALL_RESULT 8
#define SELECT_BIG_RESULT 16
#define SELECT_BIG_RESULT 16
#define OPTION_FOUND_ROWS 32
#define SELECT_HIGH_PRIORITY 64
/* Intern */
#define SELECT_HIGH_PRIORITY 64
/* Intern */
#define SELECT_USE_CACHE 256
/* Intern */
#define SELECT_USE_CACHE 256
/* Intern */
#define SELECT_COUNT_DISTINCT 512
/* Intern */
#define OPTION_BIG_TABLES 512
/* for SQL OPTION */
#define OPTION_BIG_TABLES 512
/* for SQL OPTION */
#define OPTION_BIG_SELECTS 1024
/* for SQL OPTION */
#define OPTION_BIG_SELECTS 1024
/* for SQL OPTION */
...
...
sql/sql_class.h
View file @
568d72f0
...
@@ -263,7 +263,7 @@ public:
...
@@ -263,7 +263,7 @@ public:
Vio
*
active_vio
;
Vio
*
active_vio
;
pthread_mutex_t
active_vio_lock
;
pthread_mutex_t
active_vio_lock
;
#endif
#endif
ulonglong
next_insert_id
,
last_insert_id
,
current_insert_id
;
ulonglong
next_insert_id
,
last_insert_id
,
current_insert_id
,
limit_found_rows
;
ha_rows
select_limit
,
offset_limit
,
default_select_limit
,
cuted_fields
,
ha_rows
select_limit
,
offset_limit
,
default_select_limit
,
cuted_fields
,
max_join_size
,
sent_row_count
;
max_join_size
,
sent_row_count
;
table_map
used_tables
;
table_map
used_tables
;
...
@@ -353,6 +353,10 @@ public:
...
@@ -353,6 +353,10 @@ public:
}
}
return
last_insert_id
;
return
last_insert_id
;
}
}
inline
ulonglong
found_rows
(
void
)
{
return
limit_found_rows
;
}
inline
bool
active_transaction
()
inline
bool
active_transaction
()
{
{
#ifdef USING_TRANSACTIONS
#ifdef USING_TRANSACTIONS
...
...
sql/sql_parse.cc
View file @
568d72f0
...
@@ -1092,6 +1092,8 @@ mysql_execute_command(void)
...
@@ -1092,6 +1092,8 @@ mysql_execute_command(void)
thd
->
select_limit
=
lex
->
select_limit
+
lex
->
offset_limit
;
thd
->
select_limit
=
lex
->
select_limit
+
lex
->
offset_limit
;
if
(
thd
->
select_limit
<
lex
->
select_limit
)
if
(
thd
->
select_limit
<
lex
->
select_limit
)
thd
->
select_limit
=
HA_POS_ERROR
;
// no limit
thd
->
select_limit
=
HA_POS_ERROR
;
// no limit
if
(
thd
->
select_limit
==
HA_POS_ERROR
)
lex
->
options
&=
~
OPTION_FOUND_ROWS
;
if
(
lex
->
exchange
)
if
(
lex
->
exchange
)
{
{
...
...
sql/sql_select.cc
View file @
568d72f0
...
@@ -272,6 +272,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
...
@@ -272,6 +272,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
count_field_types
(
&
join
.
tmp_table_param
,
all_fields
,
0
);
count_field_types
(
&
join
.
tmp_table_param
,
all_fields
,
0
);
join
.
const_tables
=
0
;
join
.
const_tables
=
0
;
join
.
having
=
0
;
join
.
having
=
0
;
join
.
do_send_rows
=
1
;
join
.
group
=
group
!=
0
;
join
.
group
=
group
!=
0
;
#ifdef RESTRICTED_GROUP
#ifdef RESTRICTED_GROUP
...
@@ -354,7 +355,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
...
@@ -354,7 +355,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
result
->
send_fields
(
fields
,
1
);
result
->
send_fields
(
fields
,
1
);
if
(
!
having
||
having
->
val_int
())
if
(
!
having
||
having
->
val_int
())
{
{
if
(
result
->
send_data
(
fields
))
if
(
join
.
do_send_rows
&&
result
->
send_data
(
fields
))
{
{
result
->
send_error
(
0
,
NullS
);
/* purecov: inspected */
result
->
send_error
(
0
,
NullS
);
/* purecov: inspected */
error
=
1
;
error
=
1
;
...
@@ -429,7 +430,8 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
...
@@ -429,7 +430,8 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
select_distinct
=
0
;
select_distinct
=
0
;
}
}
else
if
(
select_distinct
&&
join
.
tables
-
join
.
const_tables
==
1
&&
else
if
(
select_distinct
&&
join
.
tables
-
join
.
const_tables
==
1
&&
(
order
||
thd
->
select_limit
==
HA_POS_ERROR
))
(
order
||
thd
->
select_limit
==
HA_POS_ERROR
||
(
join
.
select_options
&
OPTION_FOUND_ROWS
)))
{
{
if
((
group
=
create_distinct_group
(
order
,
fields
)))
if
((
group
=
create_distinct_group
(
order
,
fields
)))
{
{
...
@@ -528,7 +530,8 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
...
@@ -528,7 +530,8 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
(
join
.
const_tables
==
join
.
tables
||
(
join
.
const_tables
==
join
.
tables
||
test_if_skip_sort_order
(
&
join
.
join_tab
[
join
.
const_tables
],
order
,
test_if_skip_sort_order
(
&
join
.
join_tab
[
join
.
const_tables
],
order
,
(
having
||
group
||
(
having
||
group
||
join
.
const_tables
!=
join
.
tables
-
1
)
?
join
.
const_tables
!=
join
.
tables
-
1
||
(
join
.
select_options
&
OPTION_FOUND_ROWS
))
?
HA_POS_ERROR
:
thd
->
select_limit
)))
HA_POS_ERROR
:
thd
->
select_limit
)))
order
=
0
;
order
=
0
;
select_describe
(
&
join
,
need_tmp
,
select_describe
(
&
join
,
need_tmp
,
...
@@ -565,7 +568,8 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
...
@@ -565,7 +568,8 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
group
:
(
ORDER
*
)
0
),
group
:
(
ORDER
*
)
0
),
group
?
0
:
select_distinct
,
group
?
0
:
select_distinct
,
group
&&
simple_group
,
group
&&
simple_group
,
order
==
0
,
order
==
0
&&
!
(
join
.
select_options
&
OPTION_FOUND_ROWS
),
join
.
select_options
)))
join
.
select_options
)))
goto
err
;
/* purecov: inspected */
goto
err
;
/* purecov: inspected */
...
@@ -776,7 +780,8 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
...
@@ -776,7 +780,8 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
if
(
create_sort_index
(
&
join
.
join_tab
[
join
.
const_tables
],
if
(
create_sort_index
(
&
join
.
join_tab
[
join
.
const_tables
],
group
?
group
:
order
,
group
?
group
:
order
,
(
having
||
group
||
(
having
||
group
||
join
.
const_tables
!=
join
.
tables
-
1
)
?
join
.
const_tables
!=
join
.
tables
-
1
||
(
join
.
select_options
&
OPTION_FOUND_ROWS
))
?
HA_POS_ERROR
:
thd
->
select_limit
))
HA_POS_ERROR
:
thd
->
select_limit
))
goto
err
;
/* purecov: inspected */
goto
err
;
/* purecov: inspected */
}
}
...
@@ -785,6 +790,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
...
@@ -785,6 +790,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
error
=
do_select
(
&
join
,
&
fields
,
NULL
,
procedure
);
error
=
do_select
(
&
join
,
&
fields
,
NULL
,
procedure
);
err:
err:
thd
->
limit_found_rows
=
join
.
send_records
;
thd
->
proc_info
=
"end"
;
thd
->
proc_info
=
"end"
;
join
.
lock
=
0
;
// It's faster to unlock later
join
.
lock
=
0
;
// It's faster to unlock later
join_free
(
&
join
);
join_free
(
&
join
);
...
@@ -2207,6 +2213,7 @@ make_simple_join(JOIN *join,TABLE *tmp_table)
...
@@ -2207,6 +2213,7 @@ make_simple_join(JOIN *join,TABLE *tmp_table)
join
->
sum_funcs
=
0
;
join
->
sum_funcs
=
0
;
join
->
send_records
=
(
ha_rows
)
0
;
join
->
send_records
=
(
ha_rows
)
0
;
join
->
group
=
0
;
join
->
group
=
0
;
join
->
do_send_rows
=
1
;
join_tab
->
cache
.
buff
=
0
;
/* No cacheing */
join_tab
->
cache
.
buff
=
0
;
/* No cacheing */
join_tab
->
table
=
tmp_table
;
join_tab
->
table
=
tmp_table
;
...
@@ -2307,15 +2314,19 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
...
@@ -2307,15 +2314,19 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
*/
*/
if
((
tab
->
keys
&
~
tab
->
const_keys
&&
i
>
0
)
||
if
((
tab
->
keys
&
~
tab
->
const_keys
&&
i
>
0
)
||
tab
->
const_keys
&&
i
==
join
->
const_tables
&&
(
tab
->
const_keys
&&
i
==
join
->
const_tables
&&
join
->
thd
->
select_limit
<
join
->
best_positions
[
i
].
records_read
)
join
->
thd
->
select_limit
<
join
->
best_positions
[
i
].
records_read
&&
!
(
join
->
select_options
&
OPTION_FOUND_ROWS
)))
{
{
/* Join with outer join condition */
/* Join with outer join condition */
COND
*
orig_cond
=
sel
->
cond
;
COND
*
orig_cond
=
sel
->
cond
;
sel
->
cond
=
and_conds
(
sel
->
cond
,
tab
->
on_expr
);
sel
->
cond
=
and_conds
(
sel
->
cond
,
tab
->
on_expr
);
if
(
sel
->
test_quick_select
(
tab
->
keys
,
if
(
sel
->
test_quick_select
(
tab
->
keys
,
used_tables
&
~
current_map
,
used_tables
&
~
current_map
,
join
->
thd
->
select_limit
)
<
0
)
(
join
->
select_options
&
OPTION_FOUND_ROWS
?
HA_POS_ERROR
:
join
->
thd
->
select_limit
))
<
0
)
DBUG_RETURN
(
1
);
// Impossible range
DBUG_RETURN
(
1
);
// Impossible range
sel
->
cond
=
orig_cond
;
sel
->
cond
=
orig_cond
;
}
}
...
@@ -4594,15 +4605,24 @@ end_send(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
...
@@ -4594,15 +4605,24 @@ end_send(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
int
error
;
int
error
;
if
(
join
->
having
&&
join
->
having
->
val_int
()
==
0
)
if
(
join
->
having
&&
join
->
having
->
val_int
()
==
0
)
DBUG_RETURN
(
0
);
// Didn't match having
DBUG_RETURN
(
0
);
// Didn't match having
error
=
0
;
if
(
join
->
procedure
)
if
(
join
->
procedure
)
error
=
join
->
procedure
->
send_row
(
*
join
->
fields
);
error
=
join
->
procedure
->
send_row
(
*
join
->
fields
);
else
else
if
(
join
->
do_send_rows
)
error
=
join
->
result
->
send_data
(
*
join
->
fields
);
error
=
join
->
result
->
send_data
(
*
join
->
fields
);
if
(
error
)
if
(
error
)
DBUG_RETURN
(
-
1
);
/* purecov: inspected */
DBUG_RETURN
(
-
1
);
/* purecov: inspected */
if
(
++
join
->
send_records
>=
join
->
thd
->
select_limit
)
if
(
++
join
->
send_records
>=
join
->
thd
->
select_limit
&&
join
->
do_send_rows
)
{
if
(
join
->
select_options
&
OPTION_FOUND_ROWS
)
{
join
->
do_send_rows
=
0
;
join
->
thd
->
select_limit
=
HA_POS_ERROR
;
DBUG_RETURN
(
0
);
}
DBUG_RETURN
(
-
3
);
// Abort nicely
DBUG_RETURN
(
-
3
);
// Abort nicely
}
}
}
else
else
{
{
if
(
join
->
procedure
&&
join
->
procedure
->
end_of_records
())
if
(
join
->
procedure
&&
join
->
procedure
->
end_of_records
())
...
@@ -4632,9 +4652,10 @@ end_send_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
...
@@ -4632,9 +4652,10 @@ end_send_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
int
error
;
int
error
;
if
(
join
->
procedure
)
if
(
join
->
procedure
)
{
{
error
=
0
;
if
(
join
->
having
&&
join
->
having
->
val_int
()
==
0
)
if
(
join
->
having
&&
join
->
having
->
val_int
()
==
0
)
error
=
-
1
;
// Didn't satisfy having
error
=
-
1
;
// Didn't satisfy having
else
else
if
(
join
->
do_send_rows
)
error
=
join
->
procedure
->
send_row
(
*
join
->
fields
)
?
1
:
0
;
error
=
join
->
procedure
->
send_row
(
*
join
->
fields
)
?
1
:
0
;
if
(
end_of_records
&&
join
->
procedure
->
end_of_records
())
if
(
end_of_records
&&
join
->
procedure
->
end_of_records
())
error
=
1
;
// Fatal error
error
=
1
;
// Fatal error
...
@@ -4652,8 +4673,14 @@ end_send_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
...
@@ -4652,8 +4673,14 @@ end_send_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
DBUG_RETURN
(
-
1
);
/* purecov: inspected */
DBUG_RETURN
(
-
1
);
/* purecov: inspected */
if
(
end_of_records
)
if
(
end_of_records
)
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
if
(
!
error
&&
++
join
->
send_records
>=
join
->
thd
->
select_limit
)
if
(
!
error
&&
++
join
->
send_records
>=
join
->
thd
->
select_limit
&&
DBUG_RETURN
(
-
3
);
/* Abort nicely */
join
->
do_send_rows
)
{
if
(
!
(
join
->
select_options
&
OPTION_FOUND_ROWS
))
DBUG_RETURN
(
-
3
);
// Abort nicely
join
->
do_send_rows
=
0
;
join
->
thd
->
select_limit
=
HA_POS_ERROR
;
}
}
}
}
}
else
else
...
@@ -4724,8 +4751,15 @@ end_write(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
...
@@ -4724,8 +4751,15 @@ end_write(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
if
(
create_myisam_from_heap
(
table
,
&
join
->
tmp_table_param
,
error
,
1
))
if
(
create_myisam_from_heap
(
table
,
&
join
->
tmp_table_param
,
error
,
1
))
DBUG_RETURN
(
1
);
// Not a table_is_full error
DBUG_RETURN
(
1
);
// Not a table_is_full error
table
->
uniques
=
0
;
// To ensure rows are the same
table
->
uniques
=
0
;
// To ensure rows are the same
if
(
++
join
->
send_records
>=
join
->
tmp_table_param
.
end_write_records
)
if
(
++
join
->
send_records
>=
join
->
tmp_table_param
.
end_write_records
&
join
->
do_send_rows
)
{
if
(
!
(
join
->
select_options
&
OPTION_FOUND_ROWS
))
DBUG_RETURN
(
-
3
);
DBUG_RETURN
(
-
3
);
join
->
do_send_rows
=
0
;
join
->
thd
->
select_limit
=
HA_POS_ERROR
;
DBUG_RETURN
(
0
);
}
}
}
}
}
}
}
...
...
sql/sql_select.h
View file @
568d72f0
...
@@ -150,6 +150,7 @@ class JOIN {
...
@@ -150,6 +150,7 @@ class JOIN {
uint
tables
,
const_tables
;
uint
tables
,
const_tables
;
uint
send_group_parts
;
uint
send_group_parts
;
bool
sort_and_group
,
first_record
,
full_join
,
group
,
no_field_update
;
bool
sort_and_group
,
first_record
,
full_join
,
group
,
no_field_update
;
bool
do_send_rows
;
table_map
const_table_map
,
outer_join
;
table_map
const_table_map
,
outer_join
;
ha_rows
send_records
,
found_records
;
ha_rows
send_records
,
found_records
;
POSITION
positions
[
MAX_TABLES
+
1
],
best_positions
[
MAX_TABLES
+
1
];
POSITION
positions
[
MAX_TABLES
+
1
],
best_positions
[
MAX_TABLES
+
1
];
...
...
sql/sql_yacc.yy
View file @
568d72f0
...
@@ -431,6 +431,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
...
@@ -431,6 +431,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token SQL_BUFFER_RESULT
%token SQL_BUFFER_RESULT
%token SQL_WARNINGS
%token SQL_WARNINGS
%token SQL_AUTO_IS_NULL
%token SQL_AUTO_IS_NULL
%token SQL_CALC_FOUND_ROWS
%token SQL_SAFE_UPDATES
%token SQL_SAFE_UPDATES
%token SQL_QUOTE_SHOW_CREATE
%token SQL_QUOTE_SHOW_CREATE
%token SQL_SLAVE_SKIP_COUNTER
%token SQL_SLAVE_SKIP_COUNTER
...
@@ -1274,6 +1275,7 @@ select_option:
...
@@ -1274,6 +1275,7 @@ select_option:
| SQL_SMALL_RESULT { Lex->options|= SELECT_SMALL_RESULT; }
| SQL_SMALL_RESULT { Lex->options|= SELECT_SMALL_RESULT; }
| SQL_BIG_RESULT { Lex->options|= SELECT_BIG_RESULT; }
| SQL_BIG_RESULT { Lex->options|= SELECT_BIG_RESULT; }
| SQL_BUFFER_RESULT { Lex->options|= OPTION_BUFFER_RESULT; }
| SQL_BUFFER_RESULT { Lex->options|= OPTION_BUFFER_RESULT; }
| SQL_CALC_FOUND_ROWS { Lex->options|= OPTION_FOUND_ROWS; }
| ALL {}
| ALL {}
select_lock_type:
select_lock_type:
...
...
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