Database Data Types



( ZN >= 3.0.0 )

In this section we will show how to use common data types that differ according to the database drivers. Below is a table showing the variation of data types according to database platforms.

MySQL Postgres SQLite SQLServer ODBC Oracle
INTER INTEGER INTEGER INTER INTEGER Numeric
SMALLINT SMALLINT SMALLINT SMALLINT SMALLINT Numeric
TINYINT SMALLINT TINYINT TINYINT TINYINT Numeric
MEDIUMINT INTEGER MEDIUMINT INTER INTEGER Numeric
BIGINT BIGINT BIGINT BIGINT BIGINT Numeric
DECIMAL DECIMAL DECIMAL DECIMAL DECIMAL DECIMAL
DOUBLE DOUBLE PRECISION DOUBLE DOUBLE PRECISION DOUBLE PRECISION BINARY_DOUBL to
FLOAT Numeric FLOAT FLOAT FLOAT BINARY_FLOAT
CHR CHARACTER CHARACTER CHR CHR CHR
VARCHAR CHARACTER VARYING VARCHAR VARCHAR VARCHAR VARCHAR2
TINYTEXT CHARACTER VARYING ( 255 ) VARCHAR ( 255 ) VARCHAR ( 255 ) VARCHAR ( 255 ) VARCHAR ( 255 )
TEXT TEXT TEXT VARCHAR ( 65535 ) VARCHAR ( 65535 ) VARCHAR ( 65535 )
MEDIUMTEXT TEXT CLOB VARCHAR ( 16277215 ) VARCHAR ( 16277215 ) VARCHAR ( 16277215 )
LONGTEXT TEXT BLOB VARCHAR ( 16277215 ) VARCHAR ( 16277215 ) CLOB
DATE DATE DATE DATE DATE DATE
DATETIME TIMESTAMP DATETIME DATETIME UTCDATETI to TIMESTAMP
TIME TIME DATETIME TIME TIME TIMESTAMP
TIMESTAMP TIMESTAMP DATETIME TIMESTAMP TIMESTAMP TIMESTAMP

Methods have been developed based on these data types to make the above differences. An example of how to use these methods is given below.

 

 

# Methods


String int ( Int $ len = NULL , Bool $ type = true )
String SmallInt ( Int $ man = NULL , Boolean $ type = true )
String Tinyint ( Int $ man = NULL , Boolean $ type = true )
String MEDIUMINT ( Int $ man = NULL , Boolean $ type = true )
String BigInt ( Int $ man = NULL , Boolean $ type = true )
String decimal ( Int $ len = NULL , Bool $ type = true )
String double ( Int $ len = NULL , Bool $ type = true )
String float ( Int $ len = NULL , Bool $ type = true )
String char ( Int $ len = NULL , Bool $ type = true )
String varchar ( Int $ len = NULL , Bool $ type = true )
String tinyText ( Void )
String text ( Void )
String mediumText ( Void )
String longText ( Void )
String date ( Int $ len = NULL , Bool $ type = true )
String dateTime ( Int $ len = NULL , Bool $ type = true )
String time ( Int $ len = NULL , Bool $ type = true )
String timestamp ( Int $ man = NULL , Boolean $ type = true )

 

 

# Int ( ZN >= 3.0.0 )


The SQL counterpart is the INT statement. However, according to the above table, the output of the method varies according to the type of the selected database drive.

Parameters
Int $ length = NULL Column character length.
return String
Use of
echo DB::int(11); # INT(11)

 

 

# SmallInt ( ZN >= 3.0.0 )


SQL is the equivalent of the SMALLINT statement. However, according to the above table, the output of the method varies according to the type of the selected database drive.

Parameters
Int $ length = NULL Column character length.
return String
Use of
echo DB::smallInt(11); # SMALLINT(11)

 

 

# TinyInt ( ZN >= 3.0.0 )


SQL is the equivalent of the TINYINT statement. However, according to the above table, the output of the method varies according to the type of the selected database drive.

Parameters
Int $ length = NULL Column character length.
return String
Use of
echo DB::tinyInt(11); # TINYINT(11)

 

 

# MediumInt ( ZN >= 3.0.0 )


SQL is the equivalent of the MEDIUMINT statement. However, according to the above table, the output of the method varies according to the type of the selected database drive.

Parameters
Int $ length = NULL Column character length.
return String
Use of
echo DB::mediumInt(11); # MEDIUMINT(11)

 

 

# BigInt ( ZN >= 3.0.0 )


The counterpart of the SQL BIGINT statement. However, according to the above table, the output of the method varies according to the type of the selected database drive.

Parameters
Int $ length = NULL Column character length.
return String
Use of
echo DB::bigInt(11); # BIGINT(11)

 

 

# Decimal ( ZN >= 3.0.0 )


SQL is the equivalent of the DECIMAL statement. However, according to the above table, the output of the method varies according to the type of the selected database drive.

Parameters
Int $ length = NULL Column character length.
return String
Use of
echo DB::decimal(11); # DECIMAL(11)

 

 

# Double ( ZN >= 3.0.0 )


This is the counterpart of the SQL DOUBLE statement. However, according to the above table, the output of the method varies according to the type of the selected database drive.

Parameters
Int $ length = NULL Column character length.
return String
Use of
echo DB::double(11); # DOUBLE(11)

 

 

# Float ( ZN >= 3.0.0 )


SQL is the counterpart of the FLOAT statement. However, according to the above table, the output of the method varies according to the type of the selected database drive.

Parameters
Int $ length = NULL Column character length.
return String
Use of
echo DB::float(11); # FLOAT(11)

 

 

# Char ( ZN >= 3.0.0 )


SQL is the counterpart of the CHAR statement. However, according to the above table, the output of the method varies according to the type of the selected database drive.

Parameters
Int $ length = NULL Column character length.
return String
Use of
echo DB::char(1); # CHAR(1)

 

 

# Varchar ( ZN >= 3.0.0 )


The counterpart of the SQL VARCHAR statement. However, according to the above table, the output of the method varies according to the type of the selected database drive.

Parameters
Int $ length = NULL Column character length.
return String
Use of
echo DB::varchar(200); # VARCHAR(200)

 

 

# TinyText ( ZN >= 3.0.0 )


SQL is the equivalent of the TINYTEXT statement. However, according to the above table, the output of the method varies according to the type of the selected database drive.

Parameters
void
return String
Use of
echo DB::tinyText(); # TINYTEXT;

 

 

# Text ( ZN >= 3.0.0 )


This is the counterpart of the SQL TEXT statement. However, according to the above table, the output of the method varies according to the type of the selected database drive.

Parameters
void
return String
Use of
echo DB::text(); # TEXT

 

 

# MediumText ( ZN> = 3.0.0 )


SQL stands for MEDIUMTEXT . However, according to the above table, the output of the method varies according to the type of the selected database drive.

Parameters
void
return String
Use of
echo DB::mediumText(); # MEDIUMTEXT

 

 

# LongText ( ZN >= 3.0.0 )


SQL is the equivalent of the LONGTEXT statement. However, according to the above table, the output of the method varies according to the type of the selected database drive.

Parameters
void
return String
Use of
echo DB::longText(); # LONGTEXT

 

 

# Date ( ZN >= 3.0.0 )


The counterpart of the SQL DATE statement. However, according to the above table, the output of the method varies according to the type of the selected database drive.

Parameters
Int $ length = NULL Column character length.
return String
Use of
echo DB::date(); # DATE

 

 

# DateTime ( ZN >= 3.0.0 )


This is the counterpart of the SQL DATETIME statement. However, according to the above table, the output of the method varies according to the type of the selected database drive.

Parameters
Int $ length = NULL Column character length.
return String
Use of
echo DB::dateTime(); # DATETIME

 

 

# Time ( ZN >= 3.0.0 )


MYSQL is the equivalent of the TIME statement. However, according to the above table, the output of the method varies according to the type of the selected database drive.

Parameters
Int $ length = NULL Column character length.
return String
Use of
echo DB::time(); # TIME

 

 

# TimeStamp ( ZN >= 3.0.0 )


MYSQL is the counterpart of the TIMESTAMP statement. However, according to the above table, the output of the method varies according to the type of the selected database drive.

Parameters
Int $ length = NULL Column character length.
return String
Use of
echo DB::timeStamp(); # TIMESTAMP