~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/item/string.cc

Merge Stewart.

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
29
29
Item *Item_string::safe_charset_converter(const CHARSET_INFO * const tocs)
30
30
{
31
31
  Item_string *conv;
32
 
  size_t conv_errors;
 
32
  uint32_t conv_errors;
33
33
  char *ptr;
34
34
  String tmp, cstr, *ostr= val_str(&tmp);
35
35
  cstr.copy(ostr->ptr(), ostr->length(), ostr->charset(), tocs, &conv_errors);
45
45
    */
46
46
    return NULL;
47
47
  }
48
 
 
49
 
  if (!(ptr= getSession().strmake(cstr.ptr(), cstr.length())))
 
48
  if (!(ptr= current_session->strmake(cstr.ptr(), cstr.length())))
50
49
    return NULL;
51
 
 
52
50
  conv->str_value.set(ptr, cstr.length(), cstr.charset());
53
51
  /* Ensure that no one is going to change the result string */
54
52
  conv->str_value.mark_as_const();
59
57
Item *Item_static_string_func::safe_charset_converter(const CHARSET_INFO * const tocs)
60
58
{
61
59
  Item_string *conv;
62
 
  size_t conv_errors;
 
60
  uint32_t conv_errors;
63
61
  String tmp, cstr, *ostr= val_str(&tmp);
64
62
  cstr.copy(ostr->ptr(), ostr->length(), ostr->charset(), tocs, &conv_errors);
65
63
  if (conv_errors ||
127
125
      We can use str_value.ptr() here as Item_string is gurantee to put an
128
126
      end \0 here.
129
127
    */
130
 
    push_warning_printf(&getSession(), DRIZZLE_ERROR::WARN_LEVEL_WARN,
 
128
    push_warning_printf(current_session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
131
129
                        ER_TRUNCATED_WRONG_VALUE,
132
130
                        ER(ER_TRUNCATED_WRONG_VALUE), "DOUBLE",
133
131
                        str_value.ptr());
156
154
  if (err > 0 ||
157
155
      (end != org_end && !check_if_only_end_space(cs, end, org_end)))
158
156
  {
159
 
    push_warning_printf(&getSession(), DRIZZLE_ERROR::WARN_LEVEL_WARN,
 
157
    push_warning_printf(current_session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
160
158
                        ER_TRUNCATED_WRONG_VALUE,
161
159
                        ER(ER_TRUNCATED_WRONG_VALUE), "INTEGER",
162
160
                        str_value.ptr());
164
162
  return tmp;
165
163
}
166
164
 
167
 
type::Decimal *Item_string::val_decimal(type::Decimal *decimal_value)
 
165
my_decimal *Item_string::val_decimal(my_decimal *decimal_value)
168
166
{
169
167
  return val_decimal_from_string(decimal_value);
170
168
}