~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/tztime.cc

  • Committer: Andrew Hutchings
  • Date: 2011-02-02 12:51:57 UTC
  • mto: (2157.1.1 build)
  • mto: This revision was merged to the branch mainline in revision 2158.
  • Revision ID: andrew@linuxjedi.co.uk-20110202125157-r6thh7ox4g9l90ec
Make transaction_message_threshold a read-only global variable instead of a per-session variable
Make replication_dictionary column lengths use transation_message_threshold

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 */
19
19
 
20
20
 
21
 
#include <config.h>
 
21
#include "config.h"
22
22
#include <cstdio>
23
 
#include <drizzled/tztime.h>
24
 
#include <drizzled/gettext.h>
25
 
#include <drizzled/session.h>
26
 
#include <drizzled/time_functions.h>
 
23
#include "drizzled/tzfile.h"
 
24
#include "drizzled/tztime.h"
 
25
#include "drizzled/gettext.h"
 
26
#include "drizzled/session.h"
 
27
#include "drizzled/time_functions.h"
27
28
 
28
29
namespace drizzled
29
30
{
127
128
 
128
129
Time_zone *my_tz_SYSTEM= &tz_SYSTEM;
129
130
 
 
131
 
 
132
/**
 
133
 * @brief
 
134
 * Initialize time zone support infrastructure.
 
135
 *
 
136
 * @details
 
137
 * This function will init memory structures needed for time zone support,
 
138
 * it will register mandatory SYSTEM time zone in them. It will try to open
 
139
 * mysql.time_zone* tables and load information about default time zone and
 
140
 * information which further will be shared among all time zones loaded.
 
141
 * If system tables with time zone descriptions don't exist it won't fail
 
142
 * (unless default_tzname is time zone from tables). If bootstrap parameter
 
143
 * is true then this routine assumes that we are in bootstrap mode and won't
 
144
 * load time zone descriptions unless someone specifies default time zone
 
145
 * which is supposedly stored in those tables.
 
146
 * It'll also set default time zone if it is specified.
 
147
 *
 
148
 * @param   session            current thread object
 
149
 * @param   default_tzname     default time zone or 0 if none.
 
150
 * @param   bootstrap          indicates whenever we are in bootstrap mode
 
151
 *
 
152
 * @return
 
153
 *  0 - ok
 
154
 *  1 - Error
 
155
 */
 
156
bool
 
157
my_tz_init(Session *session, const char *default_tzname)
 
158
{
 
159
  if (default_tzname)
 
160
  {
 
161
    String tmp_tzname2(default_tzname, &my_charset_utf8_general_ci);
 
162
    /*
 
163
      Time zone tables may be open here, and my_tz_find() may open
 
164
      most of them once more, but this is OK for system tables open
 
165
      for READ.
 
166
    */
 
167
    if (!(global_system_variables.time_zone= my_tz_find(session, &tmp_tzname2)))
 
168
    {
 
169
      errmsg_printf(ERRMSG_LVL_ERROR,
 
170
                    _("Fatal error: Illegal or unknown default time zone '%s'"),
 
171
                    default_tzname);
 
172
      return true;
 
173
    }
 
174
  }
 
175
 
 
176
  return false;
 
177
}
 
178
 
 
179
/**
 
180
 * @brief
 
181
 * Get Time_zone object for specified time zone.
 
182
 *
 
183
 * @todo
 
184
 * Not implemented yet. This needs to hook into some sort of OS system call.
 
185
 */
 
186
Time_zone *
 
187
my_tz_find(Session *,
 
188
           const String *)
 
189
{
 
190
  return NULL;
 
191
}
 
192
 
130
193
} /* namespace drizzled */