コード例 #1
0
 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')));
 }
コード例 #2
0
 public function assembleFormatSelectExpression(FormatSelectExpression $expr)
 {
     return $expr->getFunctionName() . '(' . $this->getAssembler()->assembleSegment($expr->getField()) . ($expr->hasPrecision() ? ',' . $expr->getPrecision() : '') . ')' . ($expr->hasAlias() ? ' AS ' . $this->escapeField($expr->getAlias()) : '');
 }