~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field/ipv6.h

  • Committer: Mark Atwood
  • Date: 2011-08-17 06:03:11 UTC
  • mfrom: (2398.1.1 drizzle-IPv6Address)
  • Revision ID: me@mark.atwood.name-20110817060311-ujuf1695rwsnfowu
mergeĀ lp:~mumair/drizzle/drizzle-IPV6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
  Original copyright header listed below. This comes via rsync.
 
3
  Any additional changes are provided via the same license as the original.
 
4
 
 
5
  Copyright (C) 2011 Muhammad Umair
 
6
 
 
7
*/
 
8
/*
 
9
 * Copyright (C) 1996-2001  Internet Software Consortium.
 
10
 *
 
11
 * Permission to use, copy, modify, and distribute this software for any
 
12
 * purpose with or without fee is hereby granted, provided that the above
 
13
 * copyright notice and this permission notice appear in all copies.
 
14
 *
 
15
 * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
 
16
 * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
 
17
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
 
18
 * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
 
19
 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
 
20
 * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
 
21
 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
 
22
 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
23
 */
 
24
 
 
25
#pragma once
 
26
 
 
27
#include <drizzled/field.h>
 
28
#include <string>
 
29
 
 
30
#include <drizzled/type/ipv6.h>
 
31
 
 
32
namespace drizzled
 
33
{
 
34
namespace field
 
35
{
 
36
 
 
37
class IPv6:public Field {
 
38
  const charset_info_st *field_charset;
 
39
 
 
40
public:
 
41
  IPv6(unsigned char *ptr_arg,
 
42
            uint32_t len_arg,
 
43
            unsigned char *null_ptr_arg,
 
44
            unsigned char null_bit_arg,
 
45
            const char *field_name_arg);
 
46
 
 
47
  enum_field_types type() const { return DRIZZLE_TYPE_IPV6; }
 
48
  enum ha_base_keytype key_type() const { return HA_KEYTYPE_BINARY; }
 
49
  bool zero_pack() const { return 0; }
 
50
  int  reset(void) { memset(ptr, 0, type::IPv6::LENGTH); return 0; }
 
51
  uint32_t pack_length() const { return type::IPv6::LENGTH; }
 
52
  uint32_t key_length() const { return type::IPv6::LENGTH; }
 
53
 
 
54
  int  store(const char *to,uint32_t length, const charset_info_st * const charset);
 
55
  int  store(int64_t nr, bool unsigned_val);
 
56
  double val_real() const;
 
57
  int64_t val_int() const;
 
58
  String *val_str(String*,String *) const;
 
59
  void sql_type(drizzled::String&)  const;
 
60
  int store_decimal(const drizzled::type::Decimal*);
 
61
 
 
62
  Item_result result_type () const { return STRING_RESULT; }
 
63
  int cmp(const unsigned char*, const unsigned char*);
 
64
  void sort_string(unsigned char*, uint32_t);
 
65
  uint32_t max_display_length() { return type::IPv6::IPV6_DISPLAY_LENGTH; }
 
66
 
 
67
  int  store(double ) { return 0; }
 
68
  inline String *val_str(String *str) { return val_str(str, str); }
 
69
  uint32_t size_of() const { return sizeof(*this); }
 
70
 
 
71
  static size_t max_string_length()
 
72
  {
 
73
    return type::IPv6::LENGTH;
 
74
  }
 
75
};
 
76
 
 
77
} /* namespace field */
 
78
} /* namespace drizzled */
 
79
 
 
80