~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field/str.h

  • Committer: Monty Taylor
  • Date: 2008-11-19 08:07:10 UTC
  • mto: (589.1.3 devel)
  • mto: This revision was merged to the branch mainline in revision 590.
  • Revision ID: monty@inaugust.com-20081119080710-wjyg9i0hcfddzss4
Removed field includes from field.h.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
#ifndef DRIZZLE_SERVER_FIELD_STR
22
22
#define DRIZZLE_SERVER_FIELD_STR
23
23
 
 
24
#include <drizzled/field.h>
 
25
 
 
26
typedef struct charset_info_st CHARSET_INFO;
 
27
 
24
28
/* base class for all string related classes */
25
29
 
26
30
class Field_str :public Field {
28
32
  const CHARSET_INFO *field_charset;
29
33
  enum Derivation field_derivation;
30
34
public:
31
 
  Field_str(unsigned char *ptr_arg,uint32_t len_arg, unsigned char *null_ptr_arg,
 
35
  Field_str(unsigned char *ptr_arg,uint32_t len_arg,
 
36
            unsigned char *null_ptr_arg,
32
37
            unsigned char null_bit_arg, utype unireg_check_arg,
33
38
            const char *field_name_arg, const CHARSET_INFO * const charset);
34
39
  Item_result result_type () const { return STRING_RESULT; }
39
44
  int  store(const char *to,uint32_t length, const CHARSET_INFO * const cs)=0;
40
45
  uint32_t size_of() const { return sizeof(*this); }
41
46
  const CHARSET_INFO *charset(void) const { return field_charset; }
42
 
  void set_charset(const CHARSET_INFO * const charset_arg) { field_charset= charset_arg; }
 
47
  void set_charset(const CHARSET_INFO * const charset_arg)
 
48
  { field_charset= charset_arg; }
43
49
  enum Derivation derivation(void) const { return field_derivation; }
44
50
  virtual void set_derivation(enum Derivation derivation_arg)
45
51
  { field_derivation= derivation_arg; }
52
58
  uint32_t is_equal(Create_field *new_field);
53
59
};
54
60
 
 
61
/*
 
62
  Report "not well formed" or "cannot convert" error
 
63
  after storing a character string info a field.
 
64
 
 
65
  SYNOPSIS
 
66
    check_string_copy_error()
 
67
    field                    - Field
 
68
    well_formed_error_pos    - where not well formed data was first met
 
69
    cannot_convert_error_pos - where a not-convertable character was first met
 
70
    end                      - end of the string
 
71
    cs                       - character set of the string
 
72
 
 
73
  NOTES
 
74
    As of version 5.0 both cases return the same error:
 
75
 
 
76
      "Invalid string value: 'xxx' for column 't' at row 1"
 
77
 
 
78
  Future versions will possibly introduce a new error message:
 
79
 
 
80
      "Cannot convert character string: 'xxx' for column 't' at row 1"
 
81
 
 
82
  RETURN
 
83
    false - If errors didn't happen
 
84
    true  - If an error happened
 
85
*/
 
86
 
 
87
bool check_string_copy_error(Field_str *field,
 
88
                             const char *well_formed_error_pos,
 
89
                             const char *cannot_convert_error_pos,
 
90
                             const char *end,
 
91
                             const CHARSET_INFO * const cs);
 
92
 
 
93
 
55
94
#endif