MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VerifyNdbApi.cpp
1 /*
2  Copyright (C) 2003-2006 MySQL AB
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 
20 #include <NdbApi.hpp>
21 #include <NdbOut.hpp>
22 #include <NdbMutex.h>
23 
24 #include "VerifyNdbApi.hpp"
25 
26 
27 NdbMutex* g_pNdbMutexVerify = 0;
28 
29 
30 void VerifyBegin(void)
31 {
32  if(!g_pNdbMutexVerify)
33  {
34  g_pNdbMutexVerify = NdbMutex_Create();
35  }
36  NdbMutex_Lock(g_pNdbMutexVerify);
37 }
38 
39 void VerifyEnd(void)
40 {
41  NdbMutex_Unlock(g_pNdbMutexVerify);
42 }
43 
44 
45 
46 void CVerifyNdbSchemaOp::VerifyIntError(const int i, const char* szMethod)
47 {
48  VerifyBegin();
49  ndbout << "NdbSchemaOp::" << szMethod << " returned " << dec << i;
50  ndbout << " : " << dec << getNdbError().code << " : " << getNdbError().message << endl;
51  VerifyEnd();
52 }
53 
54 
55 void CVerifyNdbSchemaCon::VerifyIntError(const int i, const char* szMethod)
56 {
57  VerifyBegin();
58  ndbout << "NdbSchemaCon::" << szMethod << " returned " << dec << i;
59  ndbout << " : " << dec << getNdbError().code << " : " << getNdbError().message << endl;
60  VerifyEnd();
61 }
62 
63 
64 void CVerifyNdbSchemaCon::VerifyPtrError(void* p, const char* szMethod)
65 {
66  VerifyBegin();
67  ndbout << "NdbSchemaCon::" << szMethod << " returned " << hex << (Uint32)p;
68  ndbout << " : " << dec << getNdbError().code << " : " << getNdbError().message << endl;
69  VerifyEnd();
70 }
71 
72 
73 void CVerifyNdbRecAttr::VerifyValueError(const int iNull, const char* szMethod)
74 {
75  VerifyBegin();
76  ndbout << "NdbRecAttr::" << szMethod << " : isNULL() returned " << dec << iNull;
77  ndbout << endl;
78  VerifyEnd();
79 }
80 
81 
82 void CVerifyNdbOperation::VerifyIntError(const int i, const char* szMethod)
83 {
84  VerifyBegin();
85  ndbout << "NdbOperation::" << szMethod << " returned " << dec << i;
86  ndbout << " : " << dec << getNdbError().code << " : " << getNdbError().message << endl;
87  VerifyEnd();
88 }
89 
90 
91 void CVerifyNdbOperation::VerifyPtrError(void* p, const char* szMethod)
92 {
93  VerifyBegin();
94  ndbout << "NdbOperation::" << szMethod << " returned " << hex << (Uint32)p;
95  ndbout << " : " << dec << getNdbError().code << " : " << getNdbError().message << endl;
96  VerifyEnd();
97 }
98 
99 
100 void CVerifyNdbIndexOperation::VerifyIntError(const int i, const char* szMethod)
101 {
102  VerifyBegin();
103  ndbout << "NdbIndexOperation::" << szMethod << " returned " << dec << i;
104  ndbout << " : " << dec << getNdbError().code << " : " << getNdbError().message << endl;
105  VerifyEnd();
106 }
107 
108 
109 void CVerifyNdbIndexOperation::VerifyPtrError(void* p, const char* szMethod)
110 {
111  VerifyBegin();
112  ndbout << "NdbIndexOperation::" << szMethod << " returned " << hex << (Uint32)p;
113  ndbout << " : " << dec << getNdbError().code << " : " << getNdbError().message << endl;
114  VerifyEnd();
115 }
116 
117 
118 void CVerifyNdbConnection::VerifyIntError(const int i, const char* szMethod)
119 {
120  VerifyBegin();
121  ndbout << "NdbConnection::" << szMethod << " returned " << dec << i;
122  ndbout << " : " << dec << getNdbError().code << " : " << getNdbError().message << endl;
123  VerifyEnd();
124 }
125 
126 
127 void CVerifyNdbConnection::VerifyPtrError(void* p, const char* szMethod)
128 {
129  VerifyBegin();
130  ndbout << "NdbConnection::" << szMethod << " returned " << hex << (Uint32)p;
131  ndbout << " : " << dec << getNdbError().code << " : " << getNdbError().message << endl;
132  VerifyEnd();
133 }
134 
135 
136 void CVerifyNdb::VerifyPtrError(void* p, const char* szMethod)
137 {
138  VerifyBegin();
139  ndbout << "Ndb::" << szMethod << " returned " << hex << (Uint32)p;
140  ndbout << " : " << dec << getNdbError().code << " : " << getNdbError().message << endl;
141  VerifyEnd();
142 }
143 
144 
145 void CVerifyNdb::VerifyVoidError(const int iCode, const char* szMethod)
146 {
147  VerifyBegin();
148  ndbout << "Ndb::" << szMethod << " : getNdbError().code returned " << dec << iCode;
149  ndbout << " : " << getNdbError().message << endl;
150  VerifyEnd();
151 }
152 
153