# DataType Class Reference
[Dynamic query builder]

Generic SQL data types. More...

Inheritance diagram for DataType:
[legend]

List of all members.

## Public Member Functions

| getSize ()
| setSize ($size)
| hasSize ()
| getPrecision ()
| setPrecision ($precision)
| hasPrecision ()
| getScale ()
| setScale ($scale)
| setTimezoned ($zoned=false)
| isTimezoned ()
| setNull ($isNull=false)
| isNull ()
| setUnsigned ($unsigned=false)
| isUnsigned ()
| toDialectString (Dialect $dialect)

## Static Public Member Functions

static | create ($id)
static | getAnyId ()

## Public Attributes

const | SMALLINT = 0x001001
const | INTEGER = 0x001002
const | BIGINT = 0x001003
const | NUMERIC = 0x001704
const | REAL = 0x001105
const | DOUBLE = 0x001106
const | BOOLEAN = 0x000007
const | CHAR = 0x000108
const | VARCHAR = 0x000109
const | TEXT = 0x00000A
const | DATE = 0x00000B
const | TIME = 0x000A0C
const | TIMESTAMP = 0x000A0D
const | INTERVAL = 0x00000F
const | BINARY = 0x00000E
const | HAVE_SIZE = 0x000100
const | HAVE_PRECISION = 0x000200
const | HAVE_SCALE = 0x000400
const | HAVE_TIMEZONE = 0x000800
const | CAN_BE_UNSIGNED = 0x001000

## Protected Attributes

| $names

## Private Attributes

| $size = null
| $precision = null
| $scale = null
| $null = true
| $timezone = false
| $unsigned = false

## Detailed Description

Generic SQL data types.

Definition at line 17 of file DataType.class.php.

## Member Function Documentation

static DataType::create | ( | $ | id | ) | `[static]`

Returns:
  DataType

Definition at line 80 of file DataType.class.php.

References IdentifiableObject::$id.

Referenced by TimeIntervalsGenerator::getSeriesGenerator(), PgSQL::getTableInfo(), MySQL::getTableInfo(), and TimeIntervalsGenerator::toSelectQuery().

static DataType::getAnyId | ( |  | ) | `[static]`

Definition at line 85 of file DataType.class.php.

DataType::getPrecision | ( |  | ) |

Definition at line 114 of file DataType.class.php.

DataType::getScale | ( |  | ) |

Definition at line 138 of file DataType.class.php.

DataType::getSize | ( |  | ) |

Definition at line 90 of file DataType.class.php.

DataType::hasPrecision | ( |  | ) |

Definition at line 133 of file DataType.class.php.

DataType::hasSize | ( |  | ) |

Definition at line 109 of file DataType.class.php.

Referenced by setSize(), and toDialectString().

DataType::isNull | ( |  | ) |

Definition at line 185 of file DataType.class.php.

DataType::isTimezoned | ( |  | ) |

Definition at line 170 of file DataType.class.php.

DataType::isUnsigned | ( |  | ) |

Definition at line 203 of file DataType.class.php.

DataType::setNull | ( | $ | isNull = `false` | ) |

Returns:
  DataType

Definition at line 178 of file DataType.class.php.

DataType::setPrecision | ( | $ | precision | ) |

Exceptions:

  | WrongArgumentException |

Returns:
  DataType

Definition at line 123 of file DataType.class.php.

References $precision, Assert::isInteger(), and Assert::isTrue().

Here is the call graph for this function:

DataType::setScale | ( | $ | scale | ) |

Exceptions:

  | WrongArgumentException |

Returns:
  DataType

Definition at line 147 of file DataType.class.php.

References $scale, Assert::isInteger(), and Assert::isTrue().

Here is the call graph for this function:

DataType::setSize | ( | $ | size | ) |

Exceptions:

  | WrongArgumentException |

Returns:
  DataType

Definition at line 99 of file DataType.class.php.

References $size, hasSize(), Assert::isInteger(), and Assert::isTrue().

Here is the call graph for this function:

DataType::setTimezoned | ( | $ | zoned = `false` | ) |

Exceptions:

  | WrongArgumentException |

Returns:
  DataType

Definition at line 161 of file DataType.class.php.

References Assert::isTrue().

Here is the call graph for this function:

DataType::setUnsigned | ( | $ | unsigned = `false` | ) |

Exceptions:

  | WrongArgumentException |

Returns:
  DataType

Definition at line 194 of file DataType.class.php.

References $unsigned, and Assert::isTrue().

Here is the call graph for this function:

DataType::toDialectString | ( | Dialect $ | dialect | ) |

Implements DialectString.

Definition at line 208 of file DataType.class.php.

References hasSize(), Dialect::timeZone(), and Dialect::typeToString().

Here is the call graph for this function:

## Member Data Documentation

DataType::$names`[protected]`

Initial value:

     array(
                self::SMALLINT      => 'SMALLINT',
                self::INTEGER       => 'INTEGER',
                self::BIGINT        => 'BIGINT',
                self::NUMERIC       => 'NUMERIC',

                self::REAL          => 'FLOAT',
                self::DOUBLE        => 'DOUBLE PRECISION',

                self::BOOLEAN       => 'BOOLEAN',

                self::CHAR          => 'CHARACTER',
                self::VARCHAR       => 'CHARACTER VARYING',
                self::TEXT          => 'TEXT',

                self::DATE          => 'DATE',
                self::TIME          => 'TIME',
                self::TIMESTAMP     => 'TIMESTAMP',
                self::INTERVAL      => 'INTERVAL',

                self::BINARY        => 'BINARY',
            )

Definition at line 54 of file DataType.class.php.

DataType::$null = true`[private]`

Definition at line 50 of file DataType.class.php.

DataType::$precision = null`[private]`

Definition at line 47 of file DataType.class.php.

Referenced by setPrecision().

DataType::$scale = null`[private]`

Definition at line 48 of file DataType.class.php.

Referenced by setScale().

DataType::$size = null`[private]`

Definition at line 46 of file DataType.class.php.

Referenced by setSize().

DataType::$timezone = false`[private]`

Definition at line 51 of file DataType.class.php.

DataType::$unsigned = false`[private]`

Definition at line 52 of file DataType.class.php.

Referenced by setUnsigned().

const DataType::BIGINT = 0x001003

Definition at line 21 of file DataType.class.php.

Referenced by LiteDialect::checkColumn(), PgSQL::getTableInfo(), MySQL::getTableInfo(), and LiteDialect::typeToString().

const DataType::BINARY = 0x00000E

Definition at line 38 of file DataType.class.php.

Referenced by PgSQL::getTableInfo(), PostgresDialect::typeToString(), MyDialect::typeToString(), and LiteDialect::typeToString().

const DataType::BOOLEAN = 0x000007

Definition at line 27 of file DataType.class.php.

Referenced by PgSQL::getTableInfo(), and DBColumn::toDialectString().

const DataType::CAN_BE_UNSIGNED = 0x001000

Definition at line 44 of file DataType.class.php.

const DataType::CHAR = 0x000108

Definition at line 29 of file DataType.class.php.

Referenced by PgSQL::getTableInfo(), and MySQL::getTableInfo().

const DataType::DATE = 0x00000B

Definition at line 33 of file DataType.class.php.

Referenced by PgSQL::getTableInfo(), and MySQL::getTableInfo().

const DataType::DOUBLE = 0x001106

Definition at line 25 of file DataType.class.php.

Referenced by PgSQL::getTableInfo(), and MySQL::getTableInfo().

const DataType::HAVE_PRECISION = 0x000200

Definition at line 41 of file DataType.class.php.

const DataType::HAVE_SCALE = 0x000400

Definition at line 42 of file DataType.class.php.

const DataType::HAVE_SIZE = 0x000100

Definition at line 40 of file DataType.class.php.

const DataType::HAVE_TIMEZONE = 0x000800

Definition at line 43 of file DataType.class.php.

const DataType::INTEGER = 0x001002

Definition at line 20 of file DataType.class.php.

Referenced by LiteDialect::checkColumn(), TimeIntervalsGenerator::getSeriesGenerator(), PgSQL::getTableInfo(), and MySQL::getTableInfo().

const DataType::INTERVAL = 0x00000F

Definition at line 36 of file DataType.class.php.

Referenced by TimeIntervalsGenerator::toSelectQuery().

const DataType::NUMERIC = 0x001704

Definition at line 22 of file DataType.class.php.

Referenced by PgSQL::getTableInfo(), and MySQL::getTableInfo().

const DataType::REAL = 0x001105

Definition at line 24 of file DataType.class.php.

Referenced by PgSQL::getTableInfo().

const DataType::SMALLINT = 0x001001

Definition at line 19 of file DataType.class.php.

Referenced by PgSQL::getTableInfo(), and MySQL::getTableInfo().

const DataType::TEXT = 0x00000A

Definition at line 31 of file DataType.class.php.

Referenced by PgSQL::getTableInfo(), and MySQL::getTableInfo().

const DataType::TIME = 0x000A0C

Definition at line 34 of file DataType.class.php.

Referenced by PgSQL::getTableInfo(), and MySQL::getTableInfo().

const DataType::TIMESTAMP = 0x000A0D

Definition at line 35 of file DataType.class.php.

Referenced by PgSQL::getTableInfo(), MySQL::getTableInfo(), and TimeIntervalsGenerator::toSelectQuery().

const DataType::VARCHAR = 0x000109

Definition at line 30 of file DataType.class.php.

Referenced by PgSQL::getTableInfo(), and MySQL::getTableInfo().

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

- core/OSQL/DataType.class.php