MySQL++ Reference Manual

MySQL++ SSQLS v2 Translator: ParseV2::Field::Type Class Reference

MySQL++ SSQLS v2 Translator 3.3.0

Public Types | Public Member Functions | List of all members
ParseV2::Field::Type Class Reference

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.

## Detailed Description

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.

## Member Enumeration Documentation

## ◆ Value

enum ParseV2::Field::Type::Value

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.

Enumerator
ft_tinyint | TINYINT, INT1, BOOL.
ft_smallint | SMALLINT, INT2.
ft_mediumint | INT, MEDIUMINT, INT3, INT4.
ft_bigint | BIGINT, INT8.
ft_float | FLOAT, FLOAT4, FLOAT8.
ft_double | DOUBLE, DECIMAL, FIXED, NUMERIC.
ft_string | *CHAR, ENUM, *TEXT
ft_blob | *BLOB, VARBINARY
ft_date | DATE.
ft_datetime | DATETIME, TIMESTAMP.
ft_time | TIME.
ft_set | SET.

## Constructor & Destructor Documentation

## ◆ Type()

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.

The documentation for this class was generated from the following files:

- parsev2.h
- parsev2.cpp