Delete::WhereAdd

Add a field to filter the delete

Sintaxe

namespace ProtocolLive\PhpLiveDb;
use ProtocolLive\PhpLiveDb\Enums\{
};

/**

 */
final class Delete{
public function WhereAdd(
string|string[]|UnitEnum|UnitEnum[] $Field,
string $Value = null,
Types $Type = null,
Operators $Operator = Operators::Equal,
AndOr $AndOr = AndOr::And,
Parenthesis $Parenthesis = Parenthesis::None,
string $CustomPlaceholder = null,
bool $BlankIsNull = true,
bool $NoField = false,
bool $NoBind = false,
bool $Debug = false
):self|array|false;
}
Parameters

$Field - Field name. Can be null to only add Parenthesis;

$Value - The field value;

$Type - The field type;

$Operator - The comparing operator;

$AndOr - The relation with the previous field;

$Parenthesis - The parenthesis operator;

$CustomPlaceholder - String to use as placeholder;

$BlankIsNull - Replace '' to null;

$NoField - To bind a placeholder previously indicated;

$NoBind - Don't bind in that call. Used with Operators::Sql or same value for different or same field. (Changed to true if Operators::Sql are used)

$Debug - Dump the command debug;

Notes

- When the $Value is null, the Type are changed to Types::Null;

- When the $Operator is Operators::Sql, the $NoBind are changed to true;

- When using a SQL expression in $Field, its mandatory to use the $CustomPlaceholder;

See more

- AndOr

- Operators

- Parenthesis

- Types

Examples

$Db->Delete('users')
->WhereAdd('id', 10, Types::Int)
->Run();