~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/item/hex_string.cc

  • Committer: Mark Atwood
  • Date: 2011-08-11 03:05:03 UTC
  • mfrom: (2385.1.12 refactor4)
  • Revision ID: me@mark.atwood.name-20110811030503-rp9xjihc5x3y0x4q
mergeĀ lp:~olafvdspek/drizzle/refactor4

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
22
#include <drizzled/error.h>
23
23
#include <drizzled/field.h>
29
29
 
30
30
using namespace std;
31
31
 
32
 
namespace drizzled
33
 
{
 
32
namespace drizzled {
34
33
 
35
 
static char _dig_vec_lower[] =
36
 
  "0123456789abcdefghijklmnopqrstuvwxyz";
 
34
static char _dig_vec_lower[] = "0123456789abcdefghijklmnopqrstuvwxyz";
37
35
 
38
36
inline uint32_t char_val(char X)
39
37
{
90
88
{
91
89
  field->set_notnull();
92
90
  if (field->result_type() == STRING_RESULT)
93
 
    return field->store(str_value.ptr(), str_value.length(),
94
 
                        collation.collation);
 
91
    return field->store(str_value.ptr(), str_value.length(), collation.collation);
95
92
 
96
93
  uint64_t nr;
97
94
  uint32_t length= str_value.length();
110
107
 
111
108
warn:
112
109
  if (!field->store((int64_t) nr, true))
113
 
    field->set_warning(DRIZZLE_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE,
114
 
                       1);
 
110
    field->set_warning(DRIZZLE_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
115
111
  return 1;
116
112
}
117
113
 
118
 
void Item_hex_string::print(String *str, enum_query_type)
 
114
void Item_hex_string::print(String *str)
119
115
{
120
116
  char *end= (char*) str_value.ptr() + str_value.length(),
121
117
       *ptr= end - min(str_value.length(), sizeof(int64_t));
139
135
  return false;
140
136
}
141
137
 
142
 
Item *Item_hex_string::safe_charset_converter(const CHARSET_INFO * const tocs)
 
138
Item *Item_hex_string::safe_charset_converter(const charset_info_st* tocs)
143
139
{
144
 
  Item_string *conv;
145
140
  String tmp, *str= val_str(&tmp);
146
 
 
147
 
  if (!(conv= new Item_string(str->ptr(), str->length(), tocs)))
148
 
    return NULL;
 
141
  Item_string* conv= new Item_string(str->ptr(), str->length(), tocs);
149
142
  conv->str_value.copy();
150
143
  conv->str_value.mark_as_const();
151
144
  return conv;