public function testStatics() { $this->assertEquals('FORMAT(fieldname)', QueryAssembler::stringify(FormatSelectExpression::create('fieldname', 0))); $this->assertEquals('FORMAT(fieldname) AS rnd', QueryAssembler::stringify(FormatSelectExpression::createWithAlias('fieldname', 'rnd'))); $this->assertEquals('FORMAT(fieldname,2) AS rnd', QueryAssembler::stringify(FormatSelectExpression::create('fieldname', 2, 'rnd'))); }
public function assembleFormatSelectExpression(FormatSelectExpression $expr) { return $expr->getFunctionName() . '(' . $this->getAssembler()->assembleSegment($expr->getField()) . ($expr->hasPrecision() ? ',' . $expr->getPrecision() : '') . ')' . ($expr->hasAlias() ? ' AS ' . $this->escapeField($expr->getAlias()) : ''); }