diff --git a/proto/proto.go b/proto/proto.go
index 91e21122b82ac5013d7bc90bbbe933d7ade4dbd1..a58725d6f81a6c7ad451390974e311b63a08b0f7 100644 (file)
--- a/proto/proto.go
+++ b/proto/proto.go
"encoding/json"
"fmt"
"io"
"encoding/json"
"fmt"
"io"
+ "strings"
)
// Network byte order.
)
// Network byte order.
// 'TIMESERIES' command in the server.
ConnectionTimeseries = Status(7)
// 'TIMESERIES' command in the server.
ConnectionTimeseries = Status(7)
- // ConnectionExpr is the internal state for expression parsing.
- ConnectionExpr = Status(100)
+ // ConnectionMatcher is the internal state for parsing matchers.
+ ConnectionMatcher = Status(100)
+ // ConnectionExpr is the internal state for parsing expressions.
+ ConnectionExpr = Status(101)
+
+ // ConnectionServerVersion is the state requesting the server version.
+ ConnectionServerVersion = Status(1000)
)
// The DataType describes the type of data in a ConnectionData message.
)
// The DataType describes the type of data in a ConnectionData message.
return json.Unmarshal(m.Raw[4:], v)
}
return json.Unmarshal(m.Raw[4:], v)
}
+// EscapeString returns the quoted and escaped string s suitable for use
+// in a query.
+func EscapeString(s string) string {
+ // Currently, the server only handles double-quotes.
+ // Backslashes do not serve any special purpose.
+ return "'" + strings.Replace(s, "'", "''", -1) + "'"
+}
+
// vim: set tw=78 sw=4 sw=4 noexpandtab :
// vim: set tw=78 sw=4 sw=4 noexpandtab :