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
5f8f947f
Commit
5f8f947f
authored
May 25, 2005
by
monty@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup's during review
Added ASSERT() to detect wrongly packed fields
parent
8832f3e1
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
41 additions
and
40 deletions
+41
-40
sql/field.h
sql/field.h
+6
-4
sql/opt_range.cc
sql/opt_range.cc
+19
-21
sql/sql_base.cc
sql/sql_base.cc
+2
-2
sql/sql_insert.cc
sql/sql_insert.cc
+4
-3
sql/sql_select.cc
sql/sql_select.cc
+4
-7
sql/unireg.cc
sql/unireg.cc
+6
-3
No files found.
sql/field.h
View file @
5f8f947f
...
...
@@ -439,10 +439,12 @@ class Field_new_decimal :public Field_num {
/* The maximum number of decimal digits can be stored */
uint
precision
;
uint
bin_size
;
/* Constructors take max_length of the field as a parameter - not the */
/* precision as the number of decimal digits allowed */
/* So for example we need to count length from precision handling */
/* CREATE TABLE ( DECIMAL(x,y)) */
/*
Constructors take max_length of the field as a parameter - not the
precision as the number of decimal digits allowed.
So for example we need to count length from precision handling
CREATE TABLE ( DECIMAL(x,y))
*/
Field_new_decimal
(
char
*
ptr_arg
,
uint32
len_arg
,
uchar
*
null_ptr_arg
,
uchar
null_bit_arg
,
enum
utype
unireg_check_arg
,
const
char
*
field_name_arg
,
...
...
sql/opt_range.cc
View file @
5f8f947f
...
...
@@ -3307,32 +3307,35 @@ QUICK_SELECT_I *TRP_ROR_UNION::make_quick(PARAM *param,
/*
Build a SEL_TREE for <> predicate
Build a SEL_TREE for <>
or NOT BETWEEN
predicate
SYNOPSIS
get_ne_mm_tree()
param PARAM from SQL_SELECT::test_quick_select
cond_func item for the predicate
field field in the predicate
value constant in the predicate
lt_value constant that field should be smaller
gt_value constant that field should be greaterr
cmp_type compare type for the field
RETURN
Pointer to tree built tree
# Pointer to tree built tree
0 on error
*/
static
SEL_TREE
*
get_ne_mm_tree
(
PARAM
*
param
,
Item_func
*
cond_func
,
Field
*
field
,
Item
*
value
,
Field
*
field
,
Item
*
lt_value
,
Item
*
gt_value
,
Item_result
cmp_type
)
{
SEL_TREE
*
tree
=
0
;
SEL_TREE
*
tree
;
tree
=
get_mm_parts
(
param
,
cond_func
,
field
,
Item_func
::
LT_FUNC
,
value
,
cmp_type
);
lt_
value
,
cmp_type
);
if
(
tree
)
{
tree
=
tree_or
(
param
,
tree
,
get_mm_parts
(
param
,
cond_func
,
field
,
Item_func
::
GT_FUNC
,
value
,
cmp_type
));
gt_
value
,
cmp_type
));
}
return
tree
;
}
...
...
@@ -3365,21 +3368,14 @@ static SEL_TREE *get_func_mm_tree(PARAM *param, Item_func *cond_func,
switch
(
cond_func
->
functype
())
{
case
Item_func
:
:
NE_FUNC
:
tree
=
get_ne_mm_tree
(
param
,
cond_func
,
field
,
value
,
cmp_type
);
tree
=
get_ne_mm_tree
(
param
,
cond_func
,
field
,
value
,
value
,
cmp_type
);
break
;
case
Item_func
:
:
BETWEEN
:
if
(
inv
)
{
tree
=
get_mm_parts
(
param
,
cond_func
,
field
,
Item_func
::
LT_FUNC
,
cond_func
->
arguments
()[
1
],
cmp_type
);
if
(
tree
)
{
tree
=
tree_or
(
param
,
tree
,
get_mm_parts
(
param
,
cond_func
,
field
,
Item_func
::
GT_FUNC
,
cond_func
->
arguments
()[
2
],
cmp_type
));
}
tree
=
get_ne_mm_tree
(
param
,
cond_func
,
field
,
cond_func
->
arguments
()[
1
],
cond_func
->
arguments
()[
2
],
cmp_type
);
}
else
{
...
...
@@ -3402,7 +3398,8 @@ static SEL_TREE *get_func_mm_tree(PARAM *param, Item_func *cond_func,
if
(
inv
)
{
tree
=
get_ne_mm_tree
(
param
,
cond_func
,
field
,
func
->
arguments
()[
1
],
cmp_type
);
func
->
arguments
()[
1
],
func
->
arguments
()[
1
],
cmp_type
);
if
(
tree
)
{
Item
**
arg
,
**
end
;
...
...
@@ -3410,7 +3407,7 @@ static SEL_TREE *get_func_mm_tree(PARAM *param, Item_func *cond_func,
arg
<
end
;
arg
++
)
{
tree
=
tree_and
(
param
,
tree
,
get_ne_mm_tree
(
param
,
cond_func
,
field
,
*
arg
,
cmp_type
));
*
arg
,
*
arg
,
cmp_type
));
}
}
}
...
...
@@ -3523,17 +3520,18 @@ static SEL_TREE *get_mm_tree(PARAM *param,COND *cond)
Item_func
*
cond_func
=
(
Item_func
*
)
cond
;
if
(
cond_func
->
functype
()
==
Item_func
::
NOT_FUNC
)
{
/* Optimize NOT BETWEEN and NOT IN */
Item
*
arg
=
cond_func
->
arguments
()[
0
];
if
(
arg
->
type
()
==
Item
::
FUNC_ITEM
)
{
cond_func
=
(
Item_func
*
)
arg
;
if
(
cond_func
->
select_optimize
()
==
Item_func
::
OPTIMIZE_NONE
)
DBUG_RETURN
(
0
);
inv
=
TRUE
;
inv
=
TRUE
;
}
else
DBUG_RETURN
(
0
);
}
}
else
if
(
cond_func
->
select_optimize
()
==
Item_func
::
OPTIMIZE_NONE
)
DBUG_RETURN
(
0
);
...
...
sql/sql_base.cc
View file @
5f8f947f
...
...
@@ -1607,9 +1607,9 @@ static int open_unireg_entry(THD *thd, TABLE *entry, const char *db,
trying to discover the table at the same time.
*/
if
(
discover_retry_count
++
!=
0
)
goto
err
;
goto
err
;
if
(
ha_create_table_from_engine
(
thd
,
db
,
name
,
TRUE
)
!=
0
)
goto
err
;
goto
err
;
mysql_reset_errors
(
thd
,
1
);
// Clear warnings
thd
->
clear_error
();
// Clear error message
...
...
sql/sql_insert.cc
View file @
5f8f947f
...
...
@@ -872,9 +872,10 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
if
(
info
->
handle_duplicates
==
DUP_UPDATE
)
{
int
res
=
0
;
/* we don't check for other UNIQUE keys - the first row
that matches, is updated. If update causes a conflict again,
an error is returned
/*
We don't check for other UNIQUE keys - the first row
that matches, is updated. If update causes a conflict again,
an error is returned
*/
DBUG_ASSERT
(
table
->
insert_values
!=
NULL
);
store_record
(
table
,
insert_values
);
...
...
sql/sql_select.cc
View file @
5f8f947f
...
...
@@ -2825,17 +2825,14 @@ add_key_fields(KEY_FIELD **key_fields,uint *and_level,
if
(
cond_func
->
functype
()
==
Item_func
::
NOT_FUNC
)
{
Item
*
item
=
cond_func
->
arguments
()[
0
];
/*
At this moment all NOT before simple comparison predicates
are eliminated. NOT IN and NOT BETWEEN are treated similar
IN and BETWEEN respectively.
/*
At this moment all NOT before simple comparison predicates
are eliminated. NOT IN and NOT BETWEEN are treated similar
IN and BETWEEN respectively.
*/
if
(
item
->
type
()
==
Item
::
FUNC_ITEM
&&
((
Item_func
*
)
item
)
->
select_optimize
()
==
Item_func
::
OPTIMIZE_KEY
)
{
add_key_fields
(
key_fields
,
and_level
,
item
,
usable_tables
);
return
;
}
return
;
}
switch
(
cond_func
->
select_optimize
())
{
...
...
sql/unireg.cc
View file @
5f8f947f
...
...
@@ -73,6 +73,7 @@ bool mysql_create_frm(THD *thd, my_string file_name,
handler
*
db_file
)
{
uint
reclength
,
info_length
,
screens
,
key_info_length
,
maxlength
;
ulong
key_buff_length
;
File
file
;
ulong
filepos
,
data_offset
;
uchar
fileinfo
[
64
],
forminfo
[
288
],
*
keybuff
;
...
...
@@ -119,7 +120,7 @@ bool mysql_create_frm(THD *thd, my_string file_name,
DBUG_RETURN
(
1
);
}
uint
key_buff_length
=
keys
*
(
7
+
NAME_LEN
+
MAX_REF_PARTS
*
9
)
+
16
;
key_buff_length
=
uint4korr
(
fileinfo
+
47
)
;
keybuff
=
(
uchar
*
)
my_malloc
(
key_buff_length
,
MYF
(
0
));
key_info_length
=
pack_keys
(
keybuff
,
keys
,
key_info
,
data_offset
);
VOID
(
get_form_pos
(
file
,
fileinfo
,
&
formnames
));
...
...
@@ -128,7 +129,6 @@ bool mysql_create_frm(THD *thd, my_string file_name,
maxlength
=
(
uint
)
next_io_size
((
ulong
)
(
uint2korr
(
forminfo
)
+
1000
));
int2store
(
forminfo
+
2
,
maxlength
);
int4store
(
fileinfo
+
10
,(
ulong
)
(
filepos
+
maxlength
));
int4store
(
fileinfo
+
47
,
key_buff_length
);
fileinfo
[
26
]
=
(
uchar
)
test
((
create_info
->
max_rows
==
1
)
&&
(
create_info
->
min_rows
==
1
)
&&
(
keys
==
0
));
int2store
(
fileinfo
+
28
,
key_info_length
);
...
...
@@ -411,7 +411,8 @@ static bool pack_header(uchar *forminfo, enum db_type table_type,
DBUG_RETURN
(
1
);
}
totlength
=
reclength
=
0L
;
totlength
=
0L
;
reclength
=
data_offset
;
no_empty
=
int_count
=
int_parts
=
int_length
=
time_stamp_pos
=
null_fields
=
com_length
=
0
;
n_length
=
2L
;
...
...
@@ -440,6 +441,8 @@ static bool pack_header(uchar *forminfo, enum db_type table_type,
!
time_stamp_pos
)
time_stamp_pos
=
(
uint
)
field
->
offset
+
(
uint
)
data_offset
+
1
;
length
=
field
->
pack_length
;
/* Ensure we don't have any bugs when generating offsets */
DBUG_ASSERT
(
reclength
==
field
->
offset
+
data_offset
);
if
((
uint
)
field
->
offset
+
(
uint
)
data_offset
+
length
>
reclength
)
reclength
=
(
uint
)
(
field
->
offset
+
data_offset
+
length
);
n_length
+=
(
ulong
)
strlen
(
field
->
field_name
)
+
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