InfluxCommunity / influxdb-ruby

Ruby client for InfluxDB
MIT License
370 stars 133 forks source link

backslash escaping issue #200

Closed CheyiLin closed 7 years ago

CheyiLin commented 7 years ago

Hi,

This issue is from fangli/fluent-plugin-influxdb#80, it seems that the point data value contains double backslashes will cause write error or incorrect escaping.

The point data hash:

{:timestamp=>1501729298688, :series=>"system.filesystem", :values=>{"v.device_name"=>"D:\\", "v.mount_point"=>"D:\\", "v.total"=>26840395776, "v.free"=>5271150592, "v.available"=>5271150592, "v.files"=>0, "v.free_files"=>0, "v.used.pct"=>0.8036, "v.used.bytes"=>21569245184}, :tags=>{"hostname"=>"my-machine"}}

And the result:

> SELECT "v.device_name", "v.mount_point" FROM "mydb"."system.filesystem"

time    v.device_name             v.mount_point
----    ----                      ----
....    D:",v.mount_point="D:\    D:
dmke commented 7 years ago

Oh, that's definitely a bug. I will have a look when I'm back at my dev machine.

dmke commented 7 years ago

I've fixed the bug. Will release v0.4.2 after Travis has run.

dmke commented 7 years ago

Here you go: https://rubygems.org/gems/influxdb/versions/0.4.2

Thanks again for reporting this!

CheyiLin commented 7 years ago

Thank you for fixing this quickly. Cheers!