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
4175461c
Commit
4175461c
authored
Oct 17, 2002
by
Sinisa@sinisa.nasamreza.org
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Small code improvement in multi-table updates
parent
562b1718
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
9 deletions
+11
-9
Docs/manual.texi
Docs/manual.texi
+2
-0
sql/sql_update.cc
sql/sql_update.cc
+9
-9
No files found.
Docs/manual.texi
View file @
4175461c
...
@@ -50815,6 +50815,8 @@ each individual 4.0.x release.
...
@@ -50815,6 +50815,8 @@ each individual 4.0.x release.
@appendixsubsec Changes in release 4.0.5
@appendixsubsec Changes in release 4.0.5
@itemize
@itemize
@item
@item
Small code improvement in multi-table updates
@item
Fixed a newly introduced bug that caused @code{ORDER BY ... LIMIT #}
Fixed a newly introduced bug that caused @code{ORDER BY ... LIMIT #}
to not return all rows.
to not return all rows.
@item
@item
sql/sql_update.cc
View file @
4175461c
...
@@ -444,7 +444,7 @@ multi_update::prepare(List<Item> &values)
...
@@ -444,7 +444,7 @@ multi_update::prepare(List<Item> &values)
else
else
*
int_ptr
++=
counter
;
*
int_ptr
++=
counter
;
}
}
if
(
!
num_updated
)
if
(
!
num_updated
--
)
{
{
net_printf
(
&
thd
->
net
,
ER_NOT_SUPPORTED_YET
,
"SET CLAUSE MUST CONTAIN TABLE.FIELD REFERENCE"
);
net_printf
(
&
thd
->
net
,
ER_NOT_SUPPORTED_YET
,
"SET CLAUSE MUST CONTAIN TABLE.FIELD REFERENCE"
);
DBUG_RETURN
(
1
);
DBUG_RETURN
(
1
);
...
@@ -454,11 +454,11 @@ multi_update::prepare(List<Item> &values)
...
@@ -454,11 +454,11 @@ multi_update::prepare(List<Item> &values)
Here, I have to allocate the array of temporary tables
Here, I have to allocate the array of temporary tables
I have to treat a case of num_updated=1 differently in send_data() method.
I have to treat a case of num_updated=1 differently in send_data() method.
*/
*/
if
(
num_updated
>
1
)
if
(
num_updated
)
{
{
tmp_tables
=
(
TABLE
**
)
sql_calloc
(
sizeof
(
TABLE
*
)
*
(
num_updated
-
1
)
);
tmp_tables
=
(
TABLE
**
)
sql_calloc
(
sizeof
(
TABLE
*
)
*
num_updated
);
infos
=
(
COPY_INFO
*
)
sql_calloc
(
sizeof
(
COPY_INFO
)
*
(
num_updated
-
1
)
);
infos
=
(
COPY_INFO
*
)
sql_calloc
(
sizeof
(
COPY_INFO
)
*
num_updated
);
fields_by_tables
=
(
List_item
**
)
sql_calloc
(
sizeof
(
List_item
*
)
*
num_updated
);
fields_by_tables
=
(
List_item
**
)
sql_calloc
(
sizeof
(
List_item
*
)
*
(
num_updated
+
1
)
);
unsigned
int
counter
;
unsigned
int
counter
;
List
<
Item
>
*
temp_fields
;
List
<
Item
>
*
temp_fields
;
for
(
table_ref
=
update_tables
,
counter
=
0
;
table_ref
;
table_ref
=
table_ref
->
next
)
for
(
table_ref
=
update_tables
,
counter
=
0
;
table_ref
;
table_ref
=
table_ref
->
next
)
...
@@ -551,7 +551,7 @@ multi_update::~multi_update()
...
@@ -551,7 +551,7 @@ multi_update::~multi_update()
table
->
time_stamp
=
save_time_stamps
[
counter
];
table
->
time_stamp
=
save_time_stamps
[
counter
];
}
}
if
(
tmp_tables
)
if
(
tmp_tables
)
for
(
uint
counter
=
0
;
counter
<
num_updated
-
1
;
counter
++
)
for
(
uint
counter
=
0
;
counter
<
num_updated
;
counter
++
)
if
(
tmp_tables
[
counter
])
if
(
tmp_tables
[
counter
])
free_tmp_table
(
thd
,
tmp_tables
[
counter
]);
free_tmp_table
(
thd
,
tmp_tables
[
counter
]);
}
}
...
@@ -563,7 +563,7 @@ bool multi_update::send_data(List<Item> &values)
...
@@ -563,7 +563,7 @@ bool multi_update::send_data(List<Item> &values)
for
(
uint
counter
=
0
;
counter
<
fields
.
elements
;
counter
++
)
for
(
uint
counter
=
0
;
counter
<
fields
.
elements
;
counter
++
)
real_values
.
pop
();
real_values
.
pop
();
// We have skipped fields ....
// We have skipped fields ....
if
(
num_updated
==
1
)
if
(
!
num_updated
)
{
{
for
(
table_being_updated
=
update_tables
;
for
(
table_being_updated
=
update_tables
;
table_being_updated
;
table_being_updated
;
...
@@ -681,7 +681,7 @@ void multi_update::send_error(uint errcode,const char *err)
...
@@ -681,7 +681,7 @@ void multi_update::send_error(uint errcode,const char *err)
if
((
table_being_updated
->
table
->
file
->
has_transactions
()
&&
if
((
table_being_updated
->
table
->
file
->
has_transactions
()
&&
table_being_updated
==
update_tables
)
||
!
not_trans_safe
)
table_being_updated
==
update_tables
)
||
!
not_trans_safe
)
ha_rollback_stmt
(
thd
);
ha_rollback_stmt
(
thd
);
else
if
(
do_update
&&
num_updated
>
1
)
else
if
(
do_update
&&
num_updated
)
VOID
(
do_updates
(
true
));
VOID
(
do_updates
(
true
));
}
}
...
@@ -768,7 +768,7 @@ bool multi_update::send_eof()
...
@@ -768,7 +768,7 @@ bool multi_update::send_eof()
thd
->
proc_info
=
"updating the reference tables"
;
thd
->
proc_info
=
"updating the reference tables"
;
/* Does updates for the last n - 1 tables, returns 0 if ok */
/* Does updates for the last n - 1 tables, returns 0 if ok */
int
error
=
(
num_updated
>
1
)
?
do_updates
(
false
)
:
0
;
/* do_updates returns 0 if success */
int
error
=
(
num_updated
)
?
do_updates
(
false
)
:
0
;
/* do_updates returns 0 if success */
/* reset used flags */
/* reset used flags */
#ifndef NOT_USED
#ifndef NOT_USED
...
...
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