PostrgreSQL to C++ datatype conversions
Numeric types
PostgreSQL documentation
Character types
PostgreSQL documentation
| PostgreSQL | C++ |
| varchar(n) | std::string |
| character(n) | std::string |
| text | std::string |
Monetary type
PostgreSQL documentation
| PostgreSQL | C++ |
| money | - Todo:
- decide MPFR or GMP - ?
|
Binary type
PostgreSQL documentation
Datetime type
PostgreSQL documentation PostgreSQL date/time support Boost.DateTime library PostgreSQL | C++ ----------------— | ----------------— timestamp | timestamptz | date | time | time with tz | interval |
Boolean type
PostgreSQL documentation
| PostgreSQL | C++ |
| boolean | bool |
Enumerated types
PostgreSQL documentation
Geometric types
PostgreSQL documentation
Network address types
PostgreSQL documentation
PostgreSQL | C++ ----------------— | ----------------— cidr | inet | boost::asio::ip::address macaddr |
Bit String types
PostgreSQL documentation
| PostgreSQL | C++ |
| bit(n) | std::bitset<n> |
| bit varying(n) | std::bitset<n>- Todo:
- create a signature structure
|
Text search types
PostgreSQL documentation
UUID type
PostgreSQL documentation
| PostgreSQL | C++ |
| uuid | boost::uuid |
XML type
PostgreSQL documentation
| PostgreSQL | C++ |
| xml | std::string |
JSON types
PostgreSQL documentation
| PostgreSQL | C++ |
| json | std::string |
Arrays
PostgreSQL documentation
| PostgreSQL | C++ |
| type array(n) | std::vector< type mapping > |
Composite types
PostgreSQL documentation
Range types
PostgreSQL documentation PostgreSQL | C++ ----------------— | ----------------— int4range | int8range | numrange | tsrange | tstzrange | daterange |