DatabaseProtobufAdapter: fix translation of unsigned fields
Independent of the protocol specification all integer fields in the result table are signed. For instance, if I store a kernel IP (e.g. 0xf1....) the value in the database is 0x7fffffff because of the wrong type. Therefore, the data fields of the result table should have the same types as specified in the protocol. Change-Id: I9154251e4ad67ba70fe86155ebda378c4a9982c2
This commit is contained in:
committed by
Tobias Stumpf
parent
d962a322ea
commit
6d3ab14365
@ -80,7 +80,7 @@ class DatabaseProtobufAdapter {
|
||||
TypeBridge_uint32(const google::protobuf::FieldDescriptor *desc)
|
||||
: TypeBridge(desc){};
|
||||
|
||||
virtual std::string sql_type() { return "INT"; };
|
||||
virtual std::string sql_type() { return "INT UNSIGNED"; };
|
||||
virtual int element_size() { return 4; };
|
||||
virtual void copy_to(const google::protobuf::Message *msg, int i, void *);
|
||||
virtual void bind(MYSQL_BIND *bind, const google::protobuf::Message *msg);
|
||||
@ -101,7 +101,7 @@ class DatabaseProtobufAdapter {
|
||||
TypeBridge_uint64(const google::protobuf::FieldDescriptor *desc)
|
||||
: TypeBridge(desc){};
|
||||
|
||||
virtual std::string sql_type() { return "BIGINT"; };
|
||||
virtual std::string sql_type() { return "BIGINT UNSIGNED"; };
|
||||
virtual int element_size() { return 8; };
|
||||
virtual void copy_to(const google::protobuf::Message *msg, int i, void *);
|
||||
virtual void bind(MYSQL_BIND *bind, const google::protobuf::Message *msg);
|
||||
|
||||
Reference in New Issue
Block a user