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
3c484480
Commit
3c484480
authored
Mar 21, 2001
by
monty@tik.mysql.fi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Split setup_fields to setup_tables and setup_fields
Fixed problem with UPDATE TABLE when keys wheren't always used.
parent
6f9a73a1
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
61 additions
and
40 deletions
+61
-40
Docs/manual.texi
Docs/manual.texi
+7
-1
scripts/mysql_install_db.sh
scripts/mysql_install_db.sh
+4
-1
sql/ha_innobase.cc
sql/ha_innobase.cc
+1
-1
sql/mysql_priv.h
sql/mysql_priv.h
+1
-0
sql/sql_base.cc
sql/sql_base.cc
+38
-29
sql/sql_insert.cc
sql/sql_insert.cc
+3
-3
sql/sql_load.cc
sql/sql_load.cc
+1
-1
sql/sql_parse.cc
sql/sql_parse.cc
+2
-1
sql/sql_select.cc
sql/sql_select.cc
+2
-1
sql/sql_update.cc
sql/sql_update.cc
+1
-1
sql/sql_yacc.yy
sql/sql_yacc.yy
+1
-1
No files found.
Docs/manual.texi
View file @
3c484480
...
@@ -18704,7 +18704,13 @@ deleted and the new one is renamed. This is done in such a way that
...
@@ -18704,7 +18704,13 @@ deleted and the new one is renamed. This is done in such a way that
all updates are automatically redirected to the new table without
all updates are automatically redirected to the new table without
any failed updates. While @code{ALTER TABLE} is executing, the original
any failed updates. While @code{ALTER TABLE} is executing, the original
table is readable by other clients. Updates and writes to the table
table is readable by other clients. Updates and writes to the table
are stalled until the new table is ready:
are stalled until the new table is ready.
Note that if you use any other option to @code{ALTER TABLE} than
@code{RENAME}, @strong{MySQL} will always create a temporary table, even
if the data wouldn't strictly need to be copied (like when you change the
name of a column). We plan to fix this in the future, but as one doesn't
normally do @code{ALTER TABLE} that often this isn't that high on our TODO.
@itemize @bullet
@itemize @bullet
@item
@item
scripts/mysql_install_db.sh
View file @
3c484480
...
@@ -79,9 +79,12 @@ then
...
@@ -79,9 +79,12 @@ then
basedir
=
@prefix@
basedir
=
@prefix@
bindir
=
@bindir@
bindir
=
@bindir@
execdir
=
@libexecdir@
execdir
=
@libexecdir@
el
se
el
if
test
-d
"
$basedir
/libexec"
bindir
=
"
$basedir
/bin"
bindir
=
"
$basedir
/bin"
execdir
=
"
$basedir
/libexec"
execdir
=
"
$basedir
/libexec"
else
bindir
=
"
$basedir
/bin"
execdir
=
"
$basedir
/bin"
fi
fi
mdata
=
$ldata
/mysql
mdata
=
$ldata
/mysql
...
...
sql/ha_innobase.cc
View file @
3c484480
...
@@ -2231,7 +2231,7 @@ ha_innobase::create(
...
@@ -2231,7 +2231,7 @@ ha_innobase::create(
/* Create the table definition in Innobase */
/* Create the table definition in Innobase */
if
(
error
=
create_table_def
(
trx
,
form
,
norm_name
))
{
if
(
(
error
=
create_table_def
(
trx
,
form
,
norm_name
)
))
{
trx_commit_for_mysql
(
trx
);
trx_commit_for_mysql
(
trx
);
...
...
sql/mysql_priv.h
View file @
3c484480
...
@@ -402,6 +402,7 @@ TABLE *unlink_open_table(THD *thd,TABLE *list,TABLE *find);
...
@@ -402,6 +402,7 @@ TABLE *unlink_open_table(THD *thd,TABLE *list,TABLE *find);
SQL_SELECT
*
make_select
(
TABLE
*
head
,
table_map
const_tables
,
SQL_SELECT
*
make_select
(
TABLE
*
head
,
table_map
const_tables
,
table_map
read_tables
,
COND
*
conds
,
int
*
error
);
table_map
read_tables
,
COND
*
conds
,
int
*
error
);
Item
**
find_item_in_list
(
Item
*
item
,
List
<
Item
>
&
items
);
Item
**
find_item_in_list
(
Item
*
item
,
List
<
Item
>
&
items
);
bool
setup_tables
(
TABLE_LIST
*
tables
);
int
setup_fields
(
THD
*
thd
,
TABLE_LIST
*
tables
,
List
<
Item
>
&
item
,
int
setup_fields
(
THD
*
thd
,
TABLE_LIST
*
tables
,
List
<
Item
>
&
item
,
bool
set_query_id
,
List
<
Item
>
*
sum_func_list
);
bool
set_query_id
,
List
<
Item
>
*
sum_func_list
);
int
setup_conds
(
THD
*
thd
,
TABLE_LIST
*
tables
,
COND
**
conds
);
int
setup_conds
(
THD
*
thd
,
TABLE_LIST
*
tables
,
COND
**
conds
);
...
...
sql/sql_base.cc
View file @
3c484480
...
@@ -39,7 +39,7 @@ static bool insert_fields(THD *thd,TABLE_LIST *tables, const char *table_name,
...
@@ -39,7 +39,7 @@ static bool insert_fields(THD *thd,TABLE_LIST *tables, const char *table_name,
List_iterator
<
Item
>
*
it
);
List_iterator
<
Item
>
*
it
);
static
void
free_cache_entry
(
TABLE
*
entry
);
static
void
free_cache_entry
(
TABLE
*
entry
);
static
void
mysql_rm_tmp_tables
(
void
);
static
void
mysql_rm_tmp_tables
(
void
);
static
key_map
get_key_map_from_key_list
(
T
HD
*
thd
,
T
ABLE
*
table
,
static
key_map
get_key_map_from_key_list
(
TABLE
*
table
,
List
<
String
>
*
index_list
);
List
<
String
>
*
index_list
);
...
@@ -1711,11 +1711,8 @@ find_item_in_list(Item *find,List<Item> &items)
...
@@ -1711,11 +1711,8 @@ find_item_in_list(Item *find,List<Item> &items)
return
found
;
return
found
;
}
}
/****************************************************************************
/****************************************************************************
** Check that all given fields exists and fill struct with current data
** Check that all given fields exists and fill struct with current data
** Check also that the 'used keys' and 'ignored keys' exists and set up the
** table structure accordingly
****************************************************************************/
****************************************************************************/
int
setup_fields
(
THD
*
thd
,
TABLE_LIST
*
tables
,
List
<
Item
>
&
fields
,
int
setup_fields
(
THD
*
thd
,
TABLE_LIST
*
tables
,
List
<
Item
>
&
fields
,
...
@@ -1729,7 +1726,36 @@ int setup_fields(THD *thd, TABLE_LIST *tables, List<Item> &fields,
...
@@ -1729,7 +1726,36 @@ int setup_fields(THD *thd, TABLE_LIST *tables, List<Item> &fields,
thd
->
allow_sum_func
=
test
(
sum_func_list
);
thd
->
allow_sum_func
=
test
(
sum_func_list
);
thd
->
where
=
"field list"
;
thd
->
where
=
"field list"
;
/* Remap table numbers if INSERT ... SELECT */
while
((
item
=
it
++
))
{
if
(
item
->
type
()
==
Item
::
FIELD_ITEM
&&
((
Item_field
*
)
item
)
->
field_name
[
0
]
==
'*'
)
{
if
(
insert_fields
(
thd
,
tables
,((
Item_field
*
)
item
)
->
table_name
,
&
it
))
DBUG_RETURN
(
-
1
);
/* purecov: inspected */
}
else
{
if
(
item
->
fix_fields
(
thd
,
tables
))
DBUG_RETURN
(
-
1
);
/* purecov: inspected */
if
(
item
->
with_sum_func
&&
item
->
type
()
!=
Item
::
SUM_FUNC_ITEM
)
item
->
split_sum_func
(
*
sum_func_list
);
thd
->
used_tables
|=
item
->
used_tables
();
}
}
DBUG_RETURN
(
test
(
thd
->
fatal_error
));
}
/*
Remap table numbers if INSERT ... SELECT
Check also that the 'used keys' and 'ignored keys' exists and set up the
table structure accordingly
*/
bool
setup_tables
(
TABLE_LIST
*
tables
)
{
DBUG_ENTER
(
"setup_tables"
);
uint
tablenr
=
0
;
uint
tablenr
=
0
;
for
(
TABLE_LIST
*
table
=
tables
;
table
;
table
=
table
->
next
,
tablenr
++
)
for
(
TABLE_LIST
*
table
=
tables
;
table
;
table
=
table
->
next
,
tablenr
++
)
{
{
...
@@ -1739,48 +1765,31 @@ int setup_fields(THD *thd, TABLE_LIST *tables, List<Item> &fields,
...
@@ -1739,48 +1765,31 @@ int setup_fields(THD *thd, TABLE_LIST *tables, List<Item> &fields,
table
->
table
->
maybe_null
=
1
;
// LEFT OUTER JOIN ...
table
->
table
->
maybe_null
=
1
;
// LEFT OUTER JOIN ...
if
(
table
->
use_index
)
if
(
table
->
use_index
)
{
{
key_map
map
=
get_key_map_from_key_list
(
t
hd
,
t
able
->
table
,
key_map
map
=
get_key_map_from_key_list
(
table
->
table
,
table
->
use_index
);
table
->
use_index
);
if
(
map
==
~
(
key_map
)
0
)
if
(
map
==
~
(
key_map
)
0
)
DBUG_RETURN
(
-
1
);
DBUG_RETURN
(
1
);
table
->
table
->
keys_in_use_for_query
=
map
;
table
->
table
->
keys_in_use_for_query
=
map
;
}
}
if
(
table
->
ignore_index
)
if
(
table
->
ignore_index
)
{
{
key_map
map
=
get_key_map_from_key_list
(
t
hd
,
t
able
->
table
,
key_map
map
=
get_key_map_from_key_list
(
table
->
table
,
table
->
ignore_index
);
table
->
ignore_index
);
if
(
map
==
~
(
key_map
)
0
)
if
(
map
==
~
(
key_map
)
0
)
DBUG_RETURN
(
-
1
);
DBUG_RETURN
(
1
);
table
->
table
->
keys_in_use_for_query
&=
~
map
;
table
->
table
->
keys_in_use_for_query
&=
~
map
;
}
}
}
}
if
(
tablenr
>
MAX_TABLES
)
if
(
tablenr
>
MAX_TABLES
)
{
{
my_error
(
ER_TOO_MANY_TABLES
,
MYF
(
0
),
MAX_TABLES
);
my_error
(
ER_TOO_MANY_TABLES
,
MYF
(
0
),
MAX_TABLES
);
DBUG_RETURN
(
-
1
);
DBUG_RETURN
(
1
);
}
}
while
((
item
=
it
++
))
DBUG_RETURN
(
0
);
{
if
(
item
->
type
()
==
Item
::
FIELD_ITEM
&&
((
Item_field
*
)
item
)
->
field_name
[
0
]
==
'*'
)
{
if
(
insert_fields
(
thd
,
tables
,((
Item_field
*
)
item
)
->
table_name
,
&
it
))
DBUG_RETURN
(
-
1
);
/* purecov: inspected */
}
else
{
if
(
item
->
fix_fields
(
thd
,
tables
))
DBUG_RETURN
(
-
1
);
/* purecov: inspected */
if
(
item
->
with_sum_func
&&
item
->
type
()
!=
Item
::
SUM_FUNC_ITEM
)
item
->
split_sum_func
(
*
sum_func_list
);
thd
->
used_tables
|=
item
->
used_tables
();
}
}
DBUG_RETURN
(
test
(
thd
->
fatal_error
));
}
}
static
key_map
get_key_map_from_key_list
(
T
HD
*
thd
,
TABLE
*
table
,
static
key_map
get_key_map_from_key_list
(
T
ABLE
*
table
,
List
<
String
>
*
index_list
)
List
<
String
>
*
index_list
)
{
{
key_map
map
=
0
;
key_map
map
=
0
;
...
...
sql/sql_insert.cc
View file @
3c484480
...
@@ -78,7 +78,7 @@ check_insert_fields(THD *thd,TABLE *table,List<Item> &fields,
...
@@ -78,7 +78,7 @@ check_insert_fields(THD *thd,TABLE *table,List<Item> &fields,
table_list
.
grant
=
table
->
grant
;
table_list
.
grant
=
table
->
grant
;
thd
->
dupp_field
=
0
;
thd
->
dupp_field
=
0
;
if
(
setup_fields
(
thd
,
&
table_list
,
fields
,
1
,
0
))
if
(
setup_
tables
(
&
table_list
)
||
setup_
fields
(
thd
,
&
table_list
,
fields
,
1
,
0
))
return
-
1
;
return
-
1
;
if
(
thd
->
dupp_field
)
if
(
thd
->
dupp_field
)
{
{
...
@@ -151,7 +151,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List<Item> &fields,
...
@@ -151,7 +151,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List<Item> &fields,
save_time_stamp
=
table
->
time_stamp
;
save_time_stamp
=
table
->
time_stamp
;
values
=
its
++
;
values
=
its
++
;
if
(
check_insert_fields
(
thd
,
table
,
fields
,
*
values
,
1
)
||
if
(
check_insert_fields
(
thd
,
table
,
fields
,
*
values
,
1
)
||
setup_fields
(
thd
,
table_list
,
*
values
,
0
,
0
))
setup_
tables
(
table_list
)
||
setup_
fields
(
thd
,
table_list
,
*
values
,
0
,
0
))
{
{
table
->
time_stamp
=
save_time_stamp
;
table
->
time_stamp
=
save_time_stamp
;
goto
abort
;
goto
abort
;
...
@@ -168,7 +168,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List<Item> &fields,
...
@@ -168,7 +168,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List<Item> &fields,
table
->
time_stamp
=
save_time_stamp
;
table
->
time_stamp
=
save_time_stamp
;
goto
abort
;
goto
abort
;
}
}
if
(
setup_fields
(
thd
,
table_list
,
*
values
,
0
,
0
))
if
(
setup_
tables
(
table_list
)
||
setup_
fields
(
thd
,
table_list
,
*
values
,
0
,
0
))
{
{
table
->
time_stamp
=
save_time_stamp
;
table
->
time_stamp
=
save_time_stamp
;
goto
abort
;
goto
abort
;
...
...
sql/sql_load.cc
View file @
3c484480
...
@@ -91,7 +91,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
...
@@ -91,7 +91,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
else
else
{
// Part field list
{
// Part field list
thd
->
dupp_field
=
0
;
thd
->
dupp_field
=
0
;
if
(
setup_
fields
(
thd
,
table_list
,
fields
,
1
,
0
)
<
0
)
if
(
setup_
tables
(
table_list
)
||
setup_fields
(
thd
,
table_list
,
fields
,
1
,
0
)
)
DBUG_RETURN
(
-
1
);
DBUG_RETURN
(
-
1
);
if
(
thd
->
dupp_field
)
if
(
thd
->
dupp_field
)
{
{
...
...
sql/sql_parse.cc
View file @
3c484480
...
@@ -455,7 +455,8 @@ check_connections(THD *thd)
...
@@ -455,7 +455,8 @@ check_connections(THD *thd)
db
=
strend
(
passwd
)
+
1
;
db
=
strend
(
passwd
)
+
1
;
if
(
thd
->
client_capabilities
&
CLIENT_INTERACTIVE
)
if
(
thd
->
client_capabilities
&
CLIENT_INTERACTIVE
)
thd
->
inactive_timeout
=
net_interactive_timeout
;
thd
->
inactive_timeout
=
net_interactive_timeout
;
if
(
thd
->
client_capabilities
&
CLIENT_TRANSACTIONS
)
if
((
thd
->
client_capabilities
&
CLIENT_TRANSACTIONS
)
&&
opt_using_transactions
)
thd
->
net
.
return_status
=
&
thd
->
server_status
;
thd
->
net
.
return_status
=
&
thd
->
server_status
;
net
->
timeout
=
net_read_timeout
;
net
->
timeout
=
net_read_timeout
;
if
(
check_user
(
thd
,
COM_CONNECT
,
user
,
passwd
,
db
,
1
))
if
(
check_user
(
thd
,
COM_CONNECT
,
user
,
passwd
,
db
,
1
))
...
...
sql/sql_select.cc
View file @
3c484480
...
@@ -174,7 +174,8 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
...
@@ -174,7 +174,8 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
thd
->
proc_info
=
"init"
;
thd
->
proc_info
=
"init"
;
thd
->
used_tables
=
0
;
// Updated by setup_fields
thd
->
used_tables
=
0
;
// Updated by setup_fields
if
(
setup_fields
(
thd
,
tables
,
fields
,
1
,
&
all_fields
)
||
if
(
setup_tables
(
tables
)
||
setup_fields
(
thd
,
tables
,
fields
,
1
,
&
all_fields
)
||
setup_conds
(
thd
,
tables
,
&
conds
)
||
setup_conds
(
thd
,
tables
,
&
conds
)
||
setup_order
(
thd
,
tables
,
fields
,
all_fields
,
order
)
||
setup_order
(
thd
,
tables
,
fields
,
all_fields
,
order
)
||
setup_group
(
thd
,
tables
,
fields
,
all_fields
,
group
,
&
hidden_group_fields
)
||
setup_group
(
thd
,
tables
,
fields
,
all_fields
,
group
,
&
hidden_group_fields
)
||
...
...
sql/sql_update.cc
View file @
3c484480
...
@@ -70,7 +70,7 @@ int mysql_update(THD *thd,TABLE_LIST *table_list,List<Item> &fields,
...
@@ -70,7 +70,7 @@ int mysql_update(THD *thd,TABLE_LIST *table_list,List<Item> &fields,
table
->
quick_keys
=
0
;
table
->
quick_keys
=
0
;
want_privilege
=
table
->
grant
.
want_privilege
;
want_privilege
=
table
->
grant
.
want_privilege
;
table
->
grant
.
want_privilege
=
(
SELECT_ACL
&
~
table
->
grant
.
privilege
);
table
->
grant
.
want_privilege
=
(
SELECT_ACL
&
~
table
->
grant
.
privilege
);
if
(
setup_conds
(
thd
,
table_list
,
&
conds
))
if
(
setup_
tables
(
table_list
)
||
setup_
conds
(
thd
,
table_list
,
&
conds
))
DBUG_RETURN
(
-
1
);
/* purecov: inspected */
DBUG_RETURN
(
-
1
);
/* purecov: inspected */
old_used_keys
=
table
->
used_keys
;
// Keys used in WHERE
old_used_keys
=
table
->
used_keys
;
// Keys used in WHERE
...
...
sql/sql_yacc.yy
View file @
3c484480
...
@@ -2785,7 +2785,7 @@ set_isolation:
...
@@ -2785,7 +2785,7 @@ set_isolation:
default_tx_isolation= $2;
default_tx_isolation= $2;
}
}
| SESSION_SYM tx_isolation
| SESSION_SYM tx_isolation
{ current_thd->session_tx_isolation= $2; }
{ current_thd->session_tx_isolation=
Lex->tx_isolation=
$2; }
| tx_isolation
| tx_isolation
{ Lex->tx_isolation= $1; }
{ Lex->tx_isolation= $1; }
...
...
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