Class: GoogleDataSource::DataSource::Sql::SelectRelation

Inherits:
Relation show all
Defined in:
lib/google_data_source/sql/models.rb

Instance Method Summary collapse

Methods inherited from Relation

#as_inner

Instance Method Details

#to_sObject



243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
# File 'lib/google_data_source/sql/models.rb', line 243

def to_s
  result = "select"
  result << " #{select.join(', ')}"
  unless where.nil?
    result << " where #{where}"
  end
  unless groupby.nil?
    result << " group by #{groupby}"
  end
  unless orderby.nil?
    result << " order by #{orderby.join(', ')}"
  end
  unless limit.nil?
    result << " limit #{limit}"
  end
  unless offset.nil?
    result << " offset #{offset}"
  end
  result
end