args=getvalue(req) # | get response (probably an array)
case message
- when 'getpresets'; results[index]=putdata(index,getpresets)
- when 'whichways'; results[index]=putdata(index,whichways(args))
- when 'getway'; results[index]=putdata(index,getway(args))
- when 'putway'; results[index]=putdata(index,putway(args))
- when 'deleteway'; results[index]=putdata(index,deleteway(args))
+ when 'getpresets'; results[index]=putdata(index,getpresets)
+ when 'whichways'; results[index]=putdata(index,whichways(args))
+ when 'getway'; results[index]=putdata(index,getway(args))
+ when 'putway'; results[index]=putdata(index,putway(args))
+ when 'deleteway'; results[index]=putdata(index,deleteway(args))
end
end
# Write out response
RAILS_DEFAULT_LOGGER.info(" Response: start")
- response.headers["Content-Type"]="application/x-amf"
a,b=results.length.divmod(256)
- ans=0.chr+0.chr+0.chr+0.chr+a.chr+b.chr
- results.each do |k,v|
- RAILS_DEFAULT_LOGGER.info(" Response: encode #{k}")
- ans+=v
- end
+ render :content_type => "application/x-amf", :text => proc { |response, output|
+ output.write 0.chr+0.chr+0.chr+0.chr+a.chr+b.chr
+ results.each do |k,v|
+ output.write(v)
+ end
+ }
RAILS_DEFAULT_LOGGER.info(" Response: end")
- render :text => ans
end
ymin=[ys,ymin].min; ymax=[ys,ymax].max
node=points[i][2].to_i
tagstr=array2tag(points[i][4])
+ tagstr=tagstr.gsub(/[\000-\037]/,"")
tagsql="'"+sqlescape(tagstr)+"'"
# compare node
insertsql =''
currentsql=''
attributes.each do |k,v|
- if v=='' then next end
+ if v=='' or v.nil? then next end
if v[0,6]=='(type ' then next end
if insertsql !='' then insertsql +=',' end
if currentsql!='' then currentsql+=',' end
+ k=k.gsub(/[\000-\037]/,"")
+ v=v.gsub(/[\000-\037]/,"")
insertsql +="(#{way},'"+sqlescape(k)+"','"+sqlescape(v)+"',#{version})"
currentsql+="(#{way},'"+sqlescape(k)+"','"+sqlescape(v)+"')"
end