3.7.2.1 Data Type Associations by Database

Every RDMS defines data types in slightly different ways. Within the datasource class for each database system, CakePHP maps those types to something it recognizes and creates a unified interface, no matter which database system you need to run on.

This breakdown describes how each one is mapped.

3.7.2.1.1 MySQL

CakePHP Type Field Properties
primary_key NOT NULL auto_increment
string varchar(255)
text text
integer int(11)
float float
datetime datetime
timestamp datetime
time time
date date
binary blob
boolean tinyint(1)

3.7.2.1.2 MySQLi

CakePHP Type Field Properties
primary_key DEFAULT NULL auto_increment
string varchar(255)
text text
integer int(11)
float float
datetime datetime
timestamp datetime
time time
date date
binary blob
boolean tinyint(1)

3.7.2.1.3 ADOdb

CakePHP Type Field Properties
primary_key R(11)
string C(255)
text X
integer I(11)
float N
datetime T (Y-m-d H:i:s)
timestamp T (Y-m-d H:i:s)
time T (H:i:s)
date T (Y-m-d)
binary B
boolean L(1)

3.7.2.1.4 DB2

CakePHP Type Field Properties
primary_key not null generated by default as identity (start with 1, increment by 1)
string varchar(255)
text clob
integer integer(10)
float double
datetime timestamp (Y-m-d-H.i.s)
timestamp timestamp (Y-m-d-H.i.s)
time time (H.i.s)
date date (Y-m-d)
binary blob
boolean smallint(1)

3.7.2.1.5 Firebird/Interbase

CakePHP Type Field Properties
primary_key IDENTITY (1, 1) NOT NULL
string varchar(255)
text BLOB SUB_TYPE 1 SEGMENT SIZE 100 CHARACTER SET NONE
integer integer
float float
datetime timestamp (d.m.Y H:i:s)
timestamp timestamp (d.m.Y H:i:s)
time time (H:i:s)
date date (d.m.Y)
binary blob
boolean smallint

3.7.2.1.6 MS SQL

CakePHP Type Field Properties
primary_key IDENTITY (1, 1) NOT NULL
string varchar(255)
text text
integer int
float numeric
datetime datetime (Y-m-d H:i:s)
timestamp timestamp (Y-m-d H:i:s)
time datetime (H:i:s)
date datetime (Y-m-d)
binary image
boolean bit

3.7.2.1.7 Oracle

CakePHP Type Field Properties
primary_key number NOT NULL
string varchar2(255)
text varchar2
integer numeric
float float
datetime date (Y-m-d H:i:s)
timestamp date (Y-m-d H:i:s)
time date (H:i:s)
date date (Y-m-d)
binary bytea
boolean boolean
number numeric
inet inet

3.7.2.1.8 PostgreSQL

CakePHP Type Field Properties
primary_key serial NOT NULL
string varchar(255)
text text
integer integer
float float
datetime timestamp (Y-m-d H:i:s)
timestamp timestamp (Y-m-d H:i:s)
time time (H:i:s)
date date (Y-m-d)
binary bytea
boolean boolean
number numeric
inet inet

3.7.2.1.9 SQLite

CakePHP Type Field Properties
primary_key integer primary key
string varchar(255)
text text
integer integer
float float
datetime datetime (Y-m-d H:i:s)
timestamp timestamp (Y-m-d H:i:s)
time time (H:i:s)
date date (Y-m-d)
binary blob
boolean boolean

3.7.2.1.10 Sybase

CakePHP Type Field Properties
primary_key numeric(9,0) IDENTITY PRIMARY KEY
string varchar(255)
text text
integer int(11)
float float
datetime datetime (Y-m-d H:i:s)
timestamp timestamp (Y-m-d H:i:s)
time datetime (H:i:s)
date datetime (Y-m-d)
binary image
boolean bit