Beispiel #1
0
 private function _sqlColumns($array)
 {
     if (is_string($array)) {
         return $array;
     }
     $columns = array();
     if (Helper::is_associative($array)) {
         $array = array($array);
     }
     foreach ($array as $item) {
         if (is_string($item)) {
             $columns[] = Helper::quote_column($item);
         } else {
             $tmp = array();
             foreach ($item as $key => $column) {
                 $tmp[] = $column . " AS `{$key}`";
             }
             $columns[] = implode(', ', $tmp);
         }
     }
     return implode(', ', $columns);
 }
Beispiel #2
0
 /**
  * @expectedException InvalidArgumentException
  */
 public function testQuoteColumnForceOneFail()
 {
     $this->assertEquals('table.column1, table.column2', \Snowfire\Database\Query\Helper::quote_column('table.column1, table.column2', true));
 }