Commit e4eb1c00 authored by tomas@poseidon.mysql.com's avatar tomas@poseidon.mysql.com

Merge poseidon.mysql.com:/home/tomas/mysql-5.0-telco-gca-ndb_restore

into  poseidon.mysql.com:/home/tomas/mysql-5.1-telco-gca-ndb_restore
parents 12bf7fbe 30c58170
......@@ -298,6 +298,24 @@ t4
4 34
5 35
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 t3;
drop table t4;
......@@ -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/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
drop table t1;
drop table t2;
......
......@@ -129,6 +129,13 @@ public:
*/
Int32 int32_value() const;
/**
* Get value stored in NdbRecAttr object.
*
* @return Medium value.
*/
Int32 medium_value() const;
/**
* Get value stored in NdbRecAttr object.
*
......@@ -157,6 +164,13 @@ public:
*/
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.
*
......@@ -287,6 +301,16 @@ NdbRecAttr::int32_value() const
return *(Int32*)theRef;
}
inline
Int32
NdbRecAttr::medium_value() const
{
Uint32 tmp = *(Uint32*)theRef;
if (tmp & (0x1<<23))
tmp|= (0xFF<<24);
return (Int32)tmp;
}
inline
short
NdbRecAttr::short_value() const
......@@ -308,6 +332,13 @@ NdbRecAttr::u_32_value() const
return *(Uint32*)theRef;
}
inline
Uint32
NdbRecAttr::u_medium_value() const
{
return *(Uint32*)theRef;
}
inline
Uint16
NdbRecAttr::u_short_value() const
......
......@@ -263,6 +263,9 @@ ndbrecattr_print_formatted(NdbOut& out, const NdbRecAttr &r,
if (length > 1)
out << f.end_array_enclosure;
break;
case NdbDictionary::Column::Mediumunsigned:
out << r.u_medium_value();
break;
case NdbDictionary::Column::Smallunsigned:
out << r.u_short_value();
break;
......@@ -275,6 +278,9 @@ ndbrecattr_print_formatted(NdbOut& out, const NdbRecAttr &r,
case NdbDictionary::Column::Int:
out << r.int32_value();
break;
case NdbDictionary::Column::Mediumint:
out << r.medium_value();
break;
case NdbDictionary::Column::Smallint:
out << r.short_value();
break;
......@@ -461,8 +467,6 @@ ndbrecattr_print_formatted(NdbOut& out, const NdbRecAttr &r,
break;
case NdbDictionary::Column::Undefined:
case NdbDictionary::Column::Mediumint:
case NdbDictionary::Column::Mediumunsigned:
unknown:
//default: /* no print functions for the rest, just print type */
out << (int) r.getType();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment