~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/function/str/set_collation.cc

Merged from Toru - removal of my_time_t.

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 <drizzled/server_includes.h>
 
21
#include CSTDINT_H
21
22
#include <drizzled/function/str/set_collation.h>
22
23
#include <drizzled/error.h>
23
 
#include <drizzled/charset.h>
24
 
 
25
 
namespace drizzled
26
 
{
27
 
 
28
 
static const char *binary_keyword= "BINARY";
29
24
 
30
25
String *Item_func_set_collation::val_str(String *str)
31
26
{
44
39
  String tmp, *str= args[1]->val_str(&tmp);
45
40
  colname= str->c_ptr();
46
41
  if (colname == binary_keyword)
47
 
    set_collation= get_charset_by_csname(args[0]->collation.collation->csname, MY_CS_BINSORT);
 
42
    set_collation= get_charset_by_csname(args[0]->collation.collation->csname,
 
43
                                         MY_CS_BINSORT,MYF(0));
48
44
  else
49
45
  {
50
 
    if (!(set_collation= get_charset_by_name(colname)))
 
46
    if (!(set_collation= get_charset_by_name(colname,MYF(0))))
51
47
    {
52
48
      my_error(ER_UNKNOWN_COLLATION, MYF(0), colname);
53
49
      return;
61
57
             colname, args[0]->collation.collation->csname);
62
58
    return;
63
59
  }
64
 
  collation.set(set_collation, DERIVATION_EXPLICIT);
 
60
  collation.set(set_collation, DERIVATION_EXPLICIT,
 
61
                args[0]->collation.repertoire);
65
62
  max_length= args[0]->max_length;
66
63
}
67
64
 
96
93
  str->append(')');
97
94
}
98
95
 
99
 
} /* namespace drizzled */
100
96
 
101
97