コード例 #1
0
ファイル: active_record.php プロジェクト: pilaf/yarr
 protected static function construct_calculation_sql($class_name, $column_name, $operation, &$options)
 {
     $columns = self::$connection->columns(self::get_table_name($class_name));
     if (isset($columns[$column_name])) {
         $column_name = self::quoted_table_name($class_name) . '.' . $column_name;
     }
     $sql = 'SELECT ' . $operation . '(' . (isset($options['distinct']) ? 'DISTINCT ' : '') . $column_name . ') ' . 'FROM ' . (isset($options['from']) ? $options['from'] : self::quoted_table_name($class_name));
     SqlBuilder::add_sql_trail($sql, $options);
     return $sql;
 }