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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
30c58170
Commit
30c58170
authored
Mar 08, 2007
by
tomas@poseidon.mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
medium int printout support
parent
a1d5b9fe
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
76 additions
and
2 deletions
+76
-2
mysql-test/r/ndb_restore_print.result
mysql-test/r/ndb_restore_print.result
+18
-0
mysql-test/t/ndb_restore_print.test
mysql-test/t/ndb_restore_print.test
+21
-0
ndb/include/ndbapi/NdbRecAttr.hpp
ndb/include/ndbapi/NdbRecAttr.hpp
+31
-0
ndb/src/ndbapi/NdbRecAttr.cpp
ndb/src/ndbapi/NdbRecAttr.cpp
+6
-2
No files found.
mysql-test/r/ndb_restore_print.result
View file @
30c58170
...
@@ -298,6 +298,24 @@ t4
...
@@ -298,6 +298,24 @@ t4
4 34
4 34
5 35
5 35
drop table t1;
drop table t1;
create table t1
(pk int key
,a1 MEDIUMINT, a2 MEDIUMINT UNSIGNED
) engine ndb;
insert into t1 values(1, 8388607, 16777215);
insert into t1 values(2, -8388608, 0);
insert into t1 values(3, -1, 1);
CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
DELETE FROM test.backup_info;
LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
SELECT @the_backup_id:=backup_id FROM test.backup_info;
@the_backup_id:=backup_id
<the_backup_id>
DROP TABLE test.backup_info;
1;8388607;16777215
2;-8388608;0
3;-1;1
drop table t1;
drop table t2;
drop table t2;
drop table t3;
drop table t3;
drop table t4;
drop table t4;
mysql-test/t/ndb_restore_print.test
View file @
30c58170
...
@@ -161,6 +161,27 @@ insert into t4 values (1,31),(2,32),(3,33),(4,34),(5,35);
...
@@ -161,6 +161,27 @@ insert into t4 values (1,31),(2,32),(3,33),(4,34),(5,35);
--
exec
rm
-
f
$MYSQLTEST_VARDIR
/
tmp
/
t3
.
txt
--
exec
rm
-
f
$MYSQLTEST_VARDIR
/
tmp
/
t3
.
txt
--
exec
rm
-
f
$MYSQLTEST_VARDIR
/
tmp
/
t4
.
txt
--
exec
rm
-
f
$MYSQLTEST_VARDIR
/
tmp
/
t4
.
txt
# now test some other datatypes
drop
table
t1
;
create
table
t1
(
pk
int
key
,
a1
MEDIUMINT
,
a2
MEDIUMINT
UNSIGNED
)
engine
ndb
;
# max values
insert
into
t1
values
(
1
,
8388607
,
16777215
);
# min values
insert
into
t1
values
(
2
,
-
8388608
,
0
);
# small values
insert
into
t1
values
(
3
,
-
1
,
1
);
# backup and print
--
source
include
/
ndb_backup
.
inc
--
let
ndb_restore_filter
=
test
t1
--
let
ndb_restore_opts
=--
verbose
=
0
--
print_data
--
hex
--
fields
-
terminated
-
by
=
";"
--
source
include
/
ndb_backup_print
.
inc
# clean up
# clean up
drop
table
t1
;
drop
table
t1
;
drop
table
t2
;
drop
table
t2
;
...
...
ndb/include/ndbapi/NdbRecAttr.hpp
View file @
30c58170
...
@@ -145,6 +145,13 @@ public:
...
@@ -145,6 +145,13 @@ public:
*/
*/
Int32
int32_value
()
const
;
Int32
int32_value
()
const
;
/**
* Get value stored in NdbRecAttr object.
*
* @return Medium value.
*/
Int32
medium_value
()
const
;
/**
/**
* Get value stored in NdbRecAttr object.
* Get value stored in NdbRecAttr object.
*
*
...
@@ -173,6 +180,13 @@ public:
...
@@ -173,6 +180,13 @@ public:
*/
*/
Uint32
u_32_value
()
const
;
Uint32
u_32_value
()
const
;
/**
* Get value stored in NdbRecAttr object.
*
* @return Unsigned medium value.
*/
Uint32
u_medium_value
()
const
;
/**
/**
* Get value stored in NdbRecAttr object.
* Get value stored in NdbRecAttr object.
*
*
...
@@ -318,6 +332,16 @@ NdbRecAttr::int32_value() const
...
@@ -318,6 +332,16 @@ NdbRecAttr::int32_value() const
return
*
(
Int32
*
)
theRef
;
return
*
(
Int32
*
)
theRef
;
}
}
inline
Int32
NdbRecAttr
::
medium_value
()
const
{
Uint32
tmp
=
*
(
Uint32
*
)
theRef
;
if
(
tmp
&
(
0x1
<<
23
))
tmp
|=
(
0xFF
<<
24
);
return
(
Int32
)
tmp
;
}
inline
inline
short
short
NdbRecAttr
::
short_value
()
const
NdbRecAttr
::
short_value
()
const
...
@@ -339,6 +363,13 @@ NdbRecAttr::u_32_value() const
...
@@ -339,6 +363,13 @@ NdbRecAttr::u_32_value() const
return
*
(
Uint32
*
)
theRef
;
return
*
(
Uint32
*
)
theRef
;
}
}
inline
Uint32
NdbRecAttr
::
u_medium_value
()
const
{
return
*
(
Uint32
*
)
theRef
;
}
inline
inline
Uint16
Uint16
NdbRecAttr
::
u_short_value
()
const
NdbRecAttr
::
u_short_value
()
const
...
...
ndb/src/ndbapi/NdbRecAttr.cpp
View file @
30c58170
...
@@ -265,6 +265,9 @@ ndbrecattr_print_formatted(NdbOut& out, const NdbRecAttr &r,
...
@@ -265,6 +265,9 @@ ndbrecattr_print_formatted(NdbOut& out, const NdbRecAttr &r,
if
(
length
>
1
)
if
(
length
>
1
)
out
<<
f
.
end_array_enclosure
;
out
<<
f
.
end_array_enclosure
;
break
;
break
;
case
NdbDictionary
:
:
Column
::
Mediumunsigned
:
out
<<
r
.
u_medium_value
();
break
;
case
NdbDictionary
:
:
Column
::
Smallunsigned
:
case
NdbDictionary
:
:
Column
::
Smallunsigned
:
out
<<
r
.
u_short_value
();
out
<<
r
.
u_short_value
();
break
;
break
;
...
@@ -277,6 +280,9 @@ ndbrecattr_print_formatted(NdbOut& out, const NdbRecAttr &r,
...
@@ -277,6 +280,9 @@ ndbrecattr_print_formatted(NdbOut& out, const NdbRecAttr &r,
case
NdbDictionary
:
:
Column
::
Int
:
case
NdbDictionary
:
:
Column
::
Int
:
out
<<
r
.
int32_value
();
out
<<
r
.
int32_value
();
break
;
break
;
case
NdbDictionary
:
:
Column
::
Mediumint
:
out
<<
r
.
medium_value
();
break
;
case
NdbDictionary
:
:
Column
::
Smallint
:
case
NdbDictionary
:
:
Column
::
Smallint
:
out
<<
r
.
short_value
();
out
<<
r
.
short_value
();
break
;
break
;
...
@@ -463,8 +469,6 @@ ndbrecattr_print_formatted(NdbOut& out, const NdbRecAttr &r,
...
@@ -463,8 +469,6 @@ ndbrecattr_print_formatted(NdbOut& out, const NdbRecAttr &r,
break
;
break
;
case
NdbDictionary
:
:
Column
::
Undefined
:
case
NdbDictionary
:
:
Column
::
Undefined
:
case
NdbDictionary
:
:
Column
::
Mediumint
:
case
NdbDictionary
:
:
Column
::
Mediumunsigned
:
unknown:
unknown:
//default: /* no print functions for the rest, just print type */
//default: /* no print functions for the rest, just print type */
out
<<
(
int
)
r
.
getType
();
out
<<
(
int
)
r
.
getType
();
...
...
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