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
5725831c
Commit
5725831c
authored
Jun 07, 2004
by
gluh@gluh.mysql.r18.ru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for bug #4036 multiple SELECT DATE_FORMAT, incorrect results
parent
73964382
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
0 deletions
+29
-0
mysql-test/r/type_date.result
mysql-test/r/type_date.result
+2
-0
mysql-test/t/type_date.test
mysql-test/t/type_date.test
+8
-0
sql/field.cc
sql/field.cc
+18
-0
sql/field.h
sql/field.h
+1
-0
No files found.
mysql-test/r/type_date.result
View file @
5725831c
...
...
@@ -22,3 +22,5 @@ DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT))
Wed, 06 March 2002 10:11:12 GMT-0800
DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)) DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT))
Wed, 06 March 2002 10:11:12 GMT-0800 Wed, 06 March 2002 10:11:12 GMT-0800
DATE_FORMAT(f1, "%l.%i %p") DATE_FORMAT(f2, "%l.%i %p")
9.00 AM 12.00 PM
mysql-test/t/type_date.test
View file @
5725831c
...
...
@@ -75,3 +75,11 @@ SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.
INSERT
INTO
t1
VALUES
(
1
);
SELECT
DATE_FORMAT
(
"2002-03-06 10:11:12"
,
CONCAT
(
'%a, %d %M %Y %H:%i:%s '
,
t2
.
GMT
)),
DATE_FORMAT
(
"2002-03-06 10:11:12"
,
CONCAT
(
'%a, %d %M %Y %H:%i:%s '
,
t2
.
GMT
))
FROM
t1
,
t2
GROUP
BY
t1
.
AFIELD
;
drop
table
t1
,
t2
;
#
# Bug 4036
#
CREATE
TABLE
t1
(
f1
time
default
NULL
,
f2
time
default
NULL
)
TYPE
=
MyISAM
;
INSERT
INTO
t1
(
f1
,
f2
)
VALUES
(
'09:00'
,
'12:00'
);
SELECT
DATE_FORMAT
(
f1
,
"%l.%i %p"
)
,
DATE_FORMAT
(
f2
,
"%l.%i %p"
)
FROM
t1
;
DROP
TABLE
t1
;
sql/field.cc
View file @
5725831c
...
...
@@ -2649,6 +2649,24 @@ String *Field_time::val_str(String *val_buffer,
return
val_buffer
;
}
bool
Field_time
::
get_date
(
TIME
*
ltime
,
bool
fuzzydate
__attribute__
((
unused
)))
{
long
tmp
=
(
long
)
sint3korr
(
ptr
);
ltime
->
neg
=
0
;
if
(
tmp
<
0
)
{
ltime
->
neg
=
1
;
tmp
=-
tmp
;
}
ltime
->
hour
=
tmp
/
10000
;
tmp
-=
ltime
->
hour
*
10000
;
ltime
->
minute
=
tmp
/
100
;
ltime
->
second
=
tmp
%
100
;
ltime
->
year
=
ltime
->
month
=
ltime
->
day
=
ltime
->
second_part
=
0
;
return
0
;
}
bool
Field_time
::
get_time
(
TIME
*
ltime
)
{
long
tmp
=
(
long
)
sint3korr
(
ptr
);
...
...
sql/field.h
View file @
5725831c
...
...
@@ -658,6 +658,7 @@ public:
double
val_real
(
void
);
longlong
val_int
(
void
);
String
*
val_str
(
String
*
,
String
*
);
bool
get_date
(
TIME
*
ltime
,
bool
fuzzydate
);
bool
get_time
(
TIME
*
ltime
);
int
cmp
(
const
char
*
,
const
char
*
);
void
sort_string
(
char
*
buff
,
uint
length
);
...
...
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