Mapeo de tipos de datos de las BD con DOCTRINE

A fin de realizar el mapeo de la base de datos a los objetos PHP se facilita la siguiente tabla que nos orientará sobre su implementación.


Doctrine PHP Database vendor
Name Version Type
smallint integer MySQL all SMALLINT UNSIGNED [10] AUTO_INCREMENT [11]
Drizzle all INT UNSIGNED [10] AUTO_INCREMENT [11]
PostgreSQL all SMALLINT
Oracle all NUMBER(5)
SQL Server all SMALLINT IDENTITY [11]
SQL Anywhere all UNSIGNED [10] SMALLINT IDENTITY [11]
SQLite all INTEGER [16]
integer integer MySQL all INT UNSIGNED [10] AUTO_INCREMENT [11]
Drizzle
PostgreSQL all INT [12]
SERIAL [11]
Oracle all NUMBER(10)
SQL Server all INT IDENTITY [11]
SQL Anywhere all UNSIGNED [10] INT IDENTITY [11]
SQLite all INTEGER [16]
bigint string [8] MySQL all BIGINT UNSIGNED [10] AUTO_INCREMENT [11]
Drizzle
PostgreSQL all BIGINT [12]
BIGSERIAL [11]
Oracle all NUMBER(20)
SQL Server all BIGINT IDENTITY [11]
SQL Anywhere all UNSIGNED [10] BIGINT IDENTITY [11]
SQLite all INTEGER [16]
decimal [7] string [9] MySQL all NUMERIC(p, s) UNSIGNED [10]
PostgreSQL all NUMERIC(p, s)
Oracle
SQL Server
SQL Anywhere
SQLite
Drizzle
float float MySQL all DOUBLE PRECISION UNSIGNED [10]
PostgreSQL all DOUBLE PRECISION
Oracle
SQL Server
SQL Anywhere
SQLite
Drizzle
string [2] [5] string MySQL all VARCHAR(n) [3]
PostgreSQL
SQL Anywhere CHAR(n) [4]
SQLite
Drizzle all VARCHAR(n)
Oracle all VARCHAR2(n) [3]
CHAR(n) [4]
SQL Server all NVARCHAR(n) [3]
NCHAR(n) [4]
text string MySQL all TINYTEXT [17]
TEXT [18]
MEDIUMTEXT [19]
LONGTEXT [20]
PostgreSQL all TEXT
SQL Anywhere
Drizzle
Oracle all CLOB
SQLite
SQL Server all VARCHAR(MAX)
**guid ** string MySQL all VARCHAR(255) [1]
Oracle
SQLite
Drizzle
SQL Server all UNIQUEIDENTIFIER
SQL Anywhere
PostgreSQL all UUID
binary [2] [6] resource MySQL all VARBINARY(n) [3]
SQL Server
BINARY(n) [4]
SQL Anywhere
Drizzle all VARBINARY(n)
Oracle all RAW(n)
PostgreSQL all BYTEA [16]
SQLite all BLOB [16]
blob resource MySQL all TINYBLOB [17]
BLOB [18]
MEDIUMBLOB [19]
LONGBLOB [20]
Oracle all BLOB
SQLite
Drizzle
SQL Server all VARBINARY(MAX)
SQL Anywhere all LONG BINARY
PostgreSQL all BYTEA
boolean boolean MySQL all TINYINT(1)
PostgreSQL all BOOLEAN
SQLite
Drizzle
SQL Server all BIT
SQL Anywhere
Oracle all NUMBER(1)
date \DateTime MySQL all DATE
PostgreSQL
Oracle
SQL Anywhere
SQLite
Drizzle
SQL Server >= 2008
< 2008 DATETIME [16]
datetime \DateTime MySQL all DATETIME [13]
Drizzle TIMESTAMP [14]
SQL Server all DATETIME
SQL Anywhere
SQLite
PostgreSQL all TIMESTAMP(0) WITHOUT TIME ZONE
Oracle all TIMESTAMP(0)
datetimetz \DateTime MySQL all DATETIME [15] [16]
Drizzle
SQLite
SQL Server < 2008
>= 2008 DATETIMEOFFSET(6)
PostgreSQL all TIMESTAMP(0) WITH TIME ZONE
Oracle
SQL Anywhere < 12 DATETIME [15] [16]
>= 12 TIMESTAMP WITH TIME ZONE
time \DateTime MySQL all TIME
SQL Anywhere
SQLite
Drizzle
PostgreSQL all TIME(0) WITHOUT TIME ZONE
Oracle all DATE [16]
SQL Server < 2008 DATETIME [16]
>= 2008 TIME(0)
array [1] array MySQL all TINYTEXT [17]
simple array [1] TEXT [18]
MEDIUMTEXT [19]
LONGTEXT [20]
PostgreSQL all TEXT
SQL Anywhere
Drizzle
Oracle all CLOB
SQLite
SQL Server all VARCHAR(MAX)
json_array array MySQL [1] all TINYTEXT [17]
TEXT [18]
MEDIUMTEXT [19]
LONGTEXT [20]
PostgreSQL >= 9.2 JSON
< 9.2 TEXT [1]
SQL Anywhere all
Drizzle
Oracle all CLOB [1]
SQLite
SQL Server all VARCHAR(MAX) [1]
object [1] object MySQL all TINYTEXT [17]
TEXT [18]
MEDIUMTEXT [19]
LONGTEXT [20]
PostgreSQL all TEXT
SQL Anywhere
Drizzle
Oracle all CLOB
SQLite
SQL Server all VARCHAR(MAX)


fuente:
 http://doctrine-dbal.readthedocs.org/en/latest/reference/types.html

Comentarios

Entradas populares de este blog