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
b31a79df
Commit
b31a79df
authored
Oct 07, 2003
by
monty@narttu.mysql.fi
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
cb334d03
73cb1a52
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
44 deletions
+48
-44
sql/ha_myisam.cc
sql/ha_myisam.cc
+2
-2
sql/item_subselect.cc
sql/item_subselect.cc
+33
-36
sql/item_subselect.h
sql/item_subselect.h
+8
-3
sql/mysqld.cc
sql/mysqld.cc
+5
-3
No files found.
sql/ha_myisam.cc
View file @
b31a79df
...
@@ -898,7 +898,7 @@ int ha_myisam::index_read(byte * buf, const byte * key,
...
@@ -898,7 +898,7 @@ int ha_myisam::index_read(byte * buf, const byte * key,
uint
key_len
,
enum
ha_rkey_function
find_flag
)
uint
key_len
,
enum
ha_rkey_function
find_flag
)
{
{
statistic_increment
(
ha_read_key_count
,
&
LOCK_status
);
statistic_increment
(
ha_read_key_count
,
&
LOCK_status
);
int
error
=
mi_rkey
(
file
,
buf
,
active_index
,
key
,
key_len
,
(
enum
ha_rkey_function
)
find_flag
);
int
error
=
mi_rkey
(
file
,
buf
,
active_index
,
key
,
key_len
,
find_flag
);
table
->
status
=
error
?
STATUS_NOT_FOUND
:
0
;
table
->
status
=
error
?
STATUS_NOT_FOUND
:
0
;
return
error
;
return
error
;
}
}
...
@@ -907,7 +907,7 @@ int ha_myisam::index_read_idx(byte * buf, uint index, const byte * key,
...
@@ -907,7 +907,7 @@ int ha_myisam::index_read_idx(byte * buf, uint index, const byte * key,
uint
key_len
,
enum
ha_rkey_function
find_flag
)
uint
key_len
,
enum
ha_rkey_function
find_flag
)
{
{
statistic_increment
(
ha_read_key_count
,
&
LOCK_status
);
statistic_increment
(
ha_read_key_count
,
&
LOCK_status
);
int
error
=
mi_rkey
(
file
,
buf
,
index
,
key
,
key_len
,
(
enum
ha_rkey_function
)
find_flag
);
int
error
=
mi_rkey
(
file
,
buf
,
index
,
key
,
key_len
,
find_flag
);
table
->
status
=
error
?
STATUS_NOT_FOUND
:
0
;
table
->
status
=
error
?
STATUS_NOT_FOUND
:
0
;
return
error
;
return
error
;
}
}
...
...
sql/item_subselect.cc
View file @
b31a79df
...
@@ -36,7 +36,7 @@ inline Item * and_items(Item* cond, Item *item)
...
@@ -36,7 +36,7 @@ inline Item * and_items(Item* cond, Item *item)
Item_subselect
::
Item_subselect
()
:
Item_subselect
::
Item_subselect
()
:
Item_result_field
(),
engine_owner
(
1
),
value_assigned
(
0
),
substitution
(
0
),
Item_result_field
(),
engine_owner
(
1
),
value_assigned
(
0
),
substitution
(
0
),
have_to_be_excluded
(
0
),
engine_changed
(
0
)
engine
(
0
),
have_to_be_excluded
(
0
),
engine_changed
(
0
)
{
{
reset
();
reset
();
/*
/*
...
@@ -46,6 +46,7 @@ Item_subselect::Item_subselect():
...
@@ -46,6 +46,7 @@ Item_subselect::Item_subselect():
null_value
=
1
;
null_value
=
1
;
}
}
void
Item_subselect
::
init
(
THD
*
thd
,
st_select_lex
*
select_lex
,
void
Item_subselect
::
init
(
THD
*
thd
,
st_select_lex
*
select_lex
,
select_subselect
*
result
)
select_subselect
*
result
)
{
{
...
@@ -62,6 +63,7 @@ void Item_subselect::init(THD *thd, st_select_lex *select_lex,
...
@@ -62,6 +63,7 @@ void Item_subselect::init(THD *thd, st_select_lex *select_lex,
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
}
}
Item_subselect
::~
Item_subselect
()
Item_subselect
::~
Item_subselect
()
{
{
if
(
engine_owner
)
if
(
engine_owner
)
...
@@ -767,6 +769,7 @@ Item_in_subselect::row_value_transformer(JOIN *join,
...
@@ -767,6 +769,7 @@ Item_in_subselect::row_value_transformer(JOIN *join,
DBUG_RETURN
(
RES_OK
);
DBUG_RETURN
(
RES_OK
);
}
}
Item_subselect
::
trans_res
Item_subselect
::
trans_res
Item_in_subselect
::
select_transformer
(
JOIN
*
join
)
Item_in_subselect
::
select_transformer
(
JOIN
*
join
)
{
{
...
@@ -776,6 +779,7 @@ Item_in_subselect::select_transformer(JOIN *join)
...
@@ -776,6 +779,7 @@ Item_in_subselect::select_transformer(JOIN *join)
return
row_value_transformer
(
join
,
left_expr
);
return
row_value_transformer
(
join
,
left_expr
);
}
}
Item_subselect
::
trans_res
Item_subselect
::
trans_res
Item_allany_subselect
::
select_transformer
(
JOIN
*
join
)
Item_allany_subselect
::
select_transformer
(
JOIN
*
join
)
{
{
...
@@ -786,8 +790,8 @@ subselect_single_select_engine::
...
@@ -786,8 +790,8 @@ subselect_single_select_engine::
subselect_single_select_engine
(
THD
*
thd
,
subselect_single_select_engine
(
THD
*
thd
,
st_select_lex
*
select
,
st_select_lex
*
select
,
select_subselect
*
result
,
select_subselect
*
result
,
Item_subselect
*
item
)
:
Item_subselect
*
item
)
subselect_engine
(
thd
,
item
,
result
),
:
subselect_engine
(
thd
,
item
,
result
),
prepared
(
0
),
optimized
(
0
),
executed
(
0
)
prepared
(
0
),
optimized
(
0
),
executed
(
0
)
{
{
select_lex
=
select
;
select_lex
=
select
;
...
@@ -807,11 +811,12 @@ subselect_single_select_engine::
...
@@ -807,11 +811,12 @@ subselect_single_select_engine::
this
->
select_lex
=
select_lex
;
this
->
select_lex
=
select_lex
;
}
}
subselect_union_engine
::
subselect_union_engine
(
THD
*
thd
,
subselect_union_engine
::
subselect_union_engine
(
THD
*
thd
,
st_select_lex_unit
*
u
,
st_select_lex_unit
*
u
,
select_subselect
*
result
,
select_subselect
*
result
,
Item_subselect
*
item
)
:
Item_subselect
*
item
)
subselect_engine
(
thd
,
item
,
result
)
:
subselect_engine
(
thd
,
item
,
result
)
{
{
unit
=
u
;
unit
=
u
;
if
(
!
result
)
if
(
!
result
)
...
@@ -994,6 +999,7 @@ int subselect_union_engine::exec()
...
@@ -994,6 +999,7 @@ int subselect_union_engine::exec()
return
res
;
return
res
;
}
}
int
subselect_uniquesubquery_engine
::
exec
()
int
subselect_uniquesubquery_engine
::
exec
()
{
{
DBUG_ENTER
(
"subselect_uniquesubquery_engine::exec"
);
DBUG_ENTER
(
"subselect_uniquesubquery_engine::exec"
);
...
@@ -1015,34 +1021,22 @@ int subselect_uniquesubquery_engine::exec()
...
@@ -1015,34 +1021,22 @@ int subselect_uniquesubquery_engine::exec()
{
{
error
=
0
;
error
=
0
;
table
->
null_row
=
0
;
table
->
null_row
=
0
;
if
(
table
->
status
)
((
Item_in_subselect
*
)
item
)
->
value
=
(
!
table
->
status
&&
((
Item_in_subselect
*
)
item
)
->
value
=
0
;
(
!
cond
||
cond
->
val_int
())
?
1
:
else
0
);
((
Item_in_subselect
*
)
item
)
->
value
=
(
!
cond
||
cond
->
val_int
()
?
1
:
0
);
}
}
}
}
DBUG_RETURN
(
e
nd_exec
(
table
)
||
(
error
!=
0
)
);
DBUG_RETURN
(
e
rror
!=
0
);
}
}
int
subselect_uniquesubquery_engine
::
end_exec
(
TABLE
*
table
)
subselect_uniquesubquery_engine
::~
subselect_uniquesubquery_engine
()
{
{
DBUG_ENTER
(
"subselect_uniquesubquery_engine::end_exec"
);
/* Tell handler we don't need the index anymore */
int
error
=
0
,
tmp
;
tab
->
table
->
file
->
index_end
();
if
((
tmp
=
table
->
file
->
extra
(
HA_EXTRA_NO_CACHE
)))
{
DBUG_PRINT
(
"error"
,
(
"extra(HA_EXTRA_NO_CACHE) failed"
));
error
=
1
;
}
if
((
tmp
=
table
->
file
->
index_end
()))
{
DBUG_PRINT
(
"error"
,
(
"index_end() failed"
));
error
=
1
;
}
if
(
error
==
1
)
table
->
file
->
print_error
(
tmp
,
MYF
(
0
));
DBUG_RETURN
(
error
!=
0
);
}
}
int
subselect_indexsubquery_engine
::
exec
()
int
subselect_indexsubquery_engine
::
exec
()
{
{
DBUG_ENTER
(
"subselect_indexsubselect_engine::exec"
);
DBUG_ENTER
(
"subselect_indexsubselect_engine::exec"
);
...
@@ -1051,9 +1045,11 @@ int subselect_indexsubquery_engine::exec()
...
@@ -1051,9 +1045,11 @@ int subselect_indexsubquery_engine::exec()
TABLE
*
table
=
tab
->
table
;
TABLE
*
table
=
tab
->
table
;
((
Item_in_subselect
*
)
item
)
->
value
=
0
;
((
Item_in_subselect
*
)
item
)
->
value
=
0
;
if
(
check_null
)
if
(
check_null
)
{
{
*
tab
->
null_ref_key
=
0
;
/* We need to check for NULL if there wasn't a matching value */
*
tab
->
null_ref_key
=
0
;
// Search first for not null
((
Item_in_subselect
*
)
item
)
->
was_null
=
0
;
((
Item_in_subselect
*
)
item
)
->
was_null
=
0
;
}
}
...
@@ -1071,7 +1067,7 @@ int subselect_indexsubquery_engine::exec()
...
@@ -1071,7 +1067,7 @@ int subselect_indexsubquery_engine::exec()
error
=
report_error
(
table
,
error
);
error
=
report_error
(
table
,
error
);
else
else
{
{
for
(;;)
for
(;;)
{
{
error
=
0
;
error
=
0
;
table
->
null_row
=
0
;
table
->
null_row
=
0
;
...
@@ -1083,7 +1079,7 @@ int subselect_indexsubquery_engine::exec()
...
@@ -1083,7 +1079,7 @@ int subselect_indexsubquery_engine::exec()
((
Item_in_subselect
*
)
item
)
->
was_null
=
1
;
((
Item_in_subselect
*
)
item
)
->
was_null
=
1
;
else
else
((
Item_in_subselect
*
)
item
)
->
value
=
1
;
((
Item_in_subselect
*
)
item
)
->
value
=
1
;
goto
finish
;
break
;
}
}
error
=
table
->
file
->
index_next_same
(
table
->
record
[
0
],
error
=
table
->
file
->
index_next_same
(
table
->
record
[
0
],
tab
->
ref
.
key_buff
,
tab
->
ref
.
key_buff
,
...
@@ -1091,25 +1087,26 @@ int subselect_indexsubquery_engine::exec()
...
@@ -1091,25 +1087,26 @@ int subselect_indexsubquery_engine::exec()
if
(
error
&&
error
!=
HA_ERR_END_OF_FILE
)
if
(
error
&&
error
!=
HA_ERR_END_OF_FILE
)
{
{
error
=
report_error
(
table
,
error
);
error
=
report_error
(
table
,
error
);
goto
finish
;
break
;
}
}
}
}
else
else
{
{
if
(
!
check_null
||
null_finding
)
if
(
!
check_null
||
null_finding
)
goto
finish
;
break
;
/* We don't need to check nulls */
*
tab
->
null_ref_key
=
1
;
*
tab
->
null_ref_key
=
1
;
null_finding
=
1
;
null_finding
=
1
;
if
(
safe_index_read
(
tab
))
/* Check if there exists a row with a null value in the index */
goto
finish
;
if
((
error
=
safe_index_read
(
tab
)))
break
;
}
}
}
}
}
}
}
}
finish:
DBUG_RETURN
(
error
!=
0
);
DBUG_RETURN
(
end_exec
(
table
)
||
(
error
!=
0
));
}
}
uint
subselect_single_select_engine
::
cols
()
uint
subselect_single_select_engine
::
cols
()
{
{
return
select_lex
->
item_list
.
elements
;
return
select_lex
->
item_list
.
elements
;
...
...
sql/item_subselect.h
View file @
b31a79df
...
@@ -243,6 +243,7 @@ public:
...
@@ -243,6 +243,7 @@ public:
friend
class
subselect_indexsubquery_engine
;
friend
class
subselect_indexsubquery_engine
;
};
};
/* ALL/ANY/SOME subselect */
/* ALL/ANY/SOME subselect */
class
Item_allany_subselect
:
public
Item_in_subselect
class
Item_allany_subselect
:
public
Item_in_subselect
{
{
...
@@ -258,6 +259,7 @@ public:
...
@@ -258,6 +259,7 @@ public:
trans_res
select_transformer
(
JOIN
*
join
);
trans_res
select_transformer
(
JOIN
*
join
);
};
};
class
subselect_engine
:
public
Sql_alloc
class
subselect_engine
:
public
Sql_alloc
{
{
protected:
protected:
...
@@ -289,6 +291,7 @@ public:
...
@@ -289,6 +291,7 @@ public:
bool
may_be_null
()
{
return
maybe_null
;
};
bool
may_be_null
()
{
return
maybe_null
;
};
};
};
class
subselect_single_select_engine
:
public
subselect_engine
class
subselect_single_select_engine
:
public
subselect_engine
{
{
my_bool
prepared
;
/* simple subselect is prepared */
my_bool
prepared
;
/* simple subselect is prepared */
...
@@ -309,6 +312,7 @@ public:
...
@@ -309,6 +312,7 @@ public:
void
exclude
();
void
exclude
();
};
};
class
subselect_union_engine
:
public
subselect_engine
class
subselect_union_engine
:
public
subselect_engine
{
{
st_select_lex_unit
*
unit
;
/* corresponding unit structure */
st_select_lex_unit
*
unit
;
/* corresponding unit structure */
...
@@ -326,6 +330,7 @@ public:
...
@@ -326,6 +330,7 @@ public:
void
exclude
();
void
exclude
();
};
};
struct
st_join_table
;
struct
st_join_table
;
class
subselect_uniquesubquery_engine
:
public
subselect_engine
class
subselect_uniquesubquery_engine
:
public
subselect_engine
{
{
...
@@ -338,7 +343,7 @@ public:
...
@@ -338,7 +343,7 @@ public:
Item_subselect
*
subs
,
Item
*
where
)
Item_subselect
*
subs
,
Item
*
where
)
:
subselect_engine
(
thd
,
subs
,
0
),
tab
(
tab_arg
),
cond
(
where
)
:
subselect_engine
(
thd
,
subs
,
0
),
tab
(
tab_arg
),
cond
(
where
)
{}
{}
~
subselect_uniquesubquery_engine
();
int
prepare
();
int
prepare
();
void
fix_length_and_dec
(
Item_cache
**
row
);
void
fix_length_and_dec
(
Item_cache
**
row
);
int
exec
();
int
exec
();
...
@@ -346,9 +351,9 @@ public:
...
@@ -346,9 +351,9 @@ public:
bool
dependent
()
{
return
1
;
}
bool
dependent
()
{
return
1
;
}
bool
uncacheable
()
{
return
1
;
}
bool
uncacheable
()
{
return
1
;
}
void
exclude
();
void
exclude
();
static
int
end_exec
(
TABLE
*
table
);
};
};
class
subselect_indexsubquery_engine
:
public
subselect_uniquesubquery_engine
class
subselect_indexsubquery_engine
:
public
subselect_uniquesubquery_engine
{
{
bool
check_null
;
bool
check_null
;
...
...
sql/mysqld.cc
View file @
b31a79df
...
@@ -5634,6 +5634,7 @@ static uint set_maximum_open_files(uint max_file_limit)
...
@@ -5634,6 +5634,7 @@ static uint set_maximum_open_files(uint max_file_limit)
rlimit
.
rlim_cur
=
rlimit
.
rlim_max
=
max_file_limit
;
rlimit
.
rlim_cur
=
rlimit
.
rlim_max
=
max_file_limit
;
if
(
setrlimit
(
RLIMIT_NOFILE
,
&
rlimit
))
if
(
setrlimit
(
RLIMIT_NOFILE
,
&
rlimit
))
{
{
if
(
global_system_variables
.
log_warnings
)
sql_print_error
(
"Warning: setrlimit couldn't increase number of open files to more than %lu (request: %u)"
,
sql_print_error
(
"Warning: setrlimit couldn't increase number of open files to more than %lu (request: %u)"
,
old_cur
,
max_file_limit
);
/* purecov: inspected */
old_cur
,
max_file_limit
);
/* purecov: inspected */
max_file_limit
=
old_cur
;
max_file_limit
=
old_cur
;
...
@@ -5641,7 +5642,8 @@ static uint set_maximum_open_files(uint max_file_limit)
...
@@ -5641,7 +5642,8 @@ static uint set_maximum_open_files(uint max_file_limit)
else
else
{
{
(
void
)
getrlimit
(
RLIMIT_NOFILE
,
&
rlimit
);
(
void
)
getrlimit
(
RLIMIT_NOFILE
,
&
rlimit
);
if
((
uint
)
rlimit
.
rlim_cur
!=
max_file_limit
)
if
((
uint
)
rlimit
.
rlim_cur
!=
max_file_limit
&&
global_system_variables
.
log_warnings
)
sql_print_error
(
"Warning: setrlimit returned ok, but didn't change limits. Max open files is %ld (request: %u)"
,
sql_print_error
(
"Warning: setrlimit returned ok, but didn't change limits. Max open files is %ld (request: %u)"
,
(
ulong
)
rlimit
.
rlim_cur
,
(
ulong
)
rlimit
.
rlim_cur
,
max_file_limit
);
/* purecov: inspected */
max_file_limit
);
/* purecov: inspected */
...
...
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