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
e4bb8377
Commit
e4bb8377
authored
Jun 29, 2005
by
monty@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simple optimization
nsure that delete works not only on table->record[0] for federated tables
parent
3dd28e98
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
22 deletions
+21
-22
sql/field.cc
sql/field.cc
+6
-1
sql/ha_federated.cc
sql/ha_federated.cc
+10
-14
sql/opt_range.cc
sql/opt_range.cc
+5
-7
No files found.
sql/field.cc
View file @
e4bb8377
...
...
@@ -6822,7 +6822,12 @@ int Field_blob::store(const char *from,uint length,CHARSET_INFO *cs)
&
not_used
)))
{
uint
conv_errors
;
tmpstr
.
copy
(
from
,
length
,
cs
,
field_charset
,
&
conv_errors
);
if
(
tmpstr
.
copy
(
from
,
length
,
cs
,
field_charset
,
&
conv_errors
))
{
/* Fatal OOM error */
bzero
(
ptr
,
Field_blob
::
pack_length
());
return
-
1
;
}
from
=
tmpstr
.
ptr
();
length
=
tmpstr
.
length
();
if
(
conv_errors
)
...
...
sql/ha_federated.cc
View file @
e4bb8377
...
...
@@ -1399,27 +1399,25 @@ int ha_federated::update_row(const byte *old_data, byte *new_data)
int
ha_federated
::
delete_row
(
const
byte
*
buf
)
{
uint
x
=
0
;
char
delete_buffer
[
IO_SIZE
];
char
data_buffer
[
IO_SIZE
];
String
delete_string
(
delete_buffer
,
sizeof
(
delete_buffer
),
&
my_charset_bin
);
delete_string
.
length
(
0
);
String
data_string
(
data_buffer
,
sizeof
(
data_buffer
),
&
my_charset_bin
);
data_string
.
length
(
0
);
DBUG_ENTER
(
"ha_federated::delete_row"
);
delete_string
.
length
(
0
);
delete_string
.
append
(
"DELETE FROM `"
);
delete_string
.
append
(
share
->
table_base_name
);
delete_string
.
append
(
"`"
);
delete_string
.
append
(
" WHERE "
);
for
(
Field
**
field
=
table
->
field
;
*
field
;
field
++
,
x
++
)
for
(
Field
**
field
=
table
->
field
;
*
field
;
field
++
)
{
delete_string
.
append
((
*
field
)
->
field_name
);
Field
*
cur_field
=
*
field
;
data_string
.
length
(
0
);
delete_string
.
append
(
cur_field
->
field_name
);
if
(
(
*
field
)
->
is_null
(
))
if
(
cur_field
->
is_null_in_record
((
const
uchar
*
)
buf
))
{
delete_string
.
append
(
" IS "
);
data_string
.
append
(
"NULL"
);
...
...
@@ -1427,17 +1425,15 @@ int ha_federated::delete_row(const byte *buf)
else
{
delete_string
.
append
(
"="
);
(
*
field
)
->
val_str
(
&
data_string
);
(
*
field
)
->
quote_data
(
&
data_string
);
cur_field
->
val_str
(
&
data_string
,
(
char
*
)
buf
+
cur_field
->
offset
()
);
cur_field
->
quote_data
(
&
data_string
);
}
delete_string
.
append
(
data_string
);
data_string
.
length
(
0
);
if
(
x
+
1
<
table
->
s
->
fields
)
delete_string
.
append
(
" AND "
);
}
delete_string
.
length
(
delete_string
.
length
()
-
5
);
// Remove AND
delete_string
.
append
(
" LIMIT 1"
);
DBUG_PRINT
(
"info"
,
(
"Delete sql: %s"
,
delete_string
.
c_ptr_quick
()));
...
...
sql/opt_range.cc
View file @
e4bb8377
...
...
@@ -8556,23 +8556,21 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_max_in_range()
if
((
result
==
HA_ERR_KEY_NOT_FOUND
)
&&
(
cur_range
->
flag
&
EQ_RANGE
))
continue
;
/* Check the next range. */
else
if
(
result
)
if
(
result
)
{
/*
In no key was found with this upper bound, there certainly are no keys
in the ranges to the left.
*/
return
result
;
}
/* A key was found. */
if
(
cur_range
->
flag
&
EQ_RANGE
)
return
result
;
/* No need to perform the checks below for equal keys. */
return
0
;
/* No need to perform the checks below for equal keys. */
/* Check if record belongs to the current group. */
if
(
key_cmp
(
index_info
->
key_part
,
group_prefix
,
real_prefix_len
))
{
result
=
HA_ERR_KEY_NOT_FOUND
;
continue
;
}
continue
;
// Row not found
/* If there is a lower limit, check if the found key is in the range. */
if
(
!
(
cur_range
->
flag
&
NO_MIN_RANGE
)
)
...
...
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