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
049ded30
Commit
049ded30
authored
Dec 29, 2001
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge sinisa@work.mysql.com:/home/bk/mysql-4.0
into sinisa.nasamreza.org:/mnt/hdc/Sinisa/mysql-4.0
parents
05a88fd7
38d4712e
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
74 additions
and
5 deletions
+74
-5
mysql-test/r/create.result
mysql-test/r/create.result
+10
-0
mysql-test/t/create.test
mysql-test/t/create.test
+3
-0
sql/field.h
sql/field.h
+12
-0
sql/item.h
sql/item.h
+3
-3
sql/item_func.h
sql/item_func.h
+15
-0
sql/item_strfunc.h
sql/item_strfunc.h
+5
-0
sql/item_timefunc.h
sql/item_timefunc.h
+21
-0
sql/sql_table.cc
sql/sql_table.cc
+5
-2
No files found.
mysql-test/r/create.result
View file @
049ded30
...
...
@@ -76,4 +76,14 @@ x varchar(50) YES NULL
describe t2;
Field Type Null Key Default Extra
x char(50) YES NULL
drop table t2;
create table t2 select now() as a , curtime() as b, curdate() as c , 1+1 as d , 1.0 + 1 as e , 33333333333333333 + 3 as f;
describe t2;
Field Type Null Key Default Extra
a datetime 0000-00-00 00:00:00
b time 00:00:00
c date 0000-00-00
d bigint(17) 0
e double(18,1) 0.0
f bigint(17) 0
drop table t1,t2;
mysql-test/t/create.test
View file @
049ded30
...
...
@@ -74,4 +74,7 @@ create table t1(x varchar(50) );
create
table
t2
select
x
from
t1
where
1
=
2
;
describe
t1
;
describe
t2
;
drop
table
t2
;
create
table
t2
select
now
()
as
a
,
curtime
()
as
b
,
curdate
()
as
c
,
1
+
1
as
d
,
1.0
+
1
as
e
,
33333333333333333
+
3
as
f
;
describe
t2
;
drop
table
t1
,
t2
;
sql/field.h
View file @
049ded30
...
...
@@ -593,6 +593,10 @@ class Field_date :public Field_str {
:
Field_str
(
ptr_arg
,
10
,
null_ptr_arg
,
null_bit_arg
,
unireg_check_arg
,
field_name_arg
,
table_arg
)
{}
Field_date
(
bool
maybe_null_arg
,
const
char
*
field_name_arg
,
struct
st_table
*
table_arg
)
:
Field_str
((
char
*
)
0
,
10
,
maybe_null_arg
?
(
uchar
*
)
""
:
0
,
0
,
NONE
,
field_name_arg
,
table_arg
)
{}
enum_field_types
type
()
const
{
return
FIELD_TYPE_DATE
;}
enum
ha_base_keytype
key_type
()
const
{
return
HA_KEYTYPE_ULONG_INT
;
}
enum
Item_result
cmp_type
()
const
{
return
INT_RESULT
;
}
...
...
@@ -650,6 +654,10 @@ class Field_time :public Field_str {
:
Field_str
(
ptr_arg
,
8
,
null_ptr_arg
,
null_bit_arg
,
unireg_check_arg
,
field_name_arg
,
table_arg
)
{}
Field_time
(
bool
maybe_null_arg
,
const
char
*
field_name_arg
,
struct
st_table
*
table_arg
)
:
Field_str
((
char
*
)
0
,
8
,
maybe_null_arg
?
(
uchar
*
)
""
:
0
,
0
,
NONE
,
field_name_arg
,
table_arg
)
{}
enum_field_types
type
()
const
{
return
FIELD_TYPE_TIME
;}
enum
ha_base_keytype
key_type
()
const
{
return
HA_KEYTYPE_INT24
;
}
enum
Item_result
cmp_type
()
const
{
return
INT_RESULT
;
}
...
...
@@ -678,6 +686,10 @@ class Field_datetime :public Field_str {
:
Field_str
(
ptr_arg
,
19
,
null_ptr_arg
,
null_bit_arg
,
unireg_check_arg
,
field_name_arg
,
table_arg
)
{}
Field_datetime
(
bool
maybe_null_arg
,
const
char
*
field_name_arg
,
struct
st_table
*
table_arg
)
:
Field_str
((
char
*
)
0
,
19
,
maybe_null_arg
?
(
uchar
*
)
""
:
0
,
0
,
NONE
,
field_name_arg
,
table_arg
)
{}
enum_field_types
type
()
const
{
return
FIELD_TYPE_DATETIME
;}
#ifdef HAVE_LONG_LONG
enum
ha_base_keytype
key_type
()
const
{
return
HA_KEYTYPE_ULONGLONG
;
}
...
...
sql/item.h
View file @
049ded30
...
...
@@ -64,7 +64,7 @@ class Item {
virtual
longlong
val_int
()
=
0
;
virtual
String
*
val_str
(
String
*
)
=
0
;
virtual
void
make_field
(
Send_field
*
field
)
=
0
;
virtual
Field
*
tmp_table_field
()
{
return
0
;
}
virtual
Field
*
tmp_table_field
(
TABLE
*
t_arg
=
(
TABLE
*
)
0
)
{
return
0
;
}
virtual
const
char
*
full_name
()
const
{
return
name
?
name
:
"???"
;
}
virtual
double
val_result
()
{
return
val
();
}
virtual
longlong
val_int_result
()
{
return
val_int
();
}
...
...
@@ -128,7 +128,7 @@ class Item_field :public Item_ident
{
return
field
->
result_type
();
}
Field
*
tmp_table_field
()
{
return
result_field
;
}
Field
*
tmp_table_field
(
TABLE
*
t_arg
=
(
TABLE
*
)
0
)
{
return
result_field
;
}
bool
get_date
(
TIME
*
ltime
,
bool
fuzzydate
);
bool
get_time
(
TIME
*
ltime
);
bool
is_null
()
{
return
field
->
is_null
();
}
...
...
@@ -308,7 +308,7 @@ class Item_result_field :public Item /* Item with result field */
Field
*
result_field
;
/* Save result here */
Item_result_field
()
:
result_field
(
0
)
{}
~
Item_result_field
()
{}
/* Required with gcc 2.95 */
Field
*
tmp_table_field
()
{
return
result_field
;
}
Field
*
tmp_table_field
(
TABLE
*
t_arg
=
(
TABLE
*
)
0
)
{
return
result_field
;
}
table_map
used_tables
()
const
{
return
1
;
}
virtual
void
fix_length_and_dec
()
=
0
;
};
...
...
sql/item_func.h
View file @
049ded30
...
...
@@ -135,6 +135,11 @@ class Item_real_func :public Item_func
longlong
val_int
()
{
return
(
longlong
)
val
();
}
enum
Item_result
result_type
()
const
{
return
REAL_RESULT
;
}
void
fix_length_and_dec
()
{
decimals
=
NOT_FIXED_DEC
;
max_length
=
float_length
(
decimals
);
}
Field
*
tmp_table_field
(
TABLE
*
t_arg
)
{
if
(
!
t_arg
)
return
result_field
;
return
new
Field_double
(
max_length
,
maybe_null
,
name
,
t_arg
,
decimals
);
}
};
class
Item_num_func
:
public
Item_func
...
...
@@ -164,6 +169,11 @@ class Item_num_op :public Item_func
void
fix_length_and_dec
()
{
fix_num_length_and_dec
();
find_num_type
();
}
void
find_num_type
(
void
);
bool
is_null
()
{
(
void
)
val
();
return
null_value
;
}
Field
*
tmp_table_field
(
TABLE
*
t_arg
)
{
if
(
!
t_arg
)
return
result_field
;
return
args
[
0
]
->
result_type
()
==
INT_RESULT
?
((
max_length
>
11
)
?
(
Field
*
)
new
Field_longlong
(
max_length
,
maybe_null
,
name
,
t_arg
,
unsigned_flag
)
:
(
Field
*
)
new
Field_long
(
max_length
,
maybe_null
,
name
,
t_arg
,
unsigned_flag
))
:
(
Field
*
)
new
Field_double
(
max_length
,
maybe_null
,
name
,
t_arg
,
decimals
);
}
};
...
...
@@ -179,6 +189,11 @@ class Item_int_func :public Item_func
String
*
val_str
(
String
*
str
);
enum
Item_result
result_type
()
const
{
return
INT_RESULT
;
}
void
fix_length_and_dec
()
{
decimals
=
0
;
max_length
=
21
;
}
Field
*
tmp_table_field
(
TABLE
*
t_arg
)
{
if
(
!
t_arg
)
return
result_field
;
return
(
max_length
>
11
)
?
(
Field
*
)
new
Field_longlong
(
max_length
,
maybe_null
,
name
,
t_arg
,
unsigned_flag
)
:
(
Field
*
)
new
Field_long
(
max_length
,
maybe_null
,
name
,
t_arg
,
unsigned_flag
);
}
};
class
Item_func_plus
:
public
Item_num_op
...
...
sql/item_strfunc.h
View file @
049ded30
...
...
@@ -35,6 +35,11 @@ class Item_str_func :public Item_func
double
val
();
enum
Item_result
result_type
()
const
{
return
STRING_RESULT
;
}
void
left_right_max_length
();
Field
*
tmp_table_field
(
TABLE
*
t_arg
)
{
if
(
!
t_arg
)
return
result_field
;
return
(
max_length
>
255
)
?
(
Field
*
)
new
Field_blob
(
max_length
,
maybe_null
,
name
,
t_arg
,
binary
)
:
(
Field
*
)
new
Field_string
(
max_length
,
maybe_null
,
name
,
t_arg
,
binary
);
}
};
class
Item_func_md5
:
public
Item_str_func
...
...
sql/item_timefunc.h
View file @
049ded30
...
...
@@ -233,6 +233,11 @@ class Item_date :public Item_func
{
init_make_field
(
tmp_field
,
FIELD_TYPE_DATE
);
}
Field
*
tmp_table_field
(
TABLE
*
t_arg
)
{
if
(
!
t_arg
)
return
result_field
;
return
new
Field_date
(
maybe_null
,
name
,
t_arg
);
}
};
...
...
@@ -246,6 +251,11 @@ class Item_date_func :public Item_str_func
{
init_make_field
(
tmp_field
,
FIELD_TYPE_DATETIME
);
}
Field
*
tmp_table_field
(
TABLE
*
t_arg
)
{
if
(
!
t_arg
)
return
result_field
;
return
new
Field_datetime
(
maybe_null
,
name
,
t_arg
);
}
};
...
...
@@ -268,6 +278,11 @@ class Item_func_curtime :public Item_func
{
init_make_field
(
tmp_field
,
FIELD_TYPE_TIME
);
}
Field
*
tmp_table_field
(
TABLE
*
t_arg
)
{
if
(
!
t_arg
)
return
result_field
;
return
new
Field_time
(
maybe_null
,
name
,
t_arg
);
}
};
...
...
@@ -355,6 +370,12 @@ class Item_func_sec_to_time :public Item_str_func
{
init_make_field
(
tmp_field
,
FIELD_TYPE_TIME
);
}
Field
*
tmp_table_field
(
TABLE
*
t_arg
)
{
if
(
!
t_arg
)
return
result_field
;
return
new
Field_time
(
maybe_null
,
name
,
t_arg
);
}
};
enum
interval_type
{
INTERVAL_YEAR
,
INTERVAL_MONTH
,
INTERVAL_DAY
,
...
...
sql/sql_table.cc
View file @
049ded30
...
...
@@ -704,8 +704,11 @@ TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
my_error
(
ER_WRONG_COLUMN_NAME
,
MYF
(
0
),
item
->
name
);
DBUG_RETURN
(
0
);
}
Field
*
field
=
create_tmp_field
(
thd
,
&
tmp_table
,
item
,
item
->
type
(),
Field
*
field
;
if
(
item
->
type
()
==
Item
::
FUNC_ITEM
)
field
=
item
->
tmp_table_field
(
&
tmp_table
);
else
field
=
create_tmp_field
(
thd
,
&
tmp_table
,
item
,
item
->
type
(),
(
Item_result_field
***
)
0
,
&
tmp_field
,
0
,
0
);
if
(
!
field
||
!
(
cr_field
=
new
create_field
(
field
,(
item
->
type
()
==
Item
::
FIELD_ITEM
?
...
...
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