Skip to content
Snippets Groups Projects
Commit 3e43ea37 authored by Alex Reisner's avatar Alex Reisner
Browse files

Add special :id_only value for :select option.

This allows selecting only the id column for cases where a single column
result is required (ie, a subquery used as an operand to the 'IN'
operator). This addresses issue #314.
parent 9c313da0
No related branches found
No related tags found
No related merge requests found
...@@ -157,8 +157,10 @@ module Geocoder::Store ...@@ -157,8 +157,10 @@ module Geocoder::Store
## ##
# Generate the SELECT clause. # Generate the SELECT clause.
# #
def select_clause(columns, distance, bearing = nil) def select_clause(columns, distance = nil, bearing = nil)
if columns == :geo_only if columns == :id_only
return full_column_name(primary_key)
elsif columns == :geo_only
clause = "" clause = ""
else else
clause = (columns || full_column_name("*")) + ", " clause = (columns || full_column_name("*")) + ", "
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment