Column
+ Inheritance diagram for Column:

Description

Immutable column expression.

Can be treated as any data type.

Read-only array access is provided for easily retrieving aggregate function results.

Immutable:
Mutations operate on and return clones.

Protected Properties

string $name
 
string $qualifier
 

Public Static Methods

magic static self factory (DB $db, string $name, string $qualifier='')
 

Public Methods

 __construct (DB $db, string $name, string $qualifier='')
 
string __toString ()
 Returns the qualified name. More...
 
string getName ()
 
string getQualifier ()
 
true offsetExists ($value)
 Aggregate function results are always available. More...
 
null string offsetGet ($aggregator)
 Returns the result of an aggregate function run over the column expression. More...
 
 offsetSet ($offset, $value)
 Throws. More...
 
 offsetUnset ($offset)
 Throws. More...
 
Select scalar[] select ()
 Returns a Select for the column's values. More...
 
$this setName (string $name)
 Returns an aliased clone. More...
 
$this setQualifier (string $qualifier)
 
- Public Methods inherited from DateTimeAddTrait
DateTime addDay ()
 
DateTime addDays (int $days)
 
DateTime addHour ()
 
DateTime addHours (int $hours)
 
DateTime addMinute ()
 
DateTime addMinutes (int $minutes)
 
DateTime addMonth ()
 
DateTime addMonths (int $months)
 
DateTime addSecond ()
 
DateTime addSeconds (int $seconds)
 
DateTime addYear ()
 
DateTime addYears (int $years)
 
- Public Methods inherited from DateTimeModifyTrait
DateTime firstDayOfMonth ()
 YYYY-MM-01 More...
 
DateTime firstDayOfYear ()
 YYYY-01-01 More...
 
DateTime lastDayOfMonth ()
 YYYY-MM-DD More...
 
DateTime lastDayOfYear ()
 YYYY-12-31 More...
 
DateTime modify ($s, int $m=0, int $h=0, int $D=0, int $M=0, int $Y=0)
 Applies date-time modifiers. More...
 
DateTime setDate (int $day=null, int $month=null, int $year=null)
 Manually set the date components, preserving the time. More...
 
DateTime setDay (int $day)
 
DateTime setHours (int $hours)
 
DateTime setMinutes (int $minutes)
 
DateTime setMonth (int $month)
 
DateTime setSeconds (int $seconds)
 
DateTime setTime (int $seconds=null, int $minutes=null, int $hours=null)
 Manually set the time components, preserving the date. More...
 
DateTime setYear (int $year)
 
DateTime toUTC (string $mysqlLocalTz=null)
 Changes the timezone from local to UTC. More...
 
- Public Methods inherited from DateTimeFormatTrait
DateTime date ()
 YYYY-MM-DD More...
 
Str dateFormat ($format)
 Date formatting expression using a driver-appropriate function. More...
 
DateTime datetime ()
 YYYY-MM-DD hh:mm:ss More...
 
Num day ()
 01 to 31 More...
 
Num dayOfWeek ()
 0 to 6 (Sunday is 0) More...
 
Num dayOfYear ()
 001 to 366 (365 + 1 during leap year) More...
 
Num hours ()
 00 to 23 More...
 
Str iso8601 ()
 ISO-8601 compatible datetime string, offset Z (UTC/Zulu) More...
 
Num julian ()
 Julian day number (fractional). More...
 
Num minutes ()
 00 to 59 More...
 
Num month ()
 01 to 12 More...
 
Num seconds ()
 00 to 59 More...
 
Str time ()
 00:00:00 to 23:59:59 More...
 
Num timestamp ()
 Unix timestamp. More...
 
Num weekOfYear ()
 00 to 53 More...
 
Num year ()
 YYYY More...
 
- Public Methods inherited from DateTimeDiffTrait
Num diffDays (DateTime $x=null)
 Date-time difference ($x - $this) in fractional days elapsed. More...
 
Num diffHours (DateTime $x=null)
 Date-time difference ($x - $this) in fractional hours elapsed. More...
 
Num diffMinutes (DateTime $x=null)
 Date-time difference ($x - $this) in fractional minutes elapsed. More...
 
Num diffMonths (DateTime $x=null)
 Date-time difference ($x - $this) in fractional months elapsed. More...
 
Num diffSeconds (DateTime $x=null)
 Date-time difference ($x - $this) in fractional seconds elapsed. More...
 
Num diffYears (DateTime $x=null)
 Date-time difference ($x - $this) in fractional years elapsed. More...
 
- Public Methods inherited from DateTimeSubTrait
DateTime subDay ()
 
DateTime subDays (int $days)
 
DateTime subHour ()
 
DateTime subHours (int $hours)
 
DateTime subMinute ()
 
DateTime subMinutes (int $minutes)
 
DateTime subMonth ()
 
DateTime subMonths (int $months)
 
DateTime subSecond ()
 
DateTime subSeconds (int $seconds)
 
DateTime subYear ()
 
DateTime subYears (int $years)
 
- Public Methods inherited from ValueTrait
Value coalesce (array $values)
 COALESCE($this, ...$values) More...
 
- Public Methods inherited from AggregateTrait
Num avg ()
 AVG($this) More...
 
Num avgDistinct ()
 AVG(DISTINCT $this) More...
 
Num count ()
 COUNT($this) More...
 
Num countDistinct ()
 COUNT(DISTINCT $this) More...
 
Str groupConcat (string $delimiter=',')
 GROUP_CONCAT($this) using a delimiter. More...
 
Num max ()
 MAX($this) More...
 
Num min ()
 MIN($this) More...
 
Num sum ()
 SUM($this) More...
 
Num sumDistinct ()
 SUM(DISTINCT $this) More...
 
- Public Methods inherited from ComparisonTrait
Predicate is ($arg)
 Null-safe type-strict equality. More...
 
Predicate isBetween ($min, $max)
 $this BETWEEN $min AND $max (inclusive) More...
 
Predicate isEqual ($arg)
 See Predicate::match(). More...
 
Predicate isFalse ()
 $this IS FALSE More...
 
Predicate isGt ($arg)
 $this > $arg, or driver-appropriate $this > ALL (SELECT ...) More...
 
Predicate isGtAny (Select $select)
 Driver-appropriate $this > ANY (SELECT ...) More...
 
Predicate isGte ($arg)
 $this >= $arg, or driver-appropriate $this >= ALL (SELECT ...) More...
 
Predicate isGteAny (Select $select)
 Driver-appropriate $this >= ANY (SELECT ...) More...
 
Predicate isLike (string $pattern)
 $this LIKE $pattern More...
 
Predicate isLt ($arg)
 $this < $arg, or driver-appropriate $this < ALL (SELECT ...) More...
 
Predicate isLtAny (Select $select)
 Driver-appropriate $this < ANY (SELECT ...) More...
 
Predicate isLte ($arg)
 $this <= $arg, or driver-appropriate $this <= ALL (SELECT ...) More...
 
Predicate isLteAny (Select $select)
 Driver-appropriate $this <= ANY (SELECT ...) More...
 
Predicate isNot ($arg)
 Null-safe type-strict inequality. More...
 
Predicate isNotBetween ($min, $max)
 $this NOT BETWEEN $min AND $max (inclusive) More...
 
Predicate isNotEqual ($arg)
 $this <> $arg or $this NOT IN ($arg) More...
 
Predicate isNotLike (string $pattern)
 $this NOT LIKE $pattern More...
 
Predicate isNotNull ()
 $this IS NOT NULL More...
 
Predicate isNotRegExp (string $pattern)
 $this NOT REGEXP $pattern More...
 
Predicate isNull ()
 $this IS NULL More...
 
Predicate isRegExp (string $pattern)
 $this REGEXP $pattern More...
 
Branch switch (array $values=[])
 CASE $this ... More...
 
- Public Methods inherited from NumTrait
Num abs ()
 ABS($this) More...
 
Num acos ()
 ACOS($this) More...
 
Num add ($arg,... $args)
 ($this + $arg + ... More...
 
Num asin ()
 ASIN($this) More...
 
Num atan ()
 ATAN($this) More...
 
Num bAnd ($value)
 Bitwise AND More...
 
Num bNot ($value)
 Bitwise NOT More...
 
Num bOr ($value)
 Bitwise OR More...
 
Num bSL (int $bits=1)
 Bitwise shift left. More...
 
Num bSR (int $bits=1)
 Bitwise shift right. More...
 
Num ceil ()
 CEIL($this) More...
 
Num cos ()
 COS($this) More...
 
Num degrees ()
 Radians to degrees. More...
 
Num div ($arg,... $args)
 ($this / $arg / ...) More...
 
Num exp ()
 Euler's constant raised to the power of the expression. More...
 
Num floor ()
 FLOOR($this) More...
 
Predicate isEven ()
 ($this % 2) = 0 More...
 
Predicate isNegative ()
 $this < 0 More...
 
Predicate isOdd ()
 ($this % 2) <> 0 More...
 
Predicate isPositive ()
 $this > 0 More...
 
Predicate isZero ()
 $this = 0 More...
 
Num ln ()
 LN($this) More...
 
Num log (float $base)
 LOG($base,$this) More...
 
Num log10 ()
 LOG10($this) More...
 
Num log2 ()
 LOG2($this) More...
 
Num mod (float $divisor)
 ($this % $divisor) More...
 
Num mul ($arg,... $args)
 ($this * $arg * ...) More...
 
Num pow (float $exponent)
 POW($this,$exponent) More...
 
Num radians ()
 Degrees to radians. More...
 
Num root (int $radix)
 POW($this,1/$radix) More...
 
Num round (int $decimals=0)
 ROUND($this,$decimals) More...
 
Num sign ()
 SIGN($this) More...
 
Num sin ()
 SIN($this) More...
 
Num sqrt ()
 SQRT($this) More...
 
Num sub ($arg,... $args)
 ($this - $arg - ...) More...
 
Num tan ()
 TAN($this) More...
 
- Public Methods inherited from BaseConversionTrait
Str toBase (int $from, int $to)
 Convert between arbitrary bases. More...
 
Str toBase16 (int $from=10)
 Convert from an arbitrary base to base 16. More...
 
Str toBase2 (int $from=10)
 Convert from an arbitrary base to base 2. More...
 
Str toBase8 (int $from=10)
 Convert from an arbitrary base to base 8. More...
 
- Public Methods inherited from NumCastIntTrait
Num toInt ()
 Casts the expression as a signed integer. More...
 
- Public Methods inherited from StrTrait
Str concat (... $strings)
 Concatenate other strings. More...
 
Str hex ()
 Hex representation. More...
 
Predicate isEmpty ()
 Zero-length. More...
 
Num length ()
 Number of characters (not necessarily bytes). More...
 
Str lower ()
 Lowercase. More...
 
Str ltrim (string $chars=null)
 See StrTrait::trim(). More...
 
Num position (string $substring)
 Substring's position (1-based). More...
 
Str replace (string $search, string $replace)
 String replacement. More...
 
Str rtrim (string $chars=null)
 See StrTrait::trim(). More...
 
Num size ()
 Number of bytes (not necessarily characters). More...
 
Str substr (int $start, int $length=null)
 Substring. More...
 
Num toBase10 (int $from)
 Convert from an arbitrary base to base 10. More...
 
Str trim (string $chars=null)
 Trims whitespace (or other things) from both ends of the string. More...
 
Str upper ()
 Uppercase. More...
 

Constructor

◆ __construct()

__construct ( DB  $db,
string  $name,
string  $qualifier = '' 
)
Parameters
DB$db
string$name
string$qualifier

Methods

◆ __toString()

string __toString ( )

Returns the qualified name.

Returns
string

Implements ExpressionInterface.

◆ factory()

magic static self factory ( DB  $db,
string  $name,
string  $qualifier = '' 
)
static
Returns
self

◆ getName()

string getName ( )
final
Returns
string

◆ getQualifier()

string getQualifier ( )
final
Returns
string

◆ offsetExists()

true offsetExists (   $value)
final

Aggregate function results are always available.

Parameters
mixed$value
Returns
true

◆ offsetGet()

null string offsetGet (   $aggregator)

Returns the result of an aggregate function run over the column expression.

Example: min returns the result of SELECT MIN($this) FROM $this->qualifier

See also
DB\Fluent\Value\AggregateTrait
Parameters
string$aggregator
Returns
null|string

◆ offsetSet()

offsetSet (   $offset,
  $value 
)
final

Throws.

Parameters
mixed$offset
mixed$value
Exceptions
LogicException

◆ offsetUnset()

offsetUnset (   $offset)
final

Throws.

Parameters
mixed$offset
Exceptions
LogicException

◆ select()

Select scalar [] select ( )

Returns a Select for the column's values.

The column must be qualified.

Returns
Select|scalar[]

◆ setName()

$this setName ( string  $name)

Returns an aliased clone.

Parameters
string$name
Returns
$this

◆ setQualifier()

$this setQualifier ( string  $qualifier)
Parameters
string$qualifier
Returns
$this