libasynql  3.2.0
Asynchronous MySQL access library for PocketMine plugins.
GenericVariable Class Reference
Inheritance diagram for GenericVariable:

Public Member Functions

 __construct (string $name, string $type, ?string $default)
 
 unlist ()
 
 getName ()
 
 isList ()
 
 canBeEmpty ()
 
 isNullable ()
 
 getType ()
 
 getDefault ()
 
 isOptional ()
 
 equals (GenericVariable $that, &$diff=null)
 
 jsonSerialize ()
 

Data Fields

const TYPE_STRING = "string"
 
const TYPE_INT = "int"
 
const TYPE_FLOAT = "float"
 
const TYPE_BOOL = "bool"
 
const TYPE_TIMESTAMP = "timestamp"
 
const TIME_0 = "0"
 
const TIME_NOW = "NOW"
 

Protected Attributes

 $name
 
 $list = false
 
 $canEmpty = false
 
 $nullable = false
 
 $type
 
 $default = null
 

Detailed Description

Represents a variable that can be passed into GenericStatement::format()

Definition at line 41 of file GenericVariable.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( string  $name,
string  $type,
?string  $default 
)

CallableParameterUseCaseInTypeContextInspection
CallableParameterUseCaseInTypeContextInspection

Definition at line 59 of file GenericVariable.php.

Member Function Documentation

◆ canBeEmpty()

canBeEmpty ( )

Returns whether the list variable is declared with list? rather than list:.

If the SQL dialect does not support empty list declarations (), and list: is used, an exception will be thrown when an empty array is passed as the value. If list? is used, a randomly-generated string will be filled into the array to satisfy the language's requirements. This might cause undesired behaviour unless you are only using this variable for a simple IN :list condition.

As this may expose a security breach or a performance degrade, plugins are not encouraged to use this method. Instead it is more desirable to check if the array is empty before passing the value into libasynql.

Returns
bool

Definition at line 144 of file GenericVariable.php.

◆ equals()

equals ( GenericVariable  $that,
$diff = null 
)

Definition at line 171 of file GenericVariable.php.

◆ getDefault()

getDefault ( )
Returns
mixed

Definition at line 163 of file GenericVariable.php.

◆ getName()

getName ( )

Definition at line 127 of file GenericVariable.php.

◆ getType()

getType ( )

Definition at line 156 of file GenericVariable.php.

◆ isList()

isList ( )

Definition at line 131 of file GenericVariable.php.

◆ isNullable()

isNullable ( )

Definition at line 152 of file GenericVariable.php.

◆ isOptional()

isOptional ( )

Definition at line 167 of file GenericVariable.php.

◆ jsonSerialize()

jsonSerialize ( )

Definition at line 195 of file GenericVariable.php.

◆ unlist()

unlist ( )

Definition at line 118 of file GenericVariable.php.

Field Documentation

◆ $canEmpty

$canEmpty = false
protected

Definition at line 53 of file GenericVariable.php.

◆ $default

$default = null
protected

Definition at line 57 of file GenericVariable.php.

◆ $list

$list = false
protected

Definition at line 52 of file GenericVariable.php.

◆ $name

$name
protected

Definition at line 51 of file GenericVariable.php.

◆ $nullable

$nullable = false
protected

Definition at line 54 of file GenericVariable.php.

◆ $type

$type
protected

Definition at line 55 of file GenericVariable.php.

◆ TIME_0

const TIME_0 = "0"

Definition at line 48 of file GenericVariable.php.

◆ TIME_NOW

const TIME_NOW = "NOW"

Definition at line 49 of file GenericVariable.php.

◆ TYPE_BOOL

const TYPE_BOOL = "bool"

Definition at line 45 of file GenericVariable.php.

◆ TYPE_FLOAT

const TYPE_FLOAT = "float"

Definition at line 44 of file GenericVariable.php.

◆ TYPE_INT

const TYPE_INT = "int"

Definition at line 43 of file GenericVariable.php.

◆ TYPE_STRING

const TYPE_STRING = "string"

Definition at line 42 of file GenericVariable.php.

◆ TYPE_TIMESTAMP

const TYPE_TIMESTAMP = "timestamp"

Definition at line 46 of file GenericVariable.php.


The documentation for this class was generated from the following file: