Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
3327c6c0
Commit
3327c6c0
authored
Jun 04, 2004
by
tomas@poseidon.bredbandsbolaget.se
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added operator<< for NdbRecAttr and removed attrtype from Event impl
parent
a481c4aa
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
90 additions
and
61 deletions
+90
-61
ndb/include/ndbapi/NdbRecAttr.hpp
ndb/include/ndbapi/NdbRecAttr.hpp
+2
-0
ndb/src/ndbapi/NdbEventOperationImpl.cpp
ndb/src/ndbapi/NdbEventOperationImpl.cpp
+1
-59
ndb/src/ndbapi/NdbEventOperationImpl.hpp
ndb/src/ndbapi/NdbEventOperationImpl.hpp
+0
-1
ndb/src/ndbapi/NdbRecAttr.cpp
ndb/src/ndbapi/NdbRecAttr.cpp
+87
-1
No files found.
ndb/include/ndbapi/NdbRecAttr.hpp
View file @
3327c6c0
...
...
@@ -475,5 +475,7 @@ NdbRecAttr::isNULL() const
return
theNULLind
;
}
class
NdbOut
&
operator
<<
(
class
NdbOut
&
,
const
NdbRecAttr
&
);
#endif
ndb/src/ndbapi/NdbEventOperationImpl.cpp
View file @
3327c6c0
...
...
@@ -499,8 +499,7 @@ NdbEventOperationImpl::print()
NdbRecAttr
*
p
=
theFirstRecAttrs
[
i
];
ndbout
<<
" %u "
<<
i
;
while
(
p
)
{
ndbout
<<
" : "
<<
p
->
attrId
()
<<
" = "
;
printRecAttr
(
p
);
ndbout
<<
" : "
<<
p
->
attrId
()
<<
" = "
<<
*
p
;
p
=
p
->
next
();
}
ndbout
<<
"
\n
"
;
...
...
@@ -1248,60 +1247,3 @@ NdbGlobalEventBuffer::real_wait(NdbGlobalEventBufferHandle *h,
n
+=
hasData
(
h
->
m_bufferIds
[
i
]);
return
n
;
}
/**
* TODO Change this function to use the real datatypes
* from NdbDictionary alternatively make a
* "printer" in NdbRecAttr that can be used from all programs
*/
// and remove this include
#include "NdbSchemaOp.hpp"
void
NdbEventOperationImpl
::
printRecAttr
(
NdbRecAttr
*
p
)
{
int
size
=
p
->
attrSize
();
int
aSize
=
p
->
arraySize
();
switch
(
convertColumnTypeToAttrType
(
p
->
getType
())){
case
UnSigned
:
switch
(
size
)
{
case
8
:
ndbout
<<
p
->
u_64_value
();
break
;
case
4
:
ndbout
<<
p
->
u_32_value
();
break
;
case
2
:
ndbout
<<
p
->
u_short_value
();
break
;
case
1
:
ndbout
<<
(
unsigned
)
p
->
u_char_value
();
break
;
default:
ndbout
<<
"Unknown size"
<<
endl
;
}
break
;
case
Signed
:
switch
(
size
)
{
case
8
:
ndbout
<<
p
->
int64_value
();
break
;
case
4
:
ndbout
<<
p
->
int32_value
();
break
;
case
2
:
ndbout
<<
p
->
short_value
();
break
;
case
1
:
ndbout
<<
(
int
)
p
->
char_value
();
break
;
default:
ndbout
<<
"Unknown size"
<<
endl
;
}
break
;
case
String
:
{
char
*
buf
=
new
char
[
aSize
+
1
];
memcpy
(
buf
,
p
->
aRef
(),
aSize
);
buf
[
aSize
]
=
0
;
ndbout
<<
buf
;
delete
[]
buf
;
}
break
;
case
Float
:
ndbout
<<
p
->
float_value
();
break
;
default:
ndbout
<<
"Unknown"
;
break
;
}
}
ndb/src/ndbapi/NdbEventOperationImpl.hpp
View file @
3327c6c0
...
...
@@ -60,7 +60,6 @@ public:
void
print
();
void
printAll
();
void
printRecAttr
(
NdbRecAttr
*
);
Ndb
*
m_ndb
;
NdbEventImpl
*
m_eventImpl
;
...
...
ndb/src/ndbapi/NdbRecAttr.cpp
View file @
3327c6c0
...
...
@@ -27,7 +27,8 @@ Documentation:
Adjust: 971206 UABRONM First version
************************************************************************************************/
#include <ndb_global.h>
#include "NdbRecAttr.hpp"
#include <NdbOut.hpp>
#include <NdbRecAttr.hpp>
#include "NdbDictionaryImpl.hpp"
NdbRecAttr
::
NdbRecAttr
()
:
...
...
@@ -124,3 +125,88 @@ NdbRecAttr::clone() const {
memcpy
(
ret
->
theRef
,
theRef
,
n
);
return
ret
;
}
NdbOut
&
operator
<<
(
NdbOut
&
ndbout
,
const
NdbRecAttr
&
r
)
{
if
(
r
.
isNULL
())
{
ndbout
<<
"[NULL]"
;
return
ndbout
;
}
switch
(
r
.
getType
()){
case
NdbDictionary
:
:
Column
::
Bigunsigned
:
ndbout
<<
r
.
u_64_value
();
break
;
case
NdbDictionary
:
:
Column
::
Unsigned
:
ndbout
<<
r
.
u_32_value
();
break
;
case
NdbDictionary
:
:
Column
::
Smallunsigned
:
ndbout
<<
r
.
u_short_value
();
break
;
case
NdbDictionary
:
:
Column
::
Tinyunsigned
:
ndbout
<<
(
unsigned
)
r
.
u_char_value
();
break
;
case
NdbDictionary
:
:
Column
::
Bigint
:
ndbout
<<
r
.
int64_value
();
break
;
case
NdbDictionary
:
:
Column
::
Int
:
ndbout
<<
r
.
int32_value
();
break
;
case
NdbDictionary
:
:
Column
::
Smallint
:
ndbout
<<
r
.
short_value
();
break
;
case
NdbDictionary
:
:
Column
::
Tinyint
:
ndbout
<<
(
int
)
r
.
char_value
();
break
;
case
NdbDictionary
:
:
Column
::
Char
:
case
NdbDictionary
:
:
Column
::
Varchar
:
{
int
aSize
=
r
.
arraySize
();
char
*
buf
=
new
char
[
aSize
+
1
];
memcpy
(
buf
,
r
.
aRef
(),
aSize
);
buf
[
aSize
]
=
0
;
ndbout
<<
buf
;
delete
[]
buf
;
}
break
;
case
NdbDictionary
:
:
Column
::
Float
:
ndbout
<<
r
.
float_value
();
break
;
case
NdbDictionary
:
:
Column
::
Double
:
ndbout
<<
r
.
double_value
();
break
;
case
NdbDictionary
:
:
Column
::
Mediumint
:
ndbout
<<
"[Mediumint]"
;
break
;
case
NdbDictionary
:
:
Column
::
Mediumunsigned
:
ndbout
<<
"[Mediumunsigend]"
;
break
;
case
NdbDictionary
:
:
Column
::
Binary
:
ndbout
<<
"[Binary]"
;
break
;
case
NdbDictionary
:
:
Column
::
Varbinary
:
ndbout
<<
"[Varbinary]"
;
break
;
case
NdbDictionary
:
:
Column
::
Decimal
:
ndbout
<<
"[Decimal]"
;
break
;
case
NdbDictionary
:
:
Column
::
Timespec
:
ndbout
<<
"[Timespec]"
;
break
;
case
NdbDictionary
:
:
Column
::
Blob
:
ndbout
<<
"[Blob]"
;
break
;
case
NdbDictionary
:
:
Column
::
Undefined
:
ndbout
<<
"[Undefined]"
;
break
;
default:
ndbout
<<
"[unknown]"
;
break
;
}
return
ndbout
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment