MySQL++ Reference Manual

Main Page Namespace List Class Hierarchy Compound List File List Namespace Members Compound Members File Members

# mysqlpp::mysql_type_info Class Reference

Holds basic type information for ColData. More...

`#include <type_info.h>`

List of all members.

## Public Methods
| mysql_type_info (unsigned char n=static_cast< unsigned char >(-1))
| Create object.
MYSQLPP_EXPORT | mysql_type_info (enum_field_types t, bool _unsigned, bool _null)
| Create object from MySQL C API type info.
MYSQLPP_EXPORT | mysql_type_info (const MYSQL_FIELD &f)
| Create object from a MySQL C API field.
| mysql_type_info (const mysql_type_info &t)
| Create object as a copy of another.
| mysql_type_info (const std::type_info &t)
| Create object from a C++ type_info object.
mysql_type_info & | operator= (unsigned char n)
| Assign a new internal type value.
mysql_type_info & | operator= (const mysql_type_info &t)
| Assign another mysql_type_info object to this object.
mysql_type_info & | operator= (const std::type_info &t)
| Assign a C++ type_info object to this object.
MYSQLPP_EXPORT const char * | name () const
| Returns an implementation-defined name of the C++ type.
MYSQLPP_EXPORT const char * | sql_name () const
| Returns the name of the SQL type.
MYSQLPP_EXPORT const std::type_info & | c_type () const
| Returns the type_info for the C++ type associated with the SQL type.
MYSQLPP_EXPORT const unsigned int | length () const
| Return length of data in this field.
MYSQLPP_EXPORT const unsigned int | max_length () const
| Return maximum length of data in this field.
MYSQLPP_EXPORT const mysql_type_info | base_type () const
| Returns the type_info for the C++ type inside of the mysqlpp::Null type.
int | id () const
| Returns the ID of the SQL type.
MYSQLPP_EXPORT bool | quote_q () const
| Returns true if the SQL type is of a type that needs to be quoted.
MYSQLPP_EXPORT bool | escape_q () const
| Returns true if the SQL type is of a type that needs to be escaped.
bool | before (mysql_type_info &b)
| Provides a way to compare two types for sorting.
## Public Attributes
unsigned int | _length
| field length, from MYSQL_FIELD
unsigned int | _max_length
| max data length, from MYSQL_FIELD
## Static Public Attributes
const unsigned char | string_type = 20
| The internal constant we use for our string type.

## Detailed Description

Holds basic type information for ColData.

Class to hold basic type information for mysqlpp::ColData.

## Constructor & Destructor Documentation

mysqlpp::mysql_type_info::mysql_type_info | ( | unsigned char | n = static_cast<unsigned char>(-1) | ) | `[inline]`

  | Create object. Parameters:
  n | index into the internal type table
Because of the `n` parameter's definition, this constructor shouldn't be used outside the library. The default is intended to try and crash a program using a default mysql_type_info object. This is a very wrong thing to do.

mysqlpp::mysql_type_info::mysql_type_info | ( | enum_field_types | t,
|  | bool | _unsigned,
|  | bool | _null
| ) | `[inline]`

  | Create object from MySQL C API type info. Parameters:
  t | the MySQL C API type ID for this type
  _unsigned | if true, this is the unsigned version of the type
  _null | if true, this type can hold a SQL null

mysqlpp::mysql_type_info::mysql_type_info | ( | const MYSQL_FIELD & | f | ) | `[inline]`

  | Create object from a MySQL C API field. Parameters:
  f | field from which we extract the type info

mysqlpp::mysql_type_info::mysql_type_info | ( | const std::type_info & | t | ) | `[inline]`

| Create object from a C++ type_info object. This tries to map a C++ type to the closest MySQL data type. It is necessarily somewhat approximate.

## Member Function Documentation

const mysql_type_info mysqlpp::mysql_type_info::base_type | ( |  | ) | `[inline]`

| Returns the type_info for the C++ type inside of the mysqlpp::Null type. Returns the type_info for the C++ type inside the mysqlpp::Null type. If the type is not Null then this is the same as c_type().

bool mysqlpp::mysql_type_info::before | ( | mysql_type_info & | b | ) | `[inline]`

| Provides a way to compare two types for sorting. Returns true if the SQL ID of this type is lower than that of another. Used by mysqlpp::type_info_cmp when comparing types.

const std::type_info & mysqlpp::mysql_type_info::c_type | ( |  | ) | `[inline]`

| Returns the type_info for the C++ type associated with the SQL type. Returns the C++ type_info record corresponding to the SQL type.

bool mysqlpp::mysql_type_info::escape_q | ( |  | ) |

| Returns true if the SQL type is of a type that needs to be escaped. Returns: true if the type needs to be escaped for syntactically correct SQL.

int mysqlpp::mysql_type_info::id | ( |  | ) | const`[inline]`

| Returns the ID of the SQL type. Returns the ID number MySQL uses for this type. Note: Do not depend on the value of this ID as it may change between MySQL versions.

const unsigned int mysqlpp::mysql_type_info::length | ( |  | ) | `[inline]`

| Return length of data in this field. This only works if you initialized this object from a MYSQL_FIELD object.

const unsigned int mysqlpp::mysql_type_info::max_length | ( |  | ) | `[inline]`

| Return maximum length of data in this field. This only works if you initialized this object from a MYSQL_FIELD object.

const char * mysqlpp::mysql_type_info::name | ( |  | ) | `[inline]`

| Returns an implementation-defined name of the C++ type. Returns the name that would be returned by typeid().name() for the C++ type associated with the SQL type.

mysql_type_info& mysqlpp::mysql_type_info::operator= | ( | const std::type_info & | t | ) | `[inline]`

| Assign a C++ type_info object to this object. This tries to map a C++ type to the closest MySQL data type. It is necessarily somewhat approximate.

mysql_type_info& mysqlpp::mysql_type_info::operator= | ( | unsigned char | n | ) | `[inline]`

  | Assign a new internal type value. Parameters:
  n | an index into the internal MySQL++ type table
This function shouldn't be used outside the library.

bool mysqlpp::mysql_type_info::quote_q | ( |  | ) |

| Returns true if the SQL type is of a type that needs to be quoted. Returns: true if the type needs to be quoted for syntactically correct SQL.

const char * mysqlpp::mysql_type_info::sql_name | ( |  | ) | `[inline]`

| Returns the name of the SQL type. Returns the SQL name for the type.

## Member Data Documentation

const unsigned char mysqlpp::mysql_type_info::string_type = 20`[static]`

| The internal constant we use for our string type. We expose this because other parts of MySQL++ need to know what the string constant is at the moment.

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

- type_info.h
- type_info.cpp