Types

Type of values to be binded to SQL query

Sintaxe

//Version 2024.02.22.00

namespace ProtocolLive\PhpLiveDb\Enums;
use PDO;

enum Types:int{
case Bool = PDO::PARAM_BOOL;
case Int = PDO::PARAM_INT;
case Null = PDO::PARAM_NULL;
case Sql = 6;
case Str = PDO::PARAM_STR;
}
Description

Bool - Replace true to 1 and false to 0;

Int - For int values;

Null - For null values;

Sql - For using SQL expressions in $Value;

Str - For use string, dates and floats;

Examples

$consult = $Db->Select('users');
$consult->WhereAdd(
'email',
$_POST['email'],
Types::Str
);

$consult = $Db->Select('users');
$consult->WhereAdd(
'type',
1,
Types::Int
);

$consult = $Db->Update('users');
$consult->FieldAdd(
'lastlogin',
'lastlogin2',
Types::Sql
);
//update users set lastlogin=lastlogin2