MySQL++ SSQLS v2 Translator
3.3.0
|
A smart enum for converting SQL type strings to one of a relatively few types we directly support. More...
#include <parsev2.h>
Public Types | |
enum | Value { ft_tinyint , ft_smallint , ft_mediumint , ft_bigint , ft_float , ft_double , ft_string , ft_blob , ft_date , ft_datetime , ft_time , ft_set } |
Known SQL field types. More... | |
Public Member Functions | |
Type (const std::string &s) | |
Constructor. More... | |
Type (Value v) | |
Copy constructor. | |
void | print (std::ostream &os) const |
Print type description out to a stream in SSQLS v2 form. | |
operator Value () const | |
Enum value accessor. | |
bool | operator== (const Type &rhs) const |
Equality operator. | |
A smart enum for converting SQL type strings to one of a relatively few types we directly support.
This object defaults to a value of ft_string if the type cannot be discerned.
This class is public only to allow it to be tested, in test/ssqls2.cpp. It shouldn't actually be used outside ssqlsxlat.
Known SQL field types.
This list is shorter than what we support in MySQL++'s lib/sql_types.h and shorter still than the full list of types that SQL database engines support. Its length is limited by the diversity of data types in C++ and MySQL++. We map SQL types to one of these values as best we can.
This list doesn't encode anything about nullness, signedness, etc. Those are considered attributes modifying the type, not creating independent data types. We store these flags in separate variables in the outer class.
ParseV2::Field::Type::Type | ( | const std::string & | s | ) |
Constructor.
Given a SQL type string, try to figure out which of the relatively small set of known values to use. Defaults to ft_string if we can't find a more appropriate type, as all SQL values can be dealt with as strings.
References ft_bigint, ft_blob, ft_date, ft_datetime, ft_double, ft_float, ft_mediumint, ft_set, ft_smallint, ft_time, and ft_tinyint.