~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/tztime.h

  • Committer: Stewart Smith
  • Author(s): Marko Mäkelä, Stewart Smith
  • Date: 2010-11-17 05:52:09 UTC
  • mto: (2021.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 1971.
  • Revision ID: stewart@flamingspork.com-20101117055209-69m035q6h7e1txrc
Merge Revision revid:marko.makela@oracle.com-20100629113248-fvl48lnzr44z94gg from MySQL InnoDB

Original revid:marko.makela@oracle.com-20100629113248-fvl48lnzr44z94gg

Original Authors: Marko Mkel <marko.makela@oracle.com>
Original commit message:
Bug#52199 utf32: mbminlen=4, mbmaxlen=4, type->mbminlen=0, type->mbmaxlen=4

Merge and adjust a forgotten change to fix this bug.
rb://393 approved by Jimmy Yang
  ------------------------------------------------------------------------
  r3794 | marko | 2009-01-07 14:14:53 +0000 (Wed, 07 Jan 2009) | 18 lines

  branches/6.0: Allow the minimum length of a multi-byte character to be
  up to 4 bytes. (Bug #35391)

  dtype_t, dict_col_t: Replace mbminlen:2, mbmaxlen:3 with mbminmaxlen:5.
  In this way, the 5 bits can hold two values of 0..4, and the storage size
  of the fields will not cross the 64-bit boundary.  Encode the values as
  DATA_MBMAX * mbmaxlen + mbminlen.  Define the auxiliary macros
  DB_MBMINLEN(mbminmaxlen), DB_MBMAXLEN(mbminmaxlen), and
  DB_MINMAXLEN(mbminlen, mbmaxlen).

  Try to trim and pad UTF-16 and UTF-32 with spaces as appropriate.

  Alexander Barkov suggested the use of cs->cset->fill(cs, buff, len, 0x20).
  ha_innobase::store_key_val_for_row() now does that, but the added function
  row_mysql_pad_col() does not, because it doesn't have the MySQL TABLE object.

  rb://49 approved by Heikki Tuuri
  ------------------------------------------------------------------------

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2008 Sun Microsystems, Inc.
 
4
 *  Copyright (C) 2008 Sun Microsystems
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
21
21
#ifndef DRIZZLED_TZTIME_H
22
22
#define DRIZZLED_TZTIME_H
23
23
 
24
 
#include <drizzled/memory/sql_alloc.h>
25
 
#include <drizzled/type/time.h>
 
24
#if TIME_WITH_SYS_TIME
 
25
# include <sys/time.h>
 
26
# include <time.h>
 
27
#else
 
28
# if HAVE_SYS_TIME_H
 
29
#  include <sys/time.h>
 
30
# else
 
31
#  include <time.h>
 
32
# endif
 
33
#endif
26
34
 
27
 
#include "drizzled/type/time.h"
 
35
#include "drizzled/memory/sql_alloc.h"
28
36
 
29
37
namespace drizzled
30
38
{
31
39
 
32
40
class String;
 
41
typedef struct st_drizzle_time DRIZZLE_TIME;
33
42
 
34
43
/**
35
44
  This class represents abstract time zone and provides
36
 
  basic interface for type::Time <-> type::Time::epoch_t conversion.
 
45
  basic interface for DRIZZLE_TIME <-> time_t conversion.
37
46
  Actual time zones which are specified by DB, or via offset
38
47
  or use system functions are its descendants.
39
48
*/
42
51
public:
43
52
  Time_zone() {}                              /* Remove gcc warning */
44
53
  /**
45
 
    Converts local time in broken down type::Time representation to
46
 
    type::Time::epoch_t (UTC seconds since Epoch) represenation.
 
54
    Converts local time in broken down DRIZZLE_TIME representation to
 
55
    time_t (UTC seconds since Epoch) represenation.
47
56
    Returns 0 in case of error. Sets in_dst_time_gap to true if date provided
48
57
    falls into spring time-gap (or lefts it untouched otherwise).
49
58
  */
50
 
  virtual type::Time::epoch_t TIME_to_gmt_sec(const type::Time &t,
51
 
                                              bool *in_dst_time_gap) const = 0;
 
59
  virtual time_t TIME_to_gmt_sec(const DRIZZLE_TIME *t,
 
60
                                 bool *in_dst_time_gap) const = 0;
52
61
  /**
53
 
    Converts time in type::Time::epoch_t representation to local time in
54
 
    broken down type::Time representation.
 
62
    Converts time in time_t representation to local time in
 
63
    broken down DRIZZLE_TIME representation.
55
64
  */
56
 
  virtual void gmt_sec_to_TIME(type::Time &tmp, type::Time::epoch_t t) const = 0;
57
 
 
 
65
  virtual void   gmt_sec_to_TIME(DRIZZLE_TIME *tmp, time_t t) const = 0;
58
66
  /**
59
67
    Because of constness of String returned by get_name() time zone name
60
68
    have to be already zeroended to be able to use String::ptr() instead
70
78
};
71
79
 
72
80
extern Time_zone * my_tz_SYSTEM;
73
 
Time_zone * my_tz_find(Session *session, const String *name);
74
 
bool     my_tz_init(Session *org_session, const char *default_tzname);
 
81
extern Time_zone * my_tz_find(Session *session, const String *name);
 
82
extern bool     my_tz_init(Session *org_session, const char *default_tzname);
75
83
 
76
84
} /* namespace drizzled */
77
85