~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/item/string.h

  • Committer: patrick crews
  • Date: 2011-06-08 03:02:27 UTC
  • mto: This revision was merged to the branch mainline in revision 2329.
  • Revision ID: gleebix@gmail.com-20110608030227-updkyv2652zvfajc
Initial voodoo worked to give us a crashme mode.  Need docs still

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
 
4
 *  Copyright (C) 2008 Sun Microsystems, Inc.
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
 
#ifndef DRIZZLED_ITEM_STRING_H
21
 
#define DRIZZLED_ITEM_STRING_H
 
20
#pragma once
22
21
 
23
22
#include <drizzled/item/basic_constant.h>
 
23
#include <drizzled/charset.h>
24
24
 
25
25
namespace drizzled
26
26
{
29
29
{
30
30
public:
31
31
  Item_string(const char *str,uint32_t length,
32
 
              const CHARSET_INFO * const cs, Derivation dv= DERIVATION_COERCIBLE)
 
32
              const charset_info_st * const cs, Derivation dv= DERIVATION_COERCIBLE)
33
33
    : m_cs_specified(false)
34
34
  {
35
35
    str_value.set_or_copy_aligned(str, length, cs);
48
48
    fixed= 1;
49
49
  }
50
50
  /* Just create an item and do not fill string representation */
51
 
  Item_string(const CHARSET_INFO * const cs, Derivation dv= DERIVATION_COERCIBLE)
 
51
  Item_string(const charset_info_st * const cs, Derivation dv= DERIVATION_COERCIBLE)
52
52
    : m_cs_specified(false)
53
53
  {
54
54
    collation.set(cs, dv);
58
58
    fixed= 1;
59
59
  }
60
60
  Item_string(const char *name_par, const char *str, uint32_t length,
61
 
              const CHARSET_INFO * const cs, Derivation dv= DERIVATION_COERCIBLE)
 
61
              const charset_info_st * const cs, Derivation dv= DERIVATION_COERCIBLE)
62
62
    : m_cs_specified(false)
63
63
  {
64
64
    str_value.set_or_copy_aligned(str, length, cs);
77
77
    assert(fixed == 1);
78
78
    return (String*) &str_value;
79
79
  }
80
 
  my_decimal *val_decimal(my_decimal *);
 
80
  type::Decimal *val_decimal(type::Decimal *);
81
81
  int save_in_field(Field *field, bool no_conversions);
82
82
  enum Item_result result_type () const { return STRING_RESULT; }
83
83
  enum_field_types field_type() const { return DRIZZLE_TYPE_VARCHAR; }
88
88
    return new Item_string(name, str_value.ptr(),
89
89
                           str_value.length(), collation.collation);
90
90
  }
91
 
  Item *safe_charset_converter(const CHARSET_INFO * const tocs);
 
91
  Item *safe_charset_converter(const charset_info_st * const tocs);
92
92
  inline void append(char *str, uint32_t length)
93
93
  {
94
94
    str_value.append(str, length);
95
95
    max_length= str_value.numchars() * collation.collation->mbmaxlen;
96
96
  }
97
 
  virtual void print(String *str, enum_query_type query_type);
 
97
  virtual void print(String *str);
98
98
 
99
99
  /**
100
100
    Return true if character-set-introducer was explicitly specified in the
145
145
  const char *func_name;
146
146
public:
147
147
  Item_static_string_func(const char *name_par, const char *str, uint32_t length,
148
 
                          const CHARSET_INFO * const cs,
 
148
                          const charset_info_st * const cs,
149
149
                          Derivation dv= DERIVATION_COERCIBLE)
150
150
    :Item_string(NULL, str, length, cs, dv), func_name(name_par)
151
151
  {}
152
 
  Item *safe_charset_converter(const CHARSET_INFO * const tocs);
 
152
  Item *safe_charset_converter(const charset_info_st * const tocs);
153
153
 
154
 
  virtual inline void print(String *str, enum_query_type)
 
154
  virtual inline void print(String *str)
155
155
  {
156
156
    str->append(func_name);
157
157
  }
159
159
 
160
160
} /* namespace drizzled */
161
161
 
162
 
#endif /* DRIZZLED_ITEM_STRING_H */