diff --git a/proto/proto.go b/proto/proto.go
index ee47fcfcf0442d78e4a89f076491bc629dc427da..a58725d6f81a6c7ad451390974e311b63a08b0f7 100644 (file)
--- a/proto/proto.go
+++ b/proto/proto.go
"encoding/json"
"fmt"
"io"
+ "strings"
)
// Network byte order.
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.
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 :