Fix param-extraction

This commit is contained in:
Kane York 2015-06-30 16:43:43 -07:00
parent a81f8495b0
commit baeb747fcb
2 changed files with 8 additions and 4 deletions

View File

@ -1,6 +1,6 @@
<h3>Queries</h3>
<div class="query-list">
{{combo-box valueAttribute="id" value=selectedQueryId nameProperty="listName" content=content castInteger="true"}}
{{combo-box valueAttribute="id" value=selectedQueryId nameProperty="listName" content=content castInteger="true" nameChanges="true"}}
{{d-button action="showCreate" icon="plus" class="no-text"}}
{{d-button action="importQuery" label="explorer.import.label" icon="upload"}}
</div>

View File

@ -47,10 +47,14 @@ after_initialize do
# (The first name is $0.)
def self.extract_params(sql)
names = []
new_sql = sql.gsub(/:([a-z_]+)/) do |_|
new_sql = sql.gsub(/(:?):([a-z_]+)/) do |_|
if $1 == ':' # skip casts
$&
else
names << $1
"$#{names.length - 1}"
end
end
{sql: new_sql, names: names}
end