mirror of
				https://github.com/MariaDB/server.git
				synced 2025-10-31 15:50:51 +03:00 
			
		
		
		
	 a65d12a830
			
		
	
	a65d12a830
	
	
	
		
			
			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)"
		
			
				
	
	
		
			78 lines
		
	
	
		
			2.8 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			78 lines
		
	
	
		
			2.8 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| /* Copyright (C) 2004 MySQL AB
 | |
| 
 | |
|    This program is free software; you can redistribute it and/or modify
 | |
|    it under the terms of the GNU General Public License as published by
 | |
|    the Free Software Foundation; version 2 of the License.
 | |
| 
 | |
|    This program is distributed in the hope that it will be useful,
 | |
|    but WITHOUT ANY WARRANTY; without even the implied warranty of
 | |
|    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | |
|    GNU General Public License for more details.
 | |
| 
 | |
|    You should have received a copy of the GNU General Public License
 | |
|    along with this program; if not, write to the Free Software
 | |
|    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 | |
| 
 | |
| 
 | |
| #ifdef USE_PRAGMA_INTERFACE
 | |
| #pragma interface			/* gcc class interface */
 | |
| #endif
 | |
| 
 | |
| #if !defined(TESTTIME) && !defined(TZINFO2SQL)
 | |
| 
 | |
| /*
 | |
|   This class represents abstract time zone and provides 
 | |
|   basic interface for MYSQL_TIME <-> my_time_t conversion.
 | |
|   Actual time zones which are specified by DB, or via offset 
 | |
|   or use system functions are its descendants.
 | |
| */
 | |
| class Time_zone: public Sql_alloc 
 | |
| {
 | |
| public:
 | |
|   Time_zone() {}                              /* Remove gcc warning */
 | |
|   /*
 | |
|     Converts local time in broken down MYSQL_TIME representation to 
 | |
|     my_time_t (UTC seconds since Epoch) represenation.
 | |
|     Returns 0 in case of error. Sets in_dst_time_gap to true if date provided
 | |
|     falls into spring time-gap (or lefts it untouched otherwise).
 | |
|   */
 | |
|   virtual my_time_t TIME_to_gmt_sec(const MYSQL_TIME *t, 
 | |
|                                     my_bool *in_dst_time_gap) const = 0;
 | |
|   /*
 | |
|     Converts time in my_time_t representation to local time in
 | |
|     broken down MYSQL_TIME representation.
 | |
|   */
 | |
|   virtual void   gmt_sec_to_TIME(MYSQL_TIME *tmp, my_time_t t) const = 0;
 | |
|   /*
 | |
|     Because of constness of String returned by get_name() time zone name 
 | |
|     have to be already zeroended to be able to use String::ptr() instead
 | |
|     of c_ptr().
 | |
|   */
 | |
|   virtual const String * get_name() const = 0;
 | |
| 
 | |
|   /* 
 | |
|     We need this only for surpressing warnings, objects of this type are
 | |
|     allocated on MEM_ROOT and should not require destruction.
 | |
|   */
 | |
|   virtual ~Time_zone() {};
 | |
| };
 | |
| 
 | |
| extern Time_zone * my_tz_UTC;
 | |
| extern Time_zone * my_tz_SYSTEM;
 | |
| extern Time_zone * my_tz_find(THD *thd, const String *name);
 | |
| extern my_bool     my_tz_init(THD *org_thd, const char *default_tzname, my_bool bootstrap);
 | |
| extern void        my_tz_free();
 | |
| extern my_time_t   sec_since_epoch_TIME(MYSQL_TIME *t);
 | |
| 
 | |
| /*
 | |
|   Number of elements in table list produced by my_tz_get_table_list()
 | |
|   (this table list contains tables which are needed for dynamical loading
 | |
|   of time zone descriptions). Actually it is imlementation detail that
 | |
|   should not be used anywhere outside of tztime.h and tztime.cc.
 | |
| */
 | |
| 
 | |
| static const int MY_TZ_TABLES_COUNT= 4;
 | |
| 
 | |
| 
 | |
| #endif /* !defined(TESTTIME) && !defined(TZINFO2SQL) */
 |