~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/function/time/month.cc

  • Committer: Brian Aker
  • Date: 2010-12-08 18:53:46 UTC
  • mto: This revision was merged to the branch mainline in revision 1983.
  • Revision ID: brian@tangent.org-20101208185346-89uak2ofyivk1yss
Update schema, make sure that it always ruturns a valid string (it just
makes the entire interface simpler to use).

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
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#include <config.h>
 
20
#include "config.h"
21
21
 
22
 
#include <drizzled/temporal.h>
23
 
#include <drizzled/error.h>
24
 
#include <drizzled/session.h>
25
 
#include <drizzled/function/time/month.h>
26
 
#include <drizzled/typelib.h>
 
22
#include "drizzled/temporal.h"
 
23
#include "drizzled/error.h"
 
24
#include "drizzled/session.h"
 
25
#include "drizzled/function/time/month.h"
27
26
 
28
27
namespace drizzled
29
28
{
117
116
  }
118
117
  const char *month_name;
119
118
  uint32_t   month= (uint) val_int();
 
119
  Session *session= current_session;
120
120
 
121
121
  if (null_value || !month)
122
122
  {
124
124
    return (String*) 0;
125
125
  }
126
126
  null_value=0;
127
 
  month_name= getSession().variables.lc_time_names->month_names->type_names[month-1];
 
127
  month_name= session->variables.lc_time_names->month_names->type_names[month-1];
128
128
  str->set(month_name, strlen(month_name), system_charset_info);
129
129
  return str;
130
130
}