creole
[ class tree: creole ] [ index: creole ] [ all elements ]

Class: CreoleTypes

Source Location: /creole/CreoleTypes.php

Class Overview


Generic Creole types modeled on JDBC types.


Author(s):

Version:

  • $Revision: 1.16 $

Variables

Constants

Methods


Child classes:

MSSQLTypes
MSSQL types / type map.
MySQLTypes
MySQL types / type map.
ODBCTypes
ODBC types / type map.
OCI8Types
Oracle types / type map.
PgSQLTypes
PostgreSQL types / type map.
SQLiteTypes
MySQL types / type map.

Class Details

[line 30]
Generic Creole types modeled on JDBC types.



Tags:

abstract:  
version:  $Revision: 1.16 $
author:  David Giffin <david@giffin.org>
author:  Hans Lellelid <hans@xmpl.org>


[ Top ]


Class Variables

$affixMap = array(
                self::BOOLEAN => 'Boolean',
                self::BIGINT => 'Int',
                self::CHAR => 'String',
                self::DATE => 'Date',
                self::DOUBLE => 'Float',
                self::FLOAT => 'Float',
                self::INTEGER => 'Int',
                self::SMALLINT => 'Int',
                self::TINYINT => 'Int',
                self::TIME => 'Time',
                self::TIMESTAMP => 'Timestamp',
                self::VARCHAR => 'String',                
                self::VARBINARY => 'Blob',
                self::NUMERIC => 'Float',
                self::BLOB => 'Blob',
                self::CLOB => 'Clob',
                self::LONGVARCHAR => 'String',
                self::DECIMAL => 'Float',
                self::REAL => 'Float',
                self::BINARY => 'Blob',
                self::LONGVARBINARY => 'Blob',
                self::YEAR => 'Int',
                self::ARR => 'Array',
                self::OTHER => '', // get() and set() for unknown
                )

[line 62]

Map of Creole type integers to the setter/getter affix.



Tags:

static:  
access:  protected

Type:   mixed


[ Top ]

$creoleTypeMap = array(
                self::BOOLEAN => 'BOOLEAN',
                self::BIGINT => 'BIGINT',
                self::SMALLINT => 'SMALLINT',
                self::TINYINT => 'TINYINT',
                self::INTEGER => 'INTEGER',
                self::NUMERIC => 'NUMERIC',
                self::DECIMAL => 'DECIMAL',
                self::REAL => 'REAL',
                self::FLOAT => 'FLOAT',
                self::DOUBLE => 'DOUBLE',
                self::CHAR => 'CHAR',
                self::VARCHAR => 'VARCHAR',
                self::TEXT => 'TEXT',
                self::TIME => 'TIME',
                self::TIMESTAMP => 'TIMESTAMP',
                self::DATE => 'DATE',
                self::YEAR => 'YEAR',
                self::VARBINARY => 'VARBINARY',                
                self::BLOB => 'BLOB',
                self::CLOB => 'CLOB',
                self::LONGVARCHAR => 'LONGVARCHAR',
                self::BINARY => 'BINARY',
                self::LONGVARBINARY => 'LONGVARBINARY',                
                self::ARR => 'ARR',
                self::OTHER => 'OTHER', // string is "raw" return
                )

[line 90]

Map of Creole type integers to their textual name.



Tags:

static:  
access:  protected

Type:   mixed


[ Top ]



Class Methods


method getAffix [line 148]

string getAffix( int $creoleType)

Gets the "affix" to use for ResultSet::get*() and PreparedStatement::set*() methods.

  1. $setter = 'set' . CreoleTypes::getAffix(CreoleTypes::INTEGER);
  2. $stmt->$setter(1, $intval);
  3. // or
  4. $getter = 'get' . CreoleTypes::getAffix(CreoleTypes::TIMESTAMP);
  5. $timestamp = $rs->$getter();




Tags:

return:  The default affix for getting/setting cols of this type.
static:  
access:  public
throws:  SQLException if $creoleType does not correspond to an affix


Parameters:

int   $creoleType   The Creole types.

[ Top ]

method getCreoleCode [line 176]

int getCreoleCode( string $creoleTypeName)

Given the name of a type (e.g. 'VARCHAR') this method will return the corresponding integer.



Tags:

return:  the Creole type.
static:  
access:  public


Parameters:

string   $creoleTypeName   The case-sensisive (must be uppercase) name of the Creole type (e.g. 'VARCHAR').

[ Top ]

method getCreoleName [line 163]

string getCreoleName( int $creoleType)

Given the integer type, this method will return the corresponding type name.



Tags:

return:  The name of the Creole type (e.g. 'VARCHAR').
static:  
access:  public


Parameters:

int   $creoleType   the integer Creole type.

[ Top ]

method getNativeType [line 133]

string getNativeType( mixed $creoleType)

This method will return a native type that corresponds to the specified Creole (JDBC-like) type.

If there is more than one matching native type, then the LAST defined native type will be returned.




Tags:

return:  Native type string.
static:  
abstract:  


Overridden in child classes as:

MSSQLTypes::getNativeType()
MySQLTypes::getNativeType()
This method will return a native type that corresponds to the specified Creole (JDBC-like) type.
ODBCTypes::getNativeType()
This method will return a native type that corresponds to the specified Creole (JDBC-like) type.
OCI8Types::getNativeType()
This method will return a native type that corresponds to the specified Creole (JDBC-like) type.
PgSQLTypes::getNativeType()
SQLiteTypes::getNativeType()
This method will return a native type that corresponds to the specified Creole (JDBC-like) type. Remember that this is really only for "hint" purposes as SQLite is typeless.

[ Top ]

method getType [line 124]

int getType( string $nativeType)

This method returns the generic Creole (JDBC-like) type when given the native db type.



Tags:

return:  Creole native type (e.g. Types::LONGVARCHAR, Types::BINARY, etc.).
static:  
abstract:  


Overridden in child classes as:

MSSQLTypes::getType()
MySQLTypes::getType()
This method returns the generic Creole (JDBC-like) type when given the native db type.
ODBCTypes::getType()
This method returns the generic Creole (JDBC-like) type when given the native db type.
OCI8Types::getType()
This method returns the generic Creole (JDBC-like) type when given the native db type.
PgSQLTypes::getType()
SQLiteTypes::getType()
This method returns the generic Creole (JDBC-like) type when given the native db type. If no match is found then we just return CreoleTypes::TEXT because SQLite is typeless.

Parameters:

string   $nativeType   DB native type (e.g. 'TEXT', 'byetea', etc.).

[ Top ]


Class Constants

ARR =  23

[line 57]

this is "ARRAY" from JDBC types


[ Top ]

BIGINT =  2

[line 33]


[ Top ]

BINARY =  20

[line 52]


[ Top ]

BLOB =  15

[line 47]


[ Top ]

BOOLEAN =  1

[line 32]


[ Top ]

CHAR =  6

[line 37]


[ Top ]

CLOB =  16

[line 48]


[ Top ]

DATE =  10

[line 42]


[ Top ]

DECIMAL =  18

[line 50]


[ Top ]

DOUBLE =  9

[line 41]


[ Top ]

FLOAT =  8

[line 40]


[ Top ]

INTEGER =  5

[line 36]


[ Top ]

LONGVARBINARY =  21

[line 53]


[ Top ]

LONGVARCHAR =  17

[line 49]


[ Top ]

NUMERIC =  14

[line 46]


[ Top ]

OTHER =  -1

[line 59]


[ Top ]

REAL =  19

[line 51]


[ Top ]

SMALLINT =  3

[line 34]


[ Top ]

TEXT =  17

[line 39]


[ Top ]

TIME =  11

[line 43]


[ Top ]

TIMESTAMP =  12

[line 44]


[ Top ]

TINYINT =  4

[line 35]


[ Top ]

VARBINARY =  13

[line 45]


[ Top ]

VARCHAR =  7

[line 38]


[ Top ]

YEAR =  22

[line 54]


[ Top ]



Documentation generated on Mon, 23 Aug 2004 21:51:21 -0400 by phpDocumentor 1.3.0RC3