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
f3e6405f
Commit
f3e6405f
authored
Sep 25, 2004
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
postreview fixes (BUG#5618 & BUG#5590)
parent
f11bcefa
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
46 deletions
+54
-46
sql/field.cc
sql/field.cc
+41
-22
sql/item.cc
sql/item.cc
+12
-23
sql/sql_derived.cc
sql/sql_derived.cc
+1
-1
No files found.
sql/field.cc
View file @
f3e6405f
...
@@ -172,42 +172,51 @@ static bool test_if_real(const char *str,int length, CHARSET_INFO *cs)
...
@@ -172,42 +172,51 @@ static bool test_if_real(const char *str,int length, CHARSET_INFO *cs)
FIELD_CAST_STOP
FIELD_CAST_STOP
*/
*/
static
Field
::
field_cast_enum
field_cast_decimal
[]
=
static
Field
::
field_cast_enum
field_cast_decimal
[]
=
{
Field
::
FIELD_CAST_STRING
,
Field
::
FIELD_CAST_VARSTRING
,
{
Field
::
FIELD_CAST_DECIMAL
,
Field
::
FIELD_CAST_STRING
,
Field
::
FIELD_CAST_VARSTRING
,
Field
::
FIELD_CAST_BLOB
,
Field
::
FIELD_CAST_STOP
};
Field
::
FIELD_CAST_BLOB
,
Field
::
FIELD_CAST_STOP
};
static
Field
::
field_cast_enum
field_cast_tiny
[]
=
static
Field
::
field_cast_enum
field_cast_tiny
[]
=
{
Field
::
FIELD_CAST_SHORT
,
Field
::
FIELD_CAST_MEDIUM
,
Field
::
FIELD_CAST_LONG
,
{
Field
::
FIELD_CAST_TINY
,
Field
::
FIELD_CAST_SHORT
,
Field
::
FIELD_CAST_MEDIUM
,
Field
::
FIELD_CAST_LONG
,
Field
::
FIELD_CAST_LONGLONG
,
Field
::
FIELD_CAST_LONGLONG
,
Field
::
FIELD_CAST_FLOAT
,
Field
::
FIELD_CAST_DOUBLE
,
Field
::
FIELD_CAST_FLOAT
,
Field
::
FIELD_CAST_DOUBLE
,
Field
::
FIELD_CAST_STRING
,
Field
::
FIELD_CAST_VARSTRING
,
Field
::
FIELD_CAST_STRING
,
Field
::
FIELD_CAST_VARSTRING
,
Field
::
FIELD_CAST_BLOB
,
Field
::
FIELD_CAST_STOP
};
Field
::
FIELD_CAST_BLOB
,
Field
::
FIELD_CAST_STOP
};
static
Field
::
field_cast_enum
field_cast_short
[]
=
static
Field
::
field_cast_enum
field_cast_short
[]
=
{
Field
::
FIELD_CAST_MEDIUM
,
Field
::
FIELD_CAST_LONG
,
Field
::
FIELD_CAST_LONGLONG
,
{
Field
::
FIELD_CAST_SHORT
,
Field
::
FIELD_CAST_MEDIUM
,
Field
::
FIELD_CAST_LONG
,
Field
::
FIELD_CAST_LONGLONG
,
Field
::
FIELD_CAST_FLOAT
,
Field
::
FIELD_CAST_DOUBLE
,
Field
::
FIELD_CAST_FLOAT
,
Field
::
FIELD_CAST_DOUBLE
,
Field
::
FIELD_CAST_STRING
,
Field
::
FIELD_CAST_VARSTRING
,
Field
::
FIELD_CAST_STRING
,
Field
::
FIELD_CAST_VARSTRING
,
Field
::
FIELD_CAST_BLOB
,
Field
::
FIELD_CAST_STOP
};
Field
::
FIELD_CAST_BLOB
,
Field
::
FIELD_CAST_STOP
};
static
Field
::
field_cast_enum
field_cast_medium
[]
=
static
Field
::
field_cast_enum
field_cast_medium
[]
=
{
Field
::
FIELD_CAST_LONG
,
Field
::
FIELD_CAST_LONGLONG
,
{
Field
::
FIELD_CAST_MEDIUM
,
Field
::
FIELD_CAST_LONG
,
Field
::
FIELD_CAST_LONGLONG
,
Field
::
FIELD_CAST_DOUBLE
,
Field
::
FIELD_CAST_DOUBLE
,
Field
::
FIELD_CAST_STRING
,
Field
::
FIELD_CAST_VARSTRING
,
Field
::
FIELD_CAST_STRING
,
Field
::
FIELD_CAST_VARSTRING
,
Field
::
FIELD_CAST_BLOB
,
Field
::
FIELD_CAST_STOP
};
Field
::
FIELD_CAST_BLOB
,
Field
::
FIELD_CAST_STOP
};
static
Field
::
field_cast_enum
field_cast_long
[]
=
static
Field
::
field_cast_enum
field_cast_long
[]
=
{
Field
::
FIELD_CAST_LONGLONG
,
{
Field
::
FIELD_CAST_LONG
,
Field
::
FIELD_CAST_LONGLONG
,
Field
::
FIELD_CAST_DOUBLE
,
Field
::
FIELD_CAST_DOUBLE
,
Field
::
FIELD_CAST_STRING
,
Field
::
FIELD_CAST_VARSTRING
,
Field
::
FIELD_CAST_STRING
,
Field
::
FIELD_CAST_VARSTRING
,
Field
::
FIELD_CAST_BLOB
,
Field
::
FIELD_CAST_STOP
};
Field
::
FIELD_CAST_BLOB
,
Field
::
FIELD_CAST_STOP
};
static
Field
::
field_cast_enum
field_cast_longlong
[]
=
static
Field
::
field_cast_enum
field_cast_longlong
[]
=
{
Field
::
FIELD_CAST_DOUBLE
,
{
Field
::
FIELD_CAST_LONGLONG
,
Field
::
FIELD_CAST_DOUBLE
,
Field
::
FIELD_CAST_STRING
,
Field
::
FIELD_CAST_VARSTRING
,
Field
::
FIELD_CAST_STRING
,
Field
::
FIELD_CAST_VARSTRING
,
Field
::
FIELD_CAST_BLOB
,
Field
::
FIELD_CAST_STOP
};
Field
::
FIELD_CAST_BLOB
,
Field
::
FIELD_CAST_STOP
};
static
Field
::
field_cast_enum
field_cast_float
[]
=
static
Field
::
field_cast_enum
field_cast_float
[]
=
{
Field
::
FIELD_CAST_DOUBLE
,
{
Field
::
FIELD_CAST_FLOAT
,
Field
::
FIELD_CAST_DOUBLE
,
Field
::
FIELD_CAST_STRING
,
Field
::
FIELD_CAST_VARSTRING
,
Field
::
FIELD_CAST_STRING
,
Field
::
FIELD_CAST_VARSTRING
,
Field
::
FIELD_CAST_BLOB
,
Field
::
FIELD_CAST_STOP
};
Field
::
FIELD_CAST_BLOB
,
Field
::
FIELD_CAST_STOP
};
static
Field
::
field_cast_enum
field_cast_double
[]
=
static
Field
::
field_cast_enum
field_cast_double
[]
=
{
Field
::
FIELD_CAST_STRING
,
Field
::
FIELD_CAST_VARSTRING
,
{
Field
::
FIELD_CAST_DOUBLE
,
Field
::
FIELD_CAST_STRING
,
Field
::
FIELD_CAST_VARSTRING
,
Field
::
FIELD_CAST_BLOB
,
Field
::
FIELD_CAST_STOP
};
Field
::
FIELD_CAST_BLOB
,
Field
::
FIELD_CAST_STOP
};
static
Field
::
field_cast_enum
field_cast_null
[]
=
static
Field
::
field_cast_enum
field_cast_null
[]
=
{
Field
::
FIELD_CAST_DECIMAL
,
Field
::
FIELD_CAST_TINY
,
Field
::
FIELD_CAST_SHORT
,
{
Field
::
FIELD_CAST_NULL
,
Field
::
FIELD_CAST_DECIMAL
,
Field
::
FIELD_CAST_TINY
,
Field
::
FIELD_CAST_SHORT
,
Field
::
FIELD_CAST_MEDIUM
,
Field
::
FIELD_CAST_LONG
,
Field
::
FIELD_CAST_LONGLONG
,
Field
::
FIELD_CAST_MEDIUM
,
Field
::
FIELD_CAST_LONG
,
Field
::
FIELD_CAST_LONGLONG
,
Field
::
FIELD_CAST_FLOAT
,
Field
::
FIELD_CAST_DOUBLE
,
Field
::
FIELD_CAST_FLOAT
,
Field
::
FIELD_CAST_DOUBLE
,
Field
::
FIELD_CAST_TIMESTAMP
,
Field
::
FIELD_CAST_YEAR
,
Field
::
FIELD_CAST_TIMESTAMP
,
Field
::
FIELD_CAST_YEAR
,
...
@@ -218,44 +227,54 @@ static Field::field_cast_enum field_cast_null[]=
...
@@ -218,44 +227,54 @@ static Field::field_cast_enum field_cast_null[]=
Field
::
FIELD_CAST_GEOM
,
Field
::
FIELD_CAST_ENUM
,
Field
::
FIELD_CAST_SET
,
Field
::
FIELD_CAST_GEOM
,
Field
::
FIELD_CAST_ENUM
,
Field
::
FIELD_CAST_SET
,
Field
::
FIELD_CAST_STOP
};
Field
::
FIELD_CAST_STOP
};
static
Field
::
field_cast_enum
field_cast_timestamp
[]
=
static
Field
::
field_cast_enum
field_cast_timestamp
[]
=
{
Field
::
FIELD_CAST_DATETIME
,
{
Field
::
FIELD_CAST_TIMESTAMP
,
Field
::
FIELD_CAST_DATETIME
,
Field
::
FIELD_CAST_STRING
,
Field
::
FIELD_CAST_VARSTRING
,
Field
::
FIELD_CAST_STRING
,
Field
::
FIELD_CAST_VARSTRING
,
Field
::
FIELD_CAST_BLOB
,
Field
::
FIELD_CAST_STOP
};
Field
::
FIELD_CAST_BLOB
,
Field
::
FIELD_CAST_STOP
};
static
Field
::
field_cast_enum
field_cast_year
[]
=
static
Field
::
field_cast_enum
field_cast_year
[]
=
{
Field
::
FIELD_CAST_SHORT
,
Field
::
FIELD_CAST_MEDIUM
,
Field
::
FIELD_CAST_LONG
,
{
Field
::
FIELD_CAST_YEAR
,
Field
::
FIELD_CAST_SHORT
,
Field
::
FIELD_CAST_MEDIUM
,
Field
::
FIELD_CAST_LONG
,
Field
::
FIELD_CAST_LONGLONG
,
Field
::
FIELD_CAST_LONGLONG
,
Field
::
FIELD_CAST_FLOAT
,
Field
::
FIELD_CAST_DOUBLE
,
Field
::
FIELD_CAST_FLOAT
,
Field
::
FIELD_CAST_DOUBLE
,
Field
::
FIELD_CAST_STRING
,
Field
::
FIELD_CAST_VARSTRING
,
Field
::
FIELD_CAST_STRING
,
Field
::
FIELD_CAST_VARSTRING
,
Field
::
FIELD_CAST_BLOB
,
Field
::
FIELD_CAST_STOP
};
Field
::
FIELD_CAST_BLOB
,
Field
::
FIELD_CAST_STOP
};
static
Field
::
field_cast_enum
field_cast_date
[]
=
static
Field
::
field_cast_enum
field_cast_date
[]
=
{
Field
::
FIELD_CAST_DATETIME
,
{
Field
::
FIELD_CAST_DATE
,
Field
::
FIELD_CAST_DATETIME
,
Field
::
FIELD_CAST_STRING
,
Field
::
FIELD_CAST_VARSTRING
,
Field
::
FIELD_CAST_STRING
,
Field
::
FIELD_CAST_VARSTRING
,
Field
::
FIELD_CAST_BLOB
,
Field
::
FIELD_CAST_STOP
};
Field
::
FIELD_CAST_BLOB
,
Field
::
FIELD_CAST_STOP
};
static
Field
::
field_cast_enum
field_cast_newdate
[]
=
static
Field
::
field_cast_enum
field_cast_newdate
[]
=
{
Field
::
FIELD_CAST_DATETIME
,
{
Field
::
FIELD_CAST_NEWDATE
,
Field
::
FIELD_CAST_DATETIME
,
Field
::
FIELD_CAST_STRING
,
Field
::
FIELD_CAST_VARSTRING
,
Field
::
FIELD_CAST_STRING
,
Field
::
FIELD_CAST_VARSTRING
,
Field
::
FIELD_CAST_BLOB
,
Field
::
FIELD_CAST_STOP
};
Field
::
FIELD_CAST_BLOB
,
Field
::
FIELD_CAST_STOP
};
static
Field
::
field_cast_enum
field_cast_time
[]
=
static
Field
::
field_cast_enum
field_cast_time
[]
=
{
Field
::
FIELD_CAST_DATETIME
,
{
Field
::
FIELD_CAST_TIME
,
Field
::
FIELD_CAST_DATETIME
,
Field
::
FIELD_CAST_STRING
,
Field
::
FIELD_CAST_VARSTRING
,
Field
::
FIELD_CAST_STRING
,
Field
::
FIELD_CAST_VARSTRING
,
Field
::
FIELD_CAST_BLOB
,
Field
::
FIELD_CAST_STOP
};
Field
::
FIELD_CAST_BLOB
,
Field
::
FIELD_CAST_STOP
};
static
Field
::
field_cast_enum
field_cast_datetime
[]
=
static
Field
::
field_cast_enum
field_cast_datetime
[]
=
{
Field
::
FIELD_CAST_STRING
,
Field
::
FIELD_CAST_VARSTRING
,
{
Field
::
FIELD_CAST_DATETIME
,
Field
::
FIELD_CAST_STRING
,
Field
::
FIELD_CAST_VARSTRING
,
Field
::
FIELD_CAST_BLOB
,
Field
::
FIELD_CAST_STOP
};
Field
::
FIELD_CAST_BLOB
,
Field
::
FIELD_CAST_STOP
};
static
Field
::
field_cast_enum
field_cast_string
[]
=
static
Field
::
field_cast_enum
field_cast_string
[]
=
{
Field
::
FIELD_CAST_VARSTRING
,
Field
::
FIELD_CAST_BLOB
,
Field
::
FIELD_CAST_STOP
};
{
Field
::
FIELD_CAST_STRING
,
Field
::
FIELD_CAST_VARSTRING
,
Field
::
FIELD_CAST_BLOB
,
Field
::
FIELD_CAST_STOP
};
static
Field
::
field_cast_enum
field_cast_varstring
[]
=
static
Field
::
field_cast_enum
field_cast_varstring
[]
=
{
Field
::
FIELD_CAST_BLOB
,
Field
::
FIELD_CAST_STOP
};
{
Field
::
FIELD_CAST_VARSTRING
,
Field
::
FIELD_CAST_BLOB
,
Field
::
FIELD_CAST_STOP
};
static
Field
::
field_cast_enum
field_cast_blob
[]
=
static
Field
::
field_cast_enum
field_cast_blob
[]
=
{
Field
::
FIELD_CAST_STOP
};
{
Field
::
FIELD_CAST_BLOB
,
Field
::
FIELD_CAST_STOP
};
/*
Geometrical, enum and set fields can be casted only to expressions
*/
static
Field
::
field_cast_enum
field_cast_geom
[]
=
static
Field
::
field_cast_enum
field_cast_geom
[]
=
{
Field
::
FIELD_CAST_STOP
};
{
Field
::
FIELD_CAST_STOP
};
static
Field
::
field_cast_enum
field_cast_enum
[]
=
static
Field
::
field_cast_enum
field_cast_enum
[]
=
{
Field
::
FIELD_CAST_STRING
,
Field
::
FIELD_CAST_VARSTRING
,
{
Field
::
FIELD_CAST_STOP
};
Field
::
FIELD_CAST_BLOB
,
Field
::
FIELD_CAST_STOP
};
static
Field
::
field_cast_enum
field_cast_set
[]
=
static
Field
::
field_cast_enum
field_cast_set
[]
=
{
Field
::
FIELD_CAST_STRING
,
Field
::
FIELD_CAST_VARSTRING
,
{
Field
::
FIELD_CAST_STOP
};
Field
::
FIELD_CAST_BLOB
,
Field
::
FIELD_CAST_STOP
};
// Array of pointers on conversion table for all fields types casting
// Array of pointers on conversion table for all fields types casting
static
Field
::
field_cast_enum
*
field_cast_array
[]
=
static
Field
::
field_cast_enum
*
field_cast_array
[]
=
{
0
,
//FIELD_CAST_STOP
{
0
,
//FIELD_CAST_STOP
...
...
sql/item.cc
View file @
f3e6405f
...
@@ -2517,38 +2517,29 @@ bool Item_type_holder::join_types(THD *thd, Item *item)
...
@@ -2517,38 +2517,29 @@ bool Item_type_holder::join_types(THD *thd, Item *item)
if
(
field_example
&&
item
->
type
()
==
Item
::
FIELD_ITEM
)
if
(
field_example
&&
item
->
type
()
==
Item
::
FIELD_ITEM
)
{
{
Field
*
field
=
((
Item_field
*
)
item
)
->
field
;
Field
*
field
=
((
Item_field
*
)
item
)
->
field
;
Field
::
field_cast_enum
field_type
=
field
->
field_cast_type
();
/* Can old example field store new data? */
if
((
change_field
=
if
(
field_type
!=
Field
::
FIELD_CAST_ENUM
&&
!
field
->
field_cast_compatible
(
field_example
->
field_cast_type
())))
field_type
!=
Field
::
FIELD_CAST_SET
)
{
{
if
(
field_example
->
field_cast_type
()
!=
field_type
)
/*
{
if old field can't store value of 'worse' new field we will make
if
(
!
(
change_field
=
decision about result field type based only on Item result type
field_example
->
field_cast_compatible
(
field
->
field_cast_type
())))
*/
{
if
(
!
field_example
->
field_cast_compatible
(
field
->
field_cast_type
()))
/*
skip_store_field
=
1
;
if old field can't store value of 'worse' new field we will make
decision about result field type based only on Item result type
*/
if
(
!
field
->
field_cast_compatible
(
field_example
->
field_cast_type
()))
skip_store_field
=
1
;
}
}
}
}
else
skip_store_field
=
1
;
}
}
else
if
(
field_example
||
item
->
type
()
==
Item
::
FIELD_ITEM
)
else
if
(
field_example
||
item
->
type
()
==
Item
::
FIELD_ITEM
)
{
/* expression can't be mixed with field */
skip_store_field
=
1
;
skip_store_field
=
1
;
}
// size/type should be changed
// size/type should be changed
if
(
change_field
||
if
(
change_field
||
skip_store_field
||
skip_store_field
||
(
new_type
!=
item_type
)
||
(
new_type
!=
item_type
)
||
(
max_length
<
new_length
)
||
(
max_length
<
new_length
)
||
((
new_type
==
INT_RESULT
)
&&
(
decimals
<
item
->
decimals
))
||
(
!
maybe_null
&&
item
->
maybe_null
)
||
(
!
maybe_null
&&
item
->
maybe_null
)
||
(
item_type
==
STRING_RESULT
&&
new_type
==
STRING_RESULT
&&
(
item_type
==
STRING_RESULT
&&
new_type
==
STRING_RESULT
&&
!
my_charset_same
(
collation
.
collation
,
item
->
collation
.
collation
)))
!
my_charset_same
(
collation
.
collation
,
item
->
collation
.
collation
)))
...
@@ -2556,8 +2547,6 @@ bool Item_type_holder::join_types(THD *thd, Item *item)
...
@@ -2556,8 +2547,6 @@ bool Item_type_holder::join_types(THD *thd, Item *item)
// new field has some parameters worse then current
// new field has some parameters worse then current
skip_store_field
|=
(
change_field
&&
skip_store_field
|=
(
change_field
&&
(
max_length
>
new_length
)
||
(
max_length
>
new_length
)
||
((
new_type
==
INT_RESULT
)
&&
(
decimals
>
item
->
decimals
))
||
(
maybe_null
&&
!
item
->
maybe_null
)
||
(
maybe_null
&&
!
item
->
maybe_null
)
||
(
item_type
==
STRING_RESULT
&&
(
item_type
==
STRING_RESULT
&&
new_type
==
STRING_RESULT
&&
new_type
==
STRING_RESULT
&&
...
...
sql/sql_derived.cc
View file @
f3e6405f
...
@@ -226,7 +226,7 @@ static int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit,
...
@@ -226,7 +226,7 @@ static int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit,
else
else
{
{
free_tmp_table
(
thd
,
table
);
free_tmp_table
(
thd
,
table
);
thd
->
lex
->
unit
.
cleanup
();
unit
->
cleanup
();
}
}
exit:
exit:
...
...
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