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
5ef8ccba
Commit
5ef8ccba
authored
Oct 16, 2002
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge work:/home/bk/mysql into hundin.mysql.fi:/my/bk/mysql
parents
5803bb2f
39a84b79
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
80 additions
and
23 deletions
+80
-23
Docs/manual.texi
Docs/manual.texi
+2
-0
sql/field.h
sql/field.h
+1
-0
sql/field_conv.cc
sql/field_conv.cc
+36
-19
sql/item.cc
sql/item.cc
+38
-4
sql/item.h
sql/item.h
+3
-0
No files found.
Docs/manual.texi
View file @
5ef8ccba
...
@@ -46942,6 +46942,8 @@ temporary tables used for some (unlikely) @code{GROUP BY} queries.
...
@@ -46942,6 +46942,8 @@ temporary tables used for some (unlikely) @code{GROUP BY} queries.
Fixed a bug in key optimizing handling where the expression
Fixed a bug in key optimizing handling where the expression
@code{WHERE column_name = key_column_name} was calculated as true
@code{WHERE column_name = key_column_name} was calculated as true
for @code{NULL} values.
for @code{NULL} values.
@item
Fixed core dump bug when doing @code{LEFT JOIN ... WHERE key_column=NULL}.
@end itemize
@end itemize
@node News-3.23.53, News-3.23.52, News-3.23.54, News-3.23.x
@node News-3.23.53, News-3.23.52, News-3.23.54, News-3.23.x
sql/field.h
View file @
5ef8ccba
...
@@ -1043,6 +1043,7 @@ Field *make_field(char *ptr, uint32 field_length,
...
@@ -1043,6 +1043,7 @@ Field *make_field(char *ptr, uint32 field_length,
uint
pack_length_to_packflag
(
uint
type
);
uint
pack_length_to_packflag
(
uint
type
);
uint32
calc_pack_length
(
enum_field_types
type
,
uint32
length
);
uint32
calc_pack_length
(
enum_field_types
type
,
uint32
length
);
bool
set_field_to_null
(
Field
*
field
);
bool
set_field_to_null
(
Field
*
field
);
bool
set_field_to_null_with_conversions
(
Field
*
field
);
uint
find_enum
(
TYPELIB
*
typelib
,
const
char
*
x
,
uint
length
);
uint
find_enum
(
TYPELIB
*
typelib
,
const
char
*
x
,
uint
length
);
ulonglong
find_set
(
TYPELIB
*
typelib
,
const
char
*
x
,
uint
length
);
ulonglong
find_set
(
TYPELIB
*
typelib
,
const
char
*
x
,
uint
length
);
bool
test_if_int
(
const
char
*
str
,
int
length
);
bool
test_if_int
(
const
char
*
str
,
int
length
);
...
...
sql/field_conv.cc
View file @
5ef8ccba
...
@@ -112,35 +112,52 @@ static void do_outer_field_to_null_str(Copy_field *copy)
...
@@ -112,35 +112,52 @@ static void do_outer_field_to_null_str(Copy_field *copy)
bool
bool
set_field_to_null
(
Field
*
field
)
set_field_to_null
(
Field
*
field
)
{
{
if
(
field
->
maybe_null
())
if
(
field
->
real_
maybe_null
())
{
{
field
->
set_null
();
field
->
set_null
();
field
->
reset
();
field
->
reset
();
return
0
;
}
}
else
return
1
;
}
bool
set_field_to_null_with_conversions
(
Field
*
field
)
{
if
(
field
->
real_maybe_null
())
{
{
if
(
field
->
type
()
==
FIELD_TYPE_TIMESTAMP
)
field
->
set_null
();
{
((
Field_timestamp
*
)
field
)
->
set_time
();
return
0
;
// Ok to set time to NULL
}
field
->
reset
();
field
->
reset
();
if
(
field
==
field
->
table
->
next_number_field
)
return
0
;
return
0
;
// field is set in handler.cc
}
if
(
current_thd
->
count_cuted_fields
)
{
/*
current_thd
->
cuted_fields
++
;
// Increment error counter
Check if this is a special type, which will get a special walue
return
0
;
when set to NULL
}
*/
if
(
!
current_thd
->
no_errors
)
if
(
field
->
type
()
==
FIELD_TYPE_TIMESTAMP
)
my_printf_error
(
ER_BAD_NULL_ERROR
,
ER
(
ER_BAD_NULL_ERROR
),
MYF
(
0
),
{
field
->
field_name
);
((
Field_timestamp
*
)
field
)
->
set_time
();
return
1
;
return
0
;
// Ok to set time to NULL
}
field
->
reset
();
if
(
field
==
field
->
table
->
next_number_field
)
return
0
;
// field is set in handler.cc
if
(
current_thd
->
count_cuted_fields
)
{
current_thd
->
cuted_fields
++
;
// Increment error counter
return
0
;
}
}
return
0
;
if
(
!
current_thd
->
no_errors
)
my_printf_error
(
ER_BAD_NULL_ERROR
,
ER
(
ER_BAD_NULL_ERROR
),
MYF
(
0
),
field
->
field_name
);
return
1
;
}
}
static
void
do_skip
(
Copy_field
*
copy
__attribute__
((
unused
)))
static
void
do_skip
(
Copy_field
*
copy
__attribute__
((
unused
)))
{
{
}
}
...
...
sql/item.cc
View file @
5ef8ccba
...
@@ -383,7 +383,7 @@ void Item_field::save_org_in_field(Field *to)
...
@@ -383,7 +383,7 @@ void Item_field::save_org_in_field(Field *to)
if
(
field
->
is_null
())
if
(
field
->
is_null
())
{
{
null_value
=
1
;
null_value
=
1
;
set_field_to_null
(
to
);
set_field_to_null
_with_conversions
(
to
);
}
}
else
else
{
{
...
@@ -398,7 +398,7 @@ bool Item_field::save_in_field(Field *to)
...
@@ -398,7 +398,7 @@ bool Item_field::save_in_field(Field *to)
if
(
result_field
->
is_null
())
if
(
result_field
->
is_null
())
{
{
null_value
=
1
;
null_value
=
1
;
return
set_field_to_null
(
to
);
return
set_field_to_null
_with_conversions
(
to
);
}
}
else
else
{
{
...
@@ -409,8 +409,41 @@ bool Item_field::save_in_field(Field *to)
...
@@ -409,8 +409,41 @@ bool Item_field::save_in_field(Field *to)
return
0
;
return
0
;
}
}
/*
Store null in field
SYNOPSIS
save_in_field()
field Field where we want to store NULL
DESCRIPTION
This is used on INSERT.
Allow NULL to be inserted in timestamp and auto_increment values
RETURN VALUES
0 ok
1 Field doesn't support NULL values and can't handle 'field = NULL'
*/
bool
Item_null
::
save_in_field
(
Field
*
field
)
bool
Item_null
::
save_in_field
(
Field
*
field
)
{
return
set_field_to_null_with_conversions
(
field
);
}
/*
Store null in field
SYNOPSIS
save_safe_in_field()
field Field where we want to store NULL
RETURN VALUES
0 ok
1 Field doesn't support NULL values
*/
bool
Item_null
::
save_safe_in_field
(
Field
*
field
)
{
{
return
set_field_to_null
(
field
);
return
set_field_to_null
(
field
);
}
}
...
@@ -427,7 +460,7 @@ bool Item::save_in_field(Field *field)
...
@@ -427,7 +460,7 @@ bool Item::save_in_field(Field *field)
str_value
.
set_quick
(
buff
,
sizeof
(
buff
));
str_value
.
set_quick
(
buff
,
sizeof
(
buff
));
result
=
val_str
(
&
str_value
);
result
=
val_str
(
&
str_value
);
if
(
null_value
)
if
(
null_value
)
return
set_field_to_null
(
field
);
return
set_field_to_null
_with_conversions
(
field
);
field
->
set_notnull
();
field
->
set_notnull
();
field
->
store
(
result
->
ptr
(),
result
->
length
());
field
->
store
(
result
->
ptr
(),
result
->
length
());
str_value
.
set_quick
(
0
,
0
);
str_value
.
set_quick
(
0
,
0
);
...
@@ -444,13 +477,14 @@ bool Item::save_in_field(Field *field)
...
@@ -444,13 +477,14 @@ bool Item::save_in_field(Field *field)
{
{
longlong
nr
=
val_int
();
longlong
nr
=
val_int
();
if
(
null_value
)
if
(
null_value
)
return
set_field_to_null
(
field
);
return
set_field_to_null
_with_conversions
(
field
);
field
->
set_notnull
();
field
->
set_notnull
();
field
->
store
(
nr
);
field
->
store
(
nr
);
}
}
return
0
;
return
0
;
}
}
bool
Item_string
::
save_in_field
(
Field
*
field
)
bool
Item_string
::
save_in_field
(
Field
*
field
)
{
{
String
*
result
;
String
*
result
;
...
...
sql/item.h
View file @
5ef8ccba
...
@@ -55,6 +55,8 @@ class Item {
...
@@ -55,6 +55,8 @@ class Item {
virtual
bool
save_in_field
(
Field
*
field
);
virtual
bool
save_in_field
(
Field
*
field
);
virtual
void
save_org_in_field
(
Field
*
field
)
virtual
void
save_org_in_field
(
Field
*
field
)
{
(
void
)
save_in_field
(
field
);
}
{
(
void
)
save_in_field
(
field
);
}
virtual
bool
save_safe_in_field
(
Field
*
field
)
{
return
save_in_field
(
field
);
}
virtual
bool
send
(
String
*
str
);
virtual
bool
send
(
String
*
str
);
virtual
bool
eq
(
const
Item
*
,
bool
binary_cmp
)
const
;
virtual
bool
eq
(
const
Item
*
,
bool
binary_cmp
)
const
;
virtual
Item_result
result_type
()
const
{
return
REAL_RESULT
;
}
virtual
Item_result
result_type
()
const
{
return
REAL_RESULT
;
}
...
@@ -144,6 +146,7 @@ class Item_null :public Item
...
@@ -144,6 +146,7 @@ class Item_null :public Item
String
*
val_str
(
String
*
str
);
String
*
val_str
(
String
*
str
);
void
make_field
(
Send_field
*
field
);
void
make_field
(
Send_field
*
field
);
bool
save_in_field
(
Field
*
field
);
bool
save_in_field
(
Field
*
field
);
bool
save_safe_in_field
(
Field
*
field
);
enum
Item_result
result_type
()
const
enum
Item_result
result_type
()
const
{
return
STRING_RESULT
;
}
{
return
STRING_RESULT
;
}
bool
send
(
String
*
str
);
bool
send
(
String
*
str
);
...
...
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