Fix param-extraction
This commit is contained in:
parent
a81f8495b0
commit
baeb747fcb
|
@ -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>
|
||||
|
|
10
plugin.rb
10
plugin.rb
|
@ -47,9 +47,13 @@ after_initialize do
|
|||
# (The first name is $0.)
|
||||
def self.extract_params(sql)
|
||||
names = []
|
||||
new_sql = sql.gsub(/:([a-z_]+)/) do |_|
|
||||
names << $1
|
||||
"$#{names.length - 1}"
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue