예제 #1
0
 public function testFromString()
 {
     $this->assertEquals(new \r8\Query\Expr\Aliased(new \r8\Query\Atom\Field("fld"), "Ailee"), \r8\Query\Expr\Aliased::fromString("fld AS Ailee"));
     $this->assertEquals(new \r8\Query\Expr\Aliased(new \r8\Query\Atom\Field("fld")), \r8\Query\Expr\Aliased::fromString("fld"));
     $this->assertEquals(new \r8\Query\Expr\Aliased(new \r8\Query\Atom\Field("fld", "db"), "Ailee"), \r8\Query\Expr\Aliased::fromString("db.fld AS Ailee"));
     $this->assertEquals(new \r8\Query\Expr\Aliased(new \r8\Query\Atom\Field("fld", "db"), "Ailee"), \r8\Query\Expr\Aliased::fromString("`db`.`fld` AS `Ailee`"));
 }
예제 #2
0
 /**
  * Adds multiple select fields at once using a fluent interface
  *
  * @param mixed... $fields Any fields to add. This can be a string
  *      or a selectable object
  * @return \r8\Query\Select Returns a self reference
  */
 public function fields()
 {
     foreach (func_get_args() as $arg) {
         // If they didn't give us an object, create one
         if (!$arg instanceof \r8\iface\Query\Selectable) {
             $arg = \r8\Query\Expr\Aliased::fromString($arg);
         }
         $this->addField($arg);
     }
     return $this;
 }