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
54fc4796
Commit
54fc4796
authored
Aug 01, 2018
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-16874 Implement class Item_handled_func
parent
af46c257
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
547 additions
and
258 deletions
+547
-258
mysql-test/main/func_time.result
mysql-test/main/func_time.result
+0
-1
sql/item_func.h
sql/item_func.h
+60
-2
sql/item_timefunc.cc
sql/item_timefunc.cc
+70
-208
sql/item_timefunc.h
sql/item_timefunc.h
+412
-47
sql/sql_type.h
sql/sql_type.h
+5
-0
No files found.
mysql-test/main/func_time.result
View file @
54fc4796
...
...
@@ -1716,7 +1716,6 @@ min(timestampadd(month, 1>'', from_days('%Z')))
NULL
Warnings:
Warning 1292 Truncated incorrect INTEGER value: '%Z'
Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Incorrect datetime value: '0000-00-00'
SET timestamp=UNIX_TIMESTAMP('2001-01-01 00:00:00');
create table t1(a time);
...
...
sql/item_func.h
View file @
54fc4796
...
...
@@ -40,8 +40,6 @@ class Item_func :public Item_func_or_sum,
{
void
sync_with_sum_func_and_with_field
(
List
<
Item
>
&
list
);
protected:
String
*
val_str_from_val_str_ascii
(
String
*
str
,
String
*
str2
);
virtual
bool
check_arguments
()
const
{
return
check_argument_types_scalar
(
0
,
arg_count
);
...
...
@@ -188,6 +186,8 @@ class Item_func :public Item_func_or_sum,
update_null_value
();
return
null_value
;
}
String
*
val_str_from_val_str_ascii
(
String
*
str
,
String
*
str2
);
void
signal_divide_by_null
();
friend
class
udf_handler
;
Field
*
create_field_for_create_select
(
TABLE
*
table
)
...
...
@@ -450,6 +450,64 @@ class Item_hybrid_func: public Item_func,
};
class
Item_handled_func
:
public
Item_func
{
public:
class
Handler
{
public:
virtual
~
Handler
()
{
}
virtual
String
*
val_str
(
Item_handled_func
*
,
String
*
)
const
=
0
;
virtual
String
*
val_str_ascii
(
Item_handled_func
*
,
String
*
)
const
=
0
;
virtual
double
val_real
(
Item_handled_func
*
)
const
=
0
;
virtual
longlong
val_int
(
Item_handled_func
*
)
const
=
0
;
virtual
my_decimal
*
val_decimal
(
Item_handled_func
*
,
my_decimal
*
)
const
=
0
;
virtual
bool
get_date
(
Item_handled_func
*
,
MYSQL_TIME
*
,
ulonglong
fuzzydate
)
const
=
0
;
virtual
const
Type_handler
*
return_type_handler
()
const
=
0
;
virtual
bool
fix_length_and_dec
(
Item_handled_func
*
)
const
=
0
;
};
protected:
const
Handler
*
m_func_handler
;
public:
Item_handled_func
(
THD
*
thd
,
Item
*
a
)
:
Item_func
(
thd
,
a
),
m_func_handler
(
NULL
)
{
}
Item_handled_func
(
THD
*
thd
,
Item
*
a
,
Item
*
b
)
:
Item_func
(
thd
,
a
,
b
),
m_func_handler
(
NULL
)
{
}
void
set_func_handler
(
const
Handler
*
handler
)
{
m_func_handler
=
handler
;
}
const
Type_handler
*
type_handler
()
const
{
return
m_func_handler
->
return_type_handler
();
}
String
*
val_str
(
String
*
to
)
{
return
m_func_handler
->
val_str
(
this
,
to
);
}
String
*
val_str_ascii
(
String
*
to
)
{
return
m_func_handler
->
val_str_ascii
(
this
,
to
);
}
double
val_real
()
{
return
m_func_handler
->
val_real
(
this
);
}
longlong
val_int
()
{
return
m_func_handler
->
val_int
(
this
);
}
my_decimal
*
val_decimal
(
my_decimal
*
to
)
{
return
m_func_handler
->
val_decimal
(
this
,
to
);
}
bool
get_date
(
MYSQL_TIME
*
to
,
ulonglong
fuzzydate
)
{
return
m_func_handler
->
get_date
(
this
,
to
,
fuzzydate
);
}
};
/**
Functions that at fix_fields() time determine the returned field type,
trying to preserve the exact data type of the arguments.
...
...
sql/item_timefunc.cc
View file @
54fc4796
This diff is collapsed.
Click to expand it.
sql/item_timefunc.h
View file @
54fc4796
This diff is collapsed.
Click to expand it.
sql/sql_type.h
View file @
54fc4796
...
...
@@ -367,6 +367,11 @@ class Temporal_with_date: protected MYSQL_TIME
{
make_from_item
(
thd
,
item
,
flags
);
}
public:
bool
check_date_with_warn
(
ulonglong
flags
)
{
return
::
check_date_with_warn
(
this
,
flags
,
MYSQL_TIMESTAMP_ERROR
);
}
};
...
...
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