MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NdbInfoRecAttr.hpp
1 /*
2  Copyright 2009, 2010 Sun Microsystems, Inc.
3  All rights reserved. Use is subject to license terms.
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; version 2 of the License.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program; if not, write to the Free Software
16  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 #ifndef NdbInfoRecAttr_H
20 #define NdbInfoRecAttr_H
21 
23 public:
24  const void* ptr() const {
25  return m_data;
26  }
27 
28  Uint32 u_32_value() const {
29  assert(m_len == sizeof(Uint32));
30  return *((Uint32 *) m_data);
31  }
32 
33  Uint64 u_64_value() const {
34  Uint64 val;
35  assert(m_len == sizeof(Uint64));
36  memcpy(&val, m_data, sizeof(Uint64));
37  return val;
38  }
39 
40  const char* c_str() const {
41  assert(m_len > 0);
42  return m_data;
43  }
44 
45  Uint32 length() const {
46  return m_len;
47  }
48 
49  bool isNULL() const {
50  return !m_defined;
51  }
52 
53 protected:
54  friend class NdbInfoScanOperation;
55  NdbInfoRecAttr() : m_data(NULL), m_len(0), m_defined(false) {};
56  ~NdbInfoRecAttr() {};
57 private:
58  const char* m_data;
59  Uint32 m_len;
60  bool m_defined;
61 };
62 
63 #endif