/* * call-seq: * PGconn.escape( str ) * * Returns a SQL-safe version of the String _str_. Unlike #quote, does not wrap the String in '...'. */ static VALUE pgconn_s_escape(self, obj) VALUE self; VALUE obj; { char *to; long len; VALUE ret; Check_Type(obj, T_STRING); to = ALLOCA_N(char, RSTRING(obj)->len * 2); len = PQescapeString(to, RSTRING(obj)->ptr, RSTRING(obj)->len); ret = rb_str_new(to, len); OBJ_INFECT(ret, obj); return ret; }