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
983efb69
Commit
983efb69
authored
Oct 26, 2005
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge baker@bk-internal.mysql.com:/home/bk/mysql-5.0
into zim.(none):/home/brian/mysql/mysql-5.0
parents
70bae357
3cee9661
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
142 additions
and
69 deletions
+142
-69
Makefile.am
Makefile.am
+20
-21
include/my_pthread.h
include/my_pthread.h
+6
-6
mysql-test/mysql-test-run.sh
mysql-test/mysql-test-run.sh
+19
-0
mysql-test/r/func_time.result
mysql-test/r/func_time.result
+51
-0
mysql-test/t/func_time.test
mysql-test/t/func_time.test
+24
-0
sql/item_timefunc.cc
sql/item_timefunc.cc
+21
-42
sql/mysqld.cc
sql/mysqld.cc
+1
-0
No files found.
Makefile.am
View file @
983efb69
...
@@ -97,36 +97,35 @@ tags:
...
@@ -97,36 +97,35 @@ tags:
support-files/build-tags
support-files/build-tags
.PHONY
:
init-db bin-dist
.PHONY
:
init-db bin-dist
# Test installation. Ports are configurable from the environment.
# Target 'test' will run the regression test suite using the built server.
#
MYSQL_TEST_MANAGER_PORT
=
9305
# If you are running in a shared environment, users can avoid clashing
MYSQL_TEST_MASTER_PORT
=
9306
# port numbers by setting individual small numbers 1-100 to the
MYSQL_TEST_SLAVE_PORT
=
9308
# environment variable MTR_BUILD_THREAD. The script "mysql-test-run"
MYSQL_TEST_NDB_PORT
=
9350
# will then calculate the various port numbers it needs from this,
MYSQL_TEST_RUN_ARGS
=
--manager-port
=
$(MYSQL_TEST_MANAGER_PORT)
\
# making sure each user use different ports.
--master_port
=
$(MYSQL_TEST_MASTER_PORT)
\
--slave_port
=
$(MYSQL_TEST_SLAVE_PORT)
\
--ndbcluster_port
=
$(MYSQL_TEST_NDB_PORT)
test
:
test
:
cd
mysql-test
;
\
cd
mysql-test
;
\
./mysql-test-run
$(MYSQL_TEST_RUN_ARGS)
&&
\
./mysql-test-run
&&
\
./mysql-test-run
$(MYSQL_TEST_RUN_ARGS)
--ps-protocol
./mysql-test-run
--ps-protocol
test-force
:
test-force
:
cd
mysql-test
;
\
cd
mysql-test
;
\
./mysql-test-run
$(MYSQL_TEST_RUN_ARGS)
--force
;
\
./mysql-test-run
--force
;
\
./mysql-test-run
$(MYSQL_TEST_RUN_ARGS)
--ps-protocol
--force
./mysql-test-run
--ps-protocol
--force
# We are testing a new Perl version of the test script
test-pl
:
test-pl
:
cd
mysql-test
;
\
cd
mysql-test
;
\
./mysql-test-run.pl
$(MYSQL_TEST_RUN_ARGS)
&&
\
./mysql-test-run.pl
&&
\
./mysql-test-run.pl
$(MYSQL_TEST_RUN_ARGS)
--ps-protocol
./mysql-test-run.pl
--ps-protocol
test-force-pl
:
test-force-pl
:
cd
mysql-test
;
\
cd
mysql-test
;
\
./mysql-test-run.pl
$(MYSQL_TEST_RUN_ARGS)
--force
;
\
./mysql-test-run.pl
--force
;
\
./mysql-test-run.pl
$(MYSQL_TEST_RUN_ARGS)
--ps-protocol
--force
./mysql-test-run.pl
--ps-protocol
--force
# Don't update the files from bitkeeper
# Don't update the files from bitkeeper
%
::
SCCS/s.%
%
::
SCCS/s.%
include/my_pthread.h
View file @
983efb69
...
@@ -25,10 +25,10 @@
...
@@ -25,10 +25,10 @@
#endif
#endif
#ifdef __cplusplus
#ifdef __cplusplus
#define EXTERN
_
C extern "C"
#define EXTERNC extern "C"
extern
"C"
{
extern
"C"
{
#else
#else
#define EXTERN
_
C
#define EXTERNC
#endif
/* __cplusplus */
#endif
/* __cplusplus */
#if defined(__WIN__) || defined(OS2)
#if defined(__WIN__) || defined(OS2)
...
@@ -80,10 +80,10 @@ struct timespec { /* For pthread_cond_timedwait() */
...
@@ -80,10 +80,10 @@ struct timespec { /* For pthread_cond_timedwait() */
typedef
int
pthread_mutexattr_t
;
typedef
int
pthread_mutexattr_t
;
#define win_pthread_self my_thread_var->pthread_self
#define win_pthread_self my_thread_var->pthread_self
#ifdef OS2
#ifdef OS2
#define pthread_handler_t EXTERN
_
C void * _Optlink
#define pthread_handler_t EXTERNC void * _Optlink
typedef
void
*
(
_Optlink
*
pthread_handler
)(
void
*
);
typedef
void
*
(
_Optlink
*
pthread_handler
)(
void
*
);
#else
#else
#define pthread_handler_t EXTERN
_
C void * __cdecl
#define pthread_handler_t EXTERNC void * __cdecl
typedef
void
*
(
__cdecl
*
pthread_handler
)(
void
*
);
typedef
void
*
(
__cdecl
*
pthread_handler
)(
void
*
);
#endif
#endif
...
@@ -187,7 +187,7 @@ typedef int pthread_attr_t; /* Needed by Unixware 7.0.0 */
...
@@ -187,7 +187,7 @@ typedef int pthread_attr_t; /* Needed by Unixware 7.0.0 */
#define pthread_key_create(A,B) thr_keycreate((A),(B))
#define pthread_key_create(A,B) thr_keycreate((A),(B))
#define pthread_key_delete(A) thr_keydelete(A)
#define pthread_key_delete(A) thr_keydelete(A)
#define pthread_handler_t EXTERN
_
C void *
#define pthread_handler_t EXTERNC void *
#define pthread_key(T,V) pthread_key_t V
#define pthread_key(T,V) pthread_key_t V
void
*
my_pthread_getspecific_imp
(
pthread_key_t
key
);
void
*
my_pthread_getspecific_imp
(
pthread_key_t
key
);
...
@@ -265,7 +265,7 @@ extern int my_pthread_getprio(pthread_t thread_id);
...
@@ -265,7 +265,7 @@ extern int my_pthread_getprio(pthread_t thread_id);
#define my_pthread_getspecific_ptr(T,V) my_pthread_getspecific(T,(V))
#define my_pthread_getspecific_ptr(T,V) my_pthread_getspecific(T,(V))
#define my_pthread_setspecific_ptr(T,V) pthread_setspecific(T,(void*) (V))
#define my_pthread_setspecific_ptr(T,V) pthread_setspecific(T,(void*) (V))
#define pthread_detach_this_thread()
#define pthread_detach_this_thread()
#define pthread_handler_t EXTERN
_
C void *
#define pthread_handler_t EXTERNC void *
typedef
void
*
(
*
pthread_handler
)(
void
*
);
typedef
void
*
(
*
pthread_handler
)(
void
*
);
/* Test first for RTS or FSU threads */
/* Test first for RTS or FSU threads */
...
...
mysql-test/mysql-test-run.sh
View file @
983efb69
...
@@ -216,6 +216,25 @@ NDBCLUSTER_PORT=9350
...
@@ -216,6 +216,25 @@ NDBCLUSTER_PORT=9350
MYSQL_MANAGER_PW_FILE
=
$MYSQL_TEST_DIR
/var/tmp/manager.pwd
MYSQL_MANAGER_PW_FILE
=
$MYSQL_TEST_DIR
/var/tmp/manager.pwd
MYSQL_MANAGER_LOG
=
$MYSQL_TEST_DIR
/var/log/manager.log
MYSQL_MANAGER_LOG
=
$MYSQL_TEST_DIR
/var/log/manager.log
MYSQL_MANAGER_USER
=
root
MYSQL_MANAGER_USER
=
root
#
# To make it easier for different devs to work on the same host,
# an environment variable can be used to control all ports. A small
# number is to be used, 0 - 16 or similar.
#
if
[
-n
"
$MTR_BUILD_THREAD
"
]
;
then
MASTER_MYPORT
=
`
expr
$MTR_BUILD_THREAD
'*'
40 + 8120
`
MYSQL_MANAGER_PORT
=
`
expr
$MASTER_MYPORT
+ 2
`
SLAVE_MYPORT
=
`
expr
$MASTER_MYPORT
+ 16
`
NDBCLUSTER_PORT
=
`
expr
$MASTER_MYPORT
+ 24
`
echo
"Using MTR_BUILD_THREAD =
$MTR_BUILD_THREAD
"
echo
"Using MASTER_MYPORT =
$MASTER_MYPORT
"
echo
"Using MYSQL_MANAGER_PORT =
$MYSQL_MANAGER_PORT
"
echo
"Using SLAVE_MYPORT =
$SLAVE_MYPORT
"
echo
"Using NDBCLUSTER_PORT =
$NDBCLUSTER_PORT
"
fi
NO_SLAVE
=
0
NO_SLAVE
=
0
USER_TEST
=
USER_TEST
=
FAILED_CASES
=
FAILED_CASES
=
...
...
mysql-test/r/func_time.result
View file @
983efb69
...
@@ -760,3 +760,54 @@ call t_sysdate();
...
@@ -760,3 +760,54 @@ call t_sysdate();
@a != @b
@a != @b
1
1
drop procedure t_sysdate;
drop procedure t_sysdate;
select timestampdiff(month,'2004-09-11','2004-09-11');
timestampdiff(month,'2004-09-11','2004-09-11')
0
select timestampdiff(month,'2004-09-11','2005-09-11');
timestampdiff(month,'2004-09-11','2005-09-11')
12
select timestampdiff(month,'2004-09-11','2006-09-11');
timestampdiff(month,'2004-09-11','2006-09-11')
24
select timestampdiff(month,'2004-09-11','2007-09-11');
timestampdiff(month,'2004-09-11','2007-09-11')
36
select timestampdiff(month,'2005-09-11','2004-09-11');
timestampdiff(month,'2005-09-11','2004-09-11')
-12
select timestampdiff(month,'2005-09-11','2003-09-11');
timestampdiff(month,'2005-09-11','2003-09-11')
-24
select timestampdiff(month,'2004-02-28','2005-02-28');
timestampdiff(month,'2004-02-28','2005-02-28')
12
select timestampdiff(month,'2004-02-29','2005-02-28');
timestampdiff(month,'2004-02-29','2005-02-28')
11
select timestampdiff(month,'2004-02-28','2005-02-28');
timestampdiff(month,'2004-02-28','2005-02-28')
12
select timestampdiff(month,'2004-03-29','2005-03-28');
timestampdiff(month,'2004-03-29','2005-03-28')
11
select timestampdiff(month,'2003-02-28','2004-02-29');
timestampdiff(month,'2003-02-28','2004-02-29')
12
select timestampdiff(month,'2003-02-28','2005-02-28');
timestampdiff(month,'2003-02-28','2005-02-28')
24
select timestampdiff(month,'1999-09-11','2001-10-10');
timestampdiff(month,'1999-09-11','2001-10-10')
24
select timestampdiff(month,'1999-09-11','2001-9-11');
timestampdiff(month,'1999-09-11','2001-9-11')
24
select timestampdiff(year,'1999-09-11','2001-9-11');
timestampdiff(year,'1999-09-11','2001-9-11')
2
select timestampdiff(year,'2004-02-28','2005-02-28');
timestampdiff(year,'2004-02-28','2005-02-28')
1
select timestampdiff(year,'2004-02-29','2005-02-28');
timestampdiff(year,'2004-02-29','2005-02-28')
0
mysql-test/t/func_time.test
View file @
983efb69
...
@@ -404,4 +404,28 @@ delimiter ;//
...
@@ -404,4 +404,28 @@ delimiter ;//
call
t_sysdate
();
call
t_sysdate
();
drop
procedure
t_sysdate
;
drop
procedure
t_sysdate
;
#
# Bug #13534: timestampdiff() returned incorrect results across leap years
#
select
timestampdiff
(
month
,
'2004-09-11'
,
'2004-09-11'
);
select
timestampdiff
(
month
,
'2004-09-11'
,
'2005-09-11'
);
select
timestampdiff
(
month
,
'2004-09-11'
,
'2006-09-11'
);
select
timestampdiff
(
month
,
'2004-09-11'
,
'2007-09-11'
);
select
timestampdiff
(
month
,
'2005-09-11'
,
'2004-09-11'
);
select
timestampdiff
(
month
,
'2005-09-11'
,
'2003-09-11'
);
select
timestampdiff
(
month
,
'2004-02-28'
,
'2005-02-28'
);
select
timestampdiff
(
month
,
'2004-02-29'
,
'2005-02-28'
);
select
timestampdiff
(
month
,
'2004-02-28'
,
'2005-02-28'
);
select
timestampdiff
(
month
,
'2004-03-29'
,
'2005-03-28'
);
select
timestampdiff
(
month
,
'2003-02-28'
,
'2004-02-29'
);
select
timestampdiff
(
month
,
'2003-02-28'
,
'2005-02-28'
);
select
timestampdiff
(
month
,
'1999-09-11'
,
'2001-10-10'
);
select
timestampdiff
(
month
,
'1999-09-11'
,
'2001-9-11'
);
select
timestampdiff
(
year
,
'1999-09-11'
,
'2001-9-11'
);
select
timestampdiff
(
year
,
'2004-02-28'
,
'2005-02-28'
);
select
timestampdiff
(
year
,
'2004-02-29'
,
'2005-02-28'
);
# End of 5.0 tests
# End of 5.0 tests
sql/item_timefunc.cc
View file @
983efb69
...
@@ -2723,16 +2723,16 @@ longlong Item_func_timestamp_diff::val_int()
...
@@ -2723,16 +2723,16 @@ longlong Item_func_timestamp_diff::val_int()
int_type
==
INTERVAL_QUARTER
||
int_type
==
INTERVAL_QUARTER
||
int_type
==
INTERVAL_MONTH
)
int_type
==
INTERVAL_MONTH
)
{
{
uint
year
;
uint
year_beg
,
year_end
,
month_beg
,
month_end
,
day_beg
,
day_end
;
uint
year_beg
,
year_end
,
month_beg
,
month_end
;
uint
years
=
0
;
uint
diff_days
=
(
uint
)
(
seconds
/
86400L
);
uint
diff_years
=
0
;
if
(
neg
==
-
1
)
if
(
neg
==
-
1
)
{
{
year_beg
=
ltime2
.
year
;
year_beg
=
ltime2
.
year
;
year_end
=
ltime1
.
year
;
year_end
=
ltime1
.
year
;
month_beg
=
ltime2
.
month
;
month_beg
=
ltime2
.
month
;
month_end
=
ltime1
.
month
;
month_end
=
ltime1
.
month
;
day_beg
=
ltime2
.
day
;
day_end
=
ltime1
.
day
;
}
}
else
else
{
{
...
@@ -2740,53 +2740,32 @@ longlong Item_func_timestamp_diff::val_int()
...
@@ -2740,53 +2740,32 @@ longlong Item_func_timestamp_diff::val_int()
year_end
=
ltime2
.
year
;
year_end
=
ltime2
.
year
;
month_beg
=
ltime1
.
month
;
month_beg
=
ltime1
.
month
;
month_end
=
ltime2
.
month
;
month_end
=
ltime2
.
month
;
}
day_beg
=
ltime1
.
day
;
/* calc years*/
day_end
=
ltime2
.
day
;
for
(
year
=
year_beg
;
year
<
year_end
;
year
++
)
{
uint
days
=
calc_days_in_year
(
year
);
if
(
days
>
diff_days
)
break
;
diff_days
-=
days
;
diff_years
++
;
}
}
/* calc months; Current year is in the 'year' variable */
/* calc years */
month_beg
--
;
/* Change months to be 0-11 for easier calculation */
years
=
year_end
-
year_beg
;
month_end
--
;
if
(
month_end
<
month_beg
||
(
month_end
==
month_beg
&&
day_end
<
day_beg
))
years
-=
1
;
months
=
12
*
diff_years
;
/* calc months */
while
(
month_beg
!=
month_end
)
months
=
12
*
years
;
{
if
(
month_end
<
month_beg
||
(
month_end
==
month_beg
&&
day_end
<
day_beg
))
uint
m_days
=
(
uint
)
days_in_month
[
month_beg
];
months
+=
12
-
(
month_beg
-
month_end
);
if
(
month_beg
==
1
)
else
{
months
+=
(
month_end
-
month_beg
);
/* This is only calculated once so there is no reason to cache it*/
if
(
day_end
<
day_beg
)
uint
leap
=
(
uint
)
((
year
&
3
)
==
0
&&
(
year
%
100
||
months
-=
1
;
(
year
%
400
==
0
&&
year
)));
m_days
+=
leap
;
}
if
(
m_days
>
diff_days
)
break
;
diff_days
-=
m_days
;
months
++
;
if
(
month_beg
++
==
11
)
/* if we wrap to next year */
{
month_beg
=
0
;
year
++
;
}
}
if
(
neg
==
-
1
)
months
=
-
months
;
}
}
switch
(
int_type
)
{
switch
(
int_type
)
{
case
INTERVAL_YEAR
:
case
INTERVAL_YEAR
:
return
months
/
12
;
return
months
/
12
*
neg
;
case
INTERVAL_QUARTER
:
case
INTERVAL_QUARTER
:
return
months
/
3
;
return
months
/
3
*
neg
;
case
INTERVAL_MONTH
:
case
INTERVAL_MONTH
:
return
months
;
return
months
*
neg
;
case
INTERVAL_WEEK
:
case
INTERVAL_WEEK
:
return
seconds
/
86400L
/
7L
*
neg
;
return
seconds
/
86400L
/
7L
*
neg
;
case
INTERVAL_DAY
:
case
INTERVAL_DAY
:
...
...
sql/mysqld.cc
View file @
983efb69
...
@@ -7155,6 +7155,7 @@ static void fix_paths(void)
...
@@ -7155,6 +7155,7 @@ static void fix_paths(void)
CHARSET_DIR
,
NullS
);
CHARSET_DIR
,
NullS
);
}
}
(
void
)
my_load_path
(
mysql_charsets_dir
,
mysql_charsets_dir
,
buff
);
(
void
)
my_load_path
(
mysql_charsets_dir
,
mysql_charsets_dir
,
buff
);
convert_dirname
(
mysql_charsets_dir
,
mysql_charsets_dir
,
NullS
);
charsets_dir
=
mysql_charsets_dir
;
charsets_dir
=
mysql_charsets_dir
;
if
(
init_tmpdir
(
&
mysql_tmpdir_list
,
opt_mysql_tmpdir
))
if
(
init_tmpdir
(
&
mysql_tmpdir_list
,
opt_mysql_tmpdir
))
...
...
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