DataType Class Reference
[Dynamic query builder]

Generic SQL data types. More...

Inheritance diagram for DataType:

Inheritance graph
[legend]

List of all members.

Public Member Functions

 getSize ()
 setSize ($size)
 
Exceptions:
WrongArgumentException 

 hasSize ()
 getPrecision ()
 setPrecision ($precision)
 
Exceptions:
WrongArgumentException 

 hasPrecision ()
 getScale ()
 setScale ($scale)
 
Exceptions:
WrongArgumentException 

 setTimezoned ($zoned=false)
 
Exceptions:
WrongArgumentException 

 isTimezoned ()
 setNull ($isNull=false)
 
Returns:
DataType

 isNull ()
 setUnsigned ($unsigned=false)
 
Exceptions:
WrongArgumentException 

 isUnsigned ()
 typeToString (Dialect $dialect)
 toDialectString (Dialect $dialect)

Static Public Member Functions

static create ($id)
 
Returns:
DataType

static getAnyId ()
 must return any existent ID 1 should be ok for most enumerations

Public Attributes

const SMALLINT = 0x001001
const INTEGER = 0x001002
const BIGINT = 0x001003
const NUMERIC = 0x001704
const REAL = 0x001005
const DOUBLE = 0x001006
const BOOLEAN = 0x000007
const CHAR = 0x000108
const VARCHAR = 0x000109
const TEXT = 0x00000A
const DATE = 0x00000B
const TIME = 0x000A0C
const TIMESTAMP = 0x000A0D
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 18 of file DataType.class.php.


Member Function Documentation

static DataType::create ( id  )  [static]

Returns:
DataType

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

References IdentifiableObject::$id.

Referenced by PgSQL::getTableInfo(), TimeType::toColumnType(), TimestampType::toColumnType(), StringType::toColumnType(), SmallIntegerType::toColumnType(), NumericType::toColumnType(), IntegerType::toColumnType(), FloatType::toColumnType(), FixedLengthStringType::toColumnType(), DoubleType::toColumnType(), DateType::toColumnType(), BooleanType::toColumnType(), and BigIntegerType::toColumnType().

static DataType::getAnyId (  )  [static]

must return any existent ID 1 should be ok for most enumerations

Reimplemented from Enumeration.

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

DataType::getSize (  ) 

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

DataType::setSize ( size  ) 

Exceptions:
WrongArgumentException 

Returns:
DataType

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

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

Here is the call graph for this function:

DataType::hasSize (  ) 

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

Referenced by setSize(), and toDialectString().

DataType::getPrecision (  ) 

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

DataType::setPrecision ( precision  ) 

Exceptions:
WrongArgumentException 

Returns:
DataType

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

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

Here is the call graph for this function:

DataType::hasPrecision (  ) 

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

DataType::getScale (  ) 

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

DataType::setScale ( scale  ) 

Exceptions:
WrongArgumentException 

Returns:
DataType

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

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

Here is the call graph for this function:

DataType::setTimezoned ( zoned = false  ) 

Exceptions:
WrongArgumentException 

Returns:
DataType

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

References Assert::isTrue().

Here is the call graph for this function:

DataType::isTimezoned (  ) 

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

DataType::setNull ( isNull = false  ) 

Returns:
DataType

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

DataType::isNull (  ) 

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

DataType::setUnsigned ( unsigned = false  ) 

Exceptions:
WrongArgumentException 

Returns:
DataType

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

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

Here is the call graph for this function:

DataType::isUnsigned (  ) 

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

DataType::typeToString ( Dialect dialect  ) 

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

Referenced by toDialectString().

DataType::toDialectString ( Dialect dialect  ) 

Implements DialectString.

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

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

Here is the call graph for this function:


Member Data Documentation

const DataType::SMALLINT = 0x001001

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

Referenced by PgSQL::getTableInfo(), and SmallIntegerType::toColumnType().

const DataType::INTEGER = 0x001002

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

Referenced by LiteDialect::checkColumn(), PgSQL::getTableInfo(), and IntegerType::toColumnType().

const DataType::BIGINT = 0x001003

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

Referenced by LiteDialect::checkColumn(), PgSQL::getTableInfo(), and BigIntegerType::toColumnType().

const DataType::NUMERIC = 0x001704

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

Referenced by PgSQL::getTableInfo(), and NumericType::toColumnType().

const DataType::REAL = 0x001005

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

Referenced by PgSQL::getTableInfo(), and FloatType::toColumnType().

const DataType::DOUBLE = 0x001006

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

Referenced by PgSQL::getTableInfo(), and DoubleType::toColumnType().

const DataType::BOOLEAN = 0x000007

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

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

const DataType::CHAR = 0x000108

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

Referenced by PgSQL::getTableInfo(), and FixedLengthStringType::toColumnType().

const DataType::VARCHAR = 0x000109

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

Referenced by PgSQL::getTableInfo(), and StringType::toColumnType().

const DataType::TEXT = 0x00000A

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

Referenced by PgSQL::getTableInfo(), and StringType::toColumnType().

const DataType::DATE = 0x00000B

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

Referenced by PgSQL::getTableInfo(), and DateType::toColumnType().

const DataType::TIME = 0x000A0C

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

Referenced by PgSQL::getTableInfo(), and TimeType::toColumnType().

const DataType::TIMESTAMP = 0x000A0D

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

Referenced by PgSQL::getTableInfo(), and TimestampType::toColumnType().

const DataType::HAVE_SIZE = 0x000100

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

const DataType::HAVE_PRECISION = 0x000200

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

const DataType::HAVE_SCALE = 0x000400

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

const DataType::HAVE_TIMEZONE = 0x000800

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

const DataType::CAN_BE_UNSIGNED = 0x001000

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

DataType::$size = null [private]

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

Referenced by setSize().

DataType::$precision = null [private]

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

Referenced by setPrecision().

DataType::$scale = null [private]

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

Referenced by setScale().

DataType::$null = true [private]

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

DataType::$timezone = false [private]

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

DataType::$unsigned = false [private]

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

Referenced by setUnsigned().

DataType::$names [protected]

Initial value:

 array(
            self::SMALLINT      => 'SMALLINT',
            self::INTEGER       => 'INTEGER',
            self::BIGINT        => 'BIGINT',
            self::NUMERIC       => 'NUMERIC',
            
            self::REAL          => 'REAL',
            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'
        )

Reimplemented from Enumeration.

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


The documentation for this class was generated from the following file:
Generated on Sun Dec 9 21:57:11 2007 for onPHP by  doxygen 1.5.4