Commit graph

124 commits

Author SHA1 Message Date
Kent Boortz
79535de206 Updated/added copyright headers 2012-02-15 17:21:38 +01:00
Alexander Barkov
1f776e9f24 BUG#13458237 - INCONSISTENT HANDLING OF INVALIDE DATES WITH ZERO DAY. SIMILAR TO '2009-10-00'
- Reverting the patch for Bug # 12584302
  The patch will be reverted in 5.1 and 5.5.
  The patch will not be reverted in 5.6, the change will
  be properly documented in 5.6.
- Backporting DBUG_ASSERT not to crash on '0000-01-00'
  (already fixed in mysql-trunk (5.6))
2012-01-24 13:00:13 +04:00
Kent Boortz
b6e6097c95 Updated/added copyright headers 2011-07-03 17:47:37 +02:00
Kent Boortz
1400d7a2cc Updated/added copyright headers 2011-06-30 17:37:13 +02:00
Kent Boortz
e5ce023f57 Updated/added copyright headers 2011-06-30 17:31:31 +02:00
Sergey Glukhov
735bab72c5 Bug#11889186 60503: CRASH IN MAKE_DATE_TIME WITH DATE_FORMAT / STR_TO_DATE COMBINATION
calc_daynr() function returns negative result
if malformed date with zero year and month is used.
Attempt to calculate week day on negative value
leads to crash. The fix is return NULL for
'W', 'a', 'w' specifiers if zero year and month is used.
Additional fix for calc_daynr():
--added assertion that result can not be negative
--return 0 if zero year and month is used
2011-04-27 11:35:57 +04:00
Georgi Kodinov
ac3243c8c8 merge to 5.1. 2011-02-02 19:05:28 +02:00
Georgi Kodinov
59f68983ff Fixes for Bug #55755 and Bug #52315 part 2
Bug #55755 : Date STD variable signness breaks server on FreeBSD and OpenBSD

* Added a check to configure on the size of time_t
* Created a macro to check for a valid time_t that is safe to use with datetime 
  functions and store in TIMESTAMP columns.
* Used the macro consistently instead of the ad-hoc checks introduced by 52315
* Fixed compliation warnings on platforms where the size of time_t is smaller than
  the size of a long (e.g. OpenBSD 4.8 64 amd64).

Bug #52315: utc_date() crashes when system time > year 2037

* Added a correct check for the timestamp range instead of just variable size check to
SET TIMESTAMP.
* Added overflow checking before converting to time_t. 
* Using a correct localized error message in this case instead of the generic error.
* Added a test suite.
* fixed the checks so that they check for unsigned time_t as well. Used the checks 
  consistently across the source code.
* fixed the original test case to expect the new error code.
2011-02-02 18:51:35 +02:00
Davi Arnaut
ed9ffc6b09 Bug#45288: pb2 returns a lot of compilation warnings on linux
Although the C standard mandates that sprintf return the number
of bytes written, some very ancient systems (i.e. SunOS 4)
returned a pointer to the buffer instead. Since these systems
are not supported anymore and are hopefully long dead by now,
simply remove the portability wrapper that dealt with this
discrepancy. The autoconf check was causing trouble with GCC.
2010-07-09 09:00:17 -03:00
Staale Smedseng
5051100a1a Merge from 5.0 2009-09-17 17:25:52 +02:00
Staale Smedseng
38b6d49e82 Bug #43414 Parenthesis (and other) warnings compiling MySQL
with gcc 4.3.2
      
This is the fifth patch cleaning up more GCC warnings about
variables used before initialized using the new macro
UNINIT_VAR().
2009-09-17 17:10:30 +02:00
Mattias Jonsson
35ba36d13d Post fix patch for bug#20577 and bug#46362.
On 64-bits machines the calculation gets the wrong types and results
in very large numbers. Fixed by explicitly cast month to (int)
2009-09-01 13:04:56 +02:00
Staale Smedseng
f59ef9eafa Merge from 5.0 for 43414 2009-08-28 18:21:54 +02:00
Staale Smedseng
2217de2513 Bug #43414 Parenthesis (and other) warnings compiling MySQL
with gcc 4.3.2
      
This patch fixes a number of GCC warnings about variables used
before initialized. A new macro UNINIT_VAR() is introduced for
use in the variable declaration, and LINT_INIT() usage will be
gradually deprecated. (A workaround is used for g++, pending a
patch for a g++ bug.)
      
GCC warnings for unused results (attribute warn_unused_result)
for a number of system calls (present at least in later
Ubuntus, where the usual void cast trick doesn't work) are
also fixed.
2009-08-28 17:51:31 +02:00
Mattias Jonsson
3b756a01a0 Bug#46362: Endpoint should be set to false for TO_DAYS(DATE)
There were a problem since pruning uses the field
for comparison (while evaluate_join_record uses longlong),
resulting in pruning failures when comparing DATE to DATETIME.

Fix was to always comparing DATE vs DATETIME as DATETIME,
by adding ' 00:00:00' to the DATE string.

And adding optimization for comparing with 23:59:59, so that
DATETIME_col > '2001-02-03 23:59:59' ->
TO_DAYS(DATETIME_col) > TO_DAYS('2001-02-03 23:59:59') instead
of '>='.
2009-08-26 12:51:23 +02:00
Tatiana A. Nurnberg
aa3f93083c Bug#42146 - DATETIME fractional seconds parse error
Bug#38435 - LONG Microseconds cause MySQL to fail a CAST to DATETIME or DATE

Parsing of optional microsecond part in datetime did not
fail gracefully when field width was larger than the allowed
six places.

Now handles up to the correct six places, and disregards
any extra digits without messing up what we've already got.
2009-02-13 19:07:03 +01:00
Tatiana A. Nurnberg
1d15df432e auto-merge 2009-01-09 14:22:15 +01:00
Tatiana A. Nurnberg
17bbe30cb0 Bug#41470: DATE_FORMAT() crashes the complete server with a valid date
Passing dubious "year zero" in non-zero date (not "0000-00-00") could
lead to negative value for year internally, while variable was unsigned.
This led to Really Bad Things further down the line.

Now doing calculations with signed type for year internally.
2009-01-08 10:25:31 +01:00
cmiller@zippy.cornsilk.net
7e78633f81 Merge zippy.cornsilk.net:/home/cmiller/work/mysql/bug26294/my50-bug26294
into  zippy.cornsilk.net:/home/cmiller/work/mysql/bug26294/my51-bug26294
2008-04-03 13:14:57 -04:00
cmiller@zippy.cornsilk.net
9ff7a0cedc Bug#26294: library name conflict between MySQL 4.x, 5.0 and Qt 3.3
When linking with some external programs, "multiple definition 
of `init_time'"

Rename init_time() to my_init_time() to avoid collision with other
libraries (particularly libmng).
2008-04-03 11:32:00 -04:00
tnurnberg@white.intern.koehntopp.de
1f8064d3f8 Merge mysql.com:/misc/mysql/mysql-5.0-opt
into  mysql.com:/misc/mysql/32180/50-32180
2007-11-17 05:57:21 +01:00
tnurnberg@white.intern.koehntopp.de
7135ca0b51 Merge mysql.com:/misc/mysql/mysql-5.1-opt
into  mysql.com:/misc/mysql/32180/51-32180
2007-11-17 02:31:40 +01:00
tnurnberg@white.intern.koehntopp.de
2adbc2e0fb Merge mysql.com:/misc/mysql/32180/50-32180
into  mysql.com:/misc/mysql/32180/51-32180
2007-11-17 00:03:12 +01:00
tnurnberg@mysql.com/white.intern.koehntopp.de
4a7c875673 Bug #32180: DATE_ADD treats datetime numeric argument as DATE instead of DATETIME
This is a regression from 2007-05-18 when code to zero out the returned struct was
added to number_to_datetime(); zero for time_type corresponds to MYSQL_TIMESTAMP_DATE.
We now explicitly set the type we return (MYSQL_TIMESTAMP_DATETIME).
2007-11-16 17:43:15 +01:00
tnurnberg@white.intern.koehntopp.de
83849fd171 Merge mysql.com:/misc/mysql/31800/50-31800
into  mysql.com:/misc/mysql/31800/51-31800
2007-11-10 13:34:12 +01:00
tnurnberg@mysql.com/white.intern.koehntopp.de
dd7452c280 Bug#31800: Date comparison fails with timezone and slashes for greater than comparison
BETWEEN was more lenient with regard to what it accepted as a DATE/DATETIME
in comparisons than greater-than and less-than were. ChangeSet makes < >
comparisons similarly robust with regard to trailing garbage (" GMT-1")
and "missing" leading zeros. Now all three comparators behave similarly
in that they throw a warning for "junk" at the end of the data, but then
proceed anyway if possible. Before < > fell back on a string- (rather than
date-) comparison when a warning-condition was raised in the string-to-date
conversion. Now the fallback only happens on actual errors, while warning-
conditions still result in a warning being to delivered to the client.
2007-11-10 13:33:42 +01:00
tnurnberg@sin.intern.azundris.com
57dc381268 Bug#30951: makedate returns different results depending on version of mysql
makedate() will fold years below 100 into the 1970-2069 range. CS removes code
that also wrongly folded years between 100 and 200 into that range, which should
be left unchanged. Backport from 5.1.
2007-10-12 11:46:48 +02:00
monty@mysql.com/nosik.monty.fi
e53a73e26c Fixed a lot of compiler warnings and errors detected by Forte C++ on Solaris
Faster thr_alarm()
Added 'Opened_files' status variable to track calls to my_open()
Don't give warnings when running mysql_install_db
Added option --source-install to mysql_install_db

I had to do the following renames() as used polymorphism didn't work with Forte compiler on 64 bit systems
index_read()      -> index_read_map()
index_read_idx()  -> index_read_idx_map()
index_read_last() -> index_read_last_map()
2007-08-13 16:11:25 +03:00
tsmith@quadxeon.mysql.com
d7d56cb6ef Merge quadxeon.mysql.com:/benchmarks/ext3/TOSAVE/tsmith/bk/maint/50
into  quadxeon.mysql.com:/benchmarks/ext3/TOSAVE/tsmith/bk/maint/51
2007-05-18 06:50:22 +02:00
tsmith@quadxeon.mysql.com
ad2b6aea7e my_time.c:
in number_to_datetime(), zero out the MYSQL_TIME structure
  before setting values, to ensure that all fields are initialized; in
  particular, ensure that ->neg is set to zero (fixes valgrind warning
  "Conditional jump ... depends on uninitialised value" in make_date_time)
2007-05-18 06:14:37 +02:00
msvensson@pilot.blaudden
a65d12a830 Backport of TIME->MYSQL_TIME / Y2K fixset
Made year 2000 handling more uniform
Removed year 2000 handling out from calc_days()
The above removes some bugs in date/datetimes with year between 0 and 200
Now we get a note when we insert a datetime value into a date column
For default values to CREATE, don't give errors for warning level NOTE
Fixed some compiler failures
Added library ws2_32 for windows compilation (needed if we want to compile with IOCP support)
Removed duplicate typedef TIME and replaced it with MYSQL_TIME

Better (more complete) fix for: Bug#21103 "DATE column not compared as DATE"
Fixed properly Bug#18997 "DATE_ADD and DATE_SUB perform year2K autoconversion magic on 4-digit year value"
Fixed Bug#23093 "Implicit conversion of 9912101 to date does not match cast(9912101 as date)"
2007-05-16 10:44:59 +02:00
jani@ua141d10.elisa.omakaista.fi
b4ba815967 Merge jamppa@bk-internal.mysql.com:/home/bk/mysql-5.1
into  ua141d10.elisa.omakaista.fi:/home/my/bk/mysql-5.1-marvel
2007-04-10 16:28:47 +03:00
monty@mysql.com/narttu.mysql.fi
5475e8928b Fixed error found by valgrind in numerical date handling
Fixed comments to say MYSQL_TIME instead of old typedef TIME
2007-03-26 13:44:58 +03:00
ramil/ram@mysql.com/ramil.myoffice.izhnet.ru
d0ed1216e2 Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-5.0-maint
into  mysql.com:/home/ram/work/b25301/b25301.5.0
2007-03-26 13:43:20 +05:00
ramil/ram@ramil.myoffice.izhnet.ru
47b07aaa9f Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-5.1-maint
into  mysql.com:/home/ram/work/b25301/b25301.5.1
2007-03-26 13:40:20 +05:00
monty@mysql.com/narttu.mysql.fi
1933603647 Removed not used define YY_MAGIC_BELOW
Made year 2000 handling more uniform
Removed year 2000 handling out from calc_days()
The above removes some bugs in date/datetimes with year between 0 and 200
Now we get a note when we insert a datetime value into a date column
For default values to CREATE, don't give errors for warning level NOTE
Fixed some compiler failures
Added library ws2_32 for windows compilation (needed if we want to compile with IOCP support)
Removed duplicate typedef TIME and replaced it with MYSQL_TIME

Better (more complete) fix for: Bug#21103 "DATE column not compared as DATE"
Fixed properly Bug#18997 "DATE_ADD and DATE_SUB perform year2K autoconversion magic on 4-digit year value"
Fixed Bug#23093 "Implicit conversion of 9912101 to date does not match cast(9912101 as date)"
2007-03-23 22:08:31 +02:00
ramil/ram@mysql.com/ramil.myoffice.izhnet.ru
9900d2f213 Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-5.0-maint
into  mysql.com:/home/ram/work/b23616/b23616.5.0
2007-03-05 12:04:37 +04:00
ramil/ram@ramil.myoffice.izhnet.ru
b69493027e Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-5.1-maint
into  mysql.com:/home/ram/work/b23616/b23616.5.1
2007-03-05 11:57:51 +04:00
ramil/ram@ramil.myoffice.izhnet.ru
363b0b6ff1 Merge mysql.com:/home/ram/work/b23616/b23616.5.0
into  mysql.com:/home/ram/work/b23616/b23616.5.1
2007-03-02 15:13:28 +04:00
ramil/ram@mysql.com/ramil.myoffice.izhnet.ru
4a5dd6956d Merge mysql.com:/home/ram/work/b23616/b23616.4.1
into  mysql.com:/home/ram/work/b23616/b23616.5.0
2007-03-02 15:09:20 +04:00
ramil/ram@ramil.myoffice.izhnet.ru
5add691aa3 Merge mysql.com:/home/ram/work/b25301/b25301.5.0
into  mysql.com:/home/ram/work/b25301/b25301.5.1
2007-02-08 13:02:53 +04:00
ramil/ram@mysql.com/ramil.myoffice.izhnet.ru
33473ac7e5 Merge mysql.com:/home/ram/work/b25301/b25301.4.1
into  mysql.com:/home/ram/work/b25301/b25301.5.0
2007-02-08 12:05:34 +04:00
ramil/ram@mysql.com/ramil.myoffice.izhnet.ru
fab56c1f24 Fix for bug #25301: Non-zero dates with year 0000 are invalid
The 0000 year is valid.
The ISO standard for "Representation of dates and times" says:
"Calendar years are numbered in ascending order according to the 
Gregorian calendar by values in the range [0000] to [9999]."

Reverted fix for 21789: DATETIME with 0000-00-00 11:22:33 should be invalid, but is accepted
as it's not a bug.

Fix for 19370: DateTime datatype in MySQL has two bugs in it
will be reverted during 4.1 -> 5.0 merging as it was pushed to the 
5.0 tree.
2007-02-08 11:56:18 +04:00
monty@narttu.mysql.fi
8a80e36ac3 Merge mysql.com:/home/my/mysql-5.0
into  mysql.com:/home/my/mysql-5.1
Merge of 'remove compiler warnings when using -Wshadow'
2007-01-27 03:46:45 +02:00
monty@mysql.com/narttu.mysql.fi
a04157fbb3 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  mysql.com:/home/my/mysql-5.0
2007-01-22 14:04:40 +02:00
kent@kent-amd64.(none)
58763e383e Merge mysql.com:/home/kent/bk/main/mysql-5.0
into  mysql.com:/home/kent/bk/main/mysql-5.1
2006-12-31 01:32:21 +01:00
kent@mysql.com/kent-amd64.(none)
6523aca729 my_strtoll10-x86.s:
Corrected spelling in copyright text
Makefile.am:
  Don't update the files from BitKeeper
Many files:
  Removed "MySQL Finland AB & TCX DataKonsult AB" from copyright header
  Adjusted year(s) in copyright header 
Many files:
  Added GPL copyright text
Removed files:
  Docs/Support/colspec-fix.pl
  Docs/Support/docbook-fixup.pl
  Docs/Support/docbook-prefix.pl
  Docs/Support/docbook-split
  Docs/Support/make-docbook
  Docs/Support/make-makefile
  Docs/Support/test-make-manual
  Docs/Support/test-make-manual-de
  Docs/Support/xwf
2006-12-31 01:02:27 +01:00
ramil/ram@mysql.com/ramil.myoffice.izhnet.ru
10475626c1 Fix for bug #23616: Week() changed behaviour between 5.0.22 and 5.0.24
Consider double values as legal date{time} function's arguments
(i.e. allow dates in internal format YYYYMMDDHHMMSS.XXXXXX).
2006-12-26 15:08:41 +04:00
kent@kent-amd64.(none)
be15e3bc15 Merge mysql.com:/home/kent/bk/main/mysql-5.0
into  mysql.com:/home/kent/bk/main/mysql-5.1
2006-12-23 20:20:40 +01:00
kent@mysql.com/kent-amd64.(none)
226a5c833f Many files:
Changed header to GPL version 2 only
2006-12-23 20:17:15 +01:00