Re: Mysql connector c++ 8.0. How to work with datetime?
Hi Egor,
For some MySQL types, like numeric and string, we do conversions from MySQL representation to the corresponding C++ type, because the type to convert to is obvious in these cases. However, there are other MySQL types for which it is not so clear what C++ type should be used to represent the value, for example the DECIMAL type for fixed precision numbers (not that such types do not exist, but it is not clear if/which one should be supported). For the moment the situation we have is that for all MySQL value types that do not have the obvious automatic conversion to C++ type, user is responsible for converting it to the type of his choice. It can be done by asking the server to do the conversion (for example to string), like Luis has suggested. The other option is to get the raw binary representation of the value using Value::getRawBytes() and work with that, which of course requires understanding of how different types of MySQL values are represented in the protocol. For temporary types you can find this information here: <
https://dev.mysql.com/doc/internals/en/x-protocol-messages-messages.html#x-protocol-messages-resultsets>.
We believe that there is no single "right" way of representing the different possible values and in the end the user has to decide what exact representation to use. Certainly the task of converting the internal representation to user's type of choice could be made simpler, for example using template techniques, and we are thinking about such solutions. But at the moment the only way is to either look at the internal representation or ask server to do the conversion.
Subject
Views
Written By
Posted
1687
January 22, 2020 08:24AM
928
January 22, 2020 03:23PM
745
January 23, 2020 12:54AM
836
January 23, 2020 08:15AM
1138
January 23, 2020 10:48AM
808
January 24, 2020 10:52AM
Re: Mysql connector c++ 8.0. How to work with datetime?
1133
January 25, 2020 03:15AM
1380
January 27, 2020 09:46AM
795
January 31, 2020 12:43PM
702
March 14, 2020 10:07AM
940
March 17, 2020 11:28AM
721
April 29, 2020 10:49AM
Sorry, you can't reply to this topic. It has been closed.
This forum is currently read only. You can not log in or make any changes. This is a temporary situation.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.