Archived
This forum has been archived. Please start a new discussion on GitHub.
persistency and Ice objects
in Help Center
Hi,
how can I store an Ice object in an external DB ?
(Freeze does not suit me)
For example,
// my_data.ice
struct A { // I need to store only such simple structs
int i;
float f;
string s;
};
I need something like
std::string A::serialize() const;
the function which returns internal presentation of the Ice object.
Or maybe, smth like this:
std::string buffer;
IceInternal::BasicStream os(buffer); // does not exists
A::__write(&os); // not in the user API
Thank you,
nsns
how can I store an Ice object in an external DB ?
(Freeze does not suit me)
For example,
// my_data.ice
struct A { // I need to store only such simple structs
int i;
float f;
string s;
};
I need something like
std::string A::serialize() const;
the function which returns internal presentation of the Ice object.
Or maybe, smth like this:
std::string buffer;
IceInternal::BasicStream os(buffer); // does not exists
A::__write(&os); // not in the user API
Thank you,
nsns
0
Comments
-
There is currently no public API to serialize a Slice construct to a binary string encoded using the Ice encoding. But you could look at the Freeze sources to figure out the private API .
Also Ice (Freeze) no longer provides an XML or plain text encoding.
If you want to store this simple struct in a relational database, you could be better off doing the conversion yourself: for example store each data member in its own column.
Cheers,
Bernard0 -
"There is currently no public API to serialize a Slice construct to a binary string encoded using the Ice encoding. "
Hope, it will be added to the TODO list.
Cheers, Nikolai (nsns)0 -
Consider it added. It's rather simple to do anyway.0