/* * Returns a SQL-safe version of the String _str_. Unlike #quote, does not wrap the String in '...'. */ static VALUE pgconn_escape(self, string) VALUE self; VALUE string; { char *escaped; int size,error; VALUE result; Check_Type(string, T_STRING); escaped = ALLOCA_N(char, RSTRING_LEN(string) * 2 + 1); size = PQescapeStringConn(get_pgconn(self),escaped, RSTRING_PTR(string), RSTRING_LEN(string), &error); result = rb_str_new(escaped, size); OBJ_INFECT(result, string); return result; }